Bug 1383569 - Remove multiple access to bundle_composeMsgs and use getComposeBundle(). r=aceman
authorJorg K <jorgk@jorgk.com>
Mon, 24 Jul 2017 22:43:02 +0200
changeset 28480 94c5ad3cebd6a183bb601698f16a2fb465236438
parent 28479 97fc9b087a3a47e5e8fb49c9d18c5cc68ea7369c
child 28481 fb6824894528f321f862f7d9eac98c95a53a2417
push id1986
push userclokep@gmail.com
push dateWed, 02 Aug 2017 14:43:31 +0000
treeherdercomm-beta@b51c9adf2c9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs1383569
Bug 1383569 - Remove multiple access to bundle_composeMsgs and use getComposeBundle(). r=aceman
mail/components/compose/content/MsgComposeCommands.js
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -5555,36 +5555,31 @@ function goUpdateMailMenuItems(commandse
   }
 }
 
 /**
  * Object to handle message related notifications that are showing in a
  * notificationbox below the composed message content.
  */
 var gComposeNotificationBar = {
-  get stringBundle() {
-    delete this.stringBundle;
-    return this.stringBundle = document.getElementById("bundle_composeMsgs");
-  },
-
   get brandBundle() {
     delete this.brandBundle;
     return this.brandBundle = document.getElementById("brandBundle");
   },
 
   get notificationBar() {
     delete this.notificationBar;
     return this.notificationBar = document.getElementById("attachmentNotificationBox");
   },
 
   setBlockedContent: function(aBlockedURI) {
     let brandName = this.brandBundle.getString("brandShortName");
-    let buttonLabel = this.stringBundle.getString((AppConstants.platform == "win") ?
+    let buttonLabel = getComposeBundle().getString((AppConstants.platform == "win") ?
       "blockedContentPrefLabel" : "blockedContentPrefLabelUnix");
-    let buttonAccesskey = this.stringBundle.getString((AppConstants.platform == "win") ?
+    let buttonAccesskey = getComposeBundle().getString((AppConstants.platform == "win") ?
       "blockedContentPrefAccesskey" : "blockedContentPrefAccesskeyUnix");
 
     let buttons = [{
       label: buttonLabel,
       accessKey: buttonAccesskey,
       popup: "blockedContentOptions",
       callback: function(aNotification, aButton) {
         return true; // keep notification open
@@ -5593,17 +5588,17 @@ var gComposeNotificationBar = {
 
     // The popup value is a space separated list of all the blocked urls.
     let popup = document.getElementById("blockedContentOptions");
     let urls = popup.value ? popup.value.split(" ") : [];
     if (!urls.includes(aBlockedURI))
       urls.push(aBlockedURI);
     popup.value = urls.join(" ");
 
-    let msg = this.stringBundle.getFormattedString(
+    let msg = getComposeBundle().getFormattedString(
       "blockedContentMessage", [brandName, brandName]);
     msg = PluralForm.get(urls.length, msg);
 
     if (!this.isShowingBlockedContentNotification()) {
       this.notificationBar.appendNotification(msg, "blockedContent",
         null, this.notificationBar.PRIORITY_WARNING_MEDIUM, buttons);
     }
     else {
@@ -5622,29 +5617,27 @@ var gComposeNotificationBar = {
 };
 
 /**
  * Populate the menuitems of what blocked content to unblock.
  */
 function onBlockedContentOptionsShowing(aEvent) {
   let urls = aEvent.target.value ? aEvent.target.value.split(" ") : [];
 
-  let composeBundle = document.getElementById("bundle_composeMsgs");
-
   // Out with the old...
   let childNodes = aEvent.target.childNodes;
   for (let i = childNodes.length - 1; i >= 0; i--) {
     childNodes[i].remove();
   }
 
   // ... and in with the new.
   for (let url of urls) {
     let menuitem = document.createElement("menuitem");
     menuitem.setAttribute("label",
-      composeBundle.getFormattedString("blockedAllowResource", [url]));
+      getComposeBundle().getFormattedString("blockedAllowResource", [url]));
     menuitem.setAttribute("crop", "center");
     menuitem.setAttribute("value", url);
     menuitem.setAttribute("oncommand",
                           "onUnblockResource(this.value, this.parentNode);");
     aEvent.target.appendChild(menuitem);
   }
 }