зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1636634 - Use BrowsingContextTargetActor's reload method to reload the current tab in RDM r=jdescottes,bradwerth
Differential Revision: https://phabricator.services.mozilla.com/D74516
This commit is contained in:
Родитель
05d7202e59
Коммит
8516e90635
|
@ -53,6 +53,7 @@ tags = devtools webextensions
|
|||
[browser_mouse_resize.js]
|
||||
[browser_navigation.js]
|
||||
[browser_network_throttling.js]
|
||||
[browser_old-rdm_reload_conditions.js]
|
||||
[browser_orientationchange_event.js]
|
||||
[browser_page_redirection.js]
|
||||
skip-if = os == "linux"
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Verify that reload conditions restore old-RDM's tab to the proper state.
|
||||
// Bug 1585097: This test will be deleted once browser UI-enabled RDM is shipped to stable.
|
||||
|
||||
const TEST_URL = "data:text/html;charset=utf-8,";
|
||||
|
||||
addRDMTask(
|
||||
null,
|
||||
async function() {
|
||||
info("Ensure reload conditions for touch simulation are enabled.");
|
||||
reloadOnTouchChange(true);
|
||||
|
||||
const tab = await addTab(TEST_URL);
|
||||
const { ui } = await openRDM(tab);
|
||||
await toggleTouchSimulation(ui);
|
||||
|
||||
info("Wait for the UI's target to reload when opening RDM.");
|
||||
await once(ui.currentTarget, "navigate");
|
||||
ok(true, "RDM's tab target reloaded");
|
||||
|
||||
info("Wait for the tab to reload when closing RDM.");
|
||||
const reloaded = BrowserTestUtils.waitForContentEvent(
|
||||
tab.linkedBrowser,
|
||||
"load",
|
||||
true
|
||||
);
|
||||
await closeRDM(tab);
|
||||
await reloaded;
|
||||
ok(true, "Tab reloaded");
|
||||
|
||||
reloadOnTouchChange(false);
|
||||
},
|
||||
{ usingBrowserUI: false, onlyPrefAndTask: true }
|
||||
);
|
|
@ -350,6 +350,8 @@ class ResponsiveUI {
|
|||
(options.reason === "TabClose" ||
|
||||
options.reason === "BeforeTabRemotenessChange"));
|
||||
|
||||
let currentTarget;
|
||||
|
||||
// Ensure init has finished before starting destroy
|
||||
if (!isTabContentDestroying) {
|
||||
await this.inited;
|
||||
|
@ -365,6 +367,10 @@ class ResponsiveUI {
|
|||
this.hideBrowserUI();
|
||||
}
|
||||
|
||||
// Save reference to tab target before RDM stops listening to it. Will need it if
|
||||
// the tab has to be reloaded to remove the emulated settings created by RDM.
|
||||
currentTarget = this.currentTarget;
|
||||
|
||||
this.targetList.unwatchTargets(
|
||||
[this.targetList.TYPES.FRAME],
|
||||
this.onTargetAvailable
|
||||
|
@ -416,8 +422,8 @@ class ResponsiveUI {
|
|||
reloadNeeded |=
|
||||
(await this.updateTouchSimulation()) &&
|
||||
this.reloadOnChange("touchSimulation");
|
||||
if (reloadNeeded) {
|
||||
this.getViewportBrowser().reload();
|
||||
if (reloadNeeded && currentTarget) {
|
||||
await currentTarget.reload();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -604,7 +610,7 @@ class ResponsiveUI {
|
|||
(await this.updateTouchSimulation(touch)) &&
|
||||
this.reloadOnChange("touchSimulation");
|
||||
if (reloadNeeded) {
|
||||
this.getViewportBrowser().reload();
|
||||
this.reloadBrowser();
|
||||
}
|
||||
// Used by tests
|
||||
this.emit("device-changed");
|
||||
|
@ -631,7 +637,7 @@ class ResponsiveUI {
|
|||
(await this.updateTouchSimulation(enabled)) &&
|
||||
this.reloadOnChange("touchSimulation");
|
||||
if (reloadNeeded) {
|
||||
this.getViewportBrowser().reload();
|
||||
this.reloadBrowser();
|
||||
}
|
||||
// Used by tests
|
||||
this.emit("touch-simulation-changed");
|
||||
|
@ -643,7 +649,7 @@ class ResponsiveUI {
|
|||
(await this.updateUserAgent(userAgent)) &&
|
||||
this.reloadOnChange("userAgent");
|
||||
if (reloadNeeded) {
|
||||
this.getViewportBrowser().reload();
|
||||
this.reloadBrowser();
|
||||
}
|
||||
this.emit("user-agent-changed");
|
||||
}
|
||||
|
@ -670,7 +676,7 @@ class ResponsiveUI {
|
|||
(await this.updateTouchSimulation()) &&
|
||||
this.reloadOnChange("touchSimulation");
|
||||
if (reloadNeeded) {
|
||||
this.getViewportBrowser().reload();
|
||||
this.reloadBrowser();
|
||||
}
|
||||
// Used by tests
|
||||
this.emit("device-association-removed");
|
||||
|
@ -911,7 +917,7 @@ class ResponsiveUI {
|
|||
this.reloadOnChange("userAgent");
|
||||
}
|
||||
if (reloadNeeded) {
|
||||
this.getViewportBrowser().reload();
|
||||
this.reloadBrowser();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1197,6 +1203,13 @@ class ResponsiveUI {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload the current tab.
|
||||
*/
|
||||
async reloadBrowser() {
|
||||
await this.currentTarget.reload();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ResponsiveUI;
|
||||
|
|
Загрузка…
Ссылка в новой задаче