Bug 1047713, fix leak of SelectParentHelper, r=felipe
authorNeil Deakin <neil@mozilla.com>
Fri, 05 Jun 2015 08:33:29 -0400
changeset 247394 45f0d3729d5fabd69476c1e916d10425867f8c87
parent 247393 9c8afe52c600eea9eeb2633bfbb13c2d5a0efe47
child 247395 407b8e33d72797a4ead2658604701fb204b71671
push id28864
push userkwierso@gmail.com
push dateFri, 05 Jun 2015 21:49:37 +0000
treeherdermozilla-central@97a39c939c51 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs1047713
milestone41.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 1047713, fix leak of SelectParentHelper, r=felipe
toolkit/content/widgets/remote-browser.xml
--- a/toolkit/content/widgets/remote-browser.xml
+++ b/toolkit/content/widgets/remote-browser.xml
@@ -42,16 +42,18 @@
         <body><![CDATA[
           this.messageManager.sendAsyncMessage("NetworkPrioritizer:AdjustPriority",
                                                {adjustment: adjustment});
         ]]></body>
       </method>
 
       <field name="_controller">null</field>
 
+      <field name="_selectParentHelper">null</field>
+
       <field name="_remoteWebNavigation">null</field>
 
       <property name="webNavigation"
                 onget="return this._remoteWebNavigation;"
                 readonly="true"/>
 
       <field name="_remoteWebProgress">null</field>
 
@@ -302,20 +304,24 @@
             case "ImageDocumentLoaded":
               this._imageDocument = {
                 width: data.width,
                 height: data.height
               };
               break;
 
             case "Forms:ShowDropDown": {
-              Cu.import("resource://gre/modules/SelectParentHelper.jsm");
+              if (!this._selectParentHelper) {
+                this._selectParentHelper =
+                  Cu.import("resource://gre/modules/SelectParentHelper.jsm", {}).SelectParentHelper;
+              }
+
               let menulist = document.getElementById(this.getAttribute("selectmenulist"));
-              SelectParentHelper.populate(menulist, data.options, data.selectedIndex);
-              SelectParentHelper.open(this, menulist, data.rect);
+              this._selectParentHelper.populate(menulist, data.options, data.selectedIndex);
+              this._selectParentHelper.open(this, menulist, data.rect);
               break;
             }
 
             case "FullZoomChange": {
               this._fullZoom = data.value;
               let event = document.createEvent("Events");
               event.initEvent("FullZoomChange", true, false);
               this.dispatchEvent(event);
@@ -333,19 +339,20 @@
             case "ZoomChangeUsingMouseWheel": {
               let event = document.createEvent("Events");
               event.initEvent("ZoomChangeUsingMouseWheel", true, false);
               this.dispatchEvent(event);
               break;
             }
 
             case "Forms:HideDropDown": {
-              Cu.import("resource://gre/modules/SelectParentHelper.jsm");
-              let menulist = document.getElementById(this.getAttribute("selectmenulist"));
-              SelectParentHelper.hide(menulist);
+              if (this._selectParentHelper) {
+                let menulist = document.getElementById(this.getAttribute("selectmenulist"));
+                this._selectParentHelper.hide(menulist);
+              }
               break;
             }
 
             case "DOMFullscreen:RequestExit": {
               let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
                                       .getInterface(Ci.nsIDOMWindowUtils);
               windowUtils.exitFullscreen();
               break;