Bug 1271792 - Set correct usercontextid before swapping tabs. r=baku

MozReview-Commit-ID: DOOTo9IhP2E

--HG--
extra : rebase_source : c36de944bb2157bb8fd56e5672f3074554421d1a
This commit is contained in:
Jonathan Hao 2016-05-13 18:14:46 +08:00
parent ebe3c8320b
commit f099b439ef
2 changed files with 12 additions and 1 deletions

View File

@ -1107,6 +1107,12 @@ var gBrowserInit = {
"without the remote tabs load context.");
}
// We must set usercontextid before updateBrowserRemoteness()
// so that the newly created remote tab child has correct usercontextid
if (tabToOpen.hasAttribute("usercontextid")) {
let usercontextid = tabToOpen.getAttribute("usercontextid");
gBrowser.selectedBrowser.setAttribute("usercontextid", usercontextid);
}
gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser, true);
}
gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, tabToOpen);

View File

@ -3073,7 +3073,12 @@
// Swap the dropped tab with a new one we create and then close
// it in the other window (making it seem to have moved between
// windows).
let newTab = this.addTab("about:blank", { eventDetail: { adoptedTab: aTab } });
let params = { eventDetail: { adoptedTab: aTab } };
if (aTab.hasAttribute("usercontextid")) {
// new tab must have the same usercontextid as the old one
params.userContextId = aTab.getAttribute("usercontextid");
}
let newTab = this.addTab("about:blank", params);
let newBrowser = this.getBrowserForTab(newTab);
let newURL = aTab.linkedBrowser.currentURI.spec;