зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1758107 - Stop using ChromeUtils.import(..., null) for importing modules in dom/push/test/xpcshell/head.js. r=mt
Also tidy up how imports are managed. Differential Revision: https://phabricator.services.mozilla.com/D140322
This commit is contained in:
Родитель
8c95812b32
Коммит
e215b57446
|
@ -541,7 +541,6 @@ module.exports = {
|
|||
{
|
||||
// TODO: Bug 1609271 Fix all violations for ChromeUtils.import(..., null)
|
||||
files: [
|
||||
"dom/push/test/xpcshell/head.js",
|
||||
"dom/push/test/xpcshell/test_broadcast_success.js",
|
||||
"dom/push/test/xpcshell/test_crypto.js",
|
||||
"toolkit/mozapps/extensions/internal/AddonTestUtils.jsm",
|
||||
|
|
|
@ -52,7 +52,12 @@ const CONNECTION_PROTOCOLS = (function() {
|
|||
return [PushServiceAndroidGCM];
|
||||
})();
|
||||
|
||||
const EXPORTED_SYMBOLS = ["PushService"];
|
||||
const EXPORTED_SYMBOLS = [
|
||||
"PushService",
|
||||
// The items below are exported for test purposes.
|
||||
"PushServiceHttp2",
|
||||
"PushServiceWebSocket",
|
||||
];
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "console", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
|
|
|
@ -6,7 +6,20 @@
|
|||
var { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
|
||||
PermissionTestUtils: "resource://testing-common/PermissionTestUtils.jsm",
|
||||
pushBroadcastService: "resource://gre/modules/PushBroadcastService.jsm",
|
||||
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.jsm",
|
||||
PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
|
||||
Preferences: "resource://gre/modules/Preferences.jsm",
|
||||
PushCrypto: "resource://gre/modules/PushCrypto.jsm",
|
||||
PushService: "resource://gre/modules/PushService.jsm",
|
||||
PushServiceHttp2: "resource://gre/modules/PushService.jsm",
|
||||
PushServiceWebSocket: "resource://gre/modules/PushService.jsm",
|
||||
Services: "resource://gre/modules/Services.jsm",
|
||||
});
|
||||
var {
|
||||
clearInterval,
|
||||
clearTimeout,
|
||||
|
@ -15,30 +28,7 @@ var {
|
|||
setTimeout,
|
||||
setTimeoutWithTarget,
|
||||
} = ChromeUtils.import("resource://gre/modules/Timer.jsm");
|
||||
var { Preferences } = ChromeUtils.import(
|
||||
"resource://gre/modules/Preferences.jsm"
|
||||
);
|
||||
var { PlacesUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/PlacesUtils.jsm"
|
||||
);
|
||||
var { ObjectUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/ObjectUtils.jsm"
|
||||
);
|
||||
var { PermissionTestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/PermissionTestUtils.jsm"
|
||||
);
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"PlacesTestUtils",
|
||||
"resource://testing-common/PlacesTestUtils.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"pushBroadcastService",
|
||||
"resource://gre/modules/PushBroadcastService.jsm",
|
||||
{}
|
||||
);
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
this,
|
||||
"PushServiceComponent",
|
||||
|
@ -46,10 +36,6 @@ XPCOMUtils.defineLazyServiceGetter(
|
|||
"nsIPushService"
|
||||
);
|
||||
|
||||
const serviceExports = ChromeUtils.import(
|
||||
"resource://gre/modules/PushService.jsm",
|
||||
null
|
||||
);
|
||||
const servicePrefs = new Preferences("dom.push.");
|
||||
|
||||
const WEBSOCKET_CLOSE_GOING_AWAY = 1001;
|
||||
|
@ -62,7 +48,7 @@ var isParent =
|
|||
// Stop and clean up after the PushService.
|
||||
Services.obs.addObserver(function observe(subject, topic, data) {
|
||||
Services.obs.removeObserver(observe, topic);
|
||||
serviceExports.PushService.uninit();
|
||||
PushService.uninit();
|
||||
// Occasionally, `profile-change-teardown` and `xpcom-shutdown` will fire
|
||||
// before the PushService and AlarmService finish writing to IndexedDB. This
|
||||
// causes spurious errors and crashes, so we spin the event loop to let the
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
// Create the profile directory early to ensure pushBroadcastService
|
||||
// is initialized with the correct path
|
||||
do_get_profile();
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
var db;
|
||||
var unregisterDefers = {};
|
||||
var userAgentID = "4ce480ef-55b2-4f83-924c-dcd35ab978b4";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const { PushService, PushServiceWebSocket } = serviceExports;
|
||||
const { ForgetAboutSite } = ChromeUtils.import(
|
||||
"resource://gre/modules/ForgetAboutSite.jsm"
|
||||
);
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "bd744428-f125-436a-b6d0-dd0c9845837f";
|
||||
|
||||
let clearForPattern = async function(testRecords, pattern) {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "2c43af06-ab6e-476a-adc4-16cbda54fb89";
|
||||
|
||||
var db;
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
var userAgentID = "5ab1d1df-7a3d-4024-a469-b9e1bb399fad";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
let db;
|
||||
let userAgentID = "f5b47f8d-771f-4ea3-b999-91c135f8766d";
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "1500e7d9-8cbe-4ee6-98da-7fa5d6a39852";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "3c7462fc-270f-45be-a459-b9d631b0d093";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "1ca1cf66-eeb4-4df7-87c1-d5c92906ab90";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "ba31ac13-88d4-4984-8e6b-8731315a7cf8";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "2c43af06-ab6e-476a-adc4-16cbda54fb89";
|
||||
|
||||
let db;
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "7eb873f9-8d47-4218-804b-fff78dc04e88";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "28cd09e2-7506-42d8-9e50-b02785adc7ef";
|
||||
|
||||
var db;
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "aaabf1f8-2f68-44f1-a920-b88e9e7d7559";
|
||||
const nsIPushQuotaManager = Ci.nsIPushQuotaManager;
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
setPrefs({
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const { PushDB, PushService, PushServiceHttp2 } = serviceExports;
|
||||
|
||||
var httpServer = null;
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "serverPort", function() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "1760b1f5-c3ba-40e3-9344-adef7c18ab12";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "9ce1e6d3-7bdb-4fe9-90a5-def1d64716f1";
|
||||
const channelID = "c26892c5-6e08-4c16-9f0c-0044697b4d85";
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "52b2b04c-b6cc-42c6-abdf-bef9cbdbea00";
|
||||
const channelID = "cafed00d";
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "c9a12e81-ea5e-40f9-8bf4-acee34621671";
|
||||
const channelID = "c0660af8-b532-4931-81f0-9fd27a12d6ab";
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "8271186b-8073-43a3-adf6-225bd44a8b0a";
|
||||
const channelID = "2d08571e-feab-48a0-9f05-8254c3c7e61f";
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
var userAgentID = "9a2f9efe-2ebb-4bcb-a5d9-9e2b73d30afe";
|
||||
var channelID = "264c2ba0-f6db-4e84-acdb-bd225b62d9e3";
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
setPrefs({
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "b2546987-4f63-49b1-99f7-739cd3c40e44";
|
||||
const channelID = "35a820f7-d7dd-43b3-af21-d65352212ae3";
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "bd744428-f125-436a-b6d0-dd0c9845837f";
|
||||
const channelID = "0ef2ad4a-6c49-41ad-af6e-95d2425276bf";
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "a4be0df9-b16d-4b5f-8f58-0f93b6f1e23d";
|
||||
const channelID = "e1944e0b-48df-45e7-bdc0-d1fbaa7986d3";
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "84afc774-6995-40d1-9c90-8c34ddcd0cb4";
|
||||
const clientChannelID = "4b42a681c99e4dfbbb166a7e01a09b8b";
|
||||
const serverChannelID = "3f5aeb89c6e8405a9569619522783436";
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService } = serviceExports;
|
||||
|
||||
const userAgentID = "c293fdc5-a75e-4eb1-af88-a203991c0787";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
setPrefs({
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceHttp2 } = serviceExports;
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
run_next_test();
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService } = serviceExports;
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
setPrefs();
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService } = serviceExports;
|
||||
|
||||
const userAgentID = "a722e448-c481-4c48-aea0-fc411cb7c9ed";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "997ee7ba-36b1-4526-ae9e-2d3f38d6efe8";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceHttp2 } = serviceExports;
|
||||
|
||||
var serverPort = -1;
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const { PushDB, PushService, PushServiceHttp2 } = serviceExports;
|
||||
|
||||
var httpServer = null;
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "serverPort", function() {
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const { PushDB, PushService, PushServiceHttp2 } = serviceExports;
|
||||
|
||||
var httpServer = null;
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "serverPort", function() {
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const { PushDB, PushService, PushServiceHttp2 } = serviceExports;
|
||||
|
||||
var httpServer = null;
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "serverPort", function() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "05f7b940-51b6-4b6f-8032-b83ebb577ded";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
Cu.importGlobalProperties(["crypto"]);
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
var db;
|
||||
|
||||
function done() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
setPrefs();
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService } = serviceExports;
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
setPrefs();
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const channelID = "00c7fa13-7b71-447d-bd27-a91abc09d1b2";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "7f0af1bb-7e1f-4fb8-8e4a-e8de434abde3";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService } = serviceExports;
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
setPrefs();
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceWebSocket } = serviceExports;
|
||||
|
||||
const userAgentID = "fbe865a6-aeb8-446f-873c-aeebdb8d493c";
|
||||
const channelID = "db0a7021-ec2d-4bd3-8802-7a6966f10ed8";
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { PushDB, PushService, PushServiceHttp2 } = serviceExports;
|
||||
|
||||
var pushEnabled;
|
||||
var pushConnectionEnabled;
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const { PushDB, PushService, PushServiceHttp2 } = serviceExports;
|
||||
|
||||
var httpServer = null;
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "serverPort", function() {
|
||||
|
|
|
@ -3,13 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
PushDB,
|
||||
PushService,
|
||||
PushServiceWebSocket,
|
||||
PushCrypto,
|
||||
} = serviceExports;
|
||||
|
||||
const userAgentID = "4dffd396-6582-471d-8c0c-84f394e9f7db";
|
||||
|
||||
function run_test() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче