Bug 1713810 - [devtools] Fix openTabAndSetupStorage and clearStorage test helpers with fission. r=ladybenko

Avoid running failing tests as they don't cleanup their storage on teardown.

Differential Revision: https://phabricator.services.mozilla.com/D116478
This commit is contained in:
Alexandre Poirot 2021-06-10 21:26:12 +00:00
Родитель 32bff66a5f
Коммит 5bee607617
3 изменённых файлов: 18 добавлений и 66 удалений

Просмотреть файл

@ -157,11 +157,11 @@ skip-if = e10s # Bug 1183605 - devtools/server/tests/browser/ tests are still di
[browser_spawn_actor_in_parent.js]
[browser_storage_cookies-duplicate-names.js]
[browser_storage_dynamic_windows.js]
fail-if = fission # cookies data is the correct length
skip-if = fission # cookies data is the correct length
[browser_storage_listings.js]
fail-if = fission
skip-if = fission
[browser_storage_updates.js]
fail-if = fission
skip-if = fission
[browser_storage_webext_storage_local.js]
[browser_style_utils_getFontPreviewData.js]
[browser_styles_getRuleText.js]

Просмотреть файл

@ -255,7 +255,6 @@ function checkStoreValue(name, value, store) {
async function finishTests(target) {
await target.destroy();
DevToolsServer.destroy();
finish();
}
async function addCookie(name, value) {

Просмотреть файл

@ -27,38 +27,15 @@ async function openTabAndSetupStorage(url) {
const content = await addTab(url);
// Setup the async storages in main window and for all its iframes
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() {
/**
* Get all windows including frames recursively.
*
* @param {Window} [baseWindow]
* The base window at which to start looking for child windows
* (optional).
* @return {Set}
* A set of windows.
*/
function getAllWindows(baseWindow) {
const windows = new Set();
const _getAllWindows = function(win) {
windows.add(win.wrappedJSObject);
for (let i = 0; i < win.length; i++) {
_getAllWindows(win[i]);
}
};
_getAllWindows(baseWindow);
return windows;
}
const windows = getAllWindows(content);
for (const win of windows) {
if (win.setup) {
await win.setup();
const browsingContexts = gBrowser.selectedBrowser.browsingContext.getAllBrowsingContextsInSubtree();
for (const browsingContext of browsingContexts) {
await SpecialPowers.spawn(browsingContext, [], async function() {
if (content.wrappedJSObject.setup) {
await content.wrappedJSObject.setup();
}
}
});
});
}
// selected tab is set in addTab
const target = await createAndAttachTargetForTab(gBrowser.selectedTab);
const front = await target.getFront("storage");
@ -66,36 +43,12 @@ async function openTabAndSetupStorage(url) {
}
async function clearStorage() {
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() {
/**
* Get all windows including frames recursively.
*
* @param {Window} [baseWindow]
* The base window at which to start looking for child windows
* (optional).
* @return {Set}
* A set of windows.
*/
function getAllWindows(baseWindow) {
const windows = new Set();
const _getAllWindows = function(win) {
windows.add(win.wrappedJSObject);
for (let i = 0; i < win.length; i++) {
_getAllWindows(win[i]);
}
};
_getAllWindows(baseWindow);
return windows;
}
const windows = getAllWindows(content);
for (const win of windows) {
if (win.clear) {
await win.clear();
const browsingContexts = gBrowser.selectedBrowser.browsingContext.getAllBrowsingContextsInSubtree();
for (const browsingContext of browsingContexts) {
await SpecialPowers.spawn(browsingContext, [], async function() {
if (content.wrappedJSObject.clear) {
await content.wrappedJSObject.clear();
}
}
});
});
}
}