Bug 1738229 - Stop using the second argument to ChromeUtils.import in various files in browser. r=Standard8,webcompat-reviewers,twisniewski

Differential Revision: https://phabricator.services.mozilla.com/D129842
This commit is contained in:
raquelvargas 2021-11-02 17:21:07 +00:00
Родитель 270e255624
Коммит 0aadb60b82
7 изменённых файлов: 18 добавлений и 20 удалений

Просмотреть файл

@ -535,10 +535,7 @@ module.exports = {
{
// TODO: Bug 1609271 Fix all violations for ChromeUtils.import(..., null)
files: [
"browser/base/content/test/forms/head.js",
"browser/base/content/test/general/browser_datachoices_notification.js",
"browser/base/content/test/sync/browser_fxa_web_channel.js",
"browser/base/content/test/webextensions/head.js",
"browser/components/customizableui/test/browser_1042100_default_placements_update.js",
"browser/components/customizableui/test/browser_1096763_seen_widgets_post_reset.js",
"browser/components/customizableui/test/browser_1161838_inserted_new_default_buttons.js",
@ -553,7 +550,6 @@ module.exports = {
"browser/components/migration/tests/unit/test_Edge_db_migration.js",
"browser/components/translation/test/unit/test_cld2.js",
"browser/extensions/formautofill/test/unit/test_sync.js",
"browser/extensions/report-site-issue/test/browser/head.js",
"devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_addons_debug_popup.js",
"dom/ipc/tests/browser_memory_distribution_telemetry.js",
"dom/push/test/xpcshell/head.js",

Просмотреть файл

@ -2,8 +2,7 @@ function hideSelectPopup(selectPopup, mode = "enter", win = window) {
let browser = win.gBrowser.selectedBrowser;
let selectClosedPromise = SpecialPowers.spawn(browser, [], async function() {
let { SelectContentHelper } = ChromeUtils.import(
"resource://gre/actors/SelectChild.jsm",
null
"resource://gre/actors/SelectChild.jsm"
);
return ContentTaskUtils.waitForCondition(() => !SelectContentHelper.open);
});

Просмотреть файл

@ -31,19 +31,18 @@ const TEST_POLICY_VERSION = 37;
function fakeShowPolicyTimeout(set, clear) {
let reportingPolicy = ChromeUtils.import(
"resource://gre/modules/TelemetryReportingPolicy.jsm",
null
"resource://gre/modules/TelemetryReportingPolicy.jsm"
).Policy;
reportingPolicy.setShowInfobarTimeout = set;
reportingPolicy.clearShowInfobarTimeout = clear;
}
function sendSessionRestoredNotification() {
let reportingPolicyImpl = ChromeUtils.import(
"resource://gre/modules/TelemetryReportingPolicy.jsm",
null
).TelemetryReportingPolicyImpl;
reportingPolicyImpl.observe(null, "sessionstore-windows-restored", null);
let reportingPolicy = ChromeUtils.import(
"resource://gre/modules/TelemetryReportingPolicy.jsm"
).Policy;
reportingPolicy.fakeSessionRestoreNotification();
}
/**

Просмотреть файл

@ -20,9 +20,8 @@ XPCOMUtils.defineLazyGetter(this, "Management", () => {
return Management;
});
ChromeUtils.import(
"resource://testing-common/CustomizableUITestUtils.jsm",
this
let { CustomizableUITestUtils } = ChromeUtils.import(
"resource://testing-common/CustomizableUITestUtils.jsm"
);
let gCUITestUtils = new CustomizableUITestUtils(window);

Просмотреть файл

@ -7,8 +7,7 @@ ChromeUtils.defineModuleGetter(
);
const { Management } = ChromeUtils.import(
"resource://gre/modules/Extension.jsm",
null
"resource://gre/modules/Extension.jsm"
);
const PREF_WC_REPORTER_ENABLED = "extensions.webcompat-reporter.enabled";

Просмотреть файл

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["SelectChild"];
var EXPORTED_SYMBOLS = ["SelectChild", "SelectContentHelper"];
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"

Просмотреть файл

@ -56,8 +56,14 @@ var Policy = {
now: () => new Date(),
setShowInfobarTimeout: (callback, delayMs) => setTimeout(callback, delayMs),
clearShowInfobarTimeout: id => clearTimeout(id),
fakeSessionRestoreNotification: () => {
TelemetryReportingPolicyImpl.observe(
null,
"sessionstore-windows-restored",
null
);
},
};
/**
* Represents a request to display data policy.
*