Bug 1128060: Fix copying permanentKey to a detached tab in e10s mode. r=billm, f=ttaubert
authorDave Townsend <dtownsend@oxymoronical.com>
Mon, 09 Mar 2015 16:19:54 -0700
changeset 233432 5a79c295029a4ced1fc66d3f6e44a2fbbd8c97fb
parent 233431 67630b38caf4edf3f623501ead3746d82e79ee36
child 233433 c1f3a8c202f3e71c03eafeab1b2dad2620875fdc
push id28412
push usercbook@mozilla.com
push dateFri, 13 Mar 2015 11:45:52 +0000
treeherdermozilla-central@11506aaf7064 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1128060
milestone39.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 1128060: Fix copying permanentKey to a detached tab in e10s mode. r=billm, f=ttaubert
browser/base/content/tabbrowser.xml
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_tab_detach_restore.js
toolkit/content/widgets/browser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1493,17 +1493,17 @@
 
             // 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;
+            aBrowser._permanentKey = permanentKey;
             parent.appendChild(aBrowser);
 
             // Restore the progress listener.
             aBrowser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
 
             if (aShouldBeRemote) {
               tab.setAttribute("remote", "true");
               // Switching the browser to be remote will connect to a new child
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -407,16 +407,17 @@ support-files =
 [browser_subframe_favicons_not_used.js]
 [browser_syncui.js]
 skip-if = e10s # Bug 1137087 - browser_tabopen_reflows.js fails if this was previously run with e10s
 [browser_tabDrop.js]
 skip-if = buildapp == 'mulet' || e10s
 [browser_tabMatchesInAwesomebar.js]
 [browser_tabMatchesInAwesomebar_perwindowpb.js]
 skip-if = e10s || os == 'linux' # Bug 1093373, bug 1104755
+[browser_tab_detach_restore.js]
 [browser_tab_drag_drop_perwindow.js]
 skip-if = buildapp == 'mulet'
 [browser_tab_dragdrop.js]
 skip-if = buildapp == 'mulet'
 [browser_tab_dragdrop2.js]
 skip-if = buildapp == 'mulet'
 [browser_tabbar_big_widgets.js]
 skip-if = os == "linux" || os == "mac" # No tabs in titlebar on linux
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/general/browser_tab_detach_restore.js
@@ -0,0 +1,31 @@
+"use strict";
+
+add_task(function*() {
+  let uri = "http://example.com/browser/browser/base/content/test/general/dummy_page.html";
+
+  // Clear out the closed windows set to start
+  while (SessionStore.getClosedWindowCount() > 0)
+    SessionStore.forgetClosedWindow(0);
+
+  let tab = gBrowser.addTab();
+  tab.linkedBrowser.loadURI(uri);
+  yield BrowserTestUtils.browserLoaded(tab.linkedBrowser);
+
+  let key = tab.linkedBrowser.permanentKey;
+  let win = gBrowser.replaceTabWithWindow(tab);
+  yield new Promise(resolve => whenDelayedStartupFinished(win, resolve));
+
+  is(win.gBrowser.selectedBrowser.permanentKey, key, "Should have properly copied the permanentKey");
+  yield promiseWindowClosed(win);
+
+  is(SessionStore.getClosedWindowCount(), 1, "Should have restore data for the closed window");
+
+  win = SessionStore.undoCloseWindow(0);
+  yield BrowserTestUtils.waitForEvent(win, "load");
+  yield BrowserTestUtils.waitForEvent(win.gBrowser.tabs[0], "SSTabRestored");
+
+  is(win.gBrowser.tabs.length, 1, "Should have restored one tab");
+  is(win.gBrowser.selectedBrowser.currentURI.spec, uri, "Should have restored the right page");
+
+  yield promiseWindowClosed(win);
+});
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -383,19 +383,18 @@
             this._fastFind.init(this.docShell);
           }
           return this._fastFind;
         ]]></getter>
       </property>
 
       <field name="_permanentKey">({})</field>
 
-      <property name="permanentKey"
-                onget="return this._permanentKey;"
-                onset="this._permanentKey = val;"/>
+      <property name="permanentKey" readonly="true"
+                onget="return this._permanentKey;"/>
 
       <property name="outerWindowID" readonly="true">
         <getter><![CDATA[
           return this.contentWindow
                      .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                      .getInterface(Components.interfaces.nsIDOMWindowUtils)
                      .outerWindowID;
         ]]></getter>