зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1485660 - Special test fixes. r=jdescottes
* browser_addons_debug_webextension_popup: It looks like frame-update events are now fired earlier. I had to move the listener to an earlier step in order to make it work. * helper_disable_cache + toolbox.js: this test wasn't correctly listening for reconfigure request's end. Not clear how this test was passing before without high rate of intermittent... * test_webextension-addon-debugging-connect.html: We can no longer listen for frame-update *before* the target object is created. (because we now need a TabTarget object or the TargetFront and not just the DebuggerClient) * Fix reload request in shadereditor which may still be pending after test ends. MozReview-Commit-ID: 49qvWSCn6nq Depends on D8066 Differential Revision: https://phabricator.services.mozilla.com/D7460 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2bab2fef72
Коммит
9c63f6e5ba
|
@ -91,7 +91,17 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() {
|
|||
/* eslint-disable no-undef */
|
||||
|
||||
let jsterm;
|
||||
let popupFramePromise;
|
||||
const popupFramePromise = new Promise(resolve => {
|
||||
const listener = data => {
|
||||
if (data.frames.some(({url}) => url && url.endsWith("popup.html"))) {
|
||||
toolbox.target.off("frame-update", listener);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
toolbox.target.on("frame-update", listener);
|
||||
});
|
||||
|
||||
const waitForFrameListUpdate = toolbox.target.once("frame-update");
|
||||
|
||||
toolbox.selectTool("webconsole")
|
||||
.then(async (console) => {
|
||||
|
@ -111,18 +121,6 @@ add_task(async function testWebExtensionsToolboxSwitchToPopup() {
|
|||
await clickNoAutoHideMenu();
|
||||
dump(`Clicked the menu button\n`);
|
||||
|
||||
popupFramePromise = new Promise(resolve => {
|
||||
const listener = data => {
|
||||
if (data.frames.some(({url}) => url && url.endsWith("popup.html"))) {
|
||||
toolbox.target.off("frame-update", listener);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
toolbox.target.on("frame-update", listener);
|
||||
});
|
||||
|
||||
const waitForFrameListUpdate = toolbox.target.once("frame-update");
|
||||
|
||||
jsterm = console.hud.jsterm;
|
||||
jsterm.execute("myWebExtensionShowPopup()");
|
||||
|
||||
|
|
|
@ -85,11 +85,12 @@ async function setDisableCacheCheckboxChecked(tabX, state) {
|
|||
|
||||
if (cbx.checked !== state) {
|
||||
info("Setting disable cache checkbox to " + state + " for " + tabX.title);
|
||||
const onReconfigured = tabX.toolbox.once("cache-reconfigured");
|
||||
cbx.click();
|
||||
|
||||
// We need to wait for all checkboxes to be updated and the docshells to
|
||||
// apply the new cache settings.
|
||||
await waitForTick();
|
||||
// We have to wait for the reconfigure request to be finished before reloading
|
||||
// the page.
|
||||
await onReconfigured;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1339,16 +1339,21 @@ Toolbox.prototype = {
|
|||
* Apply the current cache setting from devtools.cache.disabled to this
|
||||
* toolbox's tab.
|
||||
*/
|
||||
_applyCacheSettings: function() {
|
||||
_applyCacheSettings: async function() {
|
||||
const pref = "devtools.cache.disabled";
|
||||
const cacheDisabled = Services.prefs.getBoolPref(pref);
|
||||
|
||||
if (this.target.activeTab) {
|
||||
this.target.activeTab.reconfigure({
|
||||
await this.target.activeTab.reconfigure({
|
||||
options: {
|
||||
"cacheDisabled": cacheDisabled
|
||||
}
|
||||
});
|
||||
|
||||
// This event is only emitted for tests in order to know when to reload
|
||||
if (flags.testing) {
|
||||
this.emit("cache-reconfigured");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -135,9 +135,10 @@ function navigate(aTarget, aUrl, aWaitForTargetEvent = "navigate") {
|
|||
return once(aTarget, aWaitForTargetEvent);
|
||||
}
|
||||
|
||||
function reload(aTarget, aWaitForTargetEvent = "navigate") {
|
||||
executeSoon(() => aTarget.activeTab.reload());
|
||||
return once(aTarget, aWaitForTargetEvent);
|
||||
async function reload(aTarget, aWaitForTargetEvent = "navigate") {
|
||||
const onTargetEvent = once(aTarget, aWaitForTargetEvent);
|
||||
await aTarget.activeTab.reload();
|
||||
return onTargetEvent;
|
||||
}
|
||||
|
||||
function initBackend(aUrl) {
|
||||
|
|
|
@ -42,7 +42,6 @@ async function test_connect_addon(oopMode) {
|
|||
ok(addonTargetActor, "The expected webextension addon actor has been found");
|
||||
|
||||
// Connect to the target addon actor and wait for the updated list of frames.
|
||||
const waitFramesUpdated = waitForFramesUpdated({client});
|
||||
const addonTarget = await TargetFactory.forRemoteTab({
|
||||
form: addonTargetActor,
|
||||
client,
|
||||
|
@ -50,7 +49,7 @@ async function test_connect_addon(oopMode) {
|
|||
});
|
||||
is(addonTarget.form.isOOP, oopMode,
|
||||
"Got the expected oop mode in the webextension actor form");
|
||||
const frames = await waitFramesUpdated;
|
||||
const frames = await waitForFramesUpdated(addonTarget);
|
||||
const backgroundPageFrame = frames.filter((frame) => {
|
||||
return frame.url && frame.url.endsWith("/_generated_background_page.html");
|
||||
}).pop();
|
||||
|
|
Загрузка…
Ссылка в новой задаче