Skip to content

Commit

Permalink
Bug 1442465 - Part 4.2: Stop unnecessarily awaiting on BrowserTestUti…
Browse files Browse the repository at this point in the history
…ls.removeTab (simple part). r=dao
  • Loading branch information
arai-a committed Mar 19, 2018
1 parent a8cdedb commit 841f8a2
Show file tree
Hide file tree
Showing 447 changed files with 849 additions and 841 deletions.
4 changes: 2 additions & 2 deletions accessible/tests/browser/general/browser_test_doc_creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion accessible/tests/browser/general/browser_test_urlbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion accessible/tests/browser/states/browser_test_visibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(`
Expand Down
20 changes: 10 additions & 10 deletions browser/base/content/test/about/browser_aboutCertError.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});

Expand Down Expand Up @@ -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);
}
});

Expand All @@ -148,7 +148,7 @@ add_task(async function checkBadStsCert() {

ok(exceptionButtonHidden, "Exception button is hidden");

await BrowserTestUtils.removeTab(gBrowser.selectedTab);
BrowserTestUtils.removeTab(gBrowser.selectedTab);
}
});

Expand Down Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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() {
Expand Down Expand Up @@ -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);
}
});

Expand Down Expand Up @@ -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);
}
});

Expand All @@ -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);
}
});

Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/test/about/browser_aboutNetError.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
12 changes: 6 additions & 6 deletions browser/base/content/test/about/browser_aboutStopReload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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");
});
Expand All @@ -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");
});
Expand All @@ -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");
});
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

Expand Down Expand Up @@ -55,6 +55,6 @@ add_task(async function test_settingsOpen_button() {

await syncPaneLoadedPromise;
await closePromise;
await BrowserTestUtils.removeTab(tab);
BrowserTestUtils.removeTab(tab);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ add_task(async function checkCaptivePortalCertErrorUI() {
"Captive portal error page UI is not visible.");
});

await BrowserTestUtils.removeTab(errorTab);
BrowserTestUtils.removeTab(errorTab);
});
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ add_task(async function test_select_text_link() {
await activateContextAndWaitFor("#" + elementID, where);
}
}
await BrowserTestUtils.removeTab(testTab);
BrowserTestUtils.removeTab(testTab);
});
2 changes: 1 addition & 1 deletion browser/base/content/test/favicons/browser_favicon_load.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

Expand Down
4 changes: 2 additions & 2 deletions browser/base/content/test/favicons/browser_rich_icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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);
});
16 changes: 8 additions & 8 deletions browser/base/content/test/forms/browser_selectpopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -671,7 +671,7 @@ add_task(async function test_select_search() {

await performSelectSearchTests(window);

await BrowserTestUtils.removeTab(tab);
BrowserTestUtils.removeTab(tab);

await SpecialPowers.popPrefEnv();
});
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -773,5 +773,5 @@ add_task(async function test_blur_hides_popup() {

ok(true, "Blur closed popup");

await BrowserTestUtils.removeTab(tab);
BrowserTestUtils.removeTab(tab);
});
6 changes: 3 additions & 3 deletions browser/base/content/test/forms/browser_selectpopup_colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ async function testSelectColors(select, itemCount, options) {

if (!options.leaveOpen) {
await hideSelectPopup(selectPopup, "escape");
await BrowserTestUtils.removeTab(tab);
BrowserTestUtils.removeTab(tab);
}
}

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
});
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ add_task(async function() {
}
}

await BrowserTestUtils.removeTab(tab);
BrowserTestUtils.removeTab(tab);
});
Loading

0 comments on commit 841f8a2

Please sign in to comment.