Commit 07f6cf42 authored by Mark Banner's avatar Mark Banner
Browse files

Bug 1745977 - Stop using the second argument to ChromeUtils.import in various...

Bug 1745977 - Stop using the second argument to ChromeUtils.import in various files in services/. r=markh

Differential Revision: https://phabricator.services.mozilla.com/D133776
parent 315d8e83
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -550,16 +550,6 @@ module.exports = {
        "dom/push/test/xpcshell/head.js",
        "dom/push/test/xpcshell/test_broadcast_success.js",
        "dom/push/test/xpcshell/test_crypto.js",
        "services/common/tests/unit/head_helpers.js",
        "services/common/tests/unit/test_uptake_telemetry.js",
        "services/fxaccounts/tests/xpcshell/test_accounts.js",
        "services/fxaccounts/tests/xpcshell/test_accounts_device_registration.js",
        "services/fxaccounts/tests/xpcshell/test_loginmgr_storage.js",
        "services/fxaccounts/tests/xpcshell/test_oauth_token_storage.js",
        "services/fxaccounts/tests/xpcshell/test_oauth_tokens.js",
        "services/fxaccounts/tests/xpcshell/test_web_channel.js",
        "services/sync/modules-testing/utils.js",
        "services/sync/tests/unit/test_postqueue.js",
        "toolkit/components/cloudstorage/tests/unit/test_cloudstorage.js",
        "toolkit/components/crashes/tests/xpcshell/test_crash_manager.js",
        "toolkit/components/crashes/tests/xpcshell/test_crash_service.js",
+5 −9
Original line number Diff line number Diff line
@@ -282,19 +282,15 @@ function checkUptakeTelemetry(snapshot1, snapshot2, expectedIncrements) {
}

async function withFakeChannel(channel, f) {
  const module = ChromeUtils.import(
    "resource://services-common/uptake-telemetry.js",
    null
  const { Policy } = ChromeUtils.import(
    "resource://services-common/uptake-telemetry.js"
  );
  const oldPolicy = module.Policy;
  module.Policy = {
    ...oldPolicy,
    getChannel: () => channel,
  };
  let oldGetChannel = Policy.getChannel;
  Policy.getChannel = () => channel;
  try {
    return await f();
  } finally {
    module.Policy = oldPolicy;
    Policy.getChannel = oldGetChannel;
  }
}

+6 −12
Original line number Diff line number Diff line
const { ClientID } = ChromeUtils.import("resource://gre/modules/ClientID.jsm");
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { TelemetryTestUtils } = ChromeUtils.import(
  "resource://testing-common/TelemetryTestUtils.jsm"
);
@@ -10,20 +8,16 @@ const { UptakeTelemetry } = ChromeUtils.import(
const COMPONENT = "remotesettings";

async function withFakeClientID(uuid, f) {
  const module = ChromeUtils.import(
    "resource://services-common/uptake-telemetry.js",
    null
  const { Policy } = ChromeUtils.import(
    "resource://services-common/uptake-telemetry.js"
  );
  const oldPolicy = module.Policy;
  module.Policy = {
    ...oldPolicy,
    _clientIDHash: null,
    getClientID: () => Promise.resolve(uuid),
  };
  let oldGetClientID = Policy.getClientID;
  Policy._clientIDHash = null;
  Policy.getClientID = () => Promise.resolve(uuid);
  try {
    return await f();
  } finally {
    module.Policy = oldPolicy;
    Policy.getClientID = oldGetClientID;
  }
}

+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@

"use strict";

var EXPORTED_SYMBOLS = ["UptakeTelemetry"];
var EXPORTED_SYMBOLS = ["UptakeTelemetry", "Policy"];

const { XPCOMUtils } = ChromeUtils.import(
  "resource://gre/modules/XPCOMUtils.jsm"
+2 −1
Original line number Diff line number Diff line
@@ -1622,4 +1622,5 @@ XPCOMUtils.defineLazyGetter(this, "fxAccounts", function() {
  return a;
});

var EXPORTED_SYMBOLS = ["fxAccounts", "FxAccounts"];
// `AccountState` is exported for tests.
var EXPORTED_SYMBOLS = ["fxAccounts", "FxAccounts", "AccountState"];
Loading