Bug 1072198 - updateBrowserRemoteness() needs to keep .permanentKey when updating browsers r=billm
authorTim Taubert <ttaubert@mozilla.com>
Wed, 24 Sep 2014 12:19:46 +0200
changeset 207462 e16c4c4eb07a99753935057ff91d9a8966d9d613
parent 207461 8e4b92b32b1556b673211302f56288d7ab0c8a9e
child 207463 a7e7c1333d689171dbe97e39a2c251da8a44a985
push id27555
push userryanvm@gmail.com
push dateFri, 26 Sep 2014 20:30:28 +0000
treeherderautoland@4ff52be673f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1072198
milestone35.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 1072198 - updateBrowserRemoteness() needs to keep .permanentKey when updating browsers r=billm
browser/base/content/tabbrowser.xml
browser/base/content/test/general/browser_e10s_switchbrowser.js
toolkit/content/widgets/browser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1444,18 +1444,22 @@
             // Unhook our progress listener.
             let tab = this._getTabForBrowser(aBrowser);
             let index = tab._tPos;
             let filter = this.mTabFilters[index];
             aBrowser.webProgress.removeProgressListener(filter);
 
             // Change the "remote" attribute.
             let parent = aBrowser.parentNode;
+            let permanentKey = aBrowser.permanentKey;
             parent.removeChild(aBrowser);
             aBrowser.setAttribute("remote", aShouldBeRemote ? "true" : "false");
+            // Tearing down the browser gives a new permanentKey but we want to
+            // keep the old one. Re-set it explicitly after unbinding from DOM.
+            aBrowser.permanentKey = permanentKey;
             parent.appendChild(aBrowser);
 
             // Restore the progress listener.
             aBrowser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
 
             if (aShouldBeRemote)
               tab.setAttribute("remote", "true");
             else
--- a/browser/base/content/test/general/browser_e10s_switchbrowser.js
+++ b/browser/base/content/test/general/browser_e10s_switchbrowser.js
@@ -53,52 +53,61 @@ add_task(function*() {
   SimpleTest.requestCompleteLog();
 
   let remoting = Services.prefs.getBoolPref("browser.tabs.remote.autostart");
   let expectedRemote = remoting ? "true" : "";
 
   info("1");
   // Create a tab and load a remote page in it
   gBrowser.selectedTab = gBrowser.addTab("about:blank", {skipAnimation: true});
+  let {permanentKey} = gBrowser.selectedBrowser;
   yield waitForLoad("http://example.org/" + DUMMY_PATH);
   is(gBrowser.selectedTab.getAttribute("remote"), expectedRemote, "Remote attribute should be correct");
+  is(gBrowser.selectedBrowser.permanentKey, permanentKey, "browser.permanentKey is still the same");
 
   info("2");
   // Load another page
   yield waitForLoad("http://example.com/" + DUMMY_PATH);
   is(gBrowser.selectedTab.getAttribute("remote"), expectedRemote, "Remote attribute should be correct");
+  is(gBrowser.selectedBrowser.permanentKey, permanentKey, "browser.permanentKey is still the same");
   check_history();
 
   info("3");
   // Load a non-remote page
   yield waitForLoad("about:robots");
   is(gBrowser.selectedTab.getAttribute("remote"), "", "Remote attribute should be correct");
+  is(gBrowser.selectedBrowser.permanentKey, permanentKey, "browser.permanentKey is still the same");
   check_history();
 
   info("4");
   // Load a remote page
   yield waitForLoad("http://example.org/" + DUMMY_PATH);
   is(gBrowser.selectedTab.getAttribute("remote"), expectedRemote, "Remote attribute should be correct");
+  is(gBrowser.selectedBrowser.permanentKey, permanentKey, "browser.permanentKey is still the same");
   check_history();
 
   info("5");
   yield back();
   is(gBrowser.selectedTab.getAttribute("remote"), "", "Remote attribute should be correct");
+  is(gBrowser.selectedBrowser.permanentKey, permanentKey, "browser.permanentKey is still the same");
   check_history();
 
   info("6");
   yield back();
   is(gBrowser.selectedTab.getAttribute("remote"), expectedRemote, "Remote attribute should be correct");
+  is(gBrowser.selectedBrowser.permanentKey, permanentKey, "browser.permanentKey is still the same");
   check_history();
 
   info("7");
   yield forward();
   is(gBrowser.selectedTab.getAttribute("remote"), "", "Remote attribute should be correct");
+  is(gBrowser.selectedBrowser.permanentKey, permanentKey, "browser.permanentKey is still the same");
   check_history();
 
   info("8");
   yield forward();
   is(gBrowser.selectedTab.getAttribute("remote"), expectedRemote, "Remote attribute should be correct");
+  is(gBrowser.selectedBrowser.permanentKey, permanentKey, "browser.permanentKey is still the same");
   check_history();
 
   info("9");
   gBrowser.removeCurrentTab();
 });
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -381,18 +381,19 @@
             this._fastFind.init(this.docShell);
           }
           return this._fastFind;
         ]]></getter>
       </property>
 
       <field name="_permanentKey">({})</field>
 
-      <property name="permanentKey" readonly="true"
-                onget="return this._permanentKey;"/>
+      <property name="permanentKey"
+                onget="return this._permanentKey;"
+                onset="this._permanentKey = val;"/>
 
       <field name="_lastSearchString">null</field>
       <field name="_lastSearchHighlight">false</field>
 
       <property name="webProgress"
                 readonly="true"
                 onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebProgress);"/>