Bug 1335170: Fix intermittent failure in browser_allow_process_switches_despite_related_browser.js. r=Gijs

This commit is contained in:
Bob Owen 2017-02-02 09:18:55 +00:00
Родитель 62b845c331
Коммит bd8309ab43
1 изменённых файлов: 7 добавлений и 6 удалений

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

@ -2,31 +2,32 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
const DUMMY_FILE = "dummy_page.html";
const DATA_URI = "data:text/html,Hi";
const DATA_URI_SOURCE = "view-source:" + DATA_URI;
// Test for bug 1328829.
add_task(function* () {
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser,
"data:text/html,Hi");
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, DATA_URI);
registerCleanupFunction(function* () {
yield BrowserTestUtils.removeTab(tab);
});
let promiseTab =
BrowserTestUtils.waitForNewTab(gBrowser, "view-source:data:text/html,Hi");
let promiseTab = BrowserTestUtils.waitForNewTab(gBrowser, DATA_URI_SOURCE);
BrowserViewSource(tab.linkedBrowser);
let viewSourceTab = yield promiseTab;
registerCleanupFunction(function* () {
yield BrowserTestUtils.removeTab(viewSourceTab);
});
let dummyPage = getChromeDir(getResolvedURI(gTestPath));
dummyPage.append(DUMMY_FILE);
const uriString = Services.io.newFileURI(dummyPage).spec;
let viewSourceBrowser = viewSourceTab.linkedBrowser;
let promiseLoad =
BrowserTestUtils.browserLoaded(viewSourceBrowser, false, uriString);
viewSourceBrowser.loadURI(uriString);
let href = yield BrowserTestUtils.browserLoaded(viewSourceBrowser);
let href = yield promiseLoad;
is(href, uriString,
"Check file:// URI loads in a browser that was previously for view-source");
});