mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 20:55:39 +00:00
Bug 1147911 Part 5: Fix tests to allow for window.open to return null. r=billm
These tests open a parent browser from the child, which means that the returned window isn't actually the real one anyway. Soon we will return null in this scenario.
This commit is contained in:
parent
7703f00919
commit
014132e276
@ -34,10 +34,17 @@ add_task(function* test_url_of_generated_background_page() {
|
||||
yield extension.startup();
|
||||
const EXPECTED_URL = yield extension.awaitMessage("script done");
|
||||
|
||||
let win = window.open(EXPECTED_URL);
|
||||
ok(win, "Should open new tab at URL: " + EXPECTED_URL);
|
||||
// We are opening a window in a different process which will return null, so
|
||||
// using a try catch to test whether the window.open worked.
|
||||
let succeeded;
|
||||
try {
|
||||
window.open(EXPECTED_URL);
|
||||
succeeded = true;
|
||||
} catch (e) {
|
||||
succeeded = false;
|
||||
}
|
||||
ok(succeeded, "Should open new tab at URL: " + EXPECTED_URL);
|
||||
yield extension.awaitMessage("script done");
|
||||
win.close();
|
||||
|
||||
yield extension.unload();
|
||||
});
|
||||
|
@ -116,7 +116,7 @@ function* testPolicy(customCSP = null) {
|
||||
baseURL = yield extension.awaitMessage("base-url");
|
||||
|
||||
|
||||
let win1 = window.open(`${baseURL}/tab.html`);
|
||||
window.open(`${baseURL}/tab.html`);
|
||||
|
||||
let frame = document.createElement("iframe");
|
||||
frame.src = `${baseURL}/content.html`;
|
||||
@ -136,8 +136,6 @@ function* testPolicy(customCSP = null) {
|
||||
let contentCSP = getCSP(frame.contentWindow);
|
||||
checkCSP(contentCSP, "content frame");
|
||||
|
||||
|
||||
win1.close();
|
||||
frame.remove();
|
||||
|
||||
yield extension.unload();
|
||||
|
Loading…
Reference in New Issue
Block a user