зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1834115 - migrate newtab/lib JSMs that do not import modules to ESMs r=Standard8,fxview-reviewers,omc-reviewers,aminomancer,sfoster
Differential Revision: https://phabricator.services.mozilla.com/D178568
This commit is contained in:
Родитель
ecc15a8a0d
Коммит
0c1a6fdd6a
|
@ -814,7 +814,7 @@ module.exports = {
|
|||
"browser/components/firefoxview/tests/browser/browser_recently_closed_tabs.js",
|
||||
"browser/components/newtab/content-src/components/DiscoveryStreamComponents/TopSites/TopSites.jsx ",
|
||||
"browser/components/newtab/content-src/components/TopSites/TopSiteForm.jsx ",
|
||||
"browser/components/newtab/lib/CFRMessageProvider.jsm ",
|
||||
"browser/components/newtab/lib/CFRMessageProvider.sys.mjs ",
|
||||
"browser/components/newtab/lib/PlacesFeed.jsm ",
|
||||
"browser/components/originattributes/test/browser/browser_broadcastChannel.js",
|
||||
"browser/components/originattributes/test/browser/browser_cache.js",
|
||||
|
|
|
@ -10,6 +10,8 @@ const lazy = {};
|
|||
// Ignore unused lazy property for PluginManager.
|
||||
// eslint-disable-next-line mozilla/valid-lazy
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
ASRouterNewTabHook:
|
||||
"resource://activity-stream/lib/ASRouterNewTabHook.sys.mjs",
|
||||
ActorManagerParent: "resource://gre/modules/ActorManagerParent.sys.mjs",
|
||||
AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.sys.mjs",
|
||||
AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs",
|
||||
|
@ -80,7 +82,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
|||
AddonManager: "resource://gre/modules/AddonManager.jsm",
|
||||
ASRouterDefaultConfig:
|
||||
"resource://activity-stream/lib/ASRouterDefaultConfig.jsm",
|
||||
ASRouterNewTabHook: "resource://activity-stream/lib/ASRouterNewTabHook.jsm",
|
||||
ASRouter: "resource://activity-stream/lib/ASRouter.jsm",
|
||||
Blocklist: "resource://gre/modules/Blocklist.jsm",
|
||||
BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm",
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs",
|
||||
getSearchProvider: "resource://activity-stream/lib/SearchShortcuts.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AboutNewTab: "resource:///modules/AboutNewTab.jsm",
|
||||
shortURL: "resource://activity-stream/lib/ShortURL.jsm",
|
||||
getSearchProvider: "resource://activity-stream/lib/SearchShortcuts.jsm",
|
||||
});
|
||||
|
||||
const SHORTCUTS_PREF =
|
||||
|
|
|
@ -23,8 +23,8 @@ const { UIState } = ChromeUtils.importESModule(
|
|||
const { sinon } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/Sinon.sys.mjs"
|
||||
);
|
||||
const { FeatureCalloutMessages } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/FeatureCalloutMessages.jsm"
|
||||
const { FeatureCalloutMessages } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/FeatureCalloutMessages.sys.mjs"
|
||||
);
|
||||
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
||||
|
@ -349,7 +349,7 @@ async function tearDown(sandbox) {
|
|||
* `browser.firefox-view.feature-tour` to change the feature tour's
|
||||
* UI state.
|
||||
*
|
||||
* @see FeatureCalloutMessages.jsm for valid values of "screen"
|
||||
* @see FeatureCalloutMessages.sys.mjs for valid values of "screen"
|
||||
*
|
||||
* @param {number} screen The full ID of the feature callout screen
|
||||
* @return {string} JSON string used to set
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
|
||||
import { MESSAGE_TYPE_HASH } from "resource://activity-stream/common/ActorConstants.sys.mjs";
|
||||
|
||||
const { ASRouterNewTabHook } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouterNewTabHook.jsm"
|
||||
);
|
||||
import { ASRouterNewTabHook } from "resource://activity-stream/lib/ASRouterNewTabHook.sys.mjs";
|
||||
|
||||
const { ASRouterDefaultConfig } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouterDefaultConfig.jsm"
|
||||
);
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
// This is loaded into all XUL windows. Wrap in a block to prevent
|
||||
// leaking to window scope.
|
||||
{
|
||||
const { RemoteL10n } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/RemoteL10n.jsm"
|
||||
const { RemoteL10n } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/RemoteL10n.sys.mjs"
|
||||
);
|
||||
class MozTextParagraph extends HTMLElement {
|
||||
constructor() {
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { CFRMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.jsm"
|
||||
const { CFRMessageProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.sys.mjs"
|
||||
);
|
||||
const { OnboardingMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/OnboardingMessageProvider.jsm"
|
||||
);
|
||||
const { PanelTestProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/PanelTestProvider.jsm"
|
||||
const { PanelTestProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/PanelTestProvider.sys.mjs"
|
||||
);
|
||||
|
||||
const CWD = Services.dirsvc.get("CurWorkD", Ci.nsIFile).path;
|
||||
|
|
|
@ -130,7 +130,7 @@ module.exports = function (config) {
|
|||
functions: 100,
|
||||
branches: 84,
|
||||
},
|
||||
"lib/UTEventReporting.jsm": {
|
||||
"lib/UTEventReporting.sys.mjs": {
|
||||
statements: 100,
|
||||
lines: 100,
|
||||
functions: 100,
|
||||
|
@ -333,7 +333,7 @@ module.exports = function (config) {
|
|||
path.resolve("lib/ASRouterTargeting.jsm"),
|
||||
path.resolve("lib/ASRouterTriggerListeners.jsm"),
|
||||
path.resolve("lib/OnboardingMessageProvider.jsm"),
|
||||
path.resolve("lib/CFRMessageProvider.jsm"),
|
||||
path.resolve("lib/CFRMessageProvider.sys.mjs"),
|
||||
path.resolve("lib/CFRPageActions.jsm"),
|
||||
],
|
||||
},
|
||||
|
|
|
@ -17,6 +17,10 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs",
|
||||
MacAttribution: "resource:///modules/MacAttribution.sys.mjs",
|
||||
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
|
||||
PanelTestProvider: "resource://activity-stream/lib/PanelTestProvider.sys.mjs",
|
||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.sys.mjs",
|
||||
SnippetsTestMessageProvider:
|
||||
"resource://activity-stream/lib/SnippetsTestMessageProvider.sys.mjs",
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs",
|
||||
TargetingContext: "resource://messaging-system/targeting/Targeting.sys.mjs",
|
||||
|
@ -25,9 +29,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
SnippetsTestMessageProvider:
|
||||
"resource://activity-stream/lib/SnippetsTestMessageProvider.jsm",
|
||||
PanelTestProvider: "resource://activity-stream/lib/PanelTestProvider.jsm",
|
||||
Spotlight: "resource://activity-stream/lib/Spotlight.jsm",
|
||||
ToastNotification: "resource://activity-stream/lib/ToastNotification.jsm",
|
||||
ToolbarBadgeHub: "resource://activity-stream/lib/ToolbarBadgeHub.jsm",
|
||||
|
@ -41,7 +42,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
|||
ASRouterTriggerListeners:
|
||||
"resource://activity-stream/lib/ASRouterTriggerListeners.jsm",
|
||||
KintoHttpClient: "resource://services-common/kinto-http-client.js",
|
||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetters(lazy, {
|
||||
|
@ -51,8 +51,8 @@ const { actionCreators: ac } = ChromeUtils.importESModule(
|
|||
"resource://activity-stream/common/Actions.sys.mjs"
|
||||
);
|
||||
|
||||
const { CFRMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.jsm"
|
||||
const { CFRMessageProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.sys.mjs"
|
||||
);
|
||||
const { OnboardingMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/OnboardingMessageProvider.jsm"
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
"use strict";
|
||||
|
||||
const EXPORTED_SYMBOLS = ["ASRouterNewTabHook"];
|
||||
|
||||
class ASRouterNewTabHookInstance {
|
||||
constructor() {
|
||||
|
@ -98,7 +95,7 @@ class AwaitSingleton {
|
|||
}
|
||||
}
|
||||
|
||||
const ASRouterNewTabHook = (() => {
|
||||
export const ASRouterNewTabHook = (() => {
|
||||
const singleton = new AwaitSingleton();
|
||||
const instance = new ASRouterNewTabHookInstance();
|
||||
return {
|
|
@ -9,13 +9,8 @@ const { AppConstants } = ChromeUtils.importESModule(
|
|||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"DEFAULT_SITES",
|
||||
"resource://activity-stream/lib/DefaultSites.jsm"
|
||||
);
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
DEFAULT_SITES: "resource://activity-stream/lib/DefaultSites.sys.mjs",
|
||||
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
|
||||
Region: "resource://gre/modules/Region.sys.mjs",
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
"use strict";
|
||||
|
||||
const FACEBOOK_CONTAINER_PARAMS = {
|
||||
existing_addons: [
|
||||
"@contain-facebook",
|
||||
|
@ -814,10 +814,8 @@ const CFR_MESSAGES = [
|
|||
},
|
||||
];
|
||||
|
||||
const CFRMessageProvider = {
|
||||
export const CFRMessageProvider = {
|
||||
getMessages() {
|
||||
return Promise.resolve(CFR_MESSAGES.filter(msg => !msg.exclude));
|
||||
},
|
||||
};
|
||||
|
||||
const EXPORTED_SYMBOLS = ["CFRMessageProvider"];
|
|
@ -12,10 +12,7 @@ const lazy = {};
|
|||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
CustomizableUI: "resource:///modules/CustomizableUI.sys.mjs",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.jsm",
|
||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
|
|
|
@ -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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const DEFAULT_SITES_MAP = new Map([
|
||||
// This first item is the global list fallback for any unexpected geos
|
||||
[
|
||||
|
@ -44,7 +42,5 @@ const DEFAULT_SITES_MAP = new Map([
|
|||
],
|
||||
]);
|
||||
|
||||
const EXPORTED_SYMBOLS = ["DEFAULT_SITES"];
|
||||
|
||||
// Immutable for export.
|
||||
const DEFAULT_SITES = Object.freeze(DEFAULT_SITES_MAP);
|
||||
export const DEFAULT_SITES = Object.freeze(DEFAULT_SITES_MAP);
|
|
@ -9,6 +9,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
|
||||
NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs",
|
||||
pktApi: "chrome://pocket/content/pktApi.sys.mjs",
|
||||
PersistentCache: "resource://activity-stream/lib/PersistentCache.sys.mjs",
|
||||
Region: "resource://gre/modules/Region.sys.mjs",
|
||||
RemoteSettings: "resource://services-settings/remote-settings.sys.mjs",
|
||||
});
|
||||
|
@ -18,11 +19,6 @@ const { setTimeout, clearTimeout } = ChromeUtils.importESModule(
|
|||
const { actionTypes: at, actionCreators: ac } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/common/Actions.sys.mjs"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"PersistentCache",
|
||||
"resource://activity-stream/lib/PersistentCache.jsm"
|
||||
);
|
||||
|
||||
const CACHE_KEY = "discovery_stream";
|
||||
const LAYOUT_UPDATE_TIME = 30 * 60 * 1000; // 30 minutes
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
const { actionTypes: at } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/common/Actions.sys.mjs"
|
||||
);
|
||||
const { getDomain } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/TippyTopProvider.jsm"
|
||||
const { getDomain } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/TippyTopProvider.sys.mjs"
|
||||
);
|
||||
const { RemoteSettings } = ChromeUtils.importESModule(
|
||||
"resource://services-settings/remote-settings.sys.mjs"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
"use strict";
|
||||
|
||||
// Eventually, make this a messaging system
|
||||
// provider instead of adding these message
|
||||
|
@ -642,10 +641,8 @@ const MESSAGES = () => {
|
|||
return messages;
|
||||
};
|
||||
|
||||
const FeatureCalloutMessages = {
|
||||
export const FeatureCalloutMessages = {
|
||||
getMessages() {
|
||||
return MESSAGES();
|
||||
},
|
||||
};
|
||||
|
||||
const EXPORTED_SYMBOLS = ["FeatureCalloutMessages"];
|
|
@ -28,12 +28,8 @@ ChromeUtils.defineModuleGetter(
|
|||
"FilterAdult",
|
||||
"resource://activity-stream/lib/FilterAdult.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"LinksCache",
|
||||
"resource://activity-stream/lib/LinksCache.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
LinksCache: "resource://activity-stream/lib/LinksCache.sys.mjs",
|
||||
NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs",
|
||||
PageThumbs: "resource://gre/modules/PageThumbs.sys.mjs",
|
||||
});
|
||||
|
|
|
@ -3,18 +3,11 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.jsm",
|
||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.sys.mjs",
|
||||
});
|
||||
|
||||
class InfoBarNotification {
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
"use strict";
|
||||
|
||||
const EXPORTED_SYMBOLS = ["LinksCache"];
|
||||
|
||||
// This should be slightly less than SYSTEM_TICK_INTERVAL as timer
|
||||
// comparisons are too exact while the async/await functionality will make the
|
||||
|
@ -18,7 +15,7 @@ const EXPIRATION_TIME = 4.5 * 60 * 1000; // 4.5 minutes
|
|||
* amount of time has passed. Allows for migrating data from previously cached
|
||||
* links to the new links with the same url.
|
||||
*/
|
||||
class LinksCache {
|
||||
export class LinksCache {
|
||||
/**
|
||||
* Create a links cache for a given object property.
|
||||
*
|
|
@ -10,8 +10,8 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
|
|||
const { AppConstants } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AppConstants.sys.mjs"
|
||||
);
|
||||
const { FeatureCalloutMessages } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/FeatureCalloutMessages.jsm"
|
||||
const { FeatureCalloutMessages } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/FeatureCalloutMessages.sys.mjs"
|
||||
);
|
||||
|
||||
const lazy = {};
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Methods for setting up and tearing down page event listeners. These are used
|
||||
* to dismiss Feature Callouts when the callout's anchor element is clicked.
|
||||
*/
|
||||
class PageEventManager {
|
||||
export class PageEventManager {
|
||||
/**
|
||||
* A set of parameters defining a page event listener.
|
||||
* @typedef {Object} PageEventListenerParams
|
||||
|
@ -93,5 +92,3 @@ class PageEventManager {
|
|||
this._listeners.clear();
|
||||
}
|
||||
}
|
||||
|
||||
const EXPORTED_SYMBOLS = ["PageEventManager"];
|
|
@ -1,7 +1,6 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
"use strict";
|
||||
|
||||
const TWO_DAYS = 2 * 24 * 3600 * 1000;
|
||||
|
||||
|
@ -615,7 +614,7 @@ const MESSAGES = () => [
|
|||
},
|
||||
];
|
||||
|
||||
const PanelTestProvider = {
|
||||
export const PanelTestProvider = {
|
||||
getMessages() {
|
||||
return Promise.resolve(
|
||||
MESSAGES().map(message => ({
|
||||
|
@ -625,5 +624,3 @@ const PanelTestProvider = {
|
|||
);
|
||||
},
|
||||
};
|
||||
|
||||
const EXPORTED_SYMBOLS = ["PanelTestProvider"];
|
|
@ -1,12 +1,11 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A file (disk) based persistent cache of a JSON serializable object.
|
||||
*/
|
||||
class PersistentCache {
|
||||
export class PersistentCache {
|
||||
/**
|
||||
* Create a cache object based on a name.
|
||||
*
|
||||
|
@ -91,5 +90,3 @@ class PersistentCache {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
const EXPORTED_SYMBOLS = ["PersistentCache"];
|
|
@ -1,7 +1,6 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* The downloaded Fluent file is located in this sub-directory of the local
|
||||
|
@ -132,7 +131,7 @@ const ALL_LOCALES = new Set([
|
|||
"zh-TW",
|
||||
]);
|
||||
|
||||
class _RemoteL10n {
|
||||
export class _RemoteL10n {
|
||||
constructor() {
|
||||
this._l10n = null;
|
||||
}
|
||||
|
@ -247,6 +246,4 @@ class _RemoteL10n {
|
|||
}
|
||||
}
|
||||
|
||||
const RemoteL10n = new _RemoteL10n();
|
||||
|
||||
const EXPORTED_SYMBOLS = ["RemoteL10n", "_RemoteL10n"];
|
||||
export const RemoteL10n = new _RemoteL10n();
|
|
@ -1,11 +1,10 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
"use strict";
|
||||
|
||||
// List of sites we match against Topsites in order to identify sites
|
||||
// that should be converted to search Topsites
|
||||
const SEARCH_SHORTCUTS = [
|
||||
export const SEARCH_SHORTCUTS = [
|
||||
{ keyword: "@amazon", shortURL: "amazon", url: "https://amazon.com" },
|
||||
{ keyword: "@\u767E\u5EA6", shortURL: "baidu", url: "https://baidu.com" },
|
||||
{ keyword: "@google", shortURL: "google", url: "https://google.com" },
|
||||
|
@ -17,7 +16,7 @@ const SEARCH_SHORTCUTS = [
|
|||
];
|
||||
|
||||
// These can be added via the editor but will not be added organically
|
||||
const CUSTOM_SEARCH_SHORTCUTS = [
|
||||
export const CUSTOM_SEARCH_SHORTCUTS = [
|
||||
...SEARCH_SHORTCUTS,
|
||||
{ keyword: "@bing", shortURL: "bing", url: "https://bing.com" },
|
||||
{
|
||||
|
@ -35,13 +34,16 @@ const CUSTOM_SEARCH_SHORTCUTS = [
|
|||
];
|
||||
|
||||
// Note: you must add the activity stream branch to the beginning of this if using outside activity stream
|
||||
const SEARCH_SHORTCUTS_EXPERIMENT = "improvesearch.topSiteSearchShortcuts";
|
||||
const SEARCH_SHORTCUTS_SEARCH_ENGINES_PREF =
|
||||
export const SEARCH_SHORTCUTS_EXPERIMENT =
|
||||
"improvesearch.topSiteSearchShortcuts";
|
||||
|
||||
export const SEARCH_SHORTCUTS_SEARCH_ENGINES_PREF =
|
||||
"improvesearch.topSiteSearchShortcuts.searchEngines";
|
||||
const SEARCH_SHORTCUTS_HAVE_PINNED_PREF =
|
||||
|
||||
export const SEARCH_SHORTCUTS_HAVE_PINNED_PREF =
|
||||
"improvesearch.topSiteSearchShortcuts.havePinned";
|
||||
|
||||
function getSearchProvider(candidateShortURL) {
|
||||
export function getSearchProvider(candidateShortURL) {
|
||||
return (
|
||||
SEARCH_SHORTCUTS.filter(match => candidateShortURL === match.shortURL)[0] ||
|
||||
null
|
||||
|
@ -51,26 +53,15 @@ function getSearchProvider(candidateShortURL) {
|
|||
// Get the search form URL for a given search keyword. This allows us to pick
|
||||
// different tippytop icons for the different variants. Sush as yandex.com vs. yandex.ru.
|
||||
// See more details in bug 1643523.
|
||||
async function getSearchFormURL(keyword) {
|
||||
export async function getSearchFormURL(keyword) {
|
||||
const engine = await Services.search.getEngineByAlias(keyword);
|
||||
return engine?.wrappedJSObject._searchForm;
|
||||
}
|
||||
|
||||
// Check topsite against predefined list of valid search engines
|
||||
// https://searchfox.org/mozilla-central/rev/ca869724246f4230b272ed1c8b9944596e80d920/toolkit/components/search/nsSearchService.js#939
|
||||
async function checkHasSearchEngine(keyword) {
|
||||
export async function checkHasSearchEngine(keyword) {
|
||||
return (await Services.search.getAppProvidedEngines()).find(
|
||||
e => e.aliases.includes(keyword) && !e.hidden
|
||||
);
|
||||
}
|
||||
|
||||
const EXPORTED_SYMBOLS = [
|
||||
"checkHasSearchEngine",
|
||||
"getSearchProvider",
|
||||
"getSearchFormURL",
|
||||
"SEARCH_SHORTCUTS",
|
||||
"CUSTOM_SEARCH_SHORTCUTS",
|
||||
"SEARCH_SHORTCUTS_EXPERIMENT",
|
||||
"SEARCH_SHORTCUTS_SEARCH_ENGINES_PREF",
|
||||
"SEARCH_SHORTCUTS_HAVE_PINNED_PREF",
|
||||
];
|
|
@ -1,7 +1,6 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
"use strict";
|
||||
|
||||
const TEST_ICON = "chrome://branding/content/icon64.png";
|
||||
const TEST_ICON_16 = "chrome://branding/content/icon16.png";
|
||||
|
@ -675,7 +674,7 @@ const MESSAGES = () => [
|
|||
},
|
||||
];
|
||||
|
||||
const SnippetsTestMessageProvider = {
|
||||
export const SnippetsTestMessageProvider = {
|
||||
getMessages() {
|
||||
return Promise.resolve(
|
||||
MESSAGES()
|
||||
|
@ -687,5 +686,3 @@ const SnippetsTestMessageProvider = {
|
|||
);
|
||||
},
|
||||
};
|
||||
|
||||
const EXPORTED_SYMBOLS = ["SnippetsTestMessageProvider"];
|
|
@ -33,20 +33,16 @@ ChromeUtils.defineModuleGetter(
|
|||
"PingCentre",
|
||||
"resource:///modules/PingCentre.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"UTEventReporting",
|
||||
"resource://activity-stream/lib/UTEventReporting.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
ClientID: "resource://gre/modules/ClientID.sys.mjs",
|
||||
ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs",
|
||||
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
|
||||
pktApi: "chrome://pocket/content/pktApi.sys.mjs",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||
TelemetryEnvironment: "resource://gre/modules/TelemetryEnvironment.sys.mjs",
|
||||
TelemetrySession: "resource://gre/modules/TelemetrySession.sys.mjs",
|
||||
UTEventReporting: "resource://activity-stream/lib/UTEventReporting.sys.mjs",
|
||||
UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs",
|
||||
pktApi: "chrome://pocket/content/pktApi.sys.mjs",
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
|
|
|
@ -9,7 +9,7 @@ const TIPPYTOP_JSON_PATH =
|
|||
/*
|
||||
* Get a domain from a url optionally stripping subdomains.
|
||||
*/
|
||||
function getDomain(url, strip = "www.") {
|
||||
export function getDomain(url, strip = "www.") {
|
||||
let domain = "";
|
||||
try {
|
||||
domain = new URL(url).hostname;
|
||||
|
@ -24,7 +24,7 @@ function getDomain(url, strip = "www.") {
|
|||
return domain;
|
||||
}
|
||||
|
||||
class TippyTopProvider {
|
||||
export class TippyTopProvider {
|
||||
constructor() {
|
||||
this._sitesByDomain = new Map();
|
||||
this.initialized = false;
|
||||
|
@ -58,5 +58,3 @@ class TippyTopProvider {
|
|||
return site;
|
||||
}
|
||||
}
|
||||
|
||||
const EXPORTED_SYMBOLS = ["TippyTopProvider", "getDomain"];
|
|
@ -11,10 +11,7 @@ const lazy = {};
|
|||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.jsm",
|
||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetters(lazy, {
|
||||
|
|
|
@ -12,13 +12,14 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
PanelMultiView: "resource:///modules/PanelMultiView.sys.mjs",
|
||||
Preferences: "resource://gre/modules/Preferences.sys.mjs",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.sys.mjs",
|
||||
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
EveryWindow: "resource:///modules/EveryWindow.jsm",
|
||||
RemoteL10n: "resource://activity-stream/lib/RemoteL10n.jsm",
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
lazy,
|
||||
|
|
|
@ -10,8 +10,8 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
|
|||
const { actionCreators: ac, actionTypes: at } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/common/Actions.sys.mjs"
|
||||
);
|
||||
const { TippyTopProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/TippyTopProvider.jsm"
|
||||
const { TippyTopProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/TippyTopProvider.sys.mjs"
|
||||
);
|
||||
const { insertPinned, TOP_SITES_MAX_SITES_PER_ROW } =
|
||||
ChromeUtils.importESModule(
|
||||
|
@ -34,7 +34,9 @@ const {
|
|||
checkHasSearchEngine,
|
||||
getSearchProvider,
|
||||
getSearchFormURL,
|
||||
} = ChromeUtils.import("resource://activity-stream/lib/SearchShortcuts.jsm");
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/SearchShortcuts.sys.mjs"
|
||||
);
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
@ -43,17 +45,13 @@ ChromeUtils.defineModuleGetter(
|
|||
"FilterAdult",
|
||||
"resource://activity-stream/lib/FilterAdult.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"LinksCache",
|
||||
"resource://activity-stream/lib/LinksCache.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
LinksCache: "resource://activity-stream/lib/LinksCache.sys.mjs",
|
||||
NewTabUtils: "resource://gre/modules/NewTabUtils.sys.mjs",
|
||||
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
|
||||
PageThumbs: "resource://gre/modules/PageThumbs.sys.mjs",
|
||||
Region: "resource://gre/modules/Region.sys.mjs",
|
||||
RemoteSettings: "resource://services-settings/remote-settings.sys.mjs",
|
||||
PageThumbs: "resource://gre/modules/PageThumbs.sys.mjs",
|
||||
Sampling: "resource://gre/modules/components-utils/Sampling.sys.mjs",
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
|
|
|
@ -15,8 +15,8 @@ const { shortURL } = ChromeUtils.import(
|
|||
const { SectionsManager } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/SectionsManager.jsm"
|
||||
);
|
||||
const { PersistentCache } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/PersistentCache.jsm"
|
||||
const { PersistentCache } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/PersistentCache.sys.mjs"
|
||||
);
|
||||
|
||||
const lazy = {};
|
||||
|
|
|
@ -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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Note: the schema can be found in
|
||||
* https://searchfox.org/mozilla-central/source/toolkit/components/telemetry/Events.yaml
|
||||
|
@ -16,7 +14,7 @@ const EXTRAS_FIELD_NAMES = [
|
|||
"action_position",
|
||||
];
|
||||
|
||||
class UTEventReporting {
|
||||
export class UTEventReporting {
|
||||
constructor() {
|
||||
Services.telemetry.setEventRecordingEnabled("activity_stream", true);
|
||||
this.sendUserEvent = this.sendUserEvent.bind(this);
|
||||
|
@ -62,5 +60,3 @@ class UTEventReporting {
|
|||
Services.telemetry.setEventRecordingEnabled("activity_stream", false);
|
||||
}
|
||||
}
|
||||
|
||||
const EXPORTED_SYMBOLS = ["UTEventReporting"];
|
|
@ -6,12 +6,12 @@
|
|||
const { ASRouter, MessageLoaderUtils } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouter.jsm"
|
||||
);
|
||||
const { PanelTestProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/PanelTestProvider.jsm"
|
||||
const { PanelTestProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/PanelTestProvider.sys.mjs"
|
||||
);
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
const { RemoteL10n } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/RemoteL10n.jsm"
|
||||
const { RemoteL10n } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/RemoteL10n.sys.mjs"
|
||||
);
|
||||
const { RemoteSettings } = ChromeUtils.importESModule(
|
||||
"resource://services-settings/remote-settings.sys.mjs"
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
// TODO (Bug 1800937): Remove this whole test along with the migration code
|
||||
// after the next watershed release.
|
||||
|
||||
const { ASRouterNewTabHook } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouterNewTabHook.jsm"
|
||||
const { ASRouterNewTabHook } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/ASRouterNewTabHook.sys.mjs"
|
||||
);
|
||||
const { ASRouterDefaultConfig } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouterDefaultConfig.jsm"
|
||||
|
|
|
@ -7,8 +7,8 @@ const { ASRouterTriggerListeners } = ChromeUtils.import(
|
|||
const { ASRouter } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouter.jsm"
|
||||
);
|
||||
const { CFRMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.jsm"
|
||||
const { CFRMessageProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.sys.mjs"
|
||||
);
|
||||
|
||||
const { TelemetryFeed } = ChromeUtils.import(
|
||||
|
|
|
@ -4,8 +4,8 @@ const { ASRouter } = ChromeUtils.import(
|
|||
const { RemoteSettings } = ChromeUtils.importESModule(
|
||||
"resource://services-settings/remote-settings.sys.mjs"
|
||||
);
|
||||
const { CFRMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.jsm"
|
||||
const { CFRMessageProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.sys.mjs"
|
||||
);
|
||||
const { CFRPageActions } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRPageActions.jsm"
|
||||
|
|
|
@ -4,8 +4,8 @@ const { ASRouter } = ChromeUtils.import(
|
|||
const { RemoteSettings } = ChromeUtils.importESModule(
|
||||
"resource://services-settings/remote-settings.sys.mjs"
|
||||
);
|
||||
const { CFRMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.jsm"
|
||||
const { CFRMessageProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.sys.mjs"
|
||||
);
|
||||
const { CFRPageActions } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRPageActions.jsm"
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
const { InfoBar } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/InfoBar.jsm"
|
||||
);
|
||||
const { CFRMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.jsm"
|
||||
const { CFRMessageProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.sys.mjs"
|
||||
);
|
||||
const { ASRouter } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouter.jsm"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { PanelTestProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/PanelTestProvider.jsm"
|
||||
const { PanelTestProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/PanelTestProvider.sys.mjs"
|
||||
);
|
||||
const { MomentsPageHub } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/MomentsPageHub.jsm"
|
||||
|
|
|
@ -4,7 +4,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
AddonTestUtils: "resource://testing-common/AddonTestUtils.jsm",
|
||||
ASRouterTargeting: "resource://activity-stream/lib/ASRouterTargeting.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
CFRMessageProvider: "resource://activity-stream/lib/CFRMessageProvider.jsm",
|
||||
HomePage: "resource:///modules/HomePage.jsm",
|
||||
QueryCache: "resource://activity-stream/lib/ASRouterTargeting.jsm",
|
||||
});
|
||||
|
@ -12,6 +11,8 @@ ChromeUtils.defineESModuleGetters(this, {
|
|||
AppConstants: "resource://gre/modules/AppConstants.sys.mjs",
|
||||
AttributionCode: "resource:///modules/AttributionCode.sys.mjs",
|
||||
BuiltInThemes: "resource:///modules/BuiltInThemes.sys.mjs",
|
||||
CFRMessageProvider:
|
||||
"resource://activity-stream/lib/CFRMessageProvider.sys.mjs",
|
||||
ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs",
|
||||
ExperimentFakes: "resource://testing-common/NimbusTestUtils.sys.mjs",
|
||||
FxAccounts: "resource://gre/modules/FxAccounts.sys.mjs",
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
const { ToastNotification } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ToastNotification.jsm"
|
||||
);
|
||||
const { PanelTestProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/PanelTestProvider.jsm"
|
||||
const { PanelTestProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/PanelTestProvider.sys.mjs"
|
||||
);
|
||||
|
||||
function getMessage(id) {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
const { Spotlight } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/Spotlight.jsm"
|
||||
);
|
||||
const { PanelTestProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/PanelTestProvider.jsm"
|
||||
const { PanelTestProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/PanelTestProvider.sys.mjs"
|
||||
);
|
||||
const { BrowserWindowTracker } = ChromeUtils.import(
|
||||
"resource:///modules/BrowserWindowTracker.jsm"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
const { Spotlight } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/Spotlight.jsm"
|
||||
);
|
||||
const { PanelTestProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/PanelTestProvider.jsm"
|
||||
const { PanelTestProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/PanelTestProvider.sys.mjs"
|
||||
);
|
||||
const { BrowserWindowTracker } = ChromeUtils.import(
|
||||
"resource:///modules/BrowserWindowTracker.jsm"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { RemoteL10n } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/RemoteL10n.jsm"
|
||||
const { RemoteL10n } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/RemoteL10n.sys.mjs"
|
||||
);
|
||||
|
||||
const ID = "remote_l10n_test_string";
|
||||
|
@ -29,7 +29,7 @@ add_setup(async () => {
|
|||
});
|
||||
|
||||
// Remove any cached l10n resources, "cfr" is the cache key
|
||||
// used for strings from the remote `asrouter.ftl` see RemoteL10n.jsm
|
||||
// used for strings from the remote `asrouter.ftl` see RemoteL10n.sys.mjs
|
||||
RemoteL10n.reloadL10n();
|
||||
if (l10nRegistryInstance.hasSource("cfr")) {
|
||||
l10nRegistryInstance.removeSources(["cfr"]);
|
||||
|
|
|
@ -15,9 +15,9 @@ import {
|
|||
import { ASRouterTriggerListeners } from "lib/ASRouterTriggerListeners.jsm";
|
||||
import { CFRPageActions } from "lib/CFRPageActions.jsm";
|
||||
import { GlobalOverrider } from "test/unit/utils";
|
||||
import { PanelTestProvider } from "lib/PanelTestProvider.jsm";
|
||||
import { PanelTestProvider } from "lib/PanelTestProvider.sys.mjs";
|
||||
import ProviderResponseSchema from "content-src/asrouter/schemas/provider-response.schema.json";
|
||||
import { SnippetsTestMessageProvider } from "lib/SnippetsTestMessageProvider.jsm";
|
||||
import { SnippetsTestMessageProvider } from "lib/SnippetsTestMessageProvider.sys.mjs";
|
||||
|
||||
const MESSAGE_PROVIDER_PREF_NAME =
|
||||
"browser.newtabpage.activity-stream.asrouter.providers.snippets";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*eslint max-nested-callbacks: ["error", 10]*/
|
||||
import { ASRouterNewTabHook } from "lib/ASRouterNewTabHook.jsm";
|
||||
import { ASRouterNewTabHook } from "lib/ASRouterNewTabHook.sys.mjs";
|
||||
|
||||
describe("ASRouterNewTabHook", () => {
|
||||
let sandbox = null;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CFRMessageProvider } from "lib/CFRMessageProvider.jsm";
|
||||
import { CFRMessageProvider } from "lib/CFRMessageProvider.sys.mjs";
|
||||
|
||||
const REGULAR_IDS = [
|
||||
"FACEBOOK_CONTAINER",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import { CFRPageActions, PageAction } from "lib/CFRPageActions.jsm";
|
||||
import { FAKE_RECOMMENDATION } from "./constants";
|
||||
import { GlobalOverrider } from "test/unit/utils";
|
||||
import { CFRMessageProvider } from "lib/CFRMessageProvider.jsm";
|
||||
import { CFRMessageProvider } from "lib/CFRMessageProvider.sys.mjs";
|
||||
|
||||
describe("CFRPageActions", () => {
|
||||
let sandbox;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RemoteL10n, _RemoteL10n } from "lib/RemoteL10n.jsm";
|
||||
import { RemoteL10n, _RemoteL10n } from "lib/RemoteL10n.sys.mjs";
|
||||
import { GlobalOverrider } from "test/unit/utils";
|
||||
|
||||
describe("RemoteL10n", () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import EOYSnippetSchema from "../../../content-src/asrouter/templates/EOYSnippet/EOYSnippet.schema.json";
|
||||
import SimpleBelowSearchSnippetSchema from "../../../content-src/asrouter/templates/SimpleBelowSearchSnippet/SimpleBelowSearchSnippet.schema.json";
|
||||
import SimpleSnippetSchema from "../../../content-src/asrouter/templates/SimpleSnippet/SimpleSnippet.schema.json";
|
||||
import { SnippetsTestMessageProvider } from "../../../lib/SnippetsTestMessageProvider.jsm";
|
||||
import { SnippetsTestMessageProvider } from "../../../lib/SnippetsTestMessageProvider.sys.mjs";
|
||||
import SubmitFormSnippetSchema from "../../../content-src/asrouter/templates/SubmitFormSnippet/SubmitFormSnippet.schema.json";
|
||||
import SubmitFormScene2SnippetSchema from "../../../content-src/asrouter/templates/SubmitFormSnippet/SubmitFormScene2Snippet.schema.json";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CFRMessageProvider } from "lib/CFRMessageProvider.jsm";
|
||||
import { CFRMessageProvider } from "lib/CFRMessageProvider.sys.mjs";
|
||||
import CFRDoorhangerSchema from "content-src/asrouter/templates/CFR/templates/ExtensionDoorhanger.schema.json";
|
||||
import CFRChicletSchema from "content-src/asrouter/templates/CFR/templates/CFRUrlbarChiclet.schema.json";
|
||||
import InfoBarSchema from "content-src/asrouter/templates/CFR/templates/InfoBar.schema.json";
|
||||
|
|
|
@ -4,7 +4,7 @@ import React from "react";
|
|||
import { FluentBundle, FluentResource } from "@fluent/bundle";
|
||||
import { LocalizationProvider, ReactLocalization } from "@fluent/react";
|
||||
import schema from "content-src/asrouter/templates/FXASignupSnippet/FXASignupSnippet.schema.json";
|
||||
import { SnippetsTestMessageProvider } from "lib/SnippetsTestMessageProvider.jsm";
|
||||
import { SnippetsTestMessageProvider } from "lib/SnippetsTestMessageProvider.sys.mjs";
|
||||
|
||||
describe("FXASignupSnippet", () => {
|
||||
let DEFAULT_CONTENT;
|
||||
|
|
|
@ -4,7 +4,7 @@ import React from "react";
|
|||
import { FluentBundle, FluentResource } from "@fluent/bundle";
|
||||
import { LocalizationProvider, ReactLocalization } from "@fluent/react";
|
||||
import schema from "content-src/asrouter/templates/NewsletterSnippet/NewsletterSnippet.schema.json";
|
||||
import { SnippetsTestMessageProvider } from "lib/SnippetsTestMessageProvider.jsm";
|
||||
import { SnippetsTestMessageProvider } from "lib/SnippetsTestMessageProvider.sys.mjs";
|
||||
|
||||
describe("NewsletterSnippet", () => {
|
||||
let sandbox;
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
SendToDeviceSnippet,
|
||||
SendToDeviceScene2Snippet,
|
||||
} from "content-src/asrouter/templates/SendToDeviceSnippet/SendToDeviceSnippet";
|
||||
import { SnippetsTestMessageProvider } from "lib/SnippetsTestMessageProvider.jsm";
|
||||
import { SnippetsTestMessageProvider } from "lib/SnippetsTestMessageProvider.sys.mjs";
|
||||
|
||||
async function testBodyContains(body, key, value) {
|
||||
const regex = new RegExp(
|
||||
|
|
|
@ -2,7 +2,7 @@ import { CONTENT_MESSAGE_TYPE } from "common/Actions.sys.mjs";
|
|||
import { ActivityStream, PREFS_CONFIG } from "lib/ActivityStream.jsm";
|
||||
import { GlobalOverrider } from "test/unit/utils";
|
||||
|
||||
import { DEFAULT_SITES } from "lib/DefaultSites.jsm";
|
||||
import { DEFAULT_SITES } from "lib/DefaultSites.sys.mjs";
|
||||
import { AboutPreferences } from "lib/AboutPreferences.jsm";
|
||||
import { DefaultPrefs } from "lib/ActivityStreamPrefs.jsm";
|
||||
import { NewTabInit } from "lib/NewTabInit.jsm";
|
||||
|
@ -18,8 +18,8 @@ import { TopStoriesFeed } from "lib/TopStoriesFeed.jsm";
|
|||
import { HighlightsFeed } from "lib/HighlightsFeed.jsm";
|
||||
import { DiscoveryStreamFeed } from "lib/DiscoveryStreamFeed.jsm";
|
||||
|
||||
import { LinksCache } from "lib/LinksCache.jsm";
|
||||
import { PersistentCache } from "lib/PersistentCache.jsm";
|
||||
import { LinksCache } from "lib/LinksCache.sys.mjs";
|
||||
import { PersistentCache } from "lib/PersistentCache.sys.mjs";
|
||||
import { DownloadsManager } from "lib/DownloadsManager.jsm";
|
||||
|
||||
describe("ActivityStream", () => {
|
||||
|
|
|
@ -9,7 +9,7 @@ import { DiscoveryStreamFeed } from "lib/DiscoveryStreamFeed.jsm";
|
|||
import { RecommendationProvider } from "lib/RecommendationProvider.jsm";
|
||||
import { reducers } from "common/Reducers.sys.mjs";
|
||||
|
||||
import { PersistentCache } from "lib/PersistentCache.jsm";
|
||||
import { PersistentCache } from "lib/PersistentCache.sys.mjs";
|
||||
import { PersonalityProvider } from "lib/PersonalityProvider/PersonalityProvider.jsm";
|
||||
|
||||
const CONFIG_PREF_NAME = "discoverystream.config";
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Dedupe } from "common/Dedupe.sys.mjs";
|
|||
import { GlobalOverrider } from "test/unit/utils";
|
||||
import injector from "inject!lib/HighlightsFeed.jsm";
|
||||
import { Screenshots } from "lib/Screenshots.jsm";
|
||||
import { LinksCache } from "lib/LinksCache.jsm";
|
||||
import { LinksCache } from "lib/LinksCache.sys.mjs";
|
||||
|
||||
const FAKE_LINKS = new Array(20)
|
||||
.fill(null)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { LinksCache } from "lib/LinksCache.jsm";
|
||||
import { LinksCache } from "lib/LinksCache.sys.mjs";
|
||||
|
||||
describe("LinksCache", () => {
|
||||
it("throws when failing request", async () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GlobalOverrider } from "test/unit/utils";
|
||||
import { PanelTestProvider } from "lib/PanelTestProvider.jsm";
|
||||
import { PanelTestProvider } from "lib/PanelTestProvider.sys.mjs";
|
||||
import { _MomentsPageHub } from "lib/MomentsPageHub.jsm";
|
||||
const HOMEPAGE_OVERRIDE_PREF = "browser.startup.homepage_override.once";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GlobalOverrider } from "test/unit/utils";
|
||||
import { PersistentCache } from "lib/PersistentCache.jsm";
|
||||
import { PersistentCache } from "lib/PersistentCache.sys.mjs";
|
||||
|
||||
describe("PersistentCache", () => {
|
||||
let fakeIOUtils;
|
||||
|
|
|
@ -77,7 +77,7 @@ describe("TelemetryFeed", () => {
|
|||
EVENTS_TELEMETRY_PREF,
|
||||
STRUCTURED_INGESTION_ENDPOINT_PREF,
|
||||
} = injector({
|
||||
"lib/UTEventReporting.jsm": { UTEventReporting },
|
||||
"lib/UTEventReporting.sys.mjs": { UTEventReporting },
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GlobalOverrider } from "test/unit/utils";
|
||||
import { TippyTopProvider } from "lib/TippyTopProvider.jsm";
|
||||
import { TippyTopProvider } from "lib/TippyTopProvider.sys.mjs";
|
||||
|
||||
describe("TippyTopProvider", () => {
|
||||
let instance;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { _ToolbarPanelHub } from "lib/ToolbarPanelHub.jsm";
|
||||
import { GlobalOverrider } from "test/unit/utils";
|
||||
import { OnboardingMessageProvider } from "lib/OnboardingMessageProvider.jsm";
|
||||
import { PanelTestProvider } from "lib/PanelTestProvider.jsm";
|
||||
import { PanelTestProvider } from "lib/PanelTestProvider.sys.mjs";
|
||||
|
||||
describe("ToolbarPanelHub", () => {
|
||||
let globals;
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
import { getDefaultOptions } from "lib/ActivityStreamStorage.jsm";
|
||||
import injector from "inject!lib/TopSitesFeed.jsm";
|
||||
import { Screenshots } from "lib/Screenshots.jsm";
|
||||
import { LinksCache } from "lib/LinksCache.jsm";
|
||||
import { LinksCache } from "lib/LinksCache.sys.mjs";
|
||||
|
||||
const FAKE_FAVICON = "data987";
|
||||
const FAKE_FAVICON_SIZE = 128;
|
||||
|
@ -148,7 +148,9 @@ describe("Top Sites Feed", () => {
|
|||
},
|
||||
"lib/FilterAdult.jsm": { FilterAdult: filterAdultStub },
|
||||
"lib/Screenshots.jsm": { Screenshots: fakeScreenshot },
|
||||
"lib/TippyTopProvider.jsm": { TippyTopProvider: FakeTippyTopProvider },
|
||||
"lib/TippyTopProvider.sys.mjs": {
|
||||
TippyTopProvider: FakeTippyTopProvider,
|
||||
},
|
||||
"lib/ShortURL.jsm": { shortURL: shortURLStub },
|
||||
"lib/ActivityStreamStorage.jsm": {
|
||||
ActivityStreamStorage: function Fake() {},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { UTSessionPing, UTUserEventPing } from "test/schemas/pings";
|
||||
import { GlobalOverrider } from "test/unit/utils";
|
||||
import { UTEventReporting } from "lib/UTEventReporting.jsm";
|
||||
import { UTEventReporting } from "lib/UTEventReporting.sys.mjs";
|
||||
|
||||
const FAKE_EVENT_PING_PC = {
|
||||
event: "CLICK",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const { CFRMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.jsm"
|
||||
const { CFRMessageProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.sys.mjs"
|
||||
);
|
||||
|
||||
add_task(async function test_cfrMessages() {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const { PanelTestProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/PanelTestProvider.jsm"
|
||||
const { PanelTestProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/PanelTestProvider.sys.mjs"
|
||||
);
|
||||
|
||||
const MESSAGE_VALIDATORS = {};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const { CFRMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.jsm"
|
||||
const { CFRMessageProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.sys.mjs"
|
||||
);
|
||||
|
||||
add_task(async function test_multiMessageTreatment() {
|
||||
|
|
|
@ -5,6 +5,7 @@ ChromeUtils.defineESModuleGetters(this, {
|
|||
ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs",
|
||||
ExperimentFakes: "resource://testing-common/NimbusTestUtils.sys.mjs",
|
||||
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
|
||||
PanelTestProvider: "resource://activity-stream/lib/PanelTestProvider.sys.mjs",
|
||||
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs",
|
||||
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
|
||||
TelemetryTestUtils: "resource://testing-common/TelemetryTestUtils.sys.mjs",
|
||||
|
@ -12,7 +13,6 @@ ChromeUtils.defineESModuleGetters(this, {
|
|||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
ASRouter: "resource://activity-stream/lib/ASRouter.jsm",
|
||||
PanelTestProvider: "resource://activity-stream/lib/PanelTestProvider.jsm",
|
||||
});
|
||||
|
||||
function whenNewWindowLoaded(aOptions, aCallback) {
|
||||
|
|
|
@ -5,10 +5,14 @@
|
|||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
PageEventManager: "resource://activity-stream/lib/PageEventManager.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
AboutWelcomeParent: "resource:///actors/AboutWelcomeParent.jsm",
|
||||
ASRouter: "resource://activity-stream/lib/ASRouter.jsm",
|
||||
PageEventManager: "resource://activity-stream/lib/PageEventManager.jsm",
|
||||
});
|
||||
|
||||
const TRANSITION_MS = 500;
|
||||
|
@ -860,7 +864,7 @@ export class FeatureCallout {
|
|||
* @property {PageEventListenerParams} params Event listener parameters
|
||||
* @property {PageEventListenerAction} action Sent when the event fires
|
||||
*
|
||||
* @typedef {Object} PageEventListenerParams See PageEventManager.jsm
|
||||
* @typedef {Object} PageEventListenerParams See PageEventManager.sys.mjs
|
||||
* @property {String} type Event type string e.g. `click`
|
||||
* @property {String} selectors Target selector, e.g. `tag.class, #id[attr]`
|
||||
* @property {PageEventListenerOptions} [options] addEventListener options
|
||||
|
|
|
@ -464,9 +464,9 @@ fxms-schemas:
|
|||
- 'browser/components/newtab/content-src/asrouter/schemas/extract-test-corpus.js'
|
||||
- 'browser/components/newtab/content-src/asrouter/schemas/make-schemas.py'
|
||||
- 'browser/components/newtab/content-src/**/*.schema.json'
|
||||
- 'browser/components/newtab/lib/CFRMessageProvider.jsm'
|
||||
- 'browser/components/newtab/lib/CFRMessageProvider.sys.mjs'
|
||||
- 'browser/components/newtab/lib/OnboardingMessageProvider.jsm'
|
||||
- 'browser/components/newtab/lib/PanelTestProvider.jsm'
|
||||
- 'browser/components/newtab/lib/PanelTestProvider.sys.mjs'
|
||||
|
||||
condprof:
|
||||
description: testing/condprofile unit tests
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { CFRMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.jsm"
|
||||
const { CFRMessageProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.sys.mjs"
|
||||
);
|
||||
|
||||
add_task(async function test_all_test_messages() {
|
||||
|
|
|
@ -4,8 +4,8 @@ const TEST_URL =
|
|||
const { ASRouterTriggerListeners } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/ASRouterTriggerListeners.jsm"
|
||||
);
|
||||
const { CFRMessageProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.jsm"
|
||||
const { CFRMessageProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/CFRMessageProvider.sys.mjs"
|
||||
);
|
||||
const { JsonSchema } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/JsonSchema.sys.mjs"
|
||||
|
|
|
@ -12,8 +12,8 @@ const { NimbusFeatures } = ChromeUtils.importESModule(
|
|||
const { EnrollmentsContext } = ChromeUtils.importESModule(
|
||||
"resource://nimbus/lib/RemoteSettingsExperimentLoader.sys.mjs"
|
||||
);
|
||||
const { PanelTestProvider } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/PanelTestProvider.jsm"
|
||||
const { PanelTestProvider } = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/PanelTestProvider.sys.mjs"
|
||||
);
|
||||
const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TelemetryTestUtils.sys.mjs"
|
||||
|
|
|
@ -10,8 +10,8 @@ let searchShortcuts = {};
|
|||
let didSuccessfulImport = false;
|
||||
try {
|
||||
shortURL = ChromeUtils.import("resource://activity-stream/lib/ShortURL.jsm");
|
||||
searchShortcuts = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/SearchShortcuts.jsm"
|
||||
searchShortcuts = ChromeUtils.importESModule(
|
||||
"resource://activity-stream/lib/SearchShortcuts.sys.mjs"
|
||||
);
|
||||
didSuccessfulImport = true;
|
||||
} catch (e) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче