Bug 1198831 - Fix browser_tab_drag_drop_perwindow.js leaks by returning early in swapBrowsersAndCloseOther() when the remoteness of the given browsers differs r=jaws
This commit is contained in:
@@ -2470,6 +2470,13 @@
|
||||
PrivateBrowsingUtils.isWindowPrivate(aOtherTab.ownerDocument.defaultView))
|
||||
return;
|
||||
|
||||
let ourBrowser = this.getBrowserForTab(aOurTab);
|
||||
let otherBrowser = aOtherTab.linkedBrowser;
|
||||
|
||||
// Can't swap between chrome and content processes.
|
||||
if (ourBrowser.isRemoteBrowser != otherBrowser.isRemoteBrowser)
|
||||
return;
|
||||
|
||||
// That's gBrowser for the other window, not the tab's browser!
|
||||
var remoteBrowser = aOtherTab.ownerDocument.defaultView.gBrowser;
|
||||
var isPending = aOtherTab.hasAttribute("pending");
|
||||
@@ -2490,9 +2497,6 @@
|
||||
modifiedAttrs.push("soundplaying");
|
||||
}
|
||||
|
||||
let ourBrowser = this.getBrowserForTab(aOurTab);
|
||||
let otherBrowser = aOtherTab.linkedBrowser;
|
||||
|
||||
// If the other tab is pending (i.e. has not been restored, yet)
|
||||
// then do not switch docShells but retrieve the other tab's state
|
||||
// and apply it to our tab.
|
||||
|
||||
@@ -74,21 +74,13 @@ add_task(function* test_dragging_e10s_windows() {
|
||||
null, nonRemoteWin, remoteWin);
|
||||
is(effect, "none", "Should not be able to drag a non-remote tab to an e10s window");
|
||||
|
||||
try {
|
||||
remoteWin.gBrowser.swapBrowsersAndCloseOther(remoteTab, nonRemoteTab);
|
||||
ok(false, "swapBrowsersAndCloseOther should have thrown");
|
||||
} catch(e) {}
|
||||
|
||||
remoteWin.gBrowser.swapBrowsersAndCloseOther(remoteTab, nonRemoteTab);
|
||||
is(remoteWin.gBrowser.tabs.length, 2,
|
||||
"Prevent moving a normal tab to a private tabbrowser");
|
||||
is(nonRemoteWin.gBrowser.tabs.length, 2,
|
||||
"Prevent accepting a normal tab in a private tabbrowser");
|
||||
|
||||
try {
|
||||
nonRemoteWin.gBrowser.swapBrowsersAndCloseOther(nonRemoteTab, remoteTab);
|
||||
ok(false, "swapBrowsersAndCloseOther should have thrown");
|
||||
} catch(e) {}
|
||||
|
||||
nonRemoteWin.gBrowser.swapBrowsersAndCloseOther(nonRemoteTab, remoteTab);
|
||||
is(nonRemoteWin.gBrowser.tabs.length, 2,
|
||||
"Prevent moving a private tab to a normal tabbrowser");
|
||||
is(remoteWin.gBrowser.tabs.length, 2,
|
||||
|
||||
Reference in New Issue
Block a user