mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 22:32:51 +00:00
Merging mozilla-inbound to mozilla central a=merge
This commit is contained in:
commit
877c99c523
@ -45,8 +45,8 @@ add_task(async function testDocumentCreation() {
|
||||
});
|
||||
}
|
||||
|
||||
await BrowserTestUtils.removeTab(tab1);
|
||||
await BrowserTestUtils.removeTab(tab2);
|
||||
BrowserTestUtils.removeTab(tab1);
|
||||
BrowserTestUtils.removeTab(tab2);
|
||||
|
||||
accService = null;
|
||||
await shutdownAccessibilityService();
|
||||
|
@ -26,7 +26,7 @@ add_task(async function testAutocompleteRichResult() {
|
||||
let accessible = accService.getAccessibleFor(richlistbox);
|
||||
is(accessible.role, ROLE_COMBOBOX_LIST, "Right role");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
registerCleanupFunction(async function() {
|
||||
|
@ -35,7 +35,7 @@ async function runTest(browser, accDoc) {
|
||||
// Accessibles in background tab should have offscreen state and no
|
||||
// invisible state.
|
||||
testStates(getAcc("div"), STATE_OFFSCREEN, 0, STATE_INVISIBLE);
|
||||
await BrowserTestUtils.removeTab(newTab);
|
||||
BrowserTestUtils.removeTab(newTab);
|
||||
}
|
||||
|
||||
addAccessibleTask(`
|
||||
|
@ -81,7 +81,7 @@ add_task(async function checkReturnToAboutHome() {
|
||||
is(browser.webNavigation.canGoForward, false, "!webNavigation.canGoForward");
|
||||
is(gBrowser.currentURI.spec, "about:home", "Went back");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
});
|
||||
|
||||
@ -129,7 +129,7 @@ add_task(async function checkReturnToPreviousPage() {
|
||||
is(browser.webNavigation.canGoForward, true, "webNavigation.canGoForward");
|
||||
is(gBrowser.currentURI.spec, GOOD_PAGE, "Went back");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
});
|
||||
|
||||
@ -148,7 +148,7 @@ add_task(async function checkBadStsCert() {
|
||||
|
||||
ok(exceptionButtonHidden, "Exception button is hidden");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
});
|
||||
|
||||
@ -220,7 +220,7 @@ add_task(async function checkWrongSystemTimeWarning() {
|
||||
ok(message.actualDate.includes(serverDateFmt), "correct server date displayed");
|
||||
ok(message.learnMoreLink.includes("time-errors"), "time-errors in the Learn More URL");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
|
||||
// pretend we have a negatively skewed (behind) system time
|
||||
serverDate = new Date();
|
||||
@ -240,7 +240,7 @@ add_task(async function checkWrongSystemTimeWarning() {
|
||||
ok(message.systemDate.includes(localDateFmt), "correct local date displayed");
|
||||
ok(message.actualDate.includes(serverDateFmt), "correct server date displayed");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
|
||||
// pretend we only have a slightly skewed system time, four hours
|
||||
skew = 60 * 60 * 4;
|
||||
@ -251,7 +251,7 @@ add_task(async function checkWrongSystemTimeWarning() {
|
||||
|
||||
is(message.divDisplay, "none", "Wrong time message information is not visible");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
|
||||
// now pretend we have no skewed system time
|
||||
skew = 0;
|
||||
@ -262,7 +262,7 @@ add_task(async function checkWrongSystemTimeWarning() {
|
||||
|
||||
is(message.divDisplay, "none", "Wrong time message information is not visible");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}).skip(); // Skipping because of bug 1414804.
|
||||
|
||||
add_task(async function checkAdvancedDetails() {
|
||||
@ -319,7 +319,7 @@ add_task(async function checkAdvancedDetails() {
|
||||
let certChain = getCertChain(message.securityInfoAsString);
|
||||
ok(message.text.includes(certChain), "Found certificate chain");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
});
|
||||
|
||||
@ -384,7 +384,7 @@ add_task(async function checkAdvancedDetailsForHSTS() {
|
||||
let certChain = getCertChain(message.securityInfoAsString);
|
||||
ok(message.text.includes(certChain), "Found certificate chain");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
});
|
||||
|
||||
@ -401,7 +401,7 @@ add_task(async function checkUnknownIssuerLearnMoreLink() {
|
||||
});
|
||||
ok(href.endsWith("security-error"), "security-error in the Learn More URL");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -43,5 +43,5 @@ add_task(async function checkReturnToPreviousPage() {
|
||||
is(content.document.documentURI, LOW_TLS_VERSION_, "Should not be showing page");
|
||||
});
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
@ -20,7 +20,7 @@ add_task(async function checkDontShowStopOnNewTab() {
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser,
|
||||
opening: "about:robots",
|
||||
waitForStateStop: true});
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
||||
Assert.ok(true, "Test finished: stop-reload does not animate when navigating to local URI on new tab");
|
||||
stopReloadContainerObserver.disconnect();
|
||||
@ -36,7 +36,7 @@ add_task(async function checkDontShowStopFromLocalURI() {
|
||||
await waitForNoAnimation(stopReloadContainer);
|
||||
stopReloadContainerObserver.observe(stopReloadContainer, { attributeFilter: ["animate"]});
|
||||
await BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla");
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
||||
Assert.ok(true, "Test finished: stop-reload does not animate when navigating between local URIs");
|
||||
stopReloadContainerObserver.disconnect();
|
||||
@ -52,7 +52,7 @@ add_task(async function checkDontShowStopFromNonLocalURI() {
|
||||
await waitForNoAnimation(stopReloadContainer);
|
||||
stopReloadContainerObserver.observe(stopReloadContainer, { attributeFilter: ["animate"]});
|
||||
await BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla");
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
||||
Assert.ok(true, "Test finished: stop-reload does not animate when navigating to local URI from non-local URI");
|
||||
stopReloadContainerObserver.disconnect();
|
||||
@ -70,7 +70,7 @@ add_task(async function checkDoShowStopOnNewTab() {
|
||||
waitForStateStop: true});
|
||||
await stopPromise;
|
||||
await waitForNoAnimation(stopReloadContainer);
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
||||
info("Test finished: stop-reload shows stop when navigating to non-local URI during tab opening");
|
||||
});
|
||||
@ -88,7 +88,7 @@ add_task(async function checkAnimateStopOnTabAfterTabFinishesOpening() {
|
||||
let animatePromise = getAnimatePromise(stopReloadContainer);
|
||||
await BrowserTestUtils.loadURI(tab.linkedBrowser, "https://example.com");
|
||||
await animatePromise;
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
||||
info("Test finished: stop-reload animates when navigating to non-local URI on new tab after tab has opened");
|
||||
});
|
||||
@ -108,7 +108,7 @@ add_task(async function checkDoShowStopFromLocalURI() {
|
||||
await BrowserTestUtils.loadURI(tab.linkedBrowser, "https://example.com");
|
||||
await animatePromise;
|
||||
await waitForNoAnimation(stopReloadContainer);
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
||||
info("Test finished: stop-reload animates when navigating to non-local URI from local URI");
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ add_task(async function test_settingsOpen_observer() {
|
||||
let tab = await tabPromise;
|
||||
ok(tab, "The notification settings tab opened");
|
||||
await syncPaneLoadedPromise;
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
});
|
||||
|
||||
@ -55,6 +55,6 @@ add_task(async function test_settingsOpen_button() {
|
||||
|
||||
await syncPaneLoadedPromise;
|
||||
await closePromise;
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
});
|
||||
|
@ -56,7 +56,7 @@ let testcases = [
|
||||
testPortalTabSelectedAndButtonNotVisible();
|
||||
|
||||
// Close the tab. The button should become visible.
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
ensureNoPortalTab(win);
|
||||
testShowLoginPageButtonVisibility(notification, "visible");
|
||||
|
||||
@ -73,12 +73,12 @@ let testcases = [
|
||||
|
||||
// Close the portal tab and select the arbitrary tab. The button should become
|
||||
// visible and when it's clicked, a new portal tab should be opened.
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
win.gBrowser.selectedTab = anotherTab;
|
||||
testShowLoginPageButtonVisibility(notification, "visible");
|
||||
tab = await clickButtonAndExpectNewPortalTab();
|
||||
|
||||
await BrowserTestUtils.removeTab(anotherTab);
|
||||
BrowserTestUtils.removeTab(anotherTab);
|
||||
await freePortal(true);
|
||||
ensureNoPortalTab(win);
|
||||
ensureNoPortalNotification(win);
|
||||
|
@ -64,11 +64,11 @@ add_task(async function checkCaptivePortalCertErrorUI() {
|
||||
let portalTab2 = await portalTabPromise;
|
||||
is(portalTab2, portalTab, "The existing portal tab should be focused.");
|
||||
|
||||
let portalTabRemoved = BrowserTestUtils.tabRemoved(portalTab);
|
||||
let portalTabClosing = BrowserTestUtils.waitForTabClosing(portalTab);
|
||||
let errorTabReloaded = BrowserTestUtils.waitForErrorPage(browser);
|
||||
|
||||
Services.obs.notifyObservers(null, "captive-portal-login-success");
|
||||
await portalTabRemoved;
|
||||
await portalTabClosing;
|
||||
|
||||
info("Waiting for error tab to be reloaded after the captive portal was freed.");
|
||||
await errorTabReloaded;
|
||||
@ -78,5 +78,5 @@ add_task(async function checkCaptivePortalCertErrorUI() {
|
||||
"Captive portal error page UI is not visible.");
|
||||
});
|
||||
|
||||
await BrowserTestUtils.removeTab(errorTab);
|
||||
BrowserTestUtils.removeTab(errorTab);
|
||||
});
|
||||
|
@ -65,5 +65,5 @@ add_task(async function test_select_text_link() {
|
||||
await activateContextAndWaitFor("#" + elementID, where);
|
||||
}
|
||||
}
|
||||
await BrowserTestUtils.removeTab(testTab);
|
||||
BrowserTestUtils.removeTab(testTab);
|
||||
});
|
||||
|
@ -130,7 +130,7 @@ async function doTest(aTestPage, aFaviconURL, aTailingEnabled) {
|
||||
await promiseWaitOnFaviconLoaded;
|
||||
|
||||
// Close the tab.
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
|
||||
async function setupTailingPreference(aTailingEnabled) {
|
||||
|
@ -36,5 +36,5 @@ add_task(async function() {
|
||||
Assert.equal(gBrowser.getIcon(), ROOT + "two.png",
|
||||
"The expected icon has been set");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -40,7 +40,7 @@ add_task(async function setup() {
|
||||
const URL = ROOT + "discovery.html";
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
|
||||
registerCleanupFunction(async function() {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -47,7 +47,7 @@ add_task(async function test_richIcons() {
|
||||
return tabIconUri != null;
|
||||
}, "wait for icon load to finish", 100, 20);
|
||||
is(tabIconUri, EXPECTED_ICON, "should use the non-rich icon for the tab");
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(async function test_maskIcons() {
|
||||
@ -65,5 +65,5 @@ add_task(async function test_maskIcons() {
|
||||
return tabIconUri != null;
|
||||
}, "wait for icon load to finish", 100, 20);
|
||||
is(tabIconUri, EXPECTED_ICON, "should ignore the mask icons and load the root favicon");
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -219,7 +219,7 @@ async function doSelectTests(contentType, content) {
|
||||
is(selectPopup.lastChild.previousSibling.label, "Seven", "Spaces collapsed");
|
||||
is(selectPopup.lastChild.label, "\xA0\xA0Eight\xA0\xA0", "Non-breaking spaces not collapsed");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
|
||||
add_task(async function setup() {
|
||||
@ -281,7 +281,7 @@ add_task(async function() {
|
||||
await openSelectPopup(selectPopup, "click", "#one");
|
||||
|
||||
popupHiddenPromise = BrowserTestUtils.waitForEvent(selectPopup, "popuphidden");
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
await popupHiddenPromise;
|
||||
|
||||
ok(true, "Popup hidden when tab is closed");
|
||||
@ -348,7 +348,7 @@ add_task(async function() {
|
||||
await hideSelectPopup(selectPopup);
|
||||
}
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
// Test that we get the right events when a select popup is changed.
|
||||
@ -585,7 +585,7 @@ add_task(async function test_large_popup() {
|
||||
|
||||
await performLargePopupTests(window);
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
// This test checks the same as the previous test but in a new smaller window.
|
||||
@ -671,7 +671,7 @@ add_task(async function test_select_search() {
|
||||
|
||||
await performSelectSearchTests(window);
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
@ -711,7 +711,7 @@ add_task(async function test_mousemove_correcttarget() {
|
||||
await popupHiddenPromise;
|
||||
}
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
// This test checks when a <select> element has some options with altered display values.
|
||||
@ -741,7 +741,7 @@ add_task(async function test_somehidden() {
|
||||
}
|
||||
|
||||
await hideSelectPopup(selectPopup, "escape");
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
// This test checks that the popup is closed when the select element is blurred.
|
||||
@ -773,5 +773,5 @@ add_task(async function test_blur_hides_popup() {
|
||||
|
||||
ok(true, "Blur closed popup");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -294,7 +294,7 @@ async function testSelectColors(select, itemCount, options) {
|
||||
|
||||
if (!options.leaveOpen) {
|
||||
await hideSelectPopup(selectPopup, "escape");
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ add_task(async function test_select_with_transition_doesnt_lose_scroll_position(
|
||||
"The popup should be scrolled to the bottom of the list (where the selected item is)");
|
||||
|
||||
await hideSelectPopup(selectPopup, "escape");
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
||||
add_task(async function test_select_inherited_colors_on_options_dont_get_unique_rules_if_rule_set_on_select() {
|
||||
@ -528,5 +528,5 @@ add_task(async function test_select_inherited_colors_on_options_dont_get_unique_
|
||||
let selectPopup = menulist.menupopup;
|
||||
|
||||
await hideSelectPopup(selectPopup, "escape");
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
@ -37,6 +37,6 @@ add_task(async function test_focus_on_search_shouldnt_close_popup() {
|
||||
is(selectPopup.state, "open", "select popup should still be open after clicking on the search field");
|
||||
|
||||
await hideSelectPopup(selectPopup, "escape");
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
|
@ -49,5 +49,5 @@ add_task(async function() {
|
||||
let certOverrideService = Cc["@mozilla.org/security/certoverride;1"]
|
||||
.getService(Ci.nsICertOverrideService);
|
||||
certOverrideService.clearValidityOverride("expired.example.com", -1);
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
@ -77,5 +77,5 @@ add_task(async function() {
|
||||
}
|
||||
}
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -89,8 +89,7 @@ function pinningRemovalLoaded() {
|
||||
// Finally, we should successfully load
|
||||
// https://bad.include-subdomains.pinning-dynamic.example.com.
|
||||
function badPinningPageLoaded() {
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab).then(function() {
|
||||
ok(true, "load complete");
|
||||
finish();
|
||||
});
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
ok(true, "load complete");
|
||||
finish();
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ add_task(async function check_default_bookmark_title() {
|
||||
});
|
||||
await checkBookmark(url, title);
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(async function check_override_bookmark_title() {
|
||||
@ -85,7 +85,7 @@ add_task(async function check_override_bookmark_title() {
|
||||
// Test that a bookmark of this URI gets the correct title if we provide one
|
||||
await checkBookmarkedPageTitle(url, default_title, "An overridden title");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
// Bookmark a page and confirm that the new bookmark has the expected title.
|
||||
|
@ -30,7 +30,7 @@ add_task(async function test_content_and_chrome_selection() {
|
||||
selectedText = DOMWindowUtils.GetSelectionAsPlaintext();
|
||||
is(selectedText, "test.mozilla.org", "The macOS services got the selected chrome text");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
// Test switching active selection.
|
||||
@ -66,6 +66,6 @@ add_task(async function test_active_selection_switches_properly() {
|
||||
selectedText = DOMWindowUtils.GetSelectionAsPlaintext();
|
||||
is(selectedText, "Nothing available", "The macOS services got the selected content text");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab1);
|
||||
await BrowserTestUtils.removeTab(tab2);
|
||||
BrowserTestUtils.removeTab(tab1);
|
||||
BrowserTestUtils.removeTab(tab2);
|
||||
});
|
||||
|
@ -45,7 +45,7 @@ add_task(async function() {
|
||||
info("Hidden popup");
|
||||
|
||||
let onClose = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabClose");
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
await onClose;
|
||||
info("Tab closed");
|
||||
});
|
||||
|
@ -7,9 +7,7 @@ add_task(async function() {
|
||||
var tab = gBrowser.selectedTab;
|
||||
Services.prefs.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
|
||||
|
||||
let tabClosedPromise = BrowserTestUtils.tabRemoved(tab);
|
||||
EventUtils.synthesizeKey("w", { accelKey: true });
|
||||
await tabClosedPromise;
|
||||
|
||||
is(tab.parentNode, null, "ctrl+w removes the tab");
|
||||
is(gBrowser.tabs.length, 1, "a new tab has been opened");
|
||||
|
@ -179,11 +179,10 @@ async function waitForInstallDialog() {
|
||||
return null;
|
||||
}
|
||||
|
||||
function removeTab() {
|
||||
return Promise.all([
|
||||
waitForNotificationClose(),
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab)
|
||||
]);
|
||||
function removeTabAndWaitForNotificationClose() {
|
||||
let closePromise = waitForNotificationClose();
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
return closePromise;
|
||||
}
|
||||
|
||||
function acceptInstallDialog(installDialog) {
|
||||
@ -258,7 +257,7 @@ async function test_disabledInstall() {
|
||||
ok(false, "xpinstall.enabled should be set");
|
||||
}
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
let installs = await getInstalls();
|
||||
is(installs.length, 0, "Shouldn't be any pending installs");
|
||||
},
|
||||
@ -301,7 +300,7 @@ async function test_blockedInstall() {
|
||||
let installs = await getInstalls();
|
||||
is(installs.length, 1, "Should be one pending install");
|
||||
installs[0].cancel();
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_whitelistedInstall() {
|
||||
@ -340,7 +339,7 @@ async function test_whitelistedInstall() {
|
||||
installs[0].cancel();
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com/"), "install");
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_failedDownload() {
|
||||
@ -362,7 +361,7 @@ async function test_failedDownload() {
|
||||
"Should have seen the right message");
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com/"), "install");
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_corruptFile() {
|
||||
@ -385,7 +384,7 @@ async function test_corruptFile() {
|
||||
"Should have seen the right message");
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com/"), "install");
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_incompatible() {
|
||||
@ -408,7 +407,7 @@ async function test_incompatible() {
|
||||
"Should have seen the right message");
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com/"), "install");
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_restartless() {
|
||||
@ -440,10 +439,7 @@ async function test_restartless() {
|
||||
addon.uninstall();
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com/"), "install");
|
||||
|
||||
let closePromise = waitForNotificationClose();
|
||||
gBrowser.removeTab(gBrowser.selectedTab);
|
||||
await closePromise;
|
||||
await removeTabAndWaitForNotificationClose(gBrowser.selectedTab);
|
||||
},
|
||||
|
||||
async function test_sequential() {
|
||||
@ -517,7 +513,8 @@ async function test_sequential() {
|
||||
let closePromise = waitForNotificationClose();
|
||||
cancelInstallDialog(installDialog);
|
||||
await closePromise;
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
},
|
||||
|
||||
async function test_allUnverified() {
|
||||
@ -561,7 +558,7 @@ async function test_allUnverified() {
|
||||
addon.uninstall();
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com/"), "install");
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_url() {
|
||||
@ -587,7 +584,7 @@ async function test_url() {
|
||||
is(installs.length, 1, "Should be one pending install");
|
||||
installs[0].cancel();
|
||||
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_localFile() {
|
||||
@ -620,7 +617,7 @@ async function test_localFile() {
|
||||
"This add-on could not be installed because it appears to be corrupt.",
|
||||
"Should have seen the right message");
|
||||
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_tabClose() {
|
||||
@ -640,9 +637,7 @@ async function test_tabClose() {
|
||||
let installs = await getInstalls();
|
||||
is(installs.length, 1, "Should be one pending install");
|
||||
|
||||
let closePromise = waitForNotificationClose();
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
await closePromise;
|
||||
await removeTabAndWaitForNotificationClose(gBrowser.selectedTab);
|
||||
|
||||
installs = await getInstalls();
|
||||
is(installs.length, 0, "Should be no pending install since the tab is closed");
|
||||
@ -683,7 +678,8 @@ async function test_tabNavigate() {
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com/"), "install");
|
||||
await loadPromise;
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_urlBar() {
|
||||
@ -713,7 +709,7 @@ async function test_urlBar() {
|
||||
is(installs.length, 1, "Should be one pending install");
|
||||
installs[0].cancel();
|
||||
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_wrongHost() {
|
||||
@ -736,7 +732,7 @@ async function test_wrongHost() {
|
||||
"because it appears to be corrupt.",
|
||||
"Should have seen the right message");
|
||||
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_reload() {
|
||||
@ -777,7 +773,7 @@ async function test_reload() {
|
||||
installs[0].cancel();
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com/"), "install");
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_theme() {
|
||||
@ -821,7 +817,7 @@ async function test_theme() {
|
||||
addon.uninstall();
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com/"), "install");
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_renotifyBlocked() {
|
||||
@ -848,9 +844,7 @@ async function test_renotifyBlocked() {
|
||||
let installs = await getInstalls();
|
||||
is(installs.length, 2, "Should be two pending installs");
|
||||
|
||||
closePromise = waitForNotificationClose();
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
await closePromise;
|
||||
await removeTabAndWaitForNotificationClose(gBrowser.selectedTab);
|
||||
|
||||
installs = await getInstalls();
|
||||
is(installs.length, 0, "Should have cancelled the installs");
|
||||
@ -900,7 +894,7 @@ async function test_renotifyInstalled() {
|
||||
installs[0].cancel();
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com/"), "install");
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
},
|
||||
|
||||
async function test_cancel() {
|
||||
@ -947,7 +941,7 @@ async function test_cancel() {
|
||||
is(installs.length, 0, "Should be no pending install");
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com/"), "install");
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
},
|
||||
|
||||
async function test_failedSecurity() {
|
||||
@ -989,7 +983,7 @@ async function test_failedSecurity() {
|
||||
is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
|
||||
|
||||
Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, true);
|
||||
await removeTab();
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -65,7 +65,8 @@ async function testLink(aLinkIndexOrFunction, pinTab, expectNewTab, testSubFrame
|
||||
if (expectNewTab) {
|
||||
promise = BrowserTestUtils.waitForNewTab(gBrowser).then(tab => {
|
||||
let loaded = tab.linkedBrowser.documentURI.spec;
|
||||
return BrowserTestUtils.removeTab(tab).then(() => loaded);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
return loaded;
|
||||
});
|
||||
} else {
|
||||
promise = BrowserTestUtils.browserLoaded(browser, testSubFrame);
|
||||
@ -92,5 +93,5 @@ async function testLink(aLinkIndexOrFunction, pinTab, expectNewTab, testSubFrame
|
||||
info(`Waiting on load of ${href}`);
|
||||
let loaded = await promise;
|
||||
is(loaded, href, "loaded the right document");
|
||||
await BrowserTestUtils.removeTab(appTab);
|
||||
BrowserTestUtils.removeTab(appTab);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ add_task(async function test_remove_bookmark_with_tag_via_edit_bookmark() {
|
||||
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
await PlacesUtils.history.clear();
|
||||
});
|
||||
|
||||
|
@ -15,7 +15,7 @@ add_task(async function test() {
|
||||
|
||||
tab.addEventListener("TabClose", onTabClose);
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
||||
ok(gotTabClose, "should have got the TabClose event");
|
||||
ok(!gotTabAttrModified, "shouldn't have got the TabAttrModified event after TabClose");
|
||||
|
@ -7,12 +7,12 @@ add_task(async function test() {
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
await duplicate(0, "maintained the original index");
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
|
||||
await duplicate(-1, "went back");
|
||||
await duplicate(1, "went forward");
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -52,7 +52,7 @@ async function testLocation(link, url) {
|
||||
});
|
||||
|
||||
let tab = await tabPromise;
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
|
||||
async function runTest(url) {
|
||||
@ -70,7 +70,7 @@ async function runTest(url) {
|
||||
await testLink("link6", "test.blob");
|
||||
await testLocation("link7", "http://example.com/");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
|
@ -34,7 +34,9 @@ function preparePendingTab(aCallback) {
|
||||
let tab = BrowserTestUtils.addTab(gBrowser, URL);
|
||||
|
||||
whenLoaded(tab.linkedBrowser, function() {
|
||||
BrowserTestUtils.removeTab(tab).then(() => {
|
||||
let sessionUpdatePromise = BrowserTestUtils.waitForSessionStoreUpdate(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
sessionUpdatePromise.then(() => {
|
||||
let [{state}] = JSON.parse(SessionStore.getClosedTabData(window));
|
||||
|
||||
tab = BrowserTestUtils.addTab(gBrowser, "about:blank");
|
||||
|
@ -55,5 +55,5 @@ add_task(async function() {
|
||||
|
||||
document.documentElement.removeChild(textbox);
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -39,7 +39,7 @@ async function clean_up() {
|
||||
await PlacesUtils.history.clear();
|
||||
|
||||
Services.prefs.clearUserPref("browser.altClickSave");
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
|
||||
add_task(async function test_alt_click() {
|
||||
|
@ -20,7 +20,7 @@ add_task(async function() {
|
||||
contextMenu.hidePopup();
|
||||
await popupHiddenPromise;
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
function checkItems(menuitem, arr) {
|
||||
|
@ -254,5 +254,5 @@ add_task(async function test_text_input_readonly() {
|
||||
});
|
||||
|
||||
add_task(async function test_cleanup() {
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
@ -61,7 +61,9 @@ add_task(async function() {
|
||||
checkTabs(4);
|
||||
selectTabs([0, 1, 2, 3]);
|
||||
|
||||
await BrowserTestUtils.removeTab(tabToClose);
|
||||
let promise = BrowserTestUtils.waitForSessionStoreUpdate(tabToClose);
|
||||
BrowserTestUtils.removeTab(tabToClose);
|
||||
await promise;
|
||||
checkTabs(3);
|
||||
undoCloseTab();
|
||||
checkTabs(4);
|
||||
|
@ -71,7 +71,7 @@ async function test_decoder_doctor_notification(data, notificationMessage,
|
||||
button.click();
|
||||
let openedTab = await awaitNewTab;
|
||||
tabChecker(openedTab);
|
||||
await BrowserTestUtils.removeTab(openedTab);
|
||||
BrowserTestUtils.removeTab(openedTab);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ add_task(async function() {
|
||||
await expectFocusOnF6(false, "html2", "html2",
|
||||
true, "basic focus content page with second tab");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
||||
// Shift+F6 should navigate backwards. There's only one document here so the effect
|
||||
@ -217,7 +217,7 @@ add_task(async function() {
|
||||
await expectFocusOnF6(false, "main-window", gURLBar.inputField,
|
||||
false, "back focus with contenteditable body urlbar");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
||||
// Navigation with a frameset loaded
|
||||
@ -248,7 +248,7 @@ add_task(async function() {
|
||||
await expectFocusOnF6(true, "main-window", gURLBar.inputField,
|
||||
false, "back focus on frameset frame urlbar");
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
||||
// XXXndeakin add tests for browsers inside of panels
|
||||
|
@ -237,5 +237,5 @@ add_task(async function() {
|
||||
}
|
||||
}
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -74,7 +74,7 @@ add_task(async function test_principal_ctrl_click() {
|
||||
is(loadingPrincipal, null,
|
||||
"sanity check - load of TYPE_DOCUMENT must have a null loadingPrincipal");
|
||||
});
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
});
|
||||
|
||||
@ -119,6 +119,6 @@ add_task(async function test_principal_right_click_open_link_in_new_tab() {
|
||||
is(loadingPrincipal, null,
|
||||
"sanity check - load of TYPE_DOCUMENT must have a null loadingPrincipal");
|
||||
});
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
});
|
||||
|
@ -14,9 +14,7 @@ add_task(async function() {
|
||||
|
||||
// We have to animate the tab removal in order to get an async
|
||||
// tab close.
|
||||
let tabClosed = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabClose");
|
||||
let tabRemoved = BrowserTestUtils.removeTab(testTab, { animate: true });
|
||||
await tabClosed;
|
||||
BrowserTestUtils.removeTab(testTab, { animate: true });
|
||||
|
||||
numVisBeforeHide = gBrowser.visibleTabs.length;
|
||||
gBrowser.hideTab(testTab);
|
||||
@ -24,6 +22,4 @@ add_task(async function() {
|
||||
|
||||
is(numVisBeforeHide, 1, "animated remove has in 1 tab left");
|
||||
is(numVisAfterHide, 1, "hiding a removing tab also has 1 tab");
|
||||
|
||||
await tabRemoved;
|
||||
});
|
||||
|
@ -31,5 +31,5 @@ add_task(async function checkBackFromInvalidURI() {
|
||||
await promiseOtherPageLoaded;
|
||||
ok(gBrowser.webNavigation.canGoForward, "Should be able to go forward from previous page.");
|
||||
}
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -12,7 +12,7 @@ add_task(async function test_keyword_bookmarklet() {
|
||||
});
|
||||
|
||||
registerCleanupFunction(async function() {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
await PlacesUtils.bookmarks.remove(bm);
|
||||
});
|
||||
|
||||
|
@ -25,6 +25,6 @@ add_task(async function() {
|
||||
await BrowserTestUtils.switchTab(gBrowser, newTab);
|
||||
info(gURLBar.value);
|
||||
isnot(gURLBar.value, "", "URL bar should not be empty.");
|
||||
await BrowserTestUtils.removeTab(newTab);
|
||||
BrowserTestUtils.removeTab(newTab);
|
||||
});
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
registerCleanupFunction(async function cleanup() {
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
await BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
|
||||
BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
|
||||
}
|
||||
Services.search.currentEngine = originalEngine;
|
||||
let engine = Services.search.getEngineByName("MozSearch");
|
||||
@ -153,7 +153,7 @@ async function drop(dragData, expectedTabOpenCount = 0) {
|
||||
await promiseTabsOpen;
|
||||
info("Got TabOpen event");
|
||||
for (let tab of openedTabs) {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ add_task(async function() {
|
||||
const uriString = Services.io.newFileURI(dir).spec;
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, uriString);
|
||||
registerCleanupFunction(async function() {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
let browser = tab.linkedBrowser;
|
||||
|
||||
|
@ -93,5 +93,5 @@ add_task(async function() {
|
||||
ok(items.length, "At least one item in the menu");
|
||||
is(items.length, validLinks, "all valid links found");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -63,5 +63,5 @@ add_task(async function() {
|
||||
selected = menupopup.querySelector("menuitem[checked='true']");
|
||||
is(selected.getAttribute("label"), "1", "Should now have stylesheet 1 selected");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -17,7 +17,8 @@ function test() {
|
||||
}
|
||||
|
||||
function tidyUp() {
|
||||
BrowserTestUtils.removeTab(ourTab).then(finish);
|
||||
BrowserTestUtils.removeTab(ourTab);
|
||||
finish();
|
||||
}
|
||||
|
||||
function testClosePrintPreviewWithAccessKey() {
|
||||
|
@ -41,7 +41,7 @@ add_task(async function test_remoteWebNavigation_postdata() {
|
||||
openUILinkIn(path, "tab", null, makeInputStream(postdata));
|
||||
|
||||
});
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
|
||||
await new Promise(resolve => {
|
||||
server.stop(function() { resolve(); });
|
||||
|
@ -67,8 +67,8 @@ add_task(async function() {
|
||||
let prefDoc = gBrowser.selectedBrowser.contentDocument;
|
||||
let siteDataGroup = prefDoc.getElementById("siteDataGroup");
|
||||
is_element_visible(siteDataGroup, "Should open to the siteDataGroup section in about:preferences");
|
||||
await BrowserTestUtils.removeTab(aboutPrefTab);
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(aboutPrefTab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
// Test not displaying the 2nd notification if one is already being displayed
|
||||
|
@ -1,6 +1,6 @@
|
||||
registerCleanupFunction(async function cleanup() {
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
await BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
|
||||
BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
|
||||
}
|
||||
Services.search.currentEngine = originalEngine;
|
||||
let engine = Services.search.getEngineByName("MozSearch");
|
||||
@ -130,7 +130,7 @@ async function drop(dragData, expectedTabOpenCount = 0) {
|
||||
info("Got TabOpen event");
|
||||
tabsOpened = true;
|
||||
for (let tab of openedTabs) {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
}
|
||||
is(tabsOpened, !!expectedTabOpenCount, `Tabs for ${dragDataString} should only open if any of dropped items are valid`);
|
||||
|
@ -7,7 +7,7 @@ add_task(async function closing_tab_with_dependents_should_close_window() {
|
||||
info("Opening tab with data URI");
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(win.gBrowser, `data:text/html,<html%20onclick="W=window.open()"><body%20onbeforeunload="W.close()">`);
|
||||
info("Closing original tab in this window.");
|
||||
await BrowserTestUtils.removeTab(win.gBrowser.tabs[0]);
|
||||
BrowserTestUtils.removeTab(win.gBrowser.tabs[0]);
|
||||
info("Clicking into the window");
|
||||
let depTabOpened = BrowserTestUtils.waitForEvent(win.gBrowser.tabContainer, "TabOpen");
|
||||
await BrowserTestUtils.synthesizeMouse("html", 0, 0, {}, tab.linkedBrowser);
|
||||
@ -15,11 +15,8 @@ add_task(async function closing_tab_with_dependents_should_close_window() {
|
||||
let openedTab = (await depTabOpened).target;
|
||||
info("Got opened tab");
|
||||
|
||||
let otherTabClosePromise = BrowserTestUtils.tabRemoved(openedTab);
|
||||
let windowClosedPromise = BrowserTestUtils.windowClosed(win);
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
info("Wait for other tab to close, this shouldn't time out");
|
||||
await otherTabClosePromise;
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
is(Cu.isDeadWrapper(openedTab) || openedTab.linkedBrowser == null, true, "Opened tab should also have closed");
|
||||
info("If we timeout now, the window failed to close - that shouldn't happen!");
|
||||
await windowClosedPromise;
|
||||
|
@ -32,17 +32,14 @@ add_task(async function() {
|
||||
await secondTabLoadedPromise;
|
||||
|
||||
let closeBtn = document.getAnonymousElementByAttribute(secondTab, "anonid", "close-button");
|
||||
let closePromise = BrowserTestUtils.tabRemoved(secondTab);
|
||||
info("closing second tab (which will self-close in beforeunload)");
|
||||
closeBtn.click();
|
||||
ok(secondTab.closing, "Second tab should be marked as closing synchronously.");
|
||||
await closePromise;
|
||||
ok(secondTab.closing, "Second tab should still be marked as closing");
|
||||
ok(!secondTab.linkedBrowser, "Second tab's browser should be dead");
|
||||
ok(!firstTab.closing, "First tab should not be closing");
|
||||
ok(firstTab.linkedBrowser, "First tab's browser should be alive");
|
||||
info("closing first tab");
|
||||
await BrowserTestUtils.removeTab(firstTab);
|
||||
BrowserTestUtils.removeTab(firstTab);
|
||||
|
||||
ok(firstTab.closing, "First tab should be marked as closing");
|
||||
ok(!firstTab.linkedBrowser, "First tab's browser should be dead");
|
||||
|
@ -35,7 +35,7 @@ add_task(async function() {
|
||||
ok(true, "Loaded page " + url);
|
||||
// Wait one turn of the event loop before closing, so everything settles.
|
||||
await new Promise(resolve => setTimeout(resolve, 0));
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
ok(true, "Closed page " + url + " without timeout");
|
||||
}
|
||||
});
|
||||
|
@ -97,8 +97,8 @@ add_task(async function reallyRunTests() {
|
||||
|
||||
await testFinished.promise;
|
||||
|
||||
await BrowserTestUtils.removeTab(tab1);
|
||||
await BrowserTestUtils.removeTab(tab2);
|
||||
BrowserTestUtils.removeTab(tab1);
|
||||
BrowserTestUtils.removeTab(tab2);
|
||||
otherWindow = null;
|
||||
});
|
||||
|
||||
|
@ -19,7 +19,7 @@ add_task(async function test_bad_meta_tags() {
|
||||
is(pageInfo.description, "description", "did not collect a og:description because meta tag was malformed");
|
||||
is(pageInfo.previewImageURL.href, "http://test.com/twitter-image.jpg", "did not collect og:image because of invalid loading principal");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
await PlacesUtils.history.clear();
|
||||
});
|
||||
|
||||
|
@ -18,7 +18,7 @@ add_task(async function test_metadata() {
|
||||
is(pageInfo.description, "og:description", "got the correct description");
|
||||
is(pageInfo.previewImageURL.href, "https://test.com/og-image-secure-url.jpg", "got the correct preview image");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
await PlacesUtils.history.clear();
|
||||
});
|
||||
|
||||
@ -39,7 +39,7 @@ add_task(async function multiple_tabs() {
|
||||
is(pageInfo.description, "og:description", "got the correct description");
|
||||
is(pageInfo.previewImageURL.href, "https://test.com/og-image-secure-url.jpg", "got the correct preview image");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
await PlacesUtils.history.clear();
|
||||
});
|
||||
|
@ -90,5 +90,5 @@ add_task(async function() {
|
||||
}
|
||||
}
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -39,6 +39,6 @@ add_task(async function() {
|
||||
}, EXPECTED_REFLOWS);
|
||||
|
||||
let switchDone = BrowserTestUtils.waitForEvent(window, "TabSwitchDone");
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
await switchDone;
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ add_task(async function() {
|
||||
|
||||
await withReflowObserver(async function(dirtyFrame) {
|
||||
let switchDone = BrowserTestUtils.waitForEvent(window, "TabSwitchDone");
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab, { animate: true });
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab, { animate: true });
|
||||
await switchDone;
|
||||
}, [], window);
|
||||
|
||||
@ -92,7 +92,7 @@ add_task(async function() {
|
||||
|
||||
// Okay, now close the last tab. The tabstrip should stay overflowed, but removing
|
||||
// one more after that should underflow it.
|
||||
await BrowserTestUtils.removeTab(lastTab);
|
||||
BrowserTestUtils.removeTab(lastTab);
|
||||
|
||||
Assert.ok(gBrowser.tabContainer.hasAttribute("overflow"),
|
||||
"Tabs should still be overflowed.");
|
||||
@ -110,7 +110,7 @@ add_task(async function() {
|
||||
// the overflowed state.
|
||||
await withReflowObserver(async function() {
|
||||
let switchDone = BrowserTestUtils.waitForEvent(window, "TabSwitchDone");
|
||||
await BrowserTestUtils.removeTab(lastTab, { animate: true });
|
||||
BrowserTestUtils.removeTab(lastTab, { animate: true });
|
||||
await switchDone;
|
||||
await BrowserTestUtils.waitForCondition(() => !lastTab.isConnected);
|
||||
}, EXPECTED_UNDERFLOW_REFLOWS, window);
|
||||
|
@ -43,5 +43,5 @@ add_task(async function() {
|
||||
await switchDone;
|
||||
}, EXPECTED_REFLOWS);
|
||||
|
||||
await BrowserTestUtils.removeTab(otherTab);
|
||||
BrowserTestUtils.removeTab(otherTab);
|
||||
});
|
||||
|
@ -36,7 +36,7 @@ add_task(async function test_reserved_shortcuts() {
|
||||
|
||||
document.documentElement.removeChild(container);
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
// This test checks that Alt+<key> and F10 cannot be blocked when the preference is set.
|
||||
@ -83,6 +83,6 @@ if (!navigator.platform.includes("Mac")) {
|
||||
filePopup.hidePopup();
|
||||
await popupHidden;
|
||||
|
||||
await BrowserTestUtils.removeTab(tab1);
|
||||
BrowserTestUtils.removeTab(tab1);
|
||||
});
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ add_task(async function testTempPermissionMultipleTabs() {
|
||||
Assert.equal(geoIcon.boxObject.width, 0, "geo anchor should not be visible");
|
||||
|
||||
SitePermissions.remove(uri, id, tab2.linkedBrowser);
|
||||
await BrowserTestUtils.removeTab(tab1);
|
||||
await BrowserTestUtils.removeTab(tab2);
|
||||
BrowserTestUtils.removeTab(tab1);
|
||||
BrowserTestUtils.removeTab(tab2);
|
||||
});
|
||||
|
||||
|
@ -79,6 +79,6 @@ add_task(async function() {
|
||||
}
|
||||
});
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
});
|
||||
|
@ -50,6 +50,6 @@ add_task(async function test_background_notifications_dont_reshow_in_foreground(
|
||||
PopupNotifications.remove(notification);
|
||||
await panelHidden;
|
||||
|
||||
await BrowserTestUtils.removeTab(tabB);
|
||||
await BrowserTestUtils.removeTab(tabC);
|
||||
BrowserTestUtils.removeTab(tabB);
|
||||
BrowserTestUtils.removeTab(tabC);
|
||||
});
|
||||
|
@ -72,6 +72,6 @@ add_task(async function test_opening_blocked_popups() {
|
||||
ok(!gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked"),
|
||||
"Should no longer have notification");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
|
@ -205,6 +205,6 @@ add_task(async function test_ignoring_window_opener() {
|
||||
await hideEvent;
|
||||
}
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
});
|
||||
|
@ -49,6 +49,6 @@ add_task(async function() {
|
||||
.getService(Ci.nsICertOverrideService);
|
||||
certOverrideService.clearValidityOverride("self-signed.example.com", -1);
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
||||
|
@ -102,5 +102,5 @@ add_task(async function test3() {
|
||||
// ------------------------------------------------------
|
||||
|
||||
add_task(async function cleanup() {
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
@ -1,14 +1,13 @@
|
||||
[DEFAULT]
|
||||
# These tests can be prone to intermittent failures on slower systems.
|
||||
# Since the specific flavor doesn't matter from a correctness standpoint,
|
||||
# just skip the tests on ASAN and debug builds. Also known to be flaky on
|
||||
# Linux32 (bug 1172468, bug 1349307), so skip them there as well.
|
||||
skip-if = asan || debug || (os == 'linux' && bits == 32)
|
||||
# just skip the tests on ASAN and debug builds.
|
||||
skip-if = asan || debug
|
||||
support-files =
|
||||
head.js
|
||||
|
||||
[browser_all_files_referenced.js]
|
||||
skip-if = (os == 'win' && bits == 32)
|
||||
skip-if = verify && bits == 32 # Causes OOMs when run repeatedly
|
||||
[browser_misused_characters_in_strings.js]
|
||||
support-files =
|
||||
bug1262648_string_with_newlines.dtd
|
||||
|
@ -530,11 +530,11 @@ add_task(async function checkAllTheFiles() {
|
||||
// Parse and remove all manifests from the list.
|
||||
// NOTE that this must be done before filtering out devtools paths
|
||||
// so that all chrome paths can be recorded.
|
||||
let manifestPromises = [];
|
||||
let manifestURIs = [];
|
||||
uris = uris.filter(uri => {
|
||||
let path = uri.pathQueryRef;
|
||||
if (path.endsWith(".manifest")) {
|
||||
manifestPromises.push(parseManifest(uri));
|
||||
manifestURIs.push(uri);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -542,7 +542,7 @@ add_task(async function checkAllTheFiles() {
|
||||
});
|
||||
|
||||
// Wait for all manifest to be parsed
|
||||
await Promise.all(manifestPromises);
|
||||
await throttledMapPromises(manifestURIs, parseManifest);
|
||||
|
||||
// We build a list of promises that get resolved when their respective
|
||||
// files have loaded and produced no errors.
|
||||
@ -551,13 +551,13 @@ add_task(async function checkAllTheFiles() {
|
||||
for (let uri of uris) {
|
||||
let path = uri.pathQueryRef;
|
||||
if (path.endsWith(".css"))
|
||||
allPromises.push(parseCSSFile(uri));
|
||||
allPromises.push([parseCSSFile, uri]);
|
||||
else if (kCodeExtensions.some(ext => path.endsWith(ext)))
|
||||
allPromises.push(parseCodeFile(uri));
|
||||
allPromises.push([parseCodeFile, uri]);
|
||||
}
|
||||
|
||||
// Wait for all the files to have actually loaded:
|
||||
await Promise.all(allPromises);
|
||||
await throttledMapPromises(allPromises, ([task, uri]) => task(uri));
|
||||
|
||||
// Keep only chrome:// files, and filter out either the devtools paths or
|
||||
// the non-devtools paths:
|
||||
|
@ -362,16 +362,16 @@ add_task(async function checkAllTheCSS() {
|
||||
// Parse and remove all manifests from the list.
|
||||
// NOTE that this must be done before filtering out devtools paths
|
||||
// so that all chrome paths can be recorded.
|
||||
let manifestPromises = [];
|
||||
let manifestURIs = [];
|
||||
uris = uris.filter(uri => {
|
||||
if (uri.pathQueryRef.endsWith(".manifest")) {
|
||||
manifestPromises.push(parseManifest(uri));
|
||||
manifestURIs.push(uri);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
// Wait for all manifest to be parsed
|
||||
await Promise.all(manifestPromises);
|
||||
await throttledMapPromises(manifestURIs, parseManifest);
|
||||
|
||||
// filter out either the devtools paths or the non-devtools paths:
|
||||
let isDevtools = SimpleTest.harnessParameters.subsuite == "devtools";
|
||||
@ -415,8 +415,7 @@ add_task(async function checkAllTheCSS() {
|
||||
}
|
||||
|
||||
// Wait for all the files to have actually loaded:
|
||||
allPromises = allPromises.map(loadCSS);
|
||||
await Promise.all(allPromises);
|
||||
await throttledMapPromises(allPromises, loadCSS);
|
||||
|
||||
// Check if all the files referenced from CSS actually exist.
|
||||
for (let [image, references] of imageURIsToReferencesMap) {
|
||||
|
@ -113,15 +113,12 @@ add_task(async function checkAllTheJS() {
|
||||
|
||||
// We create an array of promises so we can parallelize all our parsing
|
||||
// and file loading activity:
|
||||
let allPromises = [];
|
||||
for (let uri of uris) {
|
||||
await throttledMapPromises(uris, uri => {
|
||||
if (uriIsWhiteListed(uri)) {
|
||||
info("Not checking whitelisted " + uri.spec);
|
||||
continue;
|
||||
return undefined;
|
||||
}
|
||||
allPromises.push(parsePromise(uri.spec));
|
||||
}
|
||||
|
||||
let promiseResults = await Promise.all(allPromises);
|
||||
is(promiseResults.filter((x) => !x).length, 0, "There should be 0 parsing errors");
|
||||
return parsePromise(uri.spec);
|
||||
});
|
||||
ok(true, "All files parsed");
|
||||
});
|
||||
|
@ -146,3 +146,20 @@ function fetchFile(uri) {
|
||||
xhr.send(null);
|
||||
});
|
||||
}
|
||||
|
||||
async function throttledMapPromises(iterable, task, limit = 64) {
|
||||
let promises = new Set();
|
||||
for (let data of iterable) {
|
||||
while (promises.size >= limit) {
|
||||
await Promise.race(promises);
|
||||
}
|
||||
|
||||
let promise = task(data);
|
||||
if (promise) {
|
||||
promise.finally(() => promises.delete(promise));
|
||||
promises.add(promise);
|
||||
}
|
||||
}
|
||||
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
@ -68,5 +68,5 @@ add_task(async function() {
|
||||
let prompts = tab.linkedBrowser.parentNode.querySelectorAll("tabmodalprompt");
|
||||
is(prompts.length, 0, "Prompts should all be dismissed.");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -81,5 +81,5 @@ add_task(async function() {
|
||||
// RemotePrompt.openTabPrompt() while 'DOMModalDialogClosed' event is fired.
|
||||
await TestUtils.waitForTick();
|
||||
|
||||
await BrowserTestUtils.removeTab(openedTab);
|
||||
BrowserTestUtils.removeTab(openedTab);
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ add_task(async function test_without_dump() {
|
||||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
await BrowserTestUtils.crashBrowser(browser);
|
||||
|
||||
let tabRemovedPromise = BrowserTestUtils.tabRemoved(tab);
|
||||
let tabClosingPromise = BrowserTestUtils.waitForTabClosing(tab);
|
||||
|
||||
await ContentTask.spawn(browser, null, async function() {
|
||||
let doc = content.document;
|
||||
@ -31,6 +31,6 @@ add_task(async function test_without_dump() {
|
||||
doc.getElementById("closeTab").click();
|
||||
});
|
||||
|
||||
await tabRemovedPromise;
|
||||
await tabClosingPromise;
|
||||
});
|
||||
});
|
||||
|
@ -299,7 +299,7 @@ add_task(async function test_probes() {
|
||||
// middle of loading some resources.
|
||||
newTab.setAttribute("busy", true);
|
||||
|
||||
await BrowserTestUtils.removeTab(newTab);
|
||||
BrowserTestUtils.removeTab(newTab);
|
||||
let snapshot = histogram.snapshot();
|
||||
assertOnlyOneTypeSet(snapshot, "tabClosed");
|
||||
});
|
||||
|
@ -9,14 +9,14 @@ const DATA_URI_SOURCE = "view-source:" + DATA_URI;
|
||||
add_task(async function() {
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, DATA_URI);
|
||||
registerCleanupFunction(async function() {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
let promiseTab = BrowserTestUtils.waitForNewTab(gBrowser, DATA_URI_SOURCE);
|
||||
BrowserViewSource(tab.linkedBrowser);
|
||||
let viewSourceTab = await promiseTab;
|
||||
registerCleanupFunction(async function() {
|
||||
await BrowserTestUtils.removeTab(viewSourceTab);
|
||||
BrowserTestUtils.removeTab(viewSourceTab);
|
||||
});
|
||||
|
||||
let dummyPage = getChromeDir(getResolvedURI(gTestPath));
|
||||
|
@ -7,9 +7,7 @@ function isUndoCloseEnabled() {
|
||||
return !document.getElementById("context_undoCloseTab").disabled;
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
add_task(async function test() {
|
||||
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", 0);
|
||||
Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo");
|
||||
is(numClosedTabs(), 0, "There should be 0 closed tabs.");
|
||||
@ -17,10 +15,11 @@ function test() {
|
||||
|
||||
var tab = BrowserTestUtils.addTab(gBrowser, "http://mochi.test:8888/");
|
||||
var browser = gBrowser.getBrowserForTab(tab);
|
||||
BrowserTestUtils.browserLoaded(browser).then(() => {
|
||||
BrowserTestUtils.removeTab(tab).then(() => {
|
||||
ok(isUndoCloseEnabled(), "Undo Close Tab should be enabled.");
|
||||
finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
let sessionUpdatePromise = BrowserTestUtils.waitForSessionStoreUpdate(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
await sessionUpdatePromise;
|
||||
|
||||
ok(isUndoCloseEnabled(), "Undo Close Tab should be enabled.");
|
||||
});
|
||||
|
@ -38,6 +38,6 @@ add_task(async function test_contextmenu_openlink_after_tabnavigated() {
|
||||
});
|
||||
is(newTabURL, "http://example.com/", "Got the expected URL loaded in the new tab");
|
||||
|
||||
await BrowserTestUtils.removeTab(newTab);
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(newTab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -49,7 +49,7 @@ add_task(async function() {
|
||||
await ContentTask.spawn(extraTab.linkedBrowser, null, async function() {
|
||||
is(content.opener, null, "No opener should be available");
|
||||
});
|
||||
await BrowserTestUtils.removeTab(extraTab);
|
||||
BrowserTestUtils.removeTab(extraTab);
|
||||
});
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ add_task(async function() {
|
||||
let httpTab = await promiseTabOpened;
|
||||
let httpBrowser = httpTab.linkedBrowser;
|
||||
registerCleanupFunction(async function() {
|
||||
await BrowserTestUtils.removeTab(httpTab);
|
||||
BrowserTestUtils.removeTab(httpTab);
|
||||
});
|
||||
await CheckBrowserInPid(httpBrowser, filePid,
|
||||
"Check that new http tab opened from file loaded in file content process.");
|
||||
|
@ -18,5 +18,5 @@ add_task(async function test_browser_open_newtab_start_observer_notification() {
|
||||
|
||||
ok(true, "browser-open-newtab-start observer not called");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -18,7 +18,7 @@ add_task(async function() {
|
||||
// Open first file:// page.
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, uriString);
|
||||
registerCleanupFunction(async function() {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
// Open new file:// tab from JavaScript in first file:// page.
|
||||
@ -29,7 +29,7 @@ add_task(async function() {
|
||||
|
||||
let openedTab = await promiseTabOpened;
|
||||
registerCleanupFunction(async function() {
|
||||
await BrowserTestUtils.removeTab(openedTab);
|
||||
BrowserTestUtils.removeTab(openedTab);
|
||||
});
|
||||
|
||||
let openedBrowser = openedTab.linkedBrowser;
|
||||
|
@ -79,6 +79,6 @@ add_task(async function() {
|
||||
"(" + left(scrollbox) + " <= " + firstScrollableLeft + ")");
|
||||
|
||||
while (tabs.length > 1) {
|
||||
await BrowserTestUtils.removeTab(gBrowser.tabs[0]);
|
||||
BrowserTestUtils.removeTab(gBrowser.tabs[0]);
|
||||
}
|
||||
});
|
||||
|
@ -36,7 +36,7 @@ async function zoomNewTab(changeZoom, message) {
|
||||
const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:newtab");
|
||||
changeZoom();
|
||||
const level = tab.linkedBrowser.fullZoom;
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
||||
await checkPreloadedZoom(level, `${message}: ${level}`);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ add_task(async function() {
|
||||
const uriString = Services.io.newFileURI(disappearingPage).spec;
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, uriString);
|
||||
registerCleanupFunction(async function() {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
// Delete the page, simulate a click of the reload button and check that we
|
||||
|
@ -5,6 +5,20 @@ var gAnimHistogram = Services.telemetry
|
||||
var gNoAnimHistogram = Services.telemetry
|
||||
.getHistogramById("FX_TAB_CLOSE_TIME_NO_ANIM_MS");
|
||||
|
||||
/**
|
||||
* Takes a Telemetry histogram snapshot and returns the sum of all counts.
|
||||
*
|
||||
* @param snapshot (Object)
|
||||
* The Telemetry histogram snapshot to examine.
|
||||
* @return (int)
|
||||
* The sum of all counts in the snapshot.
|
||||
*/
|
||||
function snapshotCount(snapshot) {
|
||||
// Use Array.prototype.reduce to sum up all of the
|
||||
// snapshot.count entries
|
||||
return snapshot.counts.reduce((a, b) => a + b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a Telemetry histogram snapshot and makes sure
|
||||
* that the sum of all counts equals expectedCount.
|
||||
@ -18,12 +32,27 @@ var gNoAnimHistogram = Services.telemetry
|
||||
* this would be 0.
|
||||
*/
|
||||
function assertCount(snapshot, expectedCount) {
|
||||
// Use Array.prototype.reduce to sum up all of the
|
||||
// snapshot.count entries
|
||||
Assert.equal(snapshot.counts.reduce((a, b) => a + b), expectedCount,
|
||||
Assert.equal(snapshotCount(snapshot), expectedCount,
|
||||
`Should only be ${expectedCount} collected value.`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a Telemetry histogram and waits for the sum of all counts becomes
|
||||
* equal to expectedCount.
|
||||
*
|
||||
* @param histogram (Object)
|
||||
* The Telemetry histogram to examine.
|
||||
* @param expectedCount (int)
|
||||
* What we expect the number of incremented counts to become.
|
||||
* @return (Promise)
|
||||
* @resolves When the histogram snapshot count becomes the expected count.
|
||||
*/
|
||||
function waitForSnapshotCount(histogram, expectedCount) {
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
return snapshotCount(histogram.snapshot()) == expectedCount;
|
||||
}, `Collected value should become ${expectedCount}.`);
|
||||
}
|
||||
|
||||
add_task(async function setup() {
|
||||
// These probes are opt-in, meaning we only capture them if extended
|
||||
// Telemetry recording is enabled.
|
||||
@ -45,9 +74,9 @@ add_task(async function test_close_time_anim_probe() {
|
||||
gAnimHistogram.clear();
|
||||
gNoAnimHistogram.clear();
|
||||
|
||||
await BrowserTestUtils.removeTab(tab, { animate: true });
|
||||
BrowserTestUtils.removeTab(tab, { animate: true });
|
||||
|
||||
assertCount(gAnimHistogram.snapshot(), 1);
|
||||
await waitForSnapshotCount(gAnimHistogram, 1);
|
||||
assertCount(gNoAnimHistogram.snapshot(), 0);
|
||||
|
||||
gAnimHistogram.clear();
|
||||
@ -65,10 +94,10 @@ add_task(async function test_close_time_no_anim_probe() {
|
||||
gAnimHistogram.clear();
|
||||
gNoAnimHistogram.clear();
|
||||
|
||||
await BrowserTestUtils.removeTab(tab, { animate: false });
|
||||
BrowserTestUtils.removeTab(tab, { animate: false });
|
||||
|
||||
await waitForSnapshotCount(gNoAnimHistogram, 1);
|
||||
assertCount(gAnimHistogram.snapshot(), 0);
|
||||
assertCount(gNoAnimHistogram.snapshot(), 1);
|
||||
|
||||
gAnimHistogram.clear();
|
||||
gNoAnimHistogram.clear();
|
||||
|
@ -77,7 +77,7 @@ async function testProbe(aProbe) {
|
||||
|
||||
// Now we should have a hang in our histogram.
|
||||
let snapshot = histogram.snapshot();
|
||||
await BrowserTestUtils.removeTab(hangTab);
|
||||
BrowserTestUtils.removeTab(hangTab);
|
||||
ok(sum(snapshot.counts) > 0,
|
||||
`Spinner probe should now have a value in some bucket`);
|
||||
}
|
||||
|
@ -22,6 +22,6 @@ add_task(async function() {
|
||||
await BrowserTestUtils.waitForCondition(() => !gInPrintPreviewMode, "should no longer be in print preview mode");
|
||||
await tabSwitched;
|
||||
is(gBrowser.selectedTab, originalTab, "Selected tab should be back to the original tab that we print previewed");
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
});
|
||||
|
@ -21,6 +21,6 @@ add_task(async function() {
|
||||
}
|
||||
|
||||
updater.removeEventListener("commandupdate", countUpdates, true);
|
||||
await BrowserTestUtils.removeTab(tab1);
|
||||
await BrowserTestUtils.removeTab(tab2);
|
||||
BrowserTestUtils.removeTab(tab1);
|
||||
BrowserTestUtils.removeTab(tab2);
|
||||
});
|
||||
|
@ -33,7 +33,7 @@ add_task(async function() {
|
||||
BrowserViewSource(fileBrowser);
|
||||
let viewSourceTab = await promiseTab;
|
||||
registerCleanupFunction(async function() {
|
||||
await BrowserTestUtils.removeTab(viewSourceTab);
|
||||
BrowserTestUtils.removeTab(viewSourceTab);
|
||||
});
|
||||
await ContentTask.spawn(viewSourceTab.linkedBrowser, DATA_URI_SOURCE, uri => {
|
||||
is(content.document.documentURI, uri,
|
||||
|
@ -17,7 +17,7 @@ add_task(async function setup() {
|
||||
await PlacesUtils.keywords.remove("get");
|
||||
await PlacesUtils.keywords.remove("post");
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ add_task(async function() {
|
||||
Services.search.currentEngine = originalEngine;
|
||||
Services.search.removeEngine(engine);
|
||||
try {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
} catch (ex) { /* tab may have already been closed in case of failure */ }
|
||||
await PlacesUtils.history.clear();
|
||||
});
|
||||
|
@ -15,7 +15,7 @@ add_task(async function() {
|
||||
Services.search.currentEngine = originalEngine;
|
||||
Services.search.removeEngine(engine);
|
||||
try {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
} catch (ex) { /* tab may have already been closed in case of failure */ }
|
||||
await PlacesUtils.history.clear();
|
||||
});
|
||||
|
@ -35,7 +35,7 @@ add_task(async function() {
|
||||
registerCleanupFunction(async function() {
|
||||
await PlacesUtils.history.clear();
|
||||
Services.prefs.clearUserPref(ONEOFF_URLBAR_PREF);
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
let visits = [];
|
||||
|
@ -16,5 +16,5 @@ add_task(async function() {
|
||||
is(gURLBar.selectionStart, 5, "Should have moved the cursor");
|
||||
is(gURLBar.selectionEnd, 5, "And not selected anything");
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ add_task(async function() {
|
||||
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
|
||||
registerCleanupFunction(async function() {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
await PlacesUtils.history.clear();
|
||||
});
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user