Bug 915835 fix leak in socialmarks event listeners, r=markh
authorShane Caraveo <scaraveo@mozilla.com>
Thu, 13 Mar 2014 17:23:34 -0700
changeset 190731 c425c825c08b6f345866a224a14e8cc54f119a71
parent 190730 f5109b04e0839942c4a8c9d9d26f853a368731fc
child 190732 95341f53d78ff5b56420e0040269edce638ba30a
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs915835
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 915835 fix leak in socialmarks event listeners, r=markh
browser/base/content/socialmarks.xml
--- a/browser/base/content/socialmarks.xml
+++ b/browser/base/content/socialmarks.xml
@@ -215,20 +215,21 @@
                               CustomizableUI.AREA_PANEL);
         } else {
           let anchor = document.getAnonymousElementByAttribute(this, "class", "toolbarbutton-icon");
           panel.openPopup(anchor, "bottomcenter topright", 0, 0, false, false);
           this.setAttribute("open", "true");
         }
         if (aResetOnClose) {
           let evName = inMenuPanel ? "ViewHiding": "popuphidden";
-          panel.addEventListener(evName, function _hidden() {
+          let _hidden = () => {
             panel.removeEventListener(evName, _hidden);
             this.update();
-          }.bind(this), false);
+          };
+          panel.addEventListener(evName, _hidden, false);
         }
          ]]></body>
        </method>
 
       <method name="markCurrentPage">
         <parameter name="aOpenPanel"/>
         <body><![CDATA[
         // we always set the src on click if it has not been set for this tab,
@@ -277,22 +278,23 @@
         // showing as well as after load
         let sizeSocialPanelToContent = Cu.import("resource:///modules/Social.jsm", {}).sizeSocialPanelToContent;
         if (!this._loading && this.contentDocument &&
             this.contentDocument.readyState == "complete") {
           this.dispatchPanelEvent("socialFrameShow");
           if (!this.inMenuPanel)
             sizeSocialPanelToContent(this.panel, this.content);
         } else {
-          this.content.addEventListener("load", function panelBrowserOnload(e) {
+          let panelBrowserOnload = (e) => {
             this.content.removeEventListener("load", panelBrowserOnload, true);
             this.dispatchPanelEvent("socialFrameShow");
             if (!this.inMenuPanel)
               sizeSocialPanelToContent(this.panel, this.content);
-          }.bind(this), true);
+          };
+          this.content.addEventListener("load", panelBrowserOnload, true);
         }
         ]]></body>
       </method>
 
       <method name="handleEvent">
         <parameter name="aEvent"/>
         <body><![CDATA[
         if (aEvent.eventPhase != aEvent.BUBBLING_PHASE)