зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1296736 - Exit RDM when loading non-remote URLs. r=ochameau
MozReview-Commit-ID: 8GUZkq2fsZb
This commit is contained in:
Родитель
4a51ebacfa
Коммит
e9bd285a20
|
@ -99,13 +99,7 @@ function tunnelToInnerBrowser(outer, inner) {
|
|||
// even though it's not true. Since the actions the browser UI performs are sent
|
||||
// down to the inner browser by this tunnel, the tab's remoteness effectively is the
|
||||
// remoteness of the inner browser.
|
||||
Object.defineProperty(outer, "isRemoteBrowser", {
|
||||
get() {
|
||||
return true;
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
});
|
||||
outer.setAttribute("remote", "true");
|
||||
|
||||
// Clear out any cached state that references the current non-remote XBL binding,
|
||||
// such as form fill controllers. Otherwise they will remain in place and leak the
|
||||
|
@ -222,11 +216,13 @@ function tunnelToInnerBrowser(outer, inner) {
|
|||
// Reset overridden XBL properties and methods. Deleting the override
|
||||
// means it will fallback to the original XBL binding definitions which
|
||||
// are on the prototype.
|
||||
delete outer.isRemoteBrowser;
|
||||
delete outer.hasContentOpener;
|
||||
delete outer.docShellIsActive;
|
||||
delete outer.preserveLayers;
|
||||
|
||||
// Reset @remote since this is now back to a regular, non-remote browser
|
||||
outer.setAttribute("remote", "false");
|
||||
|
||||
// Delete the PopupNotifications getter added for permission doorhangers
|
||||
delete inner.ownerGlobal.PopupNotifications;
|
||||
|
||||
|
|
|
@ -324,6 +324,8 @@ ResponsiveUI.prototype = {
|
|||
});
|
||||
yield this.swap.start();
|
||||
|
||||
this.tab.addEventListener("BeforeTabRemotenessChange", this);
|
||||
|
||||
// Notify the inner browser to start the frame script
|
||||
yield message.request(this.toolWindow, "start-frame-script");
|
||||
|
||||
|
@ -350,18 +352,21 @@ ResponsiveUI.prototype = {
|
|||
// gracefully, but that shouldn't be a problem since the tab will go away.
|
||||
// So, skip any yielding when we're about to close the tab.
|
||||
let isWindowClosing = options && options.reason === "unload";
|
||||
let isTabClosing = (options && options.reason === "TabClose") || isWindowClosing;
|
||||
let isTabContentDestroying =
|
||||
isWindowClosing || (options && (options.reason === "TabClose" ||
|
||||
options.reason === "BeforeTabRemotenessChange"));
|
||||
|
||||
// Ensure init has finished before starting destroy
|
||||
if (!isTabClosing) {
|
||||
if (!isTabContentDestroying) {
|
||||
yield this.inited;
|
||||
}
|
||||
|
||||
this.tab.removeEventListener("TabClose", this);
|
||||
this.tab.removeEventListener("BeforeTabRemotenessChange", this);
|
||||
this.browserWindow.removeEventListener("unload", this);
|
||||
this.toolWindow.removeEventListener("message", this);
|
||||
|
||||
if (!isTabClosing) {
|
||||
if (!isTabContentDestroying) {
|
||||
// Notify the inner browser to stop the frame script
|
||||
yield message.request(this.toolWindow, "stop-frame-script");
|
||||
}
|
||||
|
@ -378,7 +383,7 @@ ResponsiveUI.prototype = {
|
|||
// The actor handles clearing any overrides itself, so it's not necessary to clear
|
||||
// anything on shutdown client side.
|
||||
let clientClosed = this.client.close();
|
||||
if (!isTabClosing) {
|
||||
if (!isTabContentDestroying) {
|
||||
yield clientClosed;
|
||||
}
|
||||
this.client = this.emulationFront = null;
|
||||
|
@ -411,8 +416,9 @@ ResponsiveUI.prototype = {
|
|||
case "message":
|
||||
this.handleMessage(event);
|
||||
break;
|
||||
case "unload":
|
||||
case "BeforeTabRemotenessChange":
|
||||
case "TabClose":
|
||||
case "unload":
|
||||
ResponsiveUIManager.closeIfNeeded(browserWindow, tab, {
|
||||
reason: event.type,
|
||||
});
|
||||
|
|
|
@ -32,7 +32,8 @@ support-files =
|
|||
[browser_permission_doorhanger.js]
|
||||
[browser_resize_cmd.js]
|
||||
[browser_screenshot_button.js]
|
||||
[browser_shutdown_close_sync.js]
|
||||
[browser_tab_close.js]
|
||||
[browser_tab_remoteness_change.js]
|
||||
[browser_toolbox_computed_view.js]
|
||||
[browser_toolbox_rule_view.js]
|
||||
[browser_toolbox_swap_browsers.js]
|
||||
|
|
|
@ -7,13 +7,6 @@
|
|||
|
||||
const TEST_URL = "http://example.com/";
|
||||
|
||||
function waitForClientClose(ui) {
|
||||
return new Promise(resolve => {
|
||||
info("RDM's debugger client is now closed");
|
||||
ui.client.addOneTimeListener("closed", resolve);
|
||||
});
|
||||
}
|
||||
|
||||
add_task(function* () {
|
||||
let tab = yield addTab(TEST_URL);
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Verify RDM closes synchronously when tabs change remoteness.
|
||||
|
||||
const TEST_URL = "http://example.com/";
|
||||
|
||||
add_task(function* () {
|
||||
let tab = yield addTab(TEST_URL);
|
||||
|
||||
let { ui } = yield openRDM(tab);
|
||||
let clientClosed = waitForClientClose(ui);
|
||||
|
||||
closeRDM(tab, {
|
||||
reason: "BeforeTabRemotenessChange",
|
||||
});
|
||||
|
||||
// This flag is set at the end of `ResponsiveUI.destroy`. If it is true
|
||||
// without yielding on `closeRDM` above, then we must have closed
|
||||
// synchronously.
|
||||
is(ui.destroyed, true, "RDM closed synchronously");
|
||||
|
||||
yield clientClosed;
|
||||
yield removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
let tab = yield addTab(TEST_URL);
|
||||
|
||||
let { ui } = yield openRDM(tab);
|
||||
let clientClosed = waitForClientClose(ui);
|
||||
|
||||
// Load URL that requires the main process, forcing a remoteness flip
|
||||
yield load(tab.linkedBrowser, "about:robots");
|
||||
|
||||
// This flag is set at the end of `ResponsiveUI.destroy`. If it is true without
|
||||
// yielding on `closeRDM` itself and only removing the tab, then we must have closed
|
||||
// synchronously in response to tab closing.
|
||||
is(ui.destroyed, true, "RDM closed synchronously");
|
||||
|
||||
yield clientClosed;
|
||||
});
|
|
@ -335,3 +335,10 @@ function addDeviceForTest(device) {
|
|||
ok(removeDevice(device), `Removed Test Device "${device.name}" from the list.`);
|
||||
});
|
||||
}
|
||||
|
||||
function waitForClientClose(ui) {
|
||||
return new Promise(resolve => {
|
||||
info("RDM's debugger client is now closed");
|
||||
ui.client.addOneTimeListener("closed", resolve);
|
||||
});
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче