Bug 1072198 - updateBrowserRemoteness() needs to keep .permanentKey when updating browsers r=billm

This commit is contained in:
Tim Taubert 2014-09-24 12:19:46 +02:00
parent 48ae4b40a5
commit e39d1b656a
3 changed files with 16 additions and 2 deletions

View File

@ -1449,8 +1449,12 @@
// 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.

View File

@ -58,45 +58,54 @@ add_task(function*() {
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");

View File

@ -386,8 +386,9 @@
<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>