Bug 1819960 - Convert consumers of netwerk/ to import ES modules directly. r=necko-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D171490
This commit is contained in:
Mark Banner 2023-03-04 11:15:30 +00:00
parent 6c4b226572
commit 30ec141b24
28 changed files with 64 additions and 50 deletions

View File

@ -41,6 +41,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
PlacesUIUtils: "resource:///modules/PlacesUIUtils.sys.mjs",
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
PublicSuffixList:
"resource://gre/modules/netwerk-dns/PublicSuffixList.sys.mjs",
QuickSuggest: "resource:///modules/QuickSuggest.sys.mjs",
RemoteSecuritySettings:
@ -93,7 +95,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
PdfJs: "resource://pdf.js/PdfJs.jsm",
PluralForm: "resource://gre/modules/PluralForm.jsm",
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
PublicSuffixList: "resource://gre/modules/netwerk-dns/PublicSuffixList.jsm",
RFPHelper: "resource://gre/modules/RFPHelper.jsm",
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
Sanitizer: "resource:///modules/Sanitizer.jsm",

View File

@ -2,8 +2,8 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
CookieXPCShellUtils.init(this);

View File

@ -1,6 +1,6 @@
const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
CookieXPCShellUtils.init(this);

View File

@ -2,8 +2,8 @@ const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
const BASE_HOST = "example.org";
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
CookieXPCShellUtils.init(this);

View File

@ -4,8 +4,8 @@ function inChildProcess() {
return Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
}
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
let CookieXPCShellUtilsInitialized = false;

View File

@ -3,8 +3,8 @@
"use strict";
const { PublicSuffixList } = ChromeUtils.import(
"resource://gre/modules/netwerk-dns/PublicSuffixList.jsm"
const { PublicSuffixList } = ChromeUtils.importESModule(
"resource://gre/modules/netwerk-dns/PublicSuffixList.sys.mjs"
);
const { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.sys.mjs"

View File

@ -4,8 +4,8 @@
Services.prefs.setBoolPref("network.early-hints.enabled", true);
const { request_count_checking } = ChromeUtils.import(
"resource://testing-common/early_hint_preload_test_helper.jsm"
const { request_count_checking } = ChromeUtils.importESModule(
"resource://testing-common/early_hint_preload_test_helper.sys.mjs"
);
// - testName is just there to be printed during Asserts when failing

View File

@ -6,8 +6,8 @@
Services.prefs.setBoolPref("network.early-hints.enabled", true);
const { test_preload_hint_and_request } = ChromeUtils.import(
"resource://testing-common/early_hint_preload_test_helper.jsm"
const { test_preload_hint_and_request } = ChromeUtils.importESModule(
"resource://testing-common/early_hint_preload_test_helper.sys.mjs"
);
add_task(async function test_preload_images_csp_in_early_hints_response() {

View File

@ -6,8 +6,8 @@
Services.prefs.setBoolPref("network.early-hints.enabled", true);
const { test_preload_hint_and_request } = ChromeUtils.import(
"resource://testing-common/early_hint_preload_test_helper.jsm"
const { test_preload_hint_and_request } = ChromeUtils.importESModule(
"resource://testing-common/early_hint_preload_test_helper.sys.mjs"
);
add_task(async function test_preload_styles_csp_in_response() {

View File

@ -6,8 +6,8 @@
Services.prefs.setBoolPref("network.early-hints.enabled", true);
const { test_hint_preload } = ChromeUtils.import(
"resource://testing-common/early_hint_preload_test_helper.jsm"
const { test_hint_preload } = ChromeUtils.importESModule(
"resource://testing-common/early_hint_preload_test_helper.sys.mjs"
);
// 400 Bad Request

View File

@ -8,8 +8,8 @@
Services.prefs.setBoolPref("network.early-hints.enabled", true);
const { request_count_checking } = ChromeUtils.import(
"resource://testing-common/early_hint_preload_test_helper.jsm"
const { request_count_checking } = ChromeUtils.importESModule(
"resource://testing-common/early_hint_preload_test_helper.sys.mjs"
);
// - httpCode is the response code we're testing for. This file mostly covers 400 and 500 responses

View File

@ -15,8 +15,8 @@ const {
request_count_checking,
test_hint_preload_internal,
test_hint_preload,
} = ChromeUtils.import(
"resource://testing-common/early_hint_preload_test_helper.jsm"
} = ChromeUtils.importESModule(
"resource://testing-common/early_hint_preload_test_helper.sys.mjs"
);
// TODO testing:

View File

@ -10,8 +10,8 @@ const {
test_hint_preload,
test_hint_preload_internal,
request_count_checking,
} = ChromeUtils.import(
"resource://testing-common/early_hint_preload_test_helper.jsm"
} = ChromeUtils.importESModule(
"resource://testing-common/early_hint_preload_test_helper.sys.mjs"
);
// two early hint responses

View File

@ -6,8 +6,11 @@
Services.prefs.setBoolPref("network.early-hints.enabled", true);
const { test_hint_preload, request_count_checking } = ChromeUtils.import(
"resource://testing-common/early_hint_preload_test_helper.jsm"
const {
test_hint_preload,
request_count_checking,
} = ChromeUtils.importESModule(
"resource://testing-common/early_hint_preload_test_helper.sys.mjs"
);
// Early hint to redirect to same origin in secure context

View File

@ -11,8 +11,8 @@ const {
request_count_checking,
test_hint_preload_internal,
test_hint_preload,
} = ChromeUtils.import(
"resource://testing-common/early_hint_preload_test_helper.jsm"
} = ChromeUtils.importESModule(
"resource://testing-common/early_hint_preload_test_helper.sys.mjs"
);
const START_VALUE =

View File

@ -16,7 +16,9 @@ const {
fetchHelper,
preclean_test,
cleanup_test,
} = ChromeUtils.import("resource://testing-common/cookie_filtering_helper.jsm");
} = ChromeUtils.importESModule(
"resource://testing-common/cookie_filtering_helper.sys.mjs"
);
// run suite with content listener
// 1. initializes the content process and observer

View File

@ -14,7 +14,9 @@ const {
checkExpectedCookies,
preclean_test,
cleanup_test,
} = ChromeUtils.import("resource://testing-common/cookie_filtering_helper.jsm");
} = ChromeUtils.importESModule(
"resource://testing-common/cookie_filtering_helper.sys.mjs"
);
async function runSuiteWithContentListener(name, trigger_suite_func, expected) {
return async function(browser) {

View File

@ -15,7 +15,9 @@ const {
fetchHelper,
preclean_test,
cleanup_test,
} = ChromeUtils.import("resource://testing-common/cookie_filtering_helper.jsm");
} = ChromeUtils.importESModule(
"resource://testing-common/cookie_filtering_helper.sys.mjs"
);
async function runSuiteWithContentListener(name, trigger_suite_func, expected) {
return async function(browser) {

View File

@ -17,7 +17,9 @@ const {
triggerSetCookieFromHttpPrivate,
preclean_test,
cleanup_test,
} = ChromeUtils.import("resource://testing-common/cookie_filtering_helper.jsm");
} = ChromeUtils.importESModule(
"resource://testing-common/cookie_filtering_helper.sys.mjs"
);
// TEST: OriginAttributes
// * example.com OA-changed cookies don't go to example.com & vice-versa

View File

@ -16,7 +16,9 @@ const {
fetchHelper,
preclean_test,
cleanup_test,
} = ChromeUtils.import("resource://testing-common/cookie_filtering_helper.jsm");
} = ChromeUtils.importESModule(
"resource://testing-common/cookie_filtering_helper.sys.mjs"
);
const HTTPS_SUBDOMAIN_1_EXAMPLE_COM = "https://test1.example.com";
const HTTP_SUBDOMAIN_1_EXAMPLE_COM = "http://test1.example.com";

View File

@ -7,8 +7,8 @@
"use strict";
const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
// Don't pick up default permissions from profile.

View File

@ -3,8 +3,8 @@
"use strict";
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
CookieXPCShellUtils.init(this);

View File

@ -4,8 +4,8 @@
"use strict";
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
CookieXPCShellUtils.init(this);

View File

@ -2,8 +2,8 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
CookieXPCShellUtils.init(this);

View File

@ -2,8 +2,8 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
CookieXPCShellUtils.init(this);

View File

@ -4,8 +4,8 @@
"use strict";
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
// Small red image.

View File

@ -4,8 +4,8 @@
"use strict";
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
let gHints = 0;

View File

@ -2,8 +2,8 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const { CookieXPCShellUtils } = ChromeUtils.import(
"resource://testing-common/CookieXPCShellUtils.jsm"
const { CookieXPCShellUtils } = ChromeUtils.importESModule(
"resource://testing-common/CookieXPCShellUtils.sys.mjs"
);
CookieXPCShellUtils.init(this);