Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
chore(mc): Port Bug 1464548: Part 3 - Update callers to use defineLaz…
Browse files Browse the repository at this point in the history
…yGlobalGetters. r=mccr8

Switched to warning eslint no-undef because https://hg.mozilla.org/mozilla-central/rev/a6e7bfa38103 will be available in something newer than 0.13.1.
  • Loading branch information
Mardak committed Jun 8, 2018
1 parent 8166de8 commit 0cf21c4
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Expand Up @@ -33,6 +33,8 @@ module.exports = {
}
}],
"rules": {
"no-undef": 1, // Override eslint-plugin-mozilla until 0.13.1+ is available

"promise/catch-or-return": 2,
"promise/param-names": 2,

Expand Down
2 changes: 1 addition & 1 deletion bootstrap.js
Expand Up @@ -4,7 +4,7 @@
"use strict";

ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.importGlobalProperties(["fetch"]);
XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);

ChromeUtils.defineModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
Expand Down
3 changes: 2 additions & 1 deletion lib/ASRouter.jsm
Expand Up @@ -4,7 +4,8 @@
"use strict";

ChromeUtils.import("resource://gre/modules/Services.jsm");
Cu.importGlobalProperties(["fetch"]);
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);
const {ASRouterActions: ra} = ChromeUtils.import("resource://activity-stream/common/Actions.jsm", {});
const {OnboardingMessageProvider} = ChromeUtils.import("resource://activity-stream/lib/OnboardingMessageProvider.jsm", {});

Expand Down
4 changes: 3 additions & 1 deletion lib/AboutPreferences.jsm
Expand Up @@ -3,11 +3,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";

Cu.importGlobalProperties(["fetch"]);
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PluralForm", "resource://gre/modules/PluralForm.jsm");
const {actionTypes: at} = ChromeUtils.import("resource://activity-stream/common/Actions.jsm", {});

XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);

const PREFERENCES_LOADED_EVENT = "home-pane-loaded";
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

Expand Down
3 changes: 2 additions & 1 deletion lib/DownloadsManager.jsm
@@ -1,5 +1,6 @@
ChromeUtils.import("resource://gre/modules/Services.jsm");
Cu.importGlobalProperties(["URL"]);
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]);

const {actionTypes: at} = ChromeUtils.import("resource://activity-stream/common/Actions.jsm", {});

Expand Down
2 changes: 1 addition & 1 deletion lib/FaviconFeed.jsm
Expand Up @@ -5,7 +5,7 @@

ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

Cu.importGlobalProperties(["fetch", "URL"]);
XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);

const {actionTypes: at} = ChromeUtils.import("resource://activity-stream/common/Actions.jsm", {});
const {PersistentCache} = ChromeUtils.import("resource://activity-stream/lib/PersistentCache.jsm", {});
Expand Down
2 changes: 1 addition & 1 deletion lib/ShortURL.jsm
Expand Up @@ -3,7 +3,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");

XPCOMUtils.defineLazyServiceGetter(this, "IDNService", "@mozilla.org/network/idn-service;1", "nsIIDNService");

Cu.importGlobalProperties(["URL"]);
XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]);

/**
* Properly convert internationalized domain names.
Expand Down
4 changes: 3 additions & 1 deletion lib/TippyTopProvider.jsm
Expand Up @@ -2,7 +2,9 @@
* 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/. */

Cu.importGlobalProperties(["fetch", "URL"]);
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

XPCOMUtils.defineLazyGlobalGetters(this, ["fetch", "URL"]);

const TIPPYTOP_JSON_PATH = "resource://activity-stream/data/content/tippytop/top_sites.json";
const TIPPYTOP_URL_PREFIX = "resource://activity-stream/data/content/tippytop/images/";
Expand Down
2 changes: 1 addition & 1 deletion lib/TopStoriesFeed.jsm
Expand Up @@ -6,7 +6,7 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/NewTabUtils.jsm");
Cu.importGlobalProperties(["fetch"]);
XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);

const {actionTypes: at, actionCreators: ac} = ChromeUtils.import("resource://activity-stream/common/Actions.jsm", {});
const {Prefs} = ChromeUtils.import("resource://activity-stream/lib/ActivityStreamPrefs.jsm", {});
Expand Down
2 changes: 1 addition & 1 deletion ping-centre/PingCentre.jsm
Expand Up @@ -4,7 +4,7 @@

ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.importGlobalProperties(["fetch"]);
XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);

ChromeUtils.defineModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
Expand Down
1 change: 1 addition & 0 deletions test/unit/unit-entry.js
Expand Up @@ -171,6 +171,7 @@ const TEST_GLOBAL = {
},
XPCOMUtils: {
defineLazyGetter(_1, _2, f) { f(); },
defineLazyGlobalGetters() {},
defineLazyModuleGetter() {},
defineLazyServiceGetter() {},
generateQI() { return {}; }
Expand Down

0 comments on commit 0cf21c4

Please sign in to comment.