mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 22:32:51 +00:00
Bug 1844582 - [remote] Stop using setTimeout for browser_NavigationManager_no_navigation.js r=webdriver-reviewers,Sasha
Differential Revision: https://phabricator.services.mozilla.com/D184175
This commit is contained in:
parent
0b166e6579
commit
1139066cb7
@ -27,16 +27,19 @@ add_task(async function testDocumentOpenWriteClose() {
|
||||
is(events.length, 0, "No event recorded");
|
||||
|
||||
info("Replace the document");
|
||||
SpecialPowers.spawn(browser, [], () => {
|
||||
await SpecialPowers.spawn(browser, [], async () => {
|
||||
// Note: we need to use eval here to have reduced permissions and avoid
|
||||
// security errors.
|
||||
content.eval(`
|
||||
document.open();
|
||||
document.write("<h1>Replaced</h1>");
|
||||
document.write("<h1 class='replaced'>Replaced</h1>");
|
||||
document.close();
|
||||
`);
|
||||
|
||||
await ContentTaskUtils.waitForCondition(() =>
|
||||
content.document.querySelector(".replaced")
|
||||
);
|
||||
});
|
||||
await wait(500);
|
||||
|
||||
// See Bug 1844517.
|
||||
// document.open/write/close is identical to same-url + same-hash navigations.
|
||||
@ -53,9 +56,3 @@ add_task(async function testDocumentOpenWriteClose() {
|
||||
navigationManager.off("navigation-stopped", onEvent);
|
||||
navigationManager.stopMonitoring();
|
||||
});
|
||||
|
||||
function wait(ms) {
|
||||
info(`Wait for ${ms} milliseconds`);
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
return new Promise(r => setTimeout(r, ms));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user