Changeset d97e9a


Ignore:
Timestamp:
Aug 30, 2012, 9:24:03 PM (7 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
7a31a1
Parents:
e27537
Message:

re-query currentWindow before usage, it's safer (hopefully)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/vI_replyToSelf.js

    re27537 rd97e9a  
    4141function removeAllReplyTos() {
    4242  if (!replyToSelfObj.hasAttribute("hidden")) {
    43     for (var row = 1; row <= currentWindow.top.MAX_RECIPIENTS; row ++) {
    44       var awType = currentWindow.awGetPopupElement(row).selectedItem.getAttribute("value");
     43    for (var row = 1; row <= vIcomposeWindow.top.MAX_RECIPIENTS; row ++) {
     44      var awType = vIcomposeWindow.awGetPopupElement(row).selectedItem.getAttribute("value");
    4545      if (awType == "addr_reply") {
    4646        Log.debug("removed ReplyTo found in row " + row);
    47         currentWindow.awDeleteRow(row--); // removed one line therefore decrease row-value
     47        vIcomposeWindow.awDeleteRow(row--); // removed one line therefore decrease row-value
    4848      }
    4949    }
     
    5353function addReplyToSelf() {
    5454  if (!replyToSelfObj.hasAttribute("hidden")) {
    55     currentWindow.awAddRecipient("addr_reply",currentWindow.document.getElementById("virtualIdentityExtension_msgIdentityClone").label);
    56     Log.debug("added ReplyToSelf");
    57     replyToSelfObj.setAttribute("hidden","true");
     55    try {
     56      vIcomposeWindow.awAddRecipient("addr_reply",vIcomposeWindow.document.getElementById("virtualIdentityExtension_msgIdentityClone").label);
     57      Log.debug("added ReplyToSelf");
     58      replyToSelfObj.setAttribute("hidden","true");
     59    } catch (e) { Log.debug("ReplyToSelf failed"); dumpCallStack(e); };
    5860  }
    5961}
    6062
    6163let replyToSelfObj = null;
    62 currentWindow = Cc["@mozilla.org/appshell/window-mediator;1"]
     64let vIcomposeWindow = Cc["@mozilla.org/appshell/window-mediator;1"]
    6365  .getService(Ci.nsIWindowMediator)
    6466  .getMostRecentWindow(null);
    65 currentWindow.addEventListener("load", function () {
    66   replyToSelfObj = currentWindow.document.getElementById("virtualIdentityExtension_autoReplyToSelfLabel");
     67vIcomposeWindow.addEventListener("load", function () {
     68  replyToSelfObj = vIcomposeWindow.document.getElementById("virtualIdentityExtension_autoReplyToSelfLabel");
    6769  }, false);
Note: See TracChangeset for help on using the changeset viewer.