Skip to content

Commit 79b29f8

Browse files
author
Stephanie Cunnane
committed
Bug 1857264 - Remove unnecessary openTabInUserContext function definitions in tests. r=mseibert
Differential Revision: https://phabricator.services.mozilla.com/D197809
1 parent 716884d commit 79b29f8

12 files changed

+11
-131
lines changed

browser/components/contextualidentity/test/browser/browser_broadcastchannel.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,6 @@ const URI =
33
BASE_ORIGIN +
44
"/browser/browser/components/contextualidentity/test/browser/empty_file.html";
55

6-
// Opens `uri' in a new tab with the provided userContextId and focuses it.
7-
// Returns the newly opened tab and browser.
8-
async function openTabInUserContext(uri, userContextId) {
9-
// open the tab in the correct userContextId
10-
let tab = BrowserTestUtils.addTab(gBrowser, uri, { userContextId });
11-
12-
// select tab and make sure its browser is focused
13-
gBrowser.selectedTab = tab;
14-
tab.ownerGlobal.focus();
15-
16-
let browser = gBrowser.getBrowserForTab(tab);
17-
await BrowserTestUtils.browserLoaded(browser);
18-
return { tab, browser };
19-
}
20-
216
async function runTestForReceiver(receiver) {
227
let channelName = "contextualidentity-broadcastchannel";
238

browser/components/contextualidentity/test/browser/browser_eme.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,6 @@ const TESTKEY = {
2020
const USER_ID_DEFAULT = 0;
2121
const USER_ID_PERSONAL = 1;
2222

23-
async function openTabInUserContext(uri, userContextId) {
24-
// Open the tab in the correct userContextId.
25-
let tab = BrowserTestUtils.addTab(gBrowser, uri, { userContextId });
26-
27-
// Select tab and make sure its browser is focused.
28-
gBrowser.selectedTab = tab;
29-
tab.ownerGlobal.focus();
30-
31-
let browser = gBrowser.getBrowserForTab(tab);
32-
await BrowserTestUtils.browserLoaded(browser);
33-
return { tab, browser };
34-
}
35-
3623
function HexToBase64(hex) {
3724
var bin = "";
3825
for (var i = 0; i < hex.length; i += 2) {

browser/components/contextualidentity/test/browser/browser_favicon.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@ function getIconFile() {
2929
});
3030
}
3131

32-
async function openTabInUserContext(uri, userContextId) {
33-
// open the tab in the correct userContextId
34-
let tab = BrowserTestUtils.addTab(gBrowser, uri, { userContextId });
35-
36-
// select tab and make sure its browser is focused
37-
gBrowser.selectedTab = tab;
38-
tab.ownerGlobal.focus();
39-
40-
let browser = gBrowser.getBrowserForTab(tab);
41-
await BrowserTestUtils.browserLoaded(browser);
42-
return { tab, browser };
43-
}
44-
4532
function loadIndexHandler(metadata, response) {
4633
response.setStatusLine(metadata.httpVersion, 200, "Ok");
4734
response.setHeader("Content-Type", "text/html", false);

browser/components/contextualidentity/test/browser/browser_forgetAPI_EME_forgetThisSite.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,6 @@ const TEST_EME_KEY = {
2424
// Support functions.
2525
//
2626

27-
async function openTabInUserContext(uri, userContextId) {
28-
// Open the tab in the correct userContextId.
29-
let tab = BrowserTestUtils.addTab(gBrowser, uri, { userContextId });
30-
31-
// Select tab and make sure its browser is focused.
32-
gBrowser.selectedTab = tab;
33-
tab.ownerGlobal.focus();
34-
35-
let browser = gBrowser.getBrowserForTab(tab);
36-
await BrowserTestUtils.browserLoaded(browser);
37-
return { tab, browser };
38-
}
39-
4027
function HexToBase64(hex) {
4128
var bin = "";
4229
for (var i = 0; i < hex.length; i += 2) {

browser/components/contextualidentity/test/browser/browser_forgetAPI_cookie_getCookiesWithOriginAttributes.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,6 @@ const USER_CONTEXTS = ["default", "personal"];
1616
// Support functions.
1717
//
1818

19-
async function openTabInUserContext(uri, userContextId) {
20-
// Open the tab in the correct userContextId.
21-
let tab = BrowserTestUtils.addTab(gBrowser, uri, { userContextId });
22-
23-
// Select tab and make sure its browser is focused.
24-
gBrowser.selectedTab = tab;
25-
tab.ownerGlobal.focus();
26-
27-
let browser = gBrowser.getBrowserForTab(tab);
28-
await BrowserTestUtils.browserLoaded(browser);
29-
return { tab, browser };
30-
}
31-
3219
function getCookiesForOA(host, userContextId) {
3320
return Services.cookies.getCookiesFromHost(host, { userContextId });
3421
}

browser/components/contextualidentity/test/browser/browser_forgetAPI_quota_clearStoragesForPrincipal.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,6 @@ const USER_CONTEXTS = ["default", "personal"];
1616
// Support functions.
1717
//
1818

19-
async function openTabInUserContext(uri, userContextId) {
20-
// Open the tab in the correct userContextId.
21-
let tab = BrowserTestUtils.addTab(gBrowser, uri, { userContextId });
22-
23-
// Select tab and make sure its browser is focused.
24-
gBrowser.selectedTab = tab;
25-
tab.ownerGlobal.focus();
26-
27-
let browser = gBrowser.getBrowserForTab(tab);
28-
await BrowserTestUtils.browserLoaded(browser);
29-
return { tab, browser };
30-
}
31-
3219
// Setup an entry for the indexedDB.
3320
async function setupIndexedDB(browser) {
3421
await SpecialPowers.spawn(

browser/components/contextualidentity/test/browser/browser_forgetaboutsite.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,6 @@ function loadImagePageHandler(metadata, response) {
5656
response.bodyOutputStream.write(body, body.length);
5757
}
5858

59-
async function openTabInUserContext(uri, userContextId) {
60-
// Open the tab in the correct userContextId.
61-
let tab = BrowserTestUtils.addTab(gBrowser, uri, { userContextId });
62-
63-
// Select tab and make sure its browser is focused.
64-
gBrowser.selectedTab = tab;
65-
tab.ownerGlobal.focus();
66-
67-
let browser = gBrowser.getBrowserForTab(tab);
68-
await BrowserTestUtils.browserLoaded(browser);
69-
return { tab, browser };
70-
}
71-
7259
function getCookiesForOA(host, userContextId) {
7360
return Services.cookies.getCookiesFromHost(host, { userContextId });
7461
}

browser/components/contextualidentity/test/browser/browser_imageCache.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,13 @@ add_setup(async function () {
4040
});
4141
});
4242

43-
// opens `uri' in a new tab with the provided userContextId and focuses it.
44-
// returns the newly opened tab
45-
async function openTabInUserContext(uri, userContextId) {
46-
// open the tab in the correct userContextId
47-
let tab = BrowserTestUtils.addTab(gBrowser, uri, { userContextId });
48-
49-
// select tab and make sure its browser is focused
50-
gBrowser.selectedTab = tab;
51-
tab.ownerGlobal.focus();
52-
53-
let browser = gBrowser.getBrowserForTab(tab);
54-
await BrowserTestUtils.browserLoaded(browser);
55-
return tab;
56-
}
57-
5843
add_task(async function test() {
5944
for (
6045
let userContextId = 0;
6146
userContextId < NUM_USER_CONTEXTS;
6247
userContextId++
6348
) {
64-
let tab = await openTabInUserContext(FILE_URI, userContextId);
49+
let { tab } = await openTabInUserContext(FILE_URI, userContextId);
6550
gBrowser.removeTab(tab);
6651
}
6752
is(

browser/components/contextualidentity/test/browser/browser_restore_getCookiesWithOriginAttributes.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,6 @@ const COOKIE_NAME = "userContextId";
1919
// Support functions.
2020
//
2121

22-
async function openTabInUserContext(uri, userContextId) {
23-
// Open the tab in the correct userContextId.
24-
let tab = BrowserTestUtils.addTab(gBrowser, uri, { userContextId });
25-
26-
// Select tab and make sure its browser is focused.
27-
gBrowser.selectedTab = tab;
28-
tab.ownerGlobal.focus();
29-
30-
let browser = gBrowser.getBrowserForTab(tab);
31-
await BrowserTestUtils.browserLoaded(browser);
32-
return { tab, browser };
33-
}
34-
3522
function getCookiesForOA(host, userContextId) {
3623
return Services.cookies.getCookiesFromHost(host, { userContextId });
3724
}

browser/components/contextualidentity/test/browser/browser_switchTab_across_user_context.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ add_task(async function test_switch_tab() {
3232
let contextIdTabB = 2;
3333
let contextIdTabC = 3;
3434

35-
let tabA = await openTabInUserContext(urlA, contextIdTabA);
36-
let tabB = await openTabInUserContext(urlA, contextIdTabB);
37-
let tabC = await openTabInUserContext(urlB, contextIdTabC);
35+
let { tab: tabA } = await openTabInUserContext(urlA, contextIdTabA);
36+
let { tab: tabB } = await openTabInUserContext(urlA, contextIdTabB);
37+
let { tab: tabC } = await openTabInUserContext(urlB, contextIdTabC);
3838

3939
let searchContext = await UrlbarTestUtils.promiseAutocompleteResultPopup({
4040
window,
@@ -111,8 +111,8 @@ add_task(async function test_chiclet_disabled_on_update() {
111111
let contextIdTabB = 3;
112112

113113
let initialTab = gBrowser.selectedTab;
114-
let tabA = await openTabInUserContext(urlA, contextIdTabA);
115-
let tabB = await openTabInUserContext(urlA, contextIdTabB);
114+
let { tab: tabA } = await openTabInUserContext(urlA, contextIdTabA);
115+
let { tab: tabB } = await openTabInUserContext(urlA, contextIdTabB);
116116

117117
await BrowserTestUtils.switchTab(gBrowser, initialTab);
118118
await UrlbarTestUtils.promiseAutocompleteResultPopup({

0 commit comments

Comments
 (0)