forked from mirrors/gecko-dev
Bug 1596918: Part 4c - Fix callers which depend on document lifecycle changes. r=mccr8
ContentTask tasks have a different lifetime than SpecialPowers tasks, with the former being tied to the lifetime of a message manager and the latter tied to the lifetime of a window global. That means that existing ContentTask callers which expect to be able to register load listeners before the creation of a window global, or which expect to persist after a page has navigated, won't work as SpecialPowers tasks. Since those sorts of tasks are not really resilient in the face of Fission, they should really be written to work differently, but this patch mostly just reverts them to using ContentTask for the time being. Differential Revision: https://phabricator.services.mozilla.com/D53744 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
4c36a24ea9
commit
0b1a146519
60 changed files with 209 additions and 294 deletions
|
|
@ -18,14 +18,11 @@ async function requestNotificationPermission(browser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function requestCameraPermission(browser) {
|
async function requestCameraPermission(browser) {
|
||||||
return SpecialPowers.spawn(browser, [], () => {
|
return SpecialPowers.spawn(browser, [], () =>
|
||||||
return new Promise(resolve => {
|
|
||||||
content.navigator.mediaDevices
|
content.navigator.mediaDevices
|
||||||
.getUserMedia({ video: true, fake: true })
|
.getUserMedia({ video: true, fake: true })
|
||||||
.catch(resolve(false))
|
.then(() => true, () => false)
|
||||||
.then(resolve(true));
|
);
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_task(async function test_fullscreen_closes_permissionui_prompt() {
|
add_task(async function test_fullscreen_closes_permissionui_prompt() {
|
||||||
|
|
@ -145,7 +142,7 @@ add_task(async function test_permission_prompt_closes_fullscreen() {
|
||||||
let fullScreenExit = waitForFullScreenState(browser, false);
|
let fullScreenExit = waitForFullScreenState(browser, false);
|
||||||
|
|
||||||
info("Requesting notification permission");
|
info("Requesting notification permission");
|
||||||
requestNotificationPermission(browser);
|
requestNotificationPermission(browser).catch(() => {});
|
||||||
await popupShown;
|
await popupShown;
|
||||||
|
|
||||||
info("Waiting for full-screen exit");
|
info("Waiting for full-screen exit");
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,10 @@ async function openNewTab(aWindow, aExpectedURL) {
|
||||||
false,
|
false,
|
||||||
aExpectedURL
|
aExpectedURL
|
||||||
);
|
);
|
||||||
let alreadyLoaded = await SpecialPowers.spawn(
|
let alreadyLoaded = await ContentTask.spawn(browser, aExpectedURL, url => {
|
||||||
browser,
|
|
||||||
[aExpectedURL],
|
|
||||||
url => {
|
|
||||||
let doc = content.document;
|
let doc = content.document;
|
||||||
return doc && doc.readyState === "complete" && doc.location.href == url;
|
return doc && doc.readyState === "complete" && doc.location.href == url;
|
||||||
}
|
});
|
||||||
);
|
|
||||||
if (!alreadyLoaded) {
|
if (!alreadyLoaded) {
|
||||||
await loadPromise;
|
await loadPromise;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,14 +71,10 @@ async function openNewTab(aWindow, aExpectedURL) {
|
||||||
false,
|
false,
|
||||||
aExpectedURL
|
aExpectedURL
|
||||||
);
|
);
|
||||||
let alreadyLoaded = await SpecialPowers.spawn(
|
let alreadyLoaded = await ContentTask.spawn(browser, aExpectedURL, url => {
|
||||||
browser,
|
|
||||||
[aExpectedURL],
|
|
||||||
url => {
|
|
||||||
let doc = content.document;
|
let doc = content.document;
|
||||||
return doc && doc.readyState === "complete" && doc.location.href == url;
|
return doc && doc.readyState === "complete" && doc.location.href == url;
|
||||||
}
|
});
|
||||||
);
|
|
||||||
if (!alreadyLoaded) {
|
if (!alreadyLoaded) {
|
||||||
await loadPromise;
|
await loadPromise;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,7 @@ function getParentTabState(aTab) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChildTabState(aTab) {
|
function getChildTabState(aTab) {
|
||||||
return SpecialPowers.spawn(aTab.linkedBrowser, [], async function() {
|
return ContentTask.spawn(aTab.linkedBrowser, null, () => docShell.isActive);
|
||||||
return docShell.isActive;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkState(parentSide, childSide, value, message) {
|
function checkState(parentSide, childSide, value, message) {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ add_task(async function test_opening_blocked_popups() {
|
||||||
|
|
||||||
ok(notification, "Should have notification.");
|
ok(notification, "Should have notification.");
|
||||||
|
|
||||||
await SpecialPowers.spawn(tab.linkedBrowser, [baseURL], async function(uri) {
|
await ContentTask.spawn(tab.linkedBrowser, baseURL, async function(uri) {
|
||||||
let iframe = content.document.createElement("iframe");
|
let iframe = content.document.createElement("iframe");
|
||||||
let pageHideHappened = ContentTaskUtils.waitForEvent(
|
let pageHideHappened = ContentTaskUtils.waitForEvent(
|
||||||
this,
|
this,
|
||||||
|
|
@ -59,7 +59,7 @@ add_task(async function test_opening_blocked_popups() {
|
||||||
ok(notification, "Should still have notification");
|
ok(notification, "Should still have notification");
|
||||||
|
|
||||||
// Now navigate the subframe.
|
// Now navigate the subframe.
|
||||||
await SpecialPowers.spawn(tab.linkedBrowser, [], async function() {
|
await ContentTask.spawn(tab.linkedBrowser, null, async function() {
|
||||||
let pageHideHappened = ContentTaskUtils.waitForEvent(
|
let pageHideHappened = ContentTaskUtils.waitForEvent(
|
||||||
this,
|
this,
|
||||||
"pagehide",
|
"pagehide",
|
||||||
|
|
|
||||||
|
|
@ -276,9 +276,9 @@ function expectObserverCalledOnClose(
|
||||||
}
|
}
|
||||||
|
|
||||||
function promiseMessage(aMessage, aAction, aCount = 1) {
|
function promiseMessage(aMessage, aAction, aCount = 1) {
|
||||||
let promise = SpecialPowers.spawn(
|
let promise = ContentTask.spawn(
|
||||||
gBrowser.selectedBrowser,
|
gBrowser.selectedBrowser,
|
||||||
[[aMessage, aCount]],
|
[aMessage, aCount],
|
||||||
async function([expectedMessage, expectedCount]) {
|
async function([expectedMessage, expectedCount]) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
function listenForMessage({ data }) {
|
function listenForMessage({ data }) {
|
||||||
|
|
@ -509,10 +509,8 @@ async function reloadAndAssertClosedStreams() {
|
||||||
await disableObserverVerification();
|
await disableObserverVerification();
|
||||||
|
|
||||||
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||||
await SpecialPowers.spawn(
|
await ContentTask.spawn(gBrowser.selectedBrowser, null, () =>
|
||||||
gBrowser.selectedBrowser,
|
content.location.reload()
|
||||||
[],
|
|
||||||
"() => content.location.reload()"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await loadedPromise;
|
await loadedPromise;
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ add_task(async function test_sort_order_persisted() {
|
||||||
url: "about:logins",
|
url: "about:logins",
|
||||||
},
|
},
|
||||||
async function(browser) {
|
async function(browser) {
|
||||||
await SpecialPowers.spawn(
|
await ContentTask.spawn(
|
||||||
browser,
|
browser,
|
||||||
[[TEST_LOGIN1, TEST_LOGIN2]],
|
[TEST_LOGIN1, TEST_LOGIN2],
|
||||||
async function([testLogin1, testLogin2]) {
|
async function([testLogin1, testLogin2]) {
|
||||||
let loginList = Cu.waiveXrays(
|
let loginList = Cu.waiveXrays(
|
||||||
content.document.querySelector("login-list")
|
content.document.querySelector("login-list")
|
||||||
|
|
@ -65,9 +65,7 @@ add_task(async function test_sort_order_persisted() {
|
||||||
url: "about:logins",
|
url: "about:logins",
|
||||||
},
|
},
|
||||||
async function(browser) {
|
async function(browser) {
|
||||||
await SpecialPowers.spawn(browser, [TEST_LOGIN1], async function(
|
await ContentTask.spawn(browser, TEST_LOGIN1, async function(testLogin1) {
|
||||||
testLogin1
|
|
||||||
) {
|
|
||||||
let loginList = Cu.waiveXrays(
|
let loginList = Cu.waiveXrays(
|
||||||
content.document.querySelector("login-list")
|
content.document.querySelector("login-list")
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -303,7 +303,7 @@ async function focusButtonAndPressKey(key, elem, modifiers) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var awaitBrowserLoaded = browser =>
|
var awaitBrowserLoaded = browser =>
|
||||||
SpecialPowers.spawn(browser, [], () => {
|
ContentTask.spawn(browser, null, () => {
|
||||||
if (
|
if (
|
||||||
content.document.readyState !== "complete" ||
|
content.document.readyState !== "complete" ||
|
||||||
content.document.documentURI === "about:blank"
|
content.document.documentURI === "about:blank"
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ async function test_trailhead_branch(
|
||||||
);
|
);
|
||||||
let browser = tab.linkedBrowser;
|
let browser = tab.linkedBrowser;
|
||||||
|
|
||||||
await SpecialPowers.spawn(
|
await ContentTask.spawn(
|
||||||
browser,
|
browser,
|
||||||
[{ expectedSelectors, branchName, unexpectedSelectors }],
|
{ expectedSelectors, branchName, unexpectedSelectors },
|
||||||
async ({
|
async ({
|
||||||
expectedSelectors: expected,
|
expectedSelectors: expected,
|
||||||
branchName: branch,
|
branchName: branch,
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@ async function checkNewtabLoads(selector, message) {
|
||||||
await waitForPreloaded(browser);
|
await waitForPreloaded(browser);
|
||||||
|
|
||||||
// check what the content task thinks has been loaded.
|
// check what the content task thinks has been loaded.
|
||||||
let found = await SpecialPowers.spawn(
|
let found = await ContentTask.spawn(
|
||||||
browser,
|
browser,
|
||||||
[selector],
|
selector,
|
||||||
arg => content.document.querySelector(arg) !== null
|
arg => content.document.querySelector(arg) !== null
|
||||||
);
|
);
|
||||||
ok(found, message);
|
ok(found, message);
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,9 @@ async function clearHistoryAndBookmarks() {
|
||||||
* not necessarily have had all its javascript/render logic executed.
|
* not necessarily have had all its javascript/render logic executed.
|
||||||
*/
|
*/
|
||||||
async function waitForPreloaded(browser) {
|
async function waitForPreloaded(browser) {
|
||||||
let readyState = await SpecialPowers.spawn(
|
let readyState = await ContentTask.spawn(
|
||||||
browser,
|
browser,
|
||||||
[],
|
null,
|
||||||
() => content.document.readyState
|
() => content.document.readyState
|
||||||
);
|
);
|
||||||
if (readyState !== "complete") {
|
if (readyState !== "complete") {
|
||||||
|
|
|
||||||
|
|
@ -1986,9 +1986,9 @@ async function testKeyEvent(aTab, aTestCase) {
|
||||||
let allKeyEventPromises = [];
|
let allKeyEventPromises = [];
|
||||||
|
|
||||||
for (let testEvent of testEvents) {
|
for (let testEvent of testEvents) {
|
||||||
let keyEventPromise = SpecialPowers.spawn(
|
let keyEventPromise = ContentTask.spawn(
|
||||||
aTab.linkedBrowser,
|
aTab.linkedBrowser,
|
||||||
[{ testEvent, result: aTestCase.result, kSameKeyCodeAndCharCodeValue }],
|
{ testEvent, result: aTestCase.result, kSameKeyCodeAndCharCodeValue },
|
||||||
async aInput => {
|
async aInput => {
|
||||||
function verifyKeyboardEvent(
|
function verifyKeyboardEvent(
|
||||||
aEvent,
|
aEvent,
|
||||||
|
|
@ -2217,9 +2217,9 @@ add_task(async function runTestForSuppressModifierKeys() {
|
||||||
|
|
||||||
for (let eventType of ["keydown", "keyup"]) {
|
for (let eventType of ["keydown", "keyup"]) {
|
||||||
for (let modifierKey of ["Alt", "Shift", "Control"]) {
|
for (let modifierKey of ["Alt", "Shift", "Control"]) {
|
||||||
let testPromise = SpecialPowers.spawn(
|
let testPromise = ContentTask.spawn(
|
||||||
tab.linkedBrowser,
|
tab.linkedBrowser,
|
||||||
[eventType],
|
eventType,
|
||||||
async aEventType => {
|
async aEventType => {
|
||||||
let inputBox = content.document.getElementById("test");
|
let inputBox = content.document.getElementById("test");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ add_task(async function test() {
|
||||||
|
|
||||||
await loadedPromise;
|
await loadedPromise;
|
||||||
|
|
||||||
await SpecialPowers.spawn(browser, [], function({}) {
|
await SpecialPowers.spawn(browser, [], function() {
|
||||||
// eslint-disable-line
|
// eslint-disable-line
|
||||||
// the data: URI inherits the CSP and the inline script needs to be blocked
|
// the data: URI inherits the CSP and the inline script needs to be blocked
|
||||||
is(
|
is(
|
||||||
|
|
@ -56,7 +56,7 @@ add_task(async function test() {
|
||||||
await promiseTabRestored(tab);
|
await promiseTabRestored(tab);
|
||||||
browser = tab.linkedBrowser;
|
browser = tab.linkedBrowser;
|
||||||
|
|
||||||
await SpecialPowers.spawn(browser, [], function({}) {
|
await SpecialPowers.spawn(browser, [], function() {
|
||||||
// eslint-disable-line
|
// eslint-disable-line
|
||||||
// the data: URI should be restored including the inherited CSP and the
|
// the data: URI should be restored including the inherited CSP and the
|
||||||
// inline script should be blocked.
|
// inline script should be blocked.
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ add_task(async function test_frametree() {
|
||||||
is(await countNonDynamicFrames(browser), 2, "two non-dynamic child frames");
|
is(await countNonDynamicFrames(browser), 2, "two non-dynamic child frames");
|
||||||
|
|
||||||
// Go back in history.
|
// Go back in history.
|
||||||
let pageShowPromise = SpecialPowers.spawn(browser, [], async () => {
|
let pageShowPromise = ContentTask.spawn(browser, null, async () => {
|
||||||
return ContentTaskUtils.waitForEvent(this, "pageshow", true);
|
await ContentTaskUtils.waitForEvent(this, "pageshow", true);
|
||||||
});
|
});
|
||||||
browser.goBack();
|
browser.goBack();
|
||||||
await pageShowPromise;
|
await pageShowPromise;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ add_task(async function() {
|
||||||
// Open a browser, configure it to cause OOM.
|
// Open a browser, configure it to cause OOM.
|
||||||
let newTab = BrowserTestUtils.addTab(gBrowser, "about:robots");
|
let newTab = BrowserTestUtils.addTab(gBrowser, "about:robots");
|
||||||
let browser = newTab.linkedBrowser;
|
let browser = newTab.linkedBrowser;
|
||||||
await SpecialPowers.spawn(browser, [], frameScript);
|
await ContentTask.spawn(browser, null, frameScript);
|
||||||
|
|
||||||
let promiseReported = new Promise(resolve => {
|
let promiseReported = new Promise(resolve => {
|
||||||
browser.messageManager.addMessageListener("SessionStore:error", resolve);
|
browser.messageManager.addMessageListener("SessionStore:error", resolve);
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,8 @@ add_task(async function test_pageshow() {
|
||||||
await promiseBrowserLoaded(browser);
|
await promiseBrowserLoaded(browser);
|
||||||
|
|
||||||
// Wait until shistory changes.
|
// Wait until shistory changes.
|
||||||
let pageShowPromise = SpecialPowers.spawn(browser, [], async () => {
|
let pageShowPromise = ContentTask.spawn(browser, null, async () => {
|
||||||
return ContentTaskUtils.waitForEvent(this, "pageshow", true);
|
await ContentTaskUtils.waitForEvent(this, "pageshow", true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Go back to the previous url which is loaded from the bfcache.
|
// Go back to the previous url which is loaded from the bfcache.
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ add_task(async function() {
|
||||||
|
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
let browser = win2.gBrowser.tabs[i].linkedBrowser;
|
let browser = win2.gBrowser.tabs[i].linkedBrowser;
|
||||||
await SpecialPowers.spawn(browser, [{ expectedId: i + 1 }], async function(
|
await ContentTask.spawn(browser, { expectedId: i + 1 }, async function(
|
||||||
args
|
args
|
||||||
) {
|
) {
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
|
|
@ -129,9 +129,7 @@ add_task(async function() {
|
||||||
|
|
||||||
for (let i = 0; i < 2; i++) {
|
for (let i = 0; i < 2; i++) {
|
||||||
let browser = win2.gBrowser.tabs[i].linkedBrowser;
|
let browser = win2.gBrowser.tabs[i].linkedBrowser;
|
||||||
await SpecialPowers.spawn(browser, [{ expectedId: i }], async function(
|
await ContentTask.spawn(browser, { expectedId: i }, async function(args) {
|
||||||
args
|
|
||||||
) {
|
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
docShell.getOriginAttributes().userContextId,
|
docShell.getOriginAttributes().userContextId,
|
||||||
args.expectedId,
|
args.expectedId,
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ function promiseCheckChildNoFocusedElement(browser) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SpecialPowers.spawn(browser, [], async function() {
|
return ContentTask.spawn(browser, null, async function() {
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
Services.focus.focusedElement,
|
Services.focus.focusedElement,
|
||||||
null,
|
null,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ add_task(async function test_ignoreFragment() {
|
||||||
switchTab("about:home#1", true);
|
switchTab("about:home#1", true);
|
||||||
switchTab("about:mozilla", true);
|
switchTab("about:mozilla", true);
|
||||||
|
|
||||||
let hashChangePromise = SpecialPowers.spawn(
|
let hashChangePromise = ContentTask.spawn(
|
||||||
tabRefAboutHome.linkedBrowser,
|
tabRefAboutHome.linkedBrowser,
|
||||||
[],
|
[],
|
||||||
async function() {
|
async function() {
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ add_task(async function moving_works() {
|
||||||
return ContentTaskUtils.waitForCondition(() => {
|
return ContentTaskUtils.waitForCondition(() => {
|
||||||
return content.document.readyState == "complete";
|
return content.document.readyState == "complete";
|
||||||
});
|
});
|
||||||
});
|
}).catch(Cu.reportError);
|
||||||
|
|
||||||
ok(true, "Managed to open a tab in the original window still.");
|
ok(true, "Managed to open a tab in the original window still.");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -726,9 +726,9 @@ function openContextMenuAndGetAllItems(inspector, options) {
|
||||||
*/
|
*/
|
||||||
async function waitUntilVisitedState(tab, selectors) {
|
async function waitUntilVisitedState(tab, selectors) {
|
||||||
await asyncWaitUntil(async () => {
|
await asyncWaitUntil(async () => {
|
||||||
const hasVisitedState = await SpecialPowers.spawn(
|
const hasVisitedState = await ContentTask.spawn(
|
||||||
tab.linkedBrowser,
|
tab.linkedBrowser,
|
||||||
[selectors],
|
selectors,
|
||||||
args => {
|
args => {
|
||||||
const NS_EVENT_STATE_VISITED = 1 << 24;
|
const NS_EVENT_STATE_VISITED = 1 << 24;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ function addRDMTask(rdmUrl, rdmTask, includeBrowserEmbeddedUI) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function spawnViewportTask(ui, args, task) {
|
function spawnViewportTask(ui, args, task) {
|
||||||
return SpecialPowers.spawn(ui.getViewportBrowser(), [args], task);
|
return ContentTask.spawn(ui.getViewportBrowser(), args, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
function waitForFrameLoad(ui, targetURL) {
|
function waitForFrameLoad(ui, targetURL) {
|
||||||
|
|
@ -442,7 +442,7 @@ const selectNetworkThrottling = (ui, value) =>
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function getSessionHistory(browser) {
|
function getSessionHistory(browser) {
|
||||||
return SpecialPowers.spawn(browser, [], async function() {
|
return ContentTask.spawn(browser, null, function() {
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
const { SessionHistory } = ChromeUtils.import(
|
const { SessionHistory } = ChromeUtils.import(
|
||||||
"resource://gre/modules/sessionstore/SessionHistory.jsm"
|
"resource://gre/modules/sessionstore/SessionHistory.jsm"
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ async function testNewWindow(client, win) {
|
||||||
|
|
||||||
async function testFocusFirst(client) {
|
async function testFocusFirst(client) {
|
||||||
const tab = window.gBrowser.selectedTab;
|
const tab = window.gBrowser.selectedTab;
|
||||||
await SpecialPowers.spawn(tab.linkedBrowser, [], async function() {
|
await ContentTask.spawn(tab.linkedBrowser, null, async function() {
|
||||||
const onFocus = new Promise(resolve => {
|
const onFocus = new Promise(resolve => {
|
||||||
content.addEventListener("focus", resolve, { once: true });
|
content.addEventListener("focus", resolve, { once: true });
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1351,9 +1351,9 @@ async function selectFrame(dbg, frame) {
|
||||||
async function pauseDebugger(dbg) {
|
async function pauseDebugger(dbg) {
|
||||||
info("Waiting for debugger to pause");
|
info("Waiting for debugger to pause");
|
||||||
const onPaused = waitForPaused(dbg);
|
const onPaused = waitForPaused(dbg);
|
||||||
SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() {
|
SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
|
||||||
content.wrappedJSObject.firstCall();
|
content.wrappedJSObject.firstCall();
|
||||||
});
|
}).catch(() => {});
|
||||||
await onPaused;
|
await onPaused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ add_task(async function test() {
|
||||||
const uris = [undefined, "about:blank"];
|
const uris = [undefined, "about:blank"];
|
||||||
|
|
||||||
function checkContentProcess(newBrowser, uri) {
|
function checkContentProcess(newBrowser, uri) {
|
||||||
return SpecialPowers.spawn(newBrowser, [uri], async function(uri) {
|
return ContentTask.spawn(newBrowser, [uri], async function(uri) {
|
||||||
var prin = content.document.nodePrincipal;
|
var prin = content.document.nodePrincipal;
|
||||||
Assert.notEqual(
|
Assert.notEqual(
|
||||||
prin,
|
prin,
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ function test() {
|
||||||
gBrowser.selectedTab = newTab;
|
gBrowser.selectedTab = newTab;
|
||||||
newBrowser = gBrowser.getBrowserForTab(newTab);
|
newBrowser = gBrowser.getBrowserForTab(newTab);
|
||||||
|
|
||||||
SpecialPowers.spawn(newBrowser, [], task).then(() => {
|
ContentTask.spawn(newBrowser, null, task).then(() => {
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ add_task(async function test() {
|
||||||
{ gBrowser, url: "about:blank" },
|
{ gBrowser, url: "about:blank" },
|
||||||
async function(browser) {
|
async function(browser) {
|
||||||
if (!SpecialPowers.getBoolPref("fission.sessionHistoryInParent")) {
|
if (!SpecialPowers.getBoolPref("fission.sessionHistoryInParent")) {
|
||||||
await SpecialPowers.spawn(browser, [URL], async function(URL) {
|
await ContentTask.spawn(browser, URL, async function(URL) {
|
||||||
let history = docShell.QueryInterface(Ci.nsIWebNavigation)
|
let history = docShell.QueryInterface(Ci.nsIWebNavigation)
|
||||||
.sessionHistory;
|
.sessionHistory;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
@ -29,22 +29,16 @@ add_task(async function test() {
|
||||||
let listener = {
|
let listener = {
|
||||||
OnHistoryNewEntry(aNewURI) {
|
OnHistoryNewEntry(aNewURI) {
|
||||||
if (aNewURI.spec == URL && 5 == ++count) {
|
if (aNewURI.spec == URL && 5 == ++count) {
|
||||||
docShell.chromeEventHandler.addEventListener(
|
addEventListener(
|
||||||
"load",
|
"load",
|
||||||
function onLoad() {
|
function onLoad() {
|
||||||
docShell.chromeEventHandler.removeEventListener(
|
|
||||||
"load",
|
|
||||||
onLoad,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
Assert.ok(
|
Assert.ok(
|
||||||
history.index < history.count,
|
history.index < history.count,
|
||||||
"history.index is valid"
|
"history.index is valid"
|
||||||
);
|
);
|
||||||
testDone.resolve();
|
testDone.resolve();
|
||||||
},
|
},
|
||||||
true
|
{ capture: true, once: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
history.legacySHistory.removeSHistoryListener(listener);
|
history.legacySHistory.removeSHistoryListener(listener);
|
||||||
|
|
@ -98,9 +92,9 @@ add_task(async function test() {
|
||||||
async OnHistoryNewEntry(aNewURI) {
|
async OnHistoryNewEntry(aNewURI) {
|
||||||
if (aNewURI.spec == URL && 5 == ++count) {
|
if (aNewURI.spec == URL && 5 == ++count) {
|
||||||
history.removeSHistoryListener(listener);
|
history.removeSHistoryListener(listener);
|
||||||
await SpecialPowers.spawn(browser, [], async () => {
|
await ContentTask.spawn(browser, null, () => {
|
||||||
let promise = new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
docShell.chromeEventHandler.addEventListener(
|
addEventListener(
|
||||||
"load",
|
"load",
|
||||||
evt => {
|
evt => {
|
||||||
let history = docShell.QueryInterface(Ci.nsIWebNavigation)
|
let history = docShell.QueryInterface(Ci.nsIWebNavigation)
|
||||||
|
|
@ -113,10 +107,9 @@ add_task(async function test() {
|
||||||
},
|
},
|
||||||
{ capture: true, once: true }
|
{ capture: true, once: true }
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
content.location.reload();
|
content.location.reload();
|
||||||
await promise;
|
});
|
||||||
});
|
});
|
||||||
testDone.resolve();
|
testDone.resolve();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ function test() {
|
||||||
let taskFinished;
|
let taskFinished;
|
||||||
|
|
||||||
let tab = BrowserTestUtils.addTab(gBrowser, doc, {}, tab => {
|
let tab = BrowserTestUtils.addTab(gBrowser, doc, {}, tab => {
|
||||||
taskFinished = SpecialPowers.spawn(tab.linkedBrowser, [], () => {
|
taskFinished = ContentTask.spawn(tab.linkedBrowser, null, () => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
docShell.chromeEventHandler.addEventListener(
|
addEventListener(
|
||||||
"load",
|
"load",
|
||||||
function() {
|
function() {
|
||||||
// The main page has loaded. Now wait for the iframe to load.
|
// The main page has loaded. Now wait for the iframe to load.
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ add_task(async function test_swap_frameloader_pagevisibility_events() {
|
||||||
|
|
||||||
// Wait for that initial browser to show its pageshow event if it hasn't
|
// Wait for that initial browser to show its pageshow event if it hasn't
|
||||||
// happened so that we don't confuse it with the other expected events.
|
// happened so that we don't confuse it with the other expected events.
|
||||||
await SpecialPowers.spawn(emptyBrowser, [], async () => {
|
await ContentTask.spawn(emptyBrowser, null, async () => {
|
||||||
if (content.document.visibilityState === "hidden") {
|
if (content.document.visibilityState === "hidden") {
|
||||||
info("waiting for hidden emptyBrowser to pageshow");
|
info("waiting for hidden emptyBrowser to pageshow");
|
||||||
await ContentTaskUtils.waitForEvent(content, "pageshow", {});
|
await ContentTaskUtils.waitForEvent(content, "pageshow", {});
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ function expectNotAllowedError(aResult) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function promiseMakeCredential(tab) {
|
function promiseMakeCredential(tab) {
|
||||||
return SpecialPowers.spawn(tab.linkedBrowser, [], async function() {
|
return ContentTask.spawn(tab.linkedBrowser, null, async function() {
|
||||||
const cose_alg_ECDSA_w_SHA256 = -7;
|
const cose_alg_ECDSA_w_SHA256 = -7;
|
||||||
|
|
||||||
let publicKey = {
|
let publicKey = {
|
||||||
|
|
@ -37,7 +37,7 @@ function promiseMakeCredential(tab) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function promiseGetAssertion(tab) {
|
function promiseGetAssertion(tab) {
|
||||||
return SpecialPowers.spawn(tab.linkedBrowser, [], async function() {
|
return ContentTask.spawn(tab.linkedBrowser, null, async function() {
|
||||||
let newCredential = {
|
let newCredential = {
|
||||||
type: "public-key",
|
type: "public-key",
|
||||||
id: content.crypto.getRandomValues(new Uint8Array(16)),
|
id: content.crypto.getRandomValues(new Uint8Array(16)),
|
||||||
|
|
|
||||||
|
|
@ -3,27 +3,16 @@ add_task(async function() {
|
||||||
let tab = BrowserTestUtils.addTab(gBrowser);
|
let tab = BrowserTestUtils.addTab(gBrowser);
|
||||||
let uri = "data:text/html;charset=utf-8,<html/>";
|
let uri = "data:text/html;charset=utf-8,<html/>";
|
||||||
|
|
||||||
let eventPromise = SpecialPowers.spawn(tab.linkedBrowser, [], function() {
|
let eventPromise = ContentTask.spawn(tab.linkedBrowser, null, function() {
|
||||||
const { PromiseUtils } = ChromeUtils.import(
|
return new Promise(resolve => {
|
||||||
"resource://gre/modules/PromiseUtils.jsm"
|
addEventListener(
|
||||||
);
|
|
||||||
let deferred = PromiseUtils.defer();
|
|
||||||
|
|
||||||
let listener = event => {
|
|
||||||
docShell.chromeEventHandler.removeEventListener(
|
|
||||||
"DOMDocElementInserted",
|
"DOMDocElementInserted",
|
||||||
listener,
|
event => resolve(event.target.documentURIObject.spec),
|
||||||
true
|
{
|
||||||
|
once: true,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
deferred.resolve(event.target.documentURIObject.spec);
|
});
|
||||||
};
|
|
||||||
docShell.chromeEventHandler.addEventListener(
|
|
||||||
"DOMDocElementInserted",
|
|
||||||
listener,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
return deferred.promise;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
|
BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ function enableOnAppInstalledPref() {
|
||||||
// This cause file_reg_install_event.html to be dynamically change.
|
// This cause file_reg_install_event.html to be dynamically change.
|
||||||
async function theTest(aBrowser) {
|
async function theTest(aBrowser) {
|
||||||
aBrowser.allowEvents = true;
|
aBrowser.allowEvents = true;
|
||||||
let waitForInstall = SpecialPowers.spawn(aBrowser, [], async function() {
|
let waitForInstall = ContentTask.spawn(aBrowser, null, async function() {
|
||||||
await ContentTaskUtils.waitForEvent(content.window, "appinstalled");
|
await ContentTaskUtils.waitForEvent(content.window, "appinstalled");
|
||||||
});
|
});
|
||||||
const {
|
const {
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ function waitForNetObserver(aBrowser, aTest) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
return SpecialPowers.spawn(aBrowser, [], () => {
|
return ContentTask.spawn(aBrowser, [], () => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
function observe(subject, topic) {
|
function observe(subject, topic) {
|
||||||
Services.obs.removeObserver(observe, "csp-on-violate-policy");
|
Services.obs.removeObserver(observe, "csp-on-violate-policy");
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ add_task(async function() {
|
||||||
gBrowser.selectedTab = tab;
|
gBrowser.selectedTab = tab;
|
||||||
var browser = gBrowser.selectedBrowser;
|
var browser = gBrowser.selectedBrowser;
|
||||||
|
|
||||||
let observerPromise = SpecialPowers.spawn(browser, [], async function(opt) {
|
let observerPromise = ContentTask.spawn(browser, null, async function(opt) {
|
||||||
const TEST_URI =
|
const TEST_URI =
|
||||||
"http://example.com/browser/dom/tests/browser/test-console-api.html";
|
"http://example.com/browser/dom/tests/browser/test-console-api.html";
|
||||||
let ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"].getService(
|
let ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"].getService(
|
||||||
|
|
@ -93,9 +93,7 @@ add_task(async function() {
|
||||||
browser = gBrowser.selectedBrowser;
|
browser = gBrowser.selectedBrowser;
|
||||||
|
|
||||||
// Spin the event loop to make sure everything is cleared.
|
// Spin the event loop to make sure everything is cleared.
|
||||||
await SpecialPowers.spawn(browser, [], function() {
|
await SpecialPowers.spawn(browser, [], () => {});
|
||||||
return Promise.resolve();
|
|
||||||
});
|
|
||||||
|
|
||||||
await SpecialPowers.spawn(browser, [windowId], function(windowId) {
|
await SpecialPowers.spawn(browser, [windowId], function(windowId) {
|
||||||
var ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"].getService(
|
var ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"].getService(
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,7 @@ function controlFrameAt(browser, frameDepth, command) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).catch(Cu.reportError);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,13 @@ function expectNoProcess() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPID(aBrowser) {
|
function getPID(aBrowser) {
|
||||||
return SpecialPowers.spawn(aBrowser, [], () => {
|
return ContentTask.spawn(aBrowser, [], () => {
|
||||||
return Services.appinfo.processID;
|
return Services.appinfo.processID;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getInLAProc(aBrowser) {
|
function getInLAProc(aBrowser) {
|
||||||
return SpecialPowers.spawn(aBrowser, [], () => {
|
return ContentTask.spawn(aBrowser, [], () => {
|
||||||
return Services.appinfo.remoteType == "webLargeAllocation";
|
return Services.appinfo.remoteType == "webLargeAllocation";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +80,7 @@ async function largeAllocSuccessTests() {
|
||||||
is(false, await getInLAProc(aBrowser));
|
is(false, await getInLAProc(aBrowser));
|
||||||
|
|
||||||
let epc = expectProcessCreated();
|
let epc = expectProcessCreated();
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ async function largeAllocSuccessTests() {
|
||||||
// Fail the test if we create a process
|
// Fail the test if we create a process
|
||||||
let stopExpectNoProcess = expectNoProcess();
|
let stopExpectNoProcess = expectNoProcess();
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
// eslint-disable-next-line no-unsanitized/property
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
content.document.body.innerHTML = `<iframe src='${TEST_URI}'></iframe>`;
|
content.document.body.innerHTML = `<iframe src='${TEST_URI}'></iframe>`;
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ async function largeAllocSuccessTests() {
|
||||||
// Fail the test if we create a process
|
// Fail the test if we create a process
|
||||||
let stopExpectNoProcess = expectNoProcess();
|
let stopExpectNoProcess = expectNoProcess();
|
||||||
|
|
||||||
let loaded = SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
let loaded = ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.body.innerHTML = "<button>CLICK ME</button>";
|
content.document.body.innerHTML = "<button>CLICK ME</button>";
|
||||||
|
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
|
@ -173,7 +173,7 @@ async function largeAllocSuccessTests() {
|
||||||
|
|
||||||
let epc = expectProcessCreated();
|
let epc = expectProcessCreated();
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -186,7 +186,7 @@ async function largeAllocSuccessTests() {
|
||||||
|
|
||||||
await BrowserTestUtils.browserLoaded(aBrowser);
|
await BrowserTestUtils.browserLoaded(aBrowser);
|
||||||
|
|
||||||
await SpecialPowers.spawn(
|
await ContentTask.spawn(
|
||||||
aBrowser,
|
aBrowser,
|
||||||
[],
|
[],
|
||||||
() => (content.document.location = "about:blank")
|
() => (content.document.location = "about:blank")
|
||||||
|
|
@ -200,7 +200,7 @@ async function largeAllocSuccessTests() {
|
||||||
|
|
||||||
epc = expectProcessCreated();
|
epc = expectProcessCreated();
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -221,7 +221,7 @@ async function largeAllocSuccessTests() {
|
||||||
|
|
||||||
let epc = expectProcessCreated();
|
let epc = expectProcessCreated();
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ async function largeAllocSuccessTests() {
|
||||||
await BrowserTestUtils.browserLoaded(aBrowser);
|
await BrowserTestUtils.browserLoaded(aBrowser);
|
||||||
|
|
||||||
// Switch to about:blank, so we can navigate back
|
// Switch to about:blank, so we can navigate back
|
||||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
await ContentTask.spawn(aBrowser, [], () => {
|
||||||
content.document.location = "about:blank";
|
content.document.location = "about:blank";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -251,7 +251,7 @@ async function largeAllocSuccessTests() {
|
||||||
|
|
||||||
// Navigate back to the previous page. As the large alloation process was
|
// Navigate back to the previous page. As the large alloation process was
|
||||||
// left, it won't be in bfcache and will have to be loaded fresh.
|
// left, it won't be in bfcache and will have to be loaded fresh.
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.window.history.back();
|
content.window.history.back();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -276,7 +276,7 @@ async function largeAllocSuccessTests() {
|
||||||
BrowserTestUtils.browserLoaded(aBrowser),
|
BrowserTestUtils.browserLoaded(aBrowser),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -289,7 +289,7 @@ async function largeAllocSuccessTests() {
|
||||||
|
|
||||||
let epc = expectProcessCreated();
|
let epc = expectProcessCreated();
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI_2], TEST_URI_2 => {
|
await ContentTask.spawn(aBrowser, TEST_URI_2, TEST_URI_2 => {
|
||||||
content.document.location = TEST_URI_2;
|
content.document.location = TEST_URI_2;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -327,7 +327,7 @@ async function largeAllocSuccessTests() {
|
||||||
BrowserTestUtils.browserLoaded(aBrowser),
|
BrowserTestUtils.browserLoaded(aBrowser),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -340,7 +340,7 @@ async function largeAllocSuccessTests() {
|
||||||
|
|
||||||
let stopExpectNoProcess = expectNoProcess();
|
let stopExpectNoProcess = expectNoProcess();
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
await ContentTask.spawn(aBrowser, [], () => {
|
||||||
this.__newWindow = content.window.open("about:blank");
|
this.__newWindow = content.window.open("about:blank");
|
||||||
content.document.location = "about:blank";
|
content.document.location = "about:blank";
|
||||||
});
|
});
|
||||||
|
|
@ -354,7 +354,7 @@ async function largeAllocSuccessTests() {
|
||||||
|
|
||||||
stopExpectNoProcess();
|
stopExpectNoProcess();
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
await ContentTask.spawn(aBrowser, [], () => {
|
||||||
ok(this.__newWindow, "The window should have been stored");
|
ok(this.__newWindow, "The window should have been stored");
|
||||||
this.__newWindow.close();
|
this.__newWindow.close();
|
||||||
});
|
});
|
||||||
|
|
@ -372,7 +372,7 @@ async function largeAllocSuccessTests() {
|
||||||
BrowserTestUtils.browserLoaded(aBrowser),
|
BrowserTestUtils.browserLoaded(aBrowser),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -390,7 +390,7 @@ async function largeAllocSuccessTests() {
|
||||||
gBrowser,
|
gBrowser,
|
||||||
"about:blank"
|
"about:blank"
|
||||||
);
|
);
|
||||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
await ContentTask.spawn(aBrowser, [], () => {
|
||||||
this.__newWindow = content.window.open("about:blank");
|
this.__newWindow = content.window.open("about:blank");
|
||||||
});
|
});
|
||||||
await promiseTabOpened;
|
await promiseTabOpened;
|
||||||
|
|
@ -410,7 +410,7 @@ async function largeAllocSuccessTests() {
|
||||||
|
|
||||||
stopExpectNoProcess();
|
stopExpectNoProcess();
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
await ContentTask.spawn(aBrowser, [], () => {
|
||||||
ok(this.__newWindow, "The window should have been stored");
|
ok(this.__newWindow, "The window should have been stored");
|
||||||
this.__newWindow.close();
|
this.__newWindow.close();
|
||||||
});
|
});
|
||||||
|
|
@ -428,7 +428,7 @@ async function largeAllocSuccessTests() {
|
||||||
expectProcessCreated(),
|
expectProcessCreated(),
|
||||||
BrowserTestUtils.browserLoaded(aBrowser),
|
BrowserTestUtils.browserLoaded(aBrowser),
|
||||||
]);
|
]);
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -476,7 +476,7 @@ async function largeAllocSuccessTests() {
|
||||||
BrowserTestUtils.browserLoaded(aBrowser),
|
BrowserTestUtils.browserLoaded(aBrowser),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -493,7 +493,7 @@ async function largeAllocSuccessTests() {
|
||||||
is(false, await getInLAProc(aBrowser));
|
is(false, await getInLAProc(aBrowser));
|
||||||
|
|
||||||
let ready = Promise.all([BrowserTestUtils.browserLoaded(aBrowser)]);
|
let ready = Promise.all([BrowserTestUtils.browserLoaded(aBrowser)]);
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
await ready;
|
await ready;
|
||||||
|
|
@ -517,7 +517,7 @@ async function largeAllocSuccessTests() {
|
||||||
// Fail the test if we create a process
|
// Fail the test if we create a process
|
||||||
let stopExpectNoProcess = expectNoProcess();
|
let stopExpectNoProcess = expectNoProcess();
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [], () => {
|
await ContentTask.spawn(aBrowser, [], () => {
|
||||||
content.document.location = "view-source:http://example.com";
|
content.document.location = "view-source:http://example.com";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -546,7 +546,7 @@ async function largeAllocSuccessTests() {
|
||||||
expectProcessCreated(),
|
expectProcessCreated(),
|
||||||
BrowserTestUtils.browserLoaded(aBrowser),
|
BrowserTestUtils.browserLoaded(aBrowser),
|
||||||
]);
|
]);
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -588,7 +588,7 @@ async function largeAllocSuccessTests() {
|
||||||
expectProcessCreated(),
|
expectProcessCreated(),
|
||||||
BrowserTestUtils.browserLoaded(aBrowser),
|
BrowserTestUtils.browserLoaded(aBrowser),
|
||||||
]);
|
]);
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -600,7 +600,7 @@ async function largeAllocSuccessTests() {
|
||||||
is(true, await getInLAProc(aBrowser));
|
is(true, await getInLAProc(aBrowser));
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
SpecialPowers.spawn(aBrowser, [], () => {
|
ContentTask.spawn(aBrowser, null, () => {
|
||||||
content.document.querySelector("#submit").click();
|
content.document.querySelector("#submit").click();
|
||||||
}),
|
}),
|
||||||
BrowserTestUtils.browserLoaded(aBrowser),
|
BrowserTestUtils.browserLoaded(aBrowser),
|
||||||
|
|
@ -632,7 +632,7 @@ async function largeAllocFailTests() {
|
||||||
// Fail the test if we create a process
|
// Fail the test if we create a process
|
||||||
let stopExpectNoProcess = expectNoProcess();
|
let stopExpectNoProcess = expectNoProcess();
|
||||||
|
|
||||||
await SpecialPowers.spawn(aBrowser, [TEST_URI], TEST_URI => {
|
await ContentTask.spawn(aBrowser, TEST_URI, TEST_URI => {
|
||||||
content.document.location = TEST_URI;
|
content.document.location = TEST_URI;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ function promiseU2FRegister(tab, app_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function promiseWebAuthnRegister(tab, appid) {
|
function promiseWebAuthnRegister(tab, appid) {
|
||||||
return SpecialPowers.spawn(tab.linkedBrowser, [[appid]], ([appid]) => {
|
return ContentTask.spawn(tab.linkedBrowser, appid, appid => {
|
||||||
const cose_alg_ECDSA_w_SHA256 = -7;
|
const cose_alg_ECDSA_w_SHA256 = -7;
|
||||||
|
|
||||||
let challenge = content.crypto.getRandomValues(new Uint8Array(16));
|
let challenge = content.crypto.getRandomValues(new Uint8Array(16));
|
||||||
|
|
@ -84,9 +84,9 @@ function promiseWebAuthnRegister(tab, appid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function promiseWebAuthnSign(tab, key_handle, extensions = {}) {
|
function promiseWebAuthnSign(tab, key_handle, extensions = {}) {
|
||||||
return SpecialPowers.spawn(
|
return ContentTask.spawn(
|
||||||
tab.linkedBrowser,
|
tab.linkedBrowser,
|
||||||
[[key_handle, extensions]],
|
[key_handle, extensions],
|
||||||
([key_handle, extensions]) => {
|
([key_handle, extensions]) => {
|
||||||
let challenge = content.crypto.getRandomValues(new Uint8Array(16));
|
let challenge = content.crypto.getRandomValues(new Uint8Array(16));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,7 @@ function verifyDirectCertificate(attestationObject) {
|
||||||
|
|
||||||
function promiseWebAuthnRegister(tab, attestation = "indirect") {
|
function promiseWebAuthnRegister(tab, attestation = "indirect") {
|
||||||
/* eslint-disable no-shadow */
|
/* eslint-disable no-shadow */
|
||||||
return SpecialPowers.spawn(
|
return ContentTask.spawn(tab.linkedBrowser, attestation, attestation => {
|
||||||
tab.linkedBrowser,
|
|
||||||
[[attestation]],
|
|
||||||
([attestation]) => {
|
|
||||||
const cose_alg_ECDSA_w_SHA256 = -7;
|
const cose_alg_ECDSA_w_SHA256 = -7;
|
||||||
|
|
||||||
let challenge = content.crypto.getRandomValues(new Uint8Array(16));
|
let challenge = content.crypto.getRandomValues(new Uint8Array(16));
|
||||||
|
|
@ -82,13 +79,12 @@ function promiseWebAuthnRegister(tab, attestation = "indirect") {
|
||||||
return content.navigator.credentials
|
return content.navigator.credentials
|
||||||
.create({ publicKey })
|
.create({ publicKey })
|
||||||
.then(cred => cred.response.attestationObject);
|
.then(cred => cred.response.attestationObject);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
/* eslint-enable no-shadow */
|
/* eslint-enable no-shadow */
|
||||||
}
|
}
|
||||||
|
|
||||||
function promiseWebAuthnSign(tab) {
|
function promiseWebAuthnSign(tab) {
|
||||||
return SpecialPowers.spawn(tab.linkedBrowser, [[]], () => {
|
return ContentTask.spawn(tab.linkedBrowser, null, () => {
|
||||||
let challenge = content.crypto.getRandomValues(new Uint8Array(16));
|
let challenge = content.crypto.getRandomValues(new Uint8Array(16));
|
||||||
let key_handle = content.crypto.getRandomValues(new Uint8Array(16));
|
let key_handle = content.crypto.getRandomValues(new Uint8Array(16));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ add_task(async function test() {
|
||||||
"http://mochi.test:8888/browser/dom/xhr/tests/browser_xhr_onchange_leak.html";
|
"http://mochi.test:8888/browser/dom/xhr/tests/browser_xhr_onchange_leak.html";
|
||||||
let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
|
let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
|
||||||
let browser = gBrowser.selectedBrowser;
|
let browser = gBrowser.selectedBrowser;
|
||||||
let done = await SpecialPowers.spawn(browser, [], async function() {
|
let done = await ContentTask.spawn(browser, null, async function() {
|
||||||
let promise = ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", true);
|
let promise = ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", true);
|
||||||
content.location = "http://mochi.test:8888/";
|
content.location = "http://mochi.test:8888/";
|
||||||
await promise;
|
await promise;
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ add_task(async function test() {
|
||||||
let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
|
let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
|
||||||
let browser = gBrowser.selectedBrowser;
|
let browser = gBrowser.selectedBrowser;
|
||||||
let innerWindowId = browser.innerWindowID;
|
let innerWindowId = browser.innerWindowID;
|
||||||
let contentDocDead = await SpecialPowers.spawn(
|
let contentDocDead = await ContentTask.spawn(
|
||||||
browser,
|
browser,
|
||||||
[{ innerWindowId }],
|
{ innerWindowId },
|
||||||
async function(args) {
|
async function(args) {
|
||||||
let doc = content.document;
|
let doc = content.document;
|
||||||
let { TestUtils } = ChromeUtils.import(
|
let { TestUtils } = ChromeUtils.import(
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ add_task(async function test() {
|
||||||
let browser = gBrowser.selectedBrowser;
|
let browser = gBrowser.selectedBrowser;
|
||||||
let innerWindowId = browser.innerWindowID;
|
let innerWindowId = browser.innerWindowID;
|
||||||
|
|
||||||
let stackTraceEmpty = await SpecialPowers.spawn(
|
let stackTraceEmpty = await ContentTask.spawn(
|
||||||
browser,
|
browser,
|
||||||
[{ innerWindowId }],
|
{ innerWindowId },
|
||||||
async function(args) {
|
async function(args) {
|
||||||
let { TestUtils } = ChromeUtils.import(
|
let { TestUtils } = ChromeUtils.import(
|
||||||
"resource://testing-common/TestUtils.jsm"
|
"resource://testing-common/TestUtils.jsm"
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||||
|
ContentTask: "resource://testing-common/ContentTask.jsm",
|
||||||
E10SUtils: "resource://gre/modules/E10SUtils.jsm",
|
E10SUtils: "resource://gre/modules/E10SUtils.jsm",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -852,18 +853,14 @@ var BrowserTestUtils = {
|
||||||
|
|
||||||
// We cannot use the regular BrowserTestUtils helper for waiting here, since that
|
// We cannot use the regular BrowserTestUtils helper for waiting here, since that
|
||||||
// would try to insert the preloaded browser, which would only break things.
|
// would try to insert the preloaded browser, which would only break things.
|
||||||
await gBrowser.preloadedBrowser.ownerGlobal.SpecialPowers.spawn(
|
await ContentTask.spawn(gBrowser.preloadedBrowser, [], async () => {
|
||||||
gBrowser.preloadedBrowser,
|
|
||||||
[],
|
|
||||||
async () => {
|
|
||||||
await ContentTaskUtils.waitForCondition(() => {
|
await ContentTaskUtils.waitForCondition(() => {
|
||||||
return (
|
return (
|
||||||
this.content.document &&
|
this.content.document &&
|
||||||
this.content.document.readyState == "complete"
|
this.content.document.readyState == "complete"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ function task(contentIds) {
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
let tab = (gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser));
|
let tab = (gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser));
|
||||||
|
|
||||||
let promise = SpecialPowers.spawn(tab.linkedBrowser, [ids], task);
|
let promise = ContentTask.spawn(tab.linkedBrowser, ids, task);
|
||||||
BrowserTestUtils.loadURI(
|
BrowserTestUtils.loadURI(
|
||||||
tab.linkedBrowser,
|
tab.linkedBrowser,
|
||||||
"data:text/html;charset=utf-8," +
|
"data:text/html;charset=utf-8," +
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ function task(contentConsts) {
|
||||||
|
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
let tab = (gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser));
|
let tab = (gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser));
|
||||||
let promise = SpecialPowers.spawn(tab.linkedBrowser, [consts], task);
|
let promise = ContentTask.spawn(tab.linkedBrowser, consts, task);
|
||||||
BrowserTestUtils.loadURI(
|
BrowserTestUtils.loadURI(
|
||||||
tab.linkedBrowser,
|
tab.linkedBrowser,
|
||||||
"data:text/html;charset=utf-8," +
|
"data:text/html;charset=utf-8," +
|
||||||
|
|
|
||||||
|
|
@ -449,9 +449,7 @@ async function assertContextMenuFill(
|
||||||
formId,
|
formId,
|
||||||
unchangedSelector,
|
unchangedSelector,
|
||||||
};
|
};
|
||||||
let continuePromise = SpecialPowers.spawn(browser, [data], async function(
|
let continuePromise = ContentTask.spawn(browser, data, async function(data) {
|
||||||
data
|
|
||||||
) {
|
|
||||||
let {
|
let {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
|
|
|
||||||
|
|
@ -301,9 +301,9 @@ add_task(async function fill_generated_password_with_matching_logins() {
|
||||||
await openPasswordContextMenu(browser, passwordInputSelector);
|
await openPasswordContextMenu(browser, passwordInputSelector);
|
||||||
|
|
||||||
// Execute the command of the first login menuitem found at the context menu.
|
// Execute the command of the first login menuitem found at the context menu.
|
||||||
let passwordChangedPromise = SpecialPowers.spawn(
|
let passwordChangedPromise = ContentTask.spawn(
|
||||||
browser,
|
browser,
|
||||||
[],
|
null,
|
||||||
async function() {
|
async function() {
|
||||||
let passwordInput = content.document.getElementById(
|
let passwordInput = content.document.getElementById(
|
||||||
"form-basic-password"
|
"form-basic-password"
|
||||||
|
|
|
||||||
|
|
@ -168,15 +168,13 @@ async function getFormSubmitResponseResult(
|
||||||
{ username = "#user", password = "#pass" } = {}
|
{ username = "#user", password = "#pass" } = {}
|
||||||
) {
|
) {
|
||||||
// default selectors are for the response page produced by formsubmit.sjs
|
// default selectors are for the response page produced by formsubmit.sjs
|
||||||
let fieldValues = await SpecialPowers.spawn(
|
let fieldValues = await ContentTask.spawn(
|
||||||
browser,
|
browser,
|
||||||
[
|
|
||||||
{
|
{
|
||||||
resultURL,
|
resultURL,
|
||||||
usernameSelector: username,
|
usernameSelector: username,
|
||||||
passwordSelector: password,
|
passwordSelector: password,
|
||||||
},
|
},
|
||||||
],
|
|
||||||
async function({ resultURL, usernameSelector, passwordSelector }) {
|
async function({ resultURL, usernameSelector, passwordSelector }) {
|
||||||
await ContentTaskUtils.waitForCondition(() => {
|
await ContentTaskUtils.waitForCondition(() => {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -92,9 +92,9 @@ function get_video_decoding_suspend_promise(browser, reload) {
|
||||||
function get_video_decoding_resume_promise(browser) {
|
function get_video_decoding_resume_promise(browser) {
|
||||||
let suspend = false;
|
let suspend = false;
|
||||||
let reload = false;
|
let reload = false;
|
||||||
return SpecialPowers.spawn(
|
return ContentTask.spawn(
|
||||||
browser,
|
browser,
|
||||||
[{ suspend, reload }],
|
{ suspend, reload },
|
||||||
check_video_decoding_state
|
check_video_decoding_state
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ find-menu appears in editor element which has had makeEditable() called but desi
|
||||||
|
|
||||||
<script type="application/javascript"><![CDATA[
|
<script type="application/javascript"><![CDATA[
|
||||||
const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
|
const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
|
||||||
;
|
const {ContentTask} = ChromeUtils.import("resource://testing-common/ContentTask.jsm");
|
||||||
ContentTask.setTestScope(window.arguments[0]);
|
ContentTask.setTestScope(window.arguments[0]);
|
||||||
|
|
||||||
var gFindBar = null;
|
var gFindBar = null;
|
||||||
|
|
@ -45,12 +45,9 @@ find-menu appears in editor element which has had makeEditable() called but desi
|
||||||
info("Starting test with browser '" + browserId + "'");
|
info("Starting test with browser '" + browserId + "'");
|
||||||
gBrowser = document.getElementById(browserId);
|
gBrowser = document.getElementById(browserId);
|
||||||
gFindBar.browser = gBrowser;
|
gFindBar.browser = gBrowser;
|
||||||
let promise = SpecialPowers.spawn(gBrowser, [], async function() {
|
let promise = ContentTask.spawn(gBrowser, [], async function() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
docShell.chromeEventHandler.addEventListener("DOMContentLoaded", function listener() {
|
addEventListener("DOMContentLoaded", () => resolve(), { once: true });
|
||||||
docShell.chromeEventHandler.removeEventListener("DOMContentLoaded", listener);
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
BrowserTestUtils.loadURI(gBrowser, "data:text/html;charset=utf-8,some%20random%20text");
|
BrowserTestUtils.loadURI(gBrowser, "data:text/html;charset=utf-8,some%20random%20text");
|
||||||
|
|
@ -59,7 +56,7 @@ find-menu appears in editor element which has had makeEditable() called but desi
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onDocumentLoaded() {
|
async function onDocumentLoaded() {
|
||||||
await SpecialPowers.spawn(gBrowser, [], async function() {
|
await ContentTask.spawn(gBrowser, [], async function() {
|
||||||
var edsession = content.docShell.editingSession;
|
var edsession = content.docShell.editingSession;
|
||||||
edsession.makeWindowEditable(content, "html", false, true, false);
|
edsession.makeWindowEditable(content, "html", false, true, false);
|
||||||
content.focus();
|
content.focus();
|
||||||
|
|
@ -74,7 +71,7 @@ find-menu appears in editor element which has had makeEditable() called but desi
|
||||||
|
|
||||||
async function enterStringIntoEditor(aString) {
|
async function enterStringIntoEditor(aString) {
|
||||||
for (let i = 0; i < aString.length; i++) {
|
for (let i = 0; i < aString.length; i++) {
|
||||||
await SpecialPowers.spawn(gBrowser, [{ charCode: aString.charCodeAt(i) }], async function(args) {
|
await ContentTask.spawn(gBrowser, [{ charCode: aString.charCodeAt(i) }], async function(args) {
|
||||||
let event = content.document.createEvent("KeyboardEvent");
|
let event = content.document.createEvent("KeyboardEvent");
|
||||||
event.initKeyEvent("keypress", true, true, null, false, false,
|
event.initKeyEvent("keypress", true, true, null, false, false,
|
||||||
false, false, 0, args.charCode);
|
false, false, 0, args.charCode);
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
title="360437 test">
|
title="360437 test">
|
||||||
|
|
||||||
<script type="application/javascript"><![CDATA[
|
<script type="application/javascript"><![CDATA[
|
||||||
;
|
|
||||||
const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
|
const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
|
||||||
|
const {ContentTask} = ChromeUtils.import("resource://testing-common/ContentTask.jsm");
|
||||||
ContentTask.setTestScope(window.arguments[0]);
|
ContentTask.setTestScope(window.arguments[0]);
|
||||||
|
|
||||||
var gFindBar = null;
|
var gFindBar = null;
|
||||||
|
|
@ -48,12 +48,9 @@
|
||||||
gFindBar.browser = gBrowser;
|
gFindBar.browser = gBrowser;
|
||||||
|
|
||||||
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser);
|
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser);
|
||||||
let contentLoadedPromise = SpecialPowers.spawn(gBrowser, [], async function() {
|
let contentLoadedPromise = ContentTask.spawn(gBrowser, null, async function() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
docShell.chromeEventHandler.addEventListener("DOMContentLoaded", function listener() {
|
addEventListener("DOMContentLoaded", () => resolve(), { once: true });
|
||||||
docShell.chromeEventHandler.removeEventListener("DOMContentLoaded", listener);
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
BrowserTestUtils.loadURI(gBrowser, "data:text/html,<form><input id='input' type='text' value='text inside an input element'></form>");
|
BrowserTestUtils.loadURI(gBrowser, "data:text/html,<form><input id='input' type='text' value='text inside an input element'></form>");
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@
|
||||||
|
|
||||||
<script type="application/javascript"><![CDATA[
|
<script type="application/javascript"><![CDATA[
|
||||||
const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
|
const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
|
||||||
;
|
const {ContentTask} = ChromeUtils.import("resource://testing-common/ContentTask.jsm");
|
||||||
ContentTask.setTestScope(window.arguments[0]);
|
|
||||||
|
|
||||||
var gFindBar = null;
|
var gFindBar = null;
|
||||||
var gBrowser;
|
var gBrowser;
|
||||||
|
|
@ -123,14 +122,11 @@
|
||||||
gBrowser = document.getElementById(browserId);
|
gBrowser = document.getElementById(browserId);
|
||||||
gFindBar.browser = gBrowser;
|
gFindBar.browser = gBrowser;
|
||||||
|
|
||||||
let promise = SpecialPowers.spawn(gBrowser, [], async function() {
|
let promise = ContentTask.spawn(gBrowser, null, () =>
|
||||||
return new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
docShell.chromeEventHandler.addEventListener("DOMContentLoaded", function listener() {
|
addEventListener("DOMContentLoaded", () => resolve(), { once: true });
|
||||||
docShell.chromeEventHandler.removeEventListener("DOMContentLoaded", listener);
|
})
|
||||||
resolve();
|
);
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
BrowserTestUtils.loadURI(gBrowser, kBaseURL + "/sample_entireword_" + testName + ".html");
|
BrowserTestUtils.loadURI(gBrowser, kBaseURL + "/sample_entireword_" + testName + ".html");
|
||||||
await promise;
|
await promise;
|
||||||
await onDocumentLoaded(testName);
|
await onDocumentLoaded(testName);
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,11 @@
|
||||||
<script>
|
<script>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
||||||
;
|
const { ContentTask } = ChromeUtils.import("resource://testing-common/ContentTask.jsm");
|
||||||
|
|
||||||
function dropOnRemoteBrowserAsync(browser, data, shouldExpectStateChange) {
|
function dropOnRemoteBrowserAsync(browser, data, shouldExpectStateChange) {
|
||||||
ContentTask.setTestScope(window); // Need this so is/isnot/ok are available inside the contenttask
|
ContentTask.setTestScope(window); // Need this so is/isnot/ok are available inside the contenttask
|
||||||
return SpecialPowers.spawn(browser, [{data, shouldExpectStateChange}], async function({data, shouldExpectStateChange}) {
|
return ContentTask.spawn(browser, {data, shouldExpectStateChange}, async function({data, shouldExpectStateChange}) {
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
||||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
if (!content.document.documentElement) {
|
if (!content.document.documentElement) {
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ function test() {
|
||||||
var triggers = encodeURIComponent(JSON.stringify(TESTROOT + "amosigned.xpi"));
|
var triggers = encodeURIComponent(JSON.stringify(TESTROOT + "amosigned.xpi"));
|
||||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TESTROOT);
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TESTROOT);
|
||||||
|
|
||||||
SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
|
ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
docShell.chromeEventHandler.addEventListener(
|
addEventListener(
|
||||||
"load",
|
"load",
|
||||||
() => {
|
() => {
|
||||||
content.addEventListener("InstallTriggered", () => {
|
content.addEventListener("InstallTriggered", () => {
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ function test() {
|
||||||
);
|
);
|
||||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TESTROOT);
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TESTROOT);
|
||||||
|
|
||||||
SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
|
ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
docShell.chromeEventHandler.addEventListener(
|
addEventListener(
|
||||||
"load",
|
"load",
|
||||||
() => {
|
() => {
|
||||||
content.addEventListener("InstallTriggered", () => {
|
content.addEventListener("InstallTriggered", () => {
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ function test() {
|
||||||
|
|
||||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TESTROOT);
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TESTROOT);
|
||||||
|
|
||||||
SpecialPowers.spawn(
|
ContentTask.spawn(
|
||||||
gBrowser.selectedBrowser,
|
gBrowser.selectedBrowser,
|
||||||
[TESTROOT + "enabled.html"],
|
TESTROOT + "enabled.html",
|
||||||
function(url) {
|
function(url) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
function page_loaded() {
|
function page_loaded() {
|
||||||
|
|
@ -16,19 +16,11 @@ function test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_listener() {
|
function load_listener() {
|
||||||
docShell.chromeEventHandler.removeEventListener(
|
removeEventListener("load", load_listener, true);
|
||||||
"load",
|
|
||||||
load_listener,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
content.addEventListener("PageLoaded", page_loaded);
|
content.addEventListener("PageLoaded", page_loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
docShell.chromeEventHandler.addEventListener(
|
addEventListener("load", load_listener, true);
|
||||||
"load",
|
|
||||||
load_listener,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
content.location.href = url;
|
content.location.href = url;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ function test() {
|
||||||
|
|
||||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TESTROOT);
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TESTROOT);
|
||||||
|
|
||||||
SpecialPowers.spawn(
|
ContentTask.spawn(
|
||||||
gBrowser.selectedBrowser,
|
gBrowser.selectedBrowser,
|
||||||
[TESTROOT + "enabled.html"],
|
TESTROOT + "enabled.html",
|
||||||
function(url) {
|
function(url) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
function page_loaded() {
|
function page_loaded() {
|
||||||
|
|
@ -18,19 +18,11 @@ function test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_listener() {
|
function load_listener() {
|
||||||
docShell.chromeEventHandler.removeEventListener(
|
removeEventListener("load", load_listener, true);
|
||||||
"load",
|
|
||||||
load_listener,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
content.addEventListener("PageLoaded", page_loaded);
|
content.addEventListener("PageLoaded", page_loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
docShell.chromeEventHandler.addEventListener(
|
addEventListener("load", load_listener, true);
|
||||||
"load",
|
|
||||||
load_listener,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
content.location.href = url;
|
content.location.href = url;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@ function test() {
|
||||||
);
|
);
|
||||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TESTROOT);
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TESTROOT);
|
||||||
|
|
||||||
SpecialPowers.spawn(
|
ContentTask.spawn(
|
||||||
gBrowser.selectedBrowser,
|
gBrowser.selectedBrowser,
|
||||||
[TESTROOT + "installtrigger.html?" + triggers],
|
TESTROOT + "installtrigger.html?" + triggers,
|
||||||
url => {
|
url => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
function page_loaded() {
|
function page_loaded() {
|
||||||
|
|
@ -26,19 +26,11 @@ function test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_listener() {
|
function load_listener() {
|
||||||
docShell.chromeEventHandler.removeEventListener(
|
removeEventListener("load", load_listener, true);
|
||||||
"load",
|
|
||||||
load_listener,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
content.addEventListener("InstallTriggered", page_loaded);
|
content.addEventListener("InstallTriggered", page_loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
docShell.chromeEventHandler.addEventListener(
|
addEventListener("load", load_listener, true);
|
||||||
"load",
|
|
||||||
load_listener,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
content.location.href = url;
|
content.location.href = url;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,13 @@ add_task(async function test() {
|
||||||
await SpecialPowers.spawn(browser, [URI], async function(URI) {
|
await SpecialPowers.spawn(browser, [URI], async function(URI) {
|
||||||
content.location.href = URI;
|
content.location.href = URI;
|
||||||
|
|
||||||
let loaded = ContentTaskUtils.waitForEvent(this, "load", true);
|
let loaded = ContentTaskUtils.waitForEvent(
|
||||||
|
docShell.chromeEventHandler,
|
||||||
|
"load",
|
||||||
|
true
|
||||||
|
);
|
||||||
let installTriggered = ContentTaskUtils.waitForEvent(
|
let installTriggered = ContentTaskUtils.waitForEvent(
|
||||||
this,
|
docShell.chromeEventHandler,
|
||||||
"InstallTriggered",
|
"InstallTriggered",
|
||||||
true,
|
true,
|
||||||
null,
|
null,
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ function finish_test(count) {
|
||||||
info("Checking if the browser is still offline...");
|
info("Checking if the browser is still offline...");
|
||||||
|
|
||||||
let tab = gBrowser.selectedTab;
|
let tab = gBrowser.selectedTab;
|
||||||
SpecialPowers.spawn(tab.linkedBrowser, [], async function() {
|
ContentTask.spawn(tab.linkedBrowser, null, async function() {
|
||||||
await ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", true);
|
await ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", true);
|
||||||
return content.document.documentURI;
|
return content.document.documentURI;
|
||||||
}).then(url => {
|
}).then(url => {
|
||||||
|
|
|
||||||
|
|
@ -72,16 +72,12 @@ add_task(async function test_profile_feature_preferencereads() {
|
||||||
|
|
||||||
startProfiler({ features: ["threads", "leaf"] });
|
startProfiler({ features: ["threads", "leaf"] });
|
||||||
// Now reload the tab with a clean run.
|
// Now reload the tab with a clean run.
|
||||||
await SpecialPowers.spawn(contentBrowser, [], () => {
|
await ContentTask.spawn(contentBrowser, null, () => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
docShell.chromeEventHandler.addEventListener(
|
addEventListener("pageshow", () => resolve(), {
|
||||||
"pageshow",
|
|
||||||
() => resolve(),
|
|
||||||
{
|
|
||||||
capturing: true,
|
capturing: true,
|
||||||
once: true,
|
once: true,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
content.location.reload();
|
content.location.reload();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue