зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1541389 - Fix browser_httpCrossOriginOpenerPolicy.js to remove timeouts and not wait for SSTabRestored r=mattwoodrow
(Matt Woodrow (:mattwoodrow) in bug 1541389 comment #7) > Nika did some work on top of DocumentChannel to make sure we delay notifying the old docshell that it had been cancelled until we'd setup the new one. This patch removes the code that waits for the `SSTabRestored` event when a process switch is expected. It also removes the `setTimeout` in the test, and uses `browser.frameLoader.remoteTab.osPid` instead of ContentTask.spawn to get the PID of the content process. Differential Revision: https://phabricator.services.mozilla.com/D54774 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f8447efbb0
Коммит
164b071ee3
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable mozilla/no-arbitrary-setTimeout */
|
||||
"use strict";
|
||||
|
||||
const { E10SUtils } = ChromeUtils.import(
|
||||
|
@ -54,7 +53,6 @@ async function test_coop(
|
|||
async function(_browser) {
|
||||
info(`test_coop: Test tab ready: ${start}`);
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 20));
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
let firstRemoteType = browser.remoteType;
|
||||
let firstProcessID = browser.frameLoader.remoteTab.osPid;
|
||||
|
@ -73,19 +71,10 @@ async function test_coop(
|
|||
url: target,
|
||||
maybeErrorPage: false,
|
||||
},
|
||||
async () => {
|
||||
BrowserTestUtils.loadURI(browser, target);
|
||||
if (expectedProcessSwitch) {
|
||||
await BrowserTestUtils.waitForEvent(
|
||||
gBrowser.getTabForBrowser(browser),
|
||||
"SSTabRestored"
|
||||
);
|
||||
}
|
||||
}
|
||||
async () => BrowserTestUtils.loadURI(browser, target)
|
||||
);
|
||||
|
||||
info(`Navigated to: ${target}`);
|
||||
await new Promise(resolve => setTimeout(resolve, 20));
|
||||
browser = gBrowser.selectedBrowser;
|
||||
let secondRemoteType = browser.remoteType;
|
||||
let secondProcessID = browser.frameLoader.remoteTab.osPid;
|
||||
|
@ -156,23 +145,12 @@ async function test_download_from(initCoop, downloadCoop) {
|
|||
maybeErrorPage: false,
|
||||
},
|
||||
async () => {
|
||||
BrowserTestUtils.loadURI(_browser, start);
|
||||
info(`test_download: Loading download page ${start}`);
|
||||
|
||||
// Wait for process switch even the page is load from a new tab.
|
||||
if (initCoop != "") {
|
||||
await BrowserTestUtils.waitForEvent(
|
||||
gBrowser.getTabForBrowser(_browser),
|
||||
"SSTabRestored"
|
||||
);
|
||||
}
|
||||
return BrowserTestUtils.loadURI(_browser, start);
|
||||
}
|
||||
);
|
||||
|
||||
info(`test_download: Download page ready ${start}`);
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 20));
|
||||
|
||||
info(`Downloading ${downloadCoop}`);
|
||||
|
||||
let winPromise = waitForDownloadWindow();
|
||||
|
@ -199,10 +177,7 @@ add_task(async function test_multiple_nav_process_switches() {
|
|||
waitForStateStop: true,
|
||||
},
|
||||
async function(browser) {
|
||||
await new Promise(resolve => setTimeout(resolve, 20));
|
||||
let prevPID = await ContentTask.spawn(browser, null, () => {
|
||||
return Services.appinfo.processID;
|
||||
});
|
||||
let prevPID = browser.frameLoader.remoteTab.osPid;
|
||||
|
||||
let target = httpURL("coop_header.sjs?.", "https://example.org");
|
||||
await performLoad(
|
||||
|
@ -211,14 +186,10 @@ add_task(async function test_multiple_nav_process_switches() {
|
|||
url: target,
|
||||
maybeErrorPage: false,
|
||||
},
|
||||
async () => {
|
||||
BrowserTestUtils.loadURI(browser, target);
|
||||
}
|
||||
async () => BrowserTestUtils.loadURI(browser, target)
|
||||
);
|
||||
|
||||
let currentPID = await ContentTask.spawn(browser, null, () => {
|
||||
return Services.appinfo.processID;
|
||||
});
|
||||
let currentPID = browser.frameLoader.remoteTab.osPid;
|
||||
|
||||
Assert.equal(prevPID, currentPID);
|
||||
prevPID = currentPID;
|
||||
|
@ -233,19 +204,10 @@ add_task(async function test_multiple_nav_process_switches() {
|
|||
url: target,
|
||||
maybeErrorPage: false,
|
||||
},
|
||||
async () => {
|
||||
BrowserTestUtils.loadURI(browser, target);
|
||||
await BrowserTestUtils.waitForEvent(
|
||||
gBrowser.getTabForBrowser(browser),
|
||||
"SSTabRestored"
|
||||
);
|
||||
}
|
||||
async () => BrowserTestUtils.loadURI(browser, target)
|
||||
);
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 20));
|
||||
currentPID = await ContentTask.spawn(browser, null, () => {
|
||||
return Services.appinfo.processID;
|
||||
});
|
||||
currentPID = browser.frameLoader.remoteTab.osPid;
|
||||
|
||||
Assert.notEqual(prevPID, currentPID);
|
||||
prevPID = currentPID;
|
||||
|
@ -260,19 +222,10 @@ add_task(async function test_multiple_nav_process_switches() {
|
|||
url: target,
|
||||
maybeErrorPage: false,
|
||||
},
|
||||
async () => {
|
||||
BrowserTestUtils.loadURI(browser, target);
|
||||
await BrowserTestUtils.waitForEvent(
|
||||
gBrowser.getTabForBrowser(browser),
|
||||
"SSTabRestored"
|
||||
);
|
||||
}
|
||||
async () => BrowserTestUtils.loadURI(browser, target)
|
||||
);
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 20));
|
||||
currentPID = await ContentTask.spawn(browser, null, () => {
|
||||
return Services.appinfo.processID;
|
||||
});
|
||||
currentPID = browser.frameLoader.remoteTab.osPid;
|
||||
|
||||
Assert.notEqual(prevPID, currentPID);
|
||||
prevPID = currentPID;
|
||||
|
@ -287,15 +240,10 @@ add_task(async function test_multiple_nav_process_switches() {
|
|||
url: target,
|
||||
maybeErrorPage: false,
|
||||
},
|
||||
async () => {
|
||||
BrowserTestUtils.loadURI(browser, target);
|
||||
}
|
||||
async () => BrowserTestUtils.loadURI(browser, target)
|
||||
);
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 20));
|
||||
currentPID = await ContentTask.spawn(browser, null, () => {
|
||||
return Services.appinfo.processID;
|
||||
});
|
||||
currentPID = browser.frameLoader.remoteTab.osPid;
|
||||
|
||||
Assert.equal(prevPID, currentPID);
|
||||
prevPID = currentPID;
|
||||
|
|
Загрузка…
Ссылка в новой задаче