mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
35960eba28
From adcf642ed40bccc0b6fed3232bcc733228d7b7da Mon Sep 17 00:00:00 2001
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
function test() {
|
|
waitForExplicitFinish();
|
|
|
|
Task.spawn(function task() {
|
|
let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla");
|
|
yield promiseBrowserLoaded(gBrowser.selectedBrowser);
|
|
|
|
let win = gBrowser.replaceTabWithWindow(tab);
|
|
yield promiseDelayedStartupFinished(win);
|
|
yield promiseBrowserHasURL(win.gBrowser.browsers[0], "about:mozilla");
|
|
|
|
win.duplicateTabIn(win.gBrowser.selectedTab, "tab");
|
|
let browser = win.gBrowser.browsers[1];
|
|
yield promiseBrowserLoaded(browser);
|
|
is(browser.currentURI.spec, "about:mozilla", "tab was duplicated");
|
|
|
|
win.close();
|
|
}).then(finish);
|
|
}
|
|
|
|
function promiseDelayedStartupFinished(win) {
|
|
let deferred = Promise.defer();
|
|
whenDelayedStartupFinished(win, deferred.resolve);
|
|
return deferred.promise;
|
|
}
|
|
|
|
function promiseBrowserHasURL(browser, url) {
|
|
let promise = Promise.resolve();
|
|
|
|
if (browser.contentDocument.readyState === "complete" &&
|
|
browser.currentURI.spec === url) {
|
|
return promise;
|
|
}
|
|
|
|
return promise.then(() => promiseBrowserHasURL(browser, url));
|
|
}
|