Skip to content

Commit 910eab3

Browse files
committed
Bug 1596918: Part 3a - Scripted rewrite of most ContentTask.spawn calls to SpecialPowers.spawn calls. r=mccr8,remote-protocol-reviewers,ato
This is generally pretty straightforward, and rewrites nearly all calls. It skips the ones that it can detect using frame script globals like `sendAsyncMessage`, though. Differential Revision: https://phabricator.services.mozilla.com/D53740 --HG-- extra : moz-landing-system : lando
1 parent 64dd29e commit 910eab3

File tree

985 files changed

+2917
-3886
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

985 files changed

+2917
-3886
lines changed

browser/base/content/test/about/browser_aboutCertError_clockSkew.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ add_task(async function checkWrongSystemTimeWarning() {
2828
info("Loading and waiting for the cert error");
2929
await certErrorLoaded;
3030

31-
return ContentTask.spawn(browser, null, async function() {
31+
return SpecialPowers.spawn(browser, [], async function() {
3232
let doc = content.document;
3333
let div = doc.getElementById("errorShortDescText");
3434
let systemDateDiv = doc.getElementById("wrongSystemTime_systemDate1");

browser/base/content/test/about/browser_aboutCertError_exception.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ add_task(async function checkExceptionDialogButton() {
1616
let browser = tab.linkedBrowser;
1717
let loaded = BrowserTestUtils.browserLoaded(browser, false, BAD_CERT);
1818
info("Clicking the exceptionDialogButton in advanced panel");
19-
await ContentTask.spawn(browser, null, async function() {
19+
await SpecialPowers.spawn(browser, [], async function() {
2020
let doc = content.document;
2121
let exceptionButton = doc.getElementById("exceptionDialogButton");
2222
exceptionButton.click();
@@ -25,7 +25,7 @@ add_task(async function checkExceptionDialogButton() {
2525
info("Loading the url after adding exception");
2626
await loaded;
2727

28-
await ContentTask.spawn(browser, null, async function() {
28+
await SpecialPowers.spawn(browser, [], async function() {
2929
let doc = content.document;
3030
ok(
3131
!doc.documentURI.startsWith("about:certerror"),
@@ -52,10 +52,8 @@ add_task(async function checkPermanentExceptionPref() {
5252
let browser = tab.linkedBrowser;
5353
let loaded = BrowserTestUtils.browserLoaded(browser, false, BAD_CERT);
5454
info("Clicking the exceptionDialogButton in advanced panel");
55-
let securityInfoAsString = await ContentTask.spawn(
56-
browser,
57-
null,
58-
async function() {
55+
let securityInfoAsString = await SpecialPowers.spawn(
56+
browser, [], async function() {
5957
let doc = content.document;
6058
let exceptionButton = doc.getElementById("exceptionDialogButton");
6159
exceptionButton.click();
@@ -72,7 +70,7 @@ add_task(async function checkPermanentExceptionPref() {
7270
info("Loading the url after adding exception");
7371
await loaded;
7472

75-
await ContentTask.spawn(browser, null, async function() {
73+
await SpecialPowers.spawn(browser, [], async function() {
7674
let doc = content.document;
7775
ok(
7876
!doc.documentURI.startsWith("about:certerror"),
@@ -116,7 +114,7 @@ add_task(async function checkBadStsCert() {
116114
let tab = await openErrorPage(BAD_STS_CERT, useFrame);
117115
let browser = tab.linkedBrowser;
118116

119-
await ContentTask.spawn(browser, { frame: useFrame }, async function({
117+
await SpecialPowers.spawn(browser, [{ frame: useFrame }], async function({
120118
frame,
121119
}) {
122120
let doc = frame
@@ -129,10 +127,8 @@ add_task(async function checkBadStsCert() {
129127
);
130128
});
131129

132-
let message = await ContentTask.spawn(
133-
browser,
134-
{ frame: useFrame },
135-
async function({ frame }) {
130+
let message = await SpecialPowers.spawn(
131+
browser, [{ frame: useFrame }], async function({ frame }) {
136132
let doc = frame
137133
? content.document.querySelector("iframe").contentDocument
138134
: content.document;
@@ -172,7 +168,7 @@ add_task(async function checkhideAddExceptionButtonViaPref() {
172168
let tab = await openErrorPage(BAD_CERT, useFrame);
173169
let browser = tab.linkedBrowser;
174170

175-
await ContentTask.spawn(browser, { frame: useFrame }, async function({
171+
await SpecialPowers.spawn(browser, [{ frame: useFrame }], async function({
176172
frame,
177173
}) {
178174
let doc = frame
@@ -199,7 +195,7 @@ add_task(async function checkhideAddExceptionButtonInFrames() {
199195
let tab = await openErrorPage(BAD_CERT, true);
200196
let browser = tab.linkedBrowser;
201197

202-
await ContentTask.spawn(browser, null, async function() {
198+
await SpecialPowers.spawn(browser, [], async function() {
203199
let doc = content.document.querySelector("iframe").contentDocument;
204200
let exceptionButton = doc.getElementById("exceptionDialogButton");
205201
ok(

browser/base/content/test/about/browser_aboutCertError_mitm.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ add_task(async function checkMitmPriming() {
3838
// The page will reload after the initial canary request, so we'll just
3939
// wait until we're seeing the dedicated MitM page.
4040
await TestUtils.waitForCondition(function() {
41-
return ContentTask.spawn(browser, {}, () => {
41+
return SpecialPowers.spawn(browser, [], () => {
4242
return (
4343
content.document.body.getAttribute("code") ==
4444
"MOZILLA_PKIX_ERROR_MITM_DETECTED"
@@ -54,7 +54,7 @@ add_task(async function checkMitmPriming() {
5454
"Stored the correct issuer"
5555
);
5656

57-
await ContentTask.spawn(browser, {}, () => {
57+
await SpecialPowers.spawn(browser, [], () => {
5858
let mitmName1 = content.document.querySelector(
5959
"#errorShortDescText .mitm-name"
6060
);
@@ -113,7 +113,7 @@ add_task(async function checkMitmAutoEnableEnterpriseRoots() {
113113
// The page will reload after the initial canary request, so we'll just
114114
// wait until we're seeing the dedicated MitM page.
115115
await TestUtils.waitForCondition(function() {
116-
return ContentTask.spawn(browser, {}, () => {
116+
return SpecialPowers.spawn(browser, [], () => {
117117
return (
118118
content.document.body.getAttribute("code") ==
119119
"MOZILLA_PKIX_ERROR_MITM_DETECTED"

browser/base/content/test/about/browser_aboutCertError_noSubjectAltName.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ add_task(async function checkUntrustedCertError() {
5757
let tab = await openErrorPage(UNKNOWN_ISSUER);
5858
let browser = tab.linkedBrowser;
5959
info("Clicking the exceptionDialogButton in advanced panel");
60-
let badCertTechnicalInfoText = await ContentTask.spawn(
61-
browser,
62-
null,
63-
checkAdvancedAndGetTechnicalInfoText
60+
let badCertTechnicalInfoText = await SpecialPowers.spawn(
61+
browser, [], checkAdvancedAndGetTechnicalInfoText
6462
);
6563
checkCorrectMessages(badCertTechnicalInfoText, browser);
6664
BrowserTestUtils.removeTab(gBrowser.selectedTab);

browser/base/content/test/about/browser_aboutHome_search_POST.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ add_task(async function() {
4141
Services.search.setDefault(engine),
4242
]);
4343
let promise = BrowserTestUtils.browserLoaded(browser);
44-
await ContentTask.spawn(browser, { needle }, async function(args) {
44+
await SpecialPowers.spawn(browser, [{ needle }], async function(args) {
4545
let doc = content.document;
4646
let el = doc.querySelector(["#searchText", "#newtab-search-text"]);
4747
el.value = args.needle;
@@ -51,7 +51,7 @@ add_task(async function() {
5151
await promise;
5252

5353
// When the search results load, check them for correctness.
54-
await ContentTask.spawn(browser, { needle }, async function(args) {
54+
await SpecialPowers.spawn(browser, [{ needle }], async function(args) {
5555
let loadedText = content.document.body.textContent;
5656
ok(loadedText, "search page loaded");
5757
is(

browser/base/content/test/about/browser_aboutHome_search_composing.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ add_task(async function() {
3636
);
3737
});
3838

39-
await ContentTask.spawn(browser, null, async function() {
39+
await SpecialPowers.spawn(browser, [], async function() {
4040
// Start composition and type "x"
4141
let input = content.document.querySelector([
4242
"#searchText",
@@ -46,7 +46,7 @@ add_task(async function() {
4646
});
4747

4848
info("Setting up the mutation observer before synthesizing composition");
49-
let mutationPromise = ContentTask.spawn(browser, null, async function() {
49+
let mutationPromise = SpecialPowers.spawn(browser, [], async function() {
5050
let searchController = content.wrappedJSObject.gContentSearchController;
5151

5252
// Wait for the search suggestions to become visible.

browser/base/content/test/about/browser_aboutHome_search_suggestion.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ add_task(async function() {
1919
Services.search.setDefault(engine),
2020
]);
2121

22-
await ContentTask.spawn(browser, null, async function() {
22+
await SpecialPowers.spawn(browser, [], async function() {
2323
// Type an X in the search input.
2424
let input = content.document.querySelector([
2525
"#searchText",
@@ -30,7 +30,7 @@ add_task(async function() {
3030

3131
await BrowserTestUtils.synthesizeKey("x", {}, browser);
3232

33-
await ContentTask.spawn(browser, null, async function() {
33+
await SpecialPowers.spawn(browser, [], async function() {
3434
// Wait for the search suggestions to become visible.
3535
let table = content.document.getElementById("searchSuggestionTable");
3636
let input = content.document.querySelector([
@@ -57,7 +57,7 @@ add_task(async function() {
5757
await BrowserTestUtils.synthesizeKey("a", { accelKey: true }, browser);
5858
await BrowserTestUtils.synthesizeKey("VK_DELETE", {}, browser);
5959

60-
await ContentTask.spawn(browser, null, async function() {
60+
await SpecialPowers.spawn(browser, [], async function() {
6161
let table = content.document.getElementById("searchSuggestionTable");
6262
await ContentTaskUtils.waitForCondition(
6363
() => table.hidden,

browser/base/content/test/about/browser_aboutHome_search_telemetry.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ add_task(async function() {
2424
Services.search.setDefault(engine),
2525
]);
2626

27-
await ContentTask.spawn(
28-
browser,
29-
{ expectedName: engine.name },
30-
async function(args) {
27+
await SpecialPowers.spawn(
28+
browser, [{ expectedName: engine.name }], async function(args) {
3129
let engineName =
3230
content.wrappedJSObject.gContentSearchController.defaultEngine.name;
3331
is(
@@ -65,7 +63,7 @@ add_task(async function() {
6563
);
6664

6765
// Perform a search to increase the SEARCH_COUNT histogram.
68-
await ContentTask.spawn(browser, { searchStr }, async function(args) {
66+
await SpecialPowers.spawn(browser, [{ searchStr }], async function(args) {
6967
let doc = content.document;
7068
info("Perform a search.");
7169
let el = doc.querySelector(["#searchText", "#newtab-search-text"]);

browser/base/content/test/about/browser_aboutNetError.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ add_task(async function resetToDefaultConfig() {
7070
TLS12_PAGE
7171
);
7272

73-
await ContentTask.spawn(browser, null, async function() {
73+
await SpecialPowers.spawn(browser, [], async function() {
7474
const doc = content.document;
7575
ok(
7676
doc.documentURI.startsWith("about:neterror"),
@@ -124,7 +124,7 @@ add_task(async function checkLearnMoreLink() {
124124

125125
const baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
126126

127-
await ContentTask.spawn(browser, baseURL, function(_baseURL) {
127+
await SpecialPowers.spawn(browser, [baseURL], function(_baseURL) {
128128
const doc = content.document;
129129
ok(
130130
doc.documentURI.startsWith("about:neterror"),
@@ -176,7 +176,7 @@ add_task(async function checkEnable10() {
176176
TLS10_PAGE
177177
);
178178

179-
await ContentTask.spawn(browser, null, async function() {
179+
await SpecialPowers.spawn(browser, [], async function() {
180180
const doc = content.document;
181181
ok(
182182
doc.documentURI.startsWith("about:neterror"),
@@ -227,7 +227,7 @@ add_task(async function dontOffer10WhenAlreadyEnabled() {
227227
info("Loading and waiting for the net error");
228228
await pageLoaded;
229229

230-
await ContentTask.spawn(browser, null, async function() {
230+
await SpecialPowers.spawn(browser, [], async function() {
231231
const doc = content.document;
232232
ok(
233233
doc.documentURI.startsWith("about:neterror"),

browser/base/content/test/about/browser_aboutSupport.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ add_task(async function() {
77
await BrowserTestUtils.withNewTab(
88
{ gBrowser, url: "about:support" },
99
async function(browser) {
10-
let keyLocationServiceGoogleStatus = await ContentTask.spawn(
11-
browser,
12-
null,
13-
async function() {
10+
let keyLocationServiceGoogleStatus = await SpecialPowers.spawn(
11+
browser, [], async function() {
1412
let textBox = content.document.getElementById(
1513
"key-location-service-google-box"
1614
);
@@ -26,10 +24,8 @@ add_task(async function() {
2624
"Google location service API key status shown"
2725
);
2826

29-
let keySafebrowsingGoogleStatus = await ContentTask.spawn(
30-
browser,
31-
null,
32-
async function() {
27+
let keySafebrowsingGoogleStatus = await SpecialPowers.spawn(
28+
browser, [], async function() {
3329
let textBox = content.document.getElementById(
3430
"key-safebrowsing-google-box"
3531
);
@@ -45,10 +41,8 @@ add_task(async function() {
4541
"Google Safebrowsing API key status shown"
4642
);
4743

48-
let keyMozillaStatus = await ContentTask.spawn(
49-
browser,
50-
null,
51-
async function() {
44+
let keyMozillaStatus = await SpecialPowers.spawn(
45+
browser, [], async function() {
5246
let textBox = content.document.getElementById("key-mozilla-box");
5347
await ContentTaskUtils.waitForCondition(
5448
() => content.document.l10n.getAttributes(textBox).id,

browser/base/content/test/about/browser_bug435325.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ add_task(async function checkSwitchPageToOnlineMode() {
3434
);
3535

3636
// Click on the 'Try again' button.
37-
await ContentTask.spawn(browser, null, async function() {
37+
await SpecialPowers.spawn(browser, [], async function() {
3838
ok(
3939
content.document.documentURI.startsWith("about:neterror?e=netOffline"),
4040
"Should be showing error page"

browser/base/content/test/about/browser_bug633691.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ add_task(async function test() {
77
await BrowserTestUtils.withNewTab({ gBrowser, url: URL }, async function(
88
browser
99
) {
10-
let context = await ContentTask.spawn(browser, null, function() {
10+
let context = await SpecialPowers.spawn(browser, [], function() {
1111
let iframe = content.document.querySelector("iframe");
1212
iframe.src = "https://expired.example.com/";
1313
return BrowsingContext.getFromWindow(iframe.contentWindow);

browser/base/content/test/about/head.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function promiseTabLoadEvent(tab, url) {
161161
* Wait for the search engine to change.
162162
*/
163163
function promiseContentSearchChange(browser, newEngineName) {
164-
return ContentTask.spawn(browser, { newEngineName }, async function(args) {
164+
return SpecialPowers.spawn(browser, [{ newEngineName }], async function(args) {
165165
return new Promise(resolve => {
166166
content.addEventListener("ContentSearchService", function listener(
167167
aEvent

browser/base/content/test/alerts/browser_notification_replace.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_task(async function test_notificationReplace() {
1212
url: notificationURL,
1313
},
1414
async function dummyTabTask(aBrowser) {
15-
await ContentTask.spawn(aBrowser, {}, async function() {
15+
await SpecialPowers.spawn(aBrowser, [], async function() {
1616
let win = content.window.wrappedJSObject;
1717
let notification = win.showNotification1();
1818
let promiseCloseEvent = ContentTaskUtils.waitForEvent(

browser/base/content/test/alerts/browser_notification_tab_switching.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ add_task(async function test_notificationPreventDefaultAndSwitchTabs() {
3434

3535
// First, show a notification that will be have the tab-switching prevented.
3636
function promiseNotificationEvent(evt) {
37-
return ContentTask.spawn(aBrowser, evt, async function(contentEvt) {
37+
return SpecialPowers.spawn(aBrowser, [evt], async function(contentEvt) {
3838
return new Promise(resolve => {
3939
let contentNotification = content.wrappedJSObject._notification;
4040
contentNotification.addEventListener(

browser/base/content/test/alerts/head.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function promiseWindowClosed(window) {
3333
*/
3434
function openNotification(aBrowser, fn, timeout) {
3535
info(`openNotification: ${fn}`);
36-
return ContentTask.spawn(aBrowser, [fn, timeout], async function([
36+
return SpecialPowers.spawn(aBrowser, [[fn, timeout]], async function([
3737
contentFn,
3838
contentTimeout,
3939
]) {
@@ -60,7 +60,7 @@ function openNotification(aBrowser, fn, timeout) {
6060
}
6161

6262
function closeNotification(aBrowser) {
63-
return ContentTask.spawn(aBrowser, null, function() {
63+
return SpecialPowers.spawn(aBrowser, [], function() {
6464
content.wrappedJSObject._notification.close();
6565
});
6666
}

browser/base/content/test/captivePortal/browser_captivePortal_certErrorUI.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ add_task(async function checkCaptivePortalCertErrorUI() {
5555
CANONICAL_URL
5656
);
5757

58-
await ContentTask.spawn(browser, null, () => {
58+
await SpecialPowers.spawn(browser, [], () => {
5959
let doc = content.document;
6060
ok(
6161
doc.body.classList.contains("captiveportal"),
@@ -84,7 +84,7 @@ add_task(async function checkCaptivePortalCertErrorUI() {
8484
// Passing an empty function to BrowserTestUtils.switchTab lets us wait for an arbitrary
8585
// tab switch.
8686
portalTabPromise = BrowserTestUtils.switchTab(gBrowser, () => {});
87-
await ContentTask.spawn(browser, null, () => {
87+
await SpecialPowers.spawn(browser, [], () => {
8888
info("Clicking the Open Login Page button.");
8989
content.document.getElementById("openPortalLoginPageButton").click();
9090
});
@@ -102,7 +102,7 @@ add_task(async function checkCaptivePortalCertErrorUI() {
102102
"Waiting for error tab to be reloaded after the captive portal was freed."
103103
);
104104
await errorTabReloaded;
105-
await ContentTask.spawn(browser, null, () => {
105+
await SpecialPowers.spawn(browser, [], () => {
106106
let doc = content.document;
107107
ok(
108108
!doc.body.classList.contains("captiveportal"),

0 commit comments

Comments
 (0)