mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1667455 - Part 7: Stop importing Services.jsm from chrome-priv JS code, lazy cases. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D150896
This commit is contained in:
parent
47c8f80432
commit
c2a1238034
@ -2,8 +2,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const lazy = {};
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const lazy = {};
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
|
@ -23,7 +23,6 @@ const tabsSetupFlowManager = new (class {
|
||||
this.sync = {};
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
Services: "resource://gre/modules/Services.jsm",
|
||||
SyncedTabs: "resource://services-sync/SyncedTabs.jsm",
|
||||
});
|
||||
XPCOMUtils.defineLazyGetter(this, "fxAccounts", () => {
|
||||
@ -103,17 +102,17 @@ const tabsSetupFlowManager = new (class {
|
||||
async initialize(elem) {
|
||||
this.elem = elem;
|
||||
this.elem.addEventListener("click", this);
|
||||
this.Services.obs.addObserver(this, this.sync.UIState.ON_UPDATE);
|
||||
this.Services.obs.addObserver(this, "fxaccounts:device_connected");
|
||||
this.Services.obs.addObserver(this, "fxaccounts:device_disconnected");
|
||||
Services.obs.addObserver(this, this.sync.UIState.ON_UPDATE);
|
||||
Services.obs.addObserver(this, "fxaccounts:device_connected");
|
||||
Services.obs.addObserver(this, "fxaccounts:device_disconnected");
|
||||
|
||||
await this.fxAccounts.getSignedInUser();
|
||||
this.maybeUpdateUI();
|
||||
}
|
||||
uninit() {
|
||||
this.Services.obs.removeObserver(this, this.sync.UIState.ON_UPDATE);
|
||||
this.Services.obs.removeObserver(this, "fxaccounts:device_connected");
|
||||
this.Services.obs.removeObserver(this, "fxaccounts:device_disconnected");
|
||||
Services.obs.removeObserver(this, this.sync.UIState.ON_UPDATE);
|
||||
Services.obs.removeObserver(this, "fxaccounts:device_connected");
|
||||
Services.obs.removeObserver(this, "fxaccounts:device_disconnected");
|
||||
}
|
||||
get fxaSignedIn() {
|
||||
return (
|
||||
@ -201,7 +200,7 @@ const tabsSetupFlowManager = new (class {
|
||||
syncOpenTabs(containerElem) {
|
||||
// Flip the pref on.
|
||||
// The observer should trigger re-evaluating state and advance to next step
|
||||
this.Services.prefs.setBoolPref(SYNC_TABS_PREF, true);
|
||||
Services.prefs.setBoolPref(SYNC_TABS_PREF, true);
|
||||
}
|
||||
})();
|
||||
|
||||
@ -210,9 +209,6 @@ class TabsPickupContainer extends HTMLElement {
|
||||
super();
|
||||
this.manager = null;
|
||||
this._currentSetupStateIndex = -1;
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
Services: "resource://gre/modules/Services.jsm",
|
||||
});
|
||||
}
|
||||
get setupContainerElem() {
|
||||
return this.querySelector(".sync-setup-container");
|
||||
@ -251,7 +247,7 @@ class TabsPickupContainer extends HTMLElement {
|
||||
}
|
||||
for (let elem of cloned.querySelectorAll("a[data-support-url]")) {
|
||||
elem.href =
|
||||
this.Services.urlFormatter.formatURLPref("app.support.baseURL") +
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL") +
|
||||
elem.dataset.supportUrl;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ const { createLazyLoaders } = ChromeUtils.import(
|
||||
);
|
||||
|
||||
const lazy = createLazyLoaders({
|
||||
Services: () => ChromeUtils.import("resource://gre/modules/Services.jsm"),
|
||||
CustomizableUI: () =>
|
||||
ChromeUtils.import("resource:///modules/CustomizableUI.jsm"),
|
||||
CustomizableWidgets: () =>
|
||||
@ -99,7 +98,6 @@ function openPopup(document) {
|
||||
function initialize(toggleProfilerKeyShortcuts) {
|
||||
const { CustomizableUI } = lazy.CustomizableUI();
|
||||
const { CustomizableWidgets } = lazy.CustomizableWidgets();
|
||||
const { Services } = lazy.Services();
|
||||
|
||||
const widget = CustomizableUI.getWidget(WIDGET_ID);
|
||||
if (widget && widget.provider == CustomizableUI.PROVIDER_API) {
|
||||
|
@ -24,7 +24,6 @@ const { createLazyLoaders } = ChromeUtils.import(
|
||||
);
|
||||
|
||||
const lazy = createLazyLoaders({
|
||||
Services: () => ChromeUtils.import("resource://gre/modules/Services.jsm"),
|
||||
PanelMultiView: () =>
|
||||
ChromeUtils.import("resource:///modules/PanelMultiView.jsm"),
|
||||
Background: () =>
|
||||
@ -117,7 +116,6 @@ function createViewControllers(state, elements) {
|
||||
},
|
||||
|
||||
updatePresets() {
|
||||
const { Services } = lazy.Services();
|
||||
const { presets, getRecordingSettings } = lazy.Background();
|
||||
const { presetName } = getRecordingSettings(
|
||||
"aboutprofiling",
|
||||
@ -146,8 +144,6 @@ function createViewControllers(state, elements) {
|
||||
},
|
||||
|
||||
updateProfilerState() {
|
||||
const { Services } = lazy.Services();
|
||||
|
||||
if (Services.profiler.IsActive()) {
|
||||
elements.inactive.hidden = true;
|
||||
elements.active.hidden = false;
|
||||
@ -170,7 +166,6 @@ function createViewControllers(state, elements) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { Services } = lazy.Services();
|
||||
const { presets } = lazy.Background();
|
||||
const currentPreset = Services.prefs.getCharPref(
|
||||
"devtools.performance.recording.preset"
|
||||
@ -327,8 +322,6 @@ function addPopupEventHandlers(state, elements, view) {
|
||||
});
|
||||
|
||||
// Update the view when the profiler starts/stops.
|
||||
const { Services } = lazy.Services();
|
||||
|
||||
// These are all events that can affect the current state of the profiler.
|
||||
const events = ["profiler-started", "profiler-stopped"];
|
||||
for (const event of events) {
|
||||
|
Loading…
Reference in New Issue
Block a user