Bug 1149775 TypeError: tabbrowser.(getTabForBrowser|getBrowserForOuterWindowID) is not a function r=Neil a=ewong CLOSED TREE a=IanN comm-aurora and comm-beta
authorPhilip Chee <philip.chee@gmail.com>
Wed, 18 Nov 2015 14:05:18 +0800
changeset 31231 a2d8017bd833b406f9eb6e5ccc21a64fa5e543b3
parent 31230 2d0998c50f59e738570b298382dd38a9f7b32ce8
child 31232 f30128a10d7fb704aa659cf1ddaf98106c739b91
push id1
push userclokep@gmail.com
push dateMon, 07 May 2018 22:45:56 +0000
treeherdercomm-esr60@57eacde5ef40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil, ewong, IanN
bugs1149775
Bug 1149775 TypeError: tabbrowser.(getTabForBrowser|getBrowserForOuterWindowID) is not a function r=Neil a=ewong CLOSED TREE a=IanN comm-aurora and comm-beta
suite/browser/tabbrowser.xml
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -1757,17 +1757,17 @@
               oldBrowser.parentNode.destroy();
               oldBrowser.destroy();
               oldBrowser.parentNode.remove();
 
               // Fix up the selected panel in the case the removed
               // browser was to the left of the current browser
               this.mTabBox.selectedPanel = this.selectedTab.linkedBrowser.parentNode;
               return;
-            } 
+            }
 
             // preserve a pointer to the browser for undoing the close
             // 1. save a copy of the session history (oldSH)
             // 2. hook up a new history
             // 3. add the last history entry from the old history the new
             //    history so we'll be able to go back from about:blank
             // 4. load a light URL in the browser, pushing the current page
             //    into bfcache - allows for saving of JS modifications
@@ -1937,27 +1937,53 @@
               if (browsers[i].contentWindow == aWindow)
                 return this.tabs[i];
 
             return null;
           ]]>
         </body>
       </method>
 
+      <method name="getTabForBrowser">
+        <parameter name="aBrowser"/>
+        <body>
+        <![CDATA[
+            for (var tab of this.tabs)
+              if (tab.linkedBrowser == aBrowser)
+                return tab;
+
+            return null;
+        ]]>
+        </body>
+      </method>
+
       <method name="getBrowserForTab">
         <parameter name="aTab"/>
         <body>
           <![CDATA[
             if (aTab.localName != "tab")
               return null;
             return aTab.linkedBrowser;
           ]]>
         </body>
       </method>
 
+      <method name="getBrowserForOuterWindowID">
+        <parameter name="aID"/>
+        <body>
+          <![CDATA[
+            for (var browser of this.browsers)
+              if (browser.outerWindowID == aID)
+                return browser;
+
+            return null;
+          ]]>
+        </body>
+      </method>
+
       <method name="getTabIndex">
         <parameter name="aTab"/>
         <body>
           <![CDATA[
             for (var i = 0; i < this.tabs.length; ++i)
               if (this.tabs[i] == aTab) 
                 return i;