Bug 1780017 - Migrate browser/components/urlbar to ESM. r=adw

Differential Revision: https://phabricator.services.mozilla.com/D152056
This commit is contained in:
Mark Banner
2022-07-20 10:36:50 +00:00
parent 7e8777ac89
commit 9b7be8cfb2
45 changed files with 96 additions and 190 deletions

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["QuickActionsLoaderDefault"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -147,7 +145,7 @@ function restartBrowser() {
/** /**
* Loads the default QuickActions. * Loads the default QuickActions.
*/ */
class QuickActionsLoaderDefault { export class QuickActionsLoaderDefault {
static load() { static load() {
for (const key in DEFAULT_ACTIONS) { for (const key in DEFAULT_ACTIONS) {
lazy.UrlbarProviderQuickActions.addAction(key, DEFAULT_ACTIONS[key]); lazy.UrlbarProviderQuickActions.addAction(key, DEFAULT_ACTIONS[key]);

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarController"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -58,7 +56,7 @@ const NOTIFICATIONS = {
* - onViewOpen() * - onViewOpen()
* - onViewClose() * - onViewClose()
*/ */
class UrlbarController { export class UrlbarController {
/** /**
* Initialises the class. The manager may be overridden here, this is for * Initialises the class. The manager may be overridden here, this is for
* test purposes. * test purposes.

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarEventBufferer"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -55,7 +53,7 @@ const QUERY_STATUS = {
* To prevent that undesirable behavior, certain keys are buffered and deferred * To prevent that undesirable behavior, certain keys are buffered and deferred
* until more results arrive, at which time they're replayed. * until more results arrive, at which time they're replayed.
*/ */
class UrlbarEventBufferer { export class UrlbarEventBufferer {
/** /**
* Initialises the class. * Initialises the class.
* @param {UrlbarInput} input The urlbar input object. * @param {UrlbarInput} input The urlbar input object.

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarInput"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -64,7 +62,7 @@ let px = number => number.toFixed(2) + "px";
/** /**
* Implements the text input part of the address bar UI. * Implements the text input part of the address bar UI.
*/ */
class UrlbarInput { export class UrlbarInput {
/** /**
* @param {object} options * @param {object} options
* The initial options for UrlbarInput. * The initial options for UrlbarInput.

View File

@@ -8,8 +8,6 @@
* This module exports a component used to sort results in a UrlbarQueryContext. * This module exports a component used to sort results in a UrlbarQueryContext.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarMuxerUnifiedComplete"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -1246,4 +1244,4 @@ class MuxerUnifiedComplete extends UrlbarMuxer {
} }
} }
var UrlbarMuxerUnifiedComplete = new MuxerUnifiedComplete(); export var UrlbarMuxerUnifiedComplete = new MuxerUnifiedComplete();

View File

@@ -10,8 +10,6 @@
* preferences, but only for variables with fallback prefs. * preferences, but only for variables with fallback prefs.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarPrefs"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -1473,4 +1471,4 @@ class Preferences {
} }
} }
var UrlbarPrefs = new Preferences(); export var UrlbarPrefs = new Preferences();

View File

@@ -8,8 +8,6 @@
* This module exports a provider that offers about pages. * This module exports a provider that offers about pages.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderAboutPages"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -84,4 +82,4 @@ class ProviderAboutPages extends UrlbarProvider {
} }
} }
var UrlbarProviderAboutPages = new ProviderAboutPages(); export var UrlbarProviderAboutPages = new ProviderAboutPages();

View File

@@ -9,8 +9,6 @@
* results. * results.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderAliasEngines"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -95,4 +93,4 @@ class ProviderAliasEngines extends UrlbarProvider {
} }
} }
var UrlbarProviderAliasEngines = new ProviderAliasEngines(); export var UrlbarProviderAliasEngines = new ProviderAliasEngines();

View File

@@ -8,8 +8,6 @@
* This module exports a provider that provides an autofill result. * This module exports a provider that provides an autofill result.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderAutofill"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -1040,4 +1038,4 @@ class ProviderAutofill extends UrlbarProvider {
} }
} }
var UrlbarProviderAutofill = new ProviderAutofill(); export var UrlbarProviderAutofill = new ProviderAutofill();

View File

@@ -8,8 +8,6 @@
* This module exports a provider that offers bookmarks with keywords. * This module exports a provider that offers bookmarks with keywords.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderBookmarkKeywords"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -119,4 +117,4 @@ class ProviderBookmarkKeywords extends UrlbarProvider {
} }
} }
var UrlbarProviderBookmarkKeywords = new ProviderBookmarkKeywords(); export var UrlbarProviderBookmarkKeywords = new ProviderBookmarkKeywords();

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarProviderCalculator", "Calculator"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -430,7 +428,7 @@ Parser.prototype = {
}, },
}; };
let Calculator = new BaseCalculator(); export let Calculator = new BaseCalculator();
Calculator.addNumberSystem({ Calculator.addNumberSystem({
isOperator: char => ["÷", "×", "-", "+", "*", "/"].includes(char), isOperator: char => ["÷", "×", "-", "+", "*", "/"].includes(char),
@@ -460,4 +458,4 @@ Calculator.addNumberSystem({
}, },
}); });
var UrlbarProviderCalculator = new ProviderCalculator(); export var UrlbarProviderCalculator = new ProviderCalculator();

View File

@@ -9,8 +9,6 @@
* extensions. * extensions.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderExtension"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -44,7 +42,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
* related to a provider, the API implementation should call setEventListener() * related to a provider, the API implementation should call setEventListener()
* to register its own event listener with the provider. * to register its own event listener with the provider.
*/ */
class UrlbarProviderExtension extends UrlbarProvider { export class UrlbarProviderExtension extends UrlbarProvider {
/** /**
* Returns the extension provider with the given name, creating it first if * Returns the extension provider with the given name, creating it first if
* it doesn't exist. * it doesn't exist.

View File

@@ -10,8 +10,6 @@
* always the ultimate fallback for any query, so this provider is always active. * always the ultimate fallback for any query, so this provider is always active.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderHeuristicFallback"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -327,4 +325,4 @@ class ProviderHeuristicFallback extends UrlbarProvider {
} }
} }
var UrlbarProviderHeuristicFallback = new ProviderHeuristicFallback(); export var UrlbarProviderHeuristicFallback = new ProviderHeuristicFallback();

View File

@@ -11,8 +11,6 @@
* string. * string.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderInputHistory"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -226,4 +224,4 @@ class ProviderInputHistory extends UrlbarProvider {
} }
} }
var UrlbarProviderInputHistory = new ProviderInputHistory(); export var UrlbarProviderInputHistory = new ProviderInputHistory();

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarProviderInterventions", "QueryScorer"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -174,7 +172,7 @@ class Node {
* up to you to filter the array to exclude scores above a certain threshold, or * up to you to filter the array to exclude scores above a certain threshold, or
* to take the top scorer, etc. * to take the top scorer, etc.
*/ */
class QueryScorer { export class QueryScorer {
/** /**
* @param {number} distanceThreshold * @param {number} distanceThreshold
* Edit distances no larger than this value are considered matches. * Edit distances no larger than this value are considered matches.
@@ -749,7 +747,7 @@ class ProviderInterventions extends UrlbarProvider {
} }
} }
var UrlbarProviderInterventions = new ProviderInterventions(); export var UrlbarProviderInterventions = new ProviderInterventions();
/** /**
* Tip callbacks follow. * Tip callbacks follow.

View File

@@ -9,8 +9,6 @@
* extensions using the `omnibox` API. * extensions using the `omnibox` API.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderOmnibox"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -186,4 +184,4 @@ class ProviderOmnibox extends UrlbarProvider {
} }
} }
var UrlbarProviderOmnibox = new ProviderOmnibox(); export var UrlbarProviderOmnibox = new ProviderOmnibox();

View File

@@ -9,8 +9,6 @@
* It is also used to register and unregister open tabs. * It is also used to register and unregister open tabs.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderOpenTabs"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -35,7 +33,7 @@ const PRIVATE_USER_CONTEXT_ID = -1;
/** /**
* Class used to create the provider. * Class used to create the provider.
*/ */
class UrlbarProviderOpenTabs extends UrlbarProvider { export class UrlbarProviderOpenTabs extends UrlbarProvider {
constructor() { constructor() {
super(); super();
} }

View File

@@ -11,8 +11,6 @@
* This module exports a provider that providers results from the Places * This module exports a provider that providers results from the Places
* database, including history, bookmarks, and open tabs. * database, including history, bookmarks, and open tabs.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderPlaces"];
// Constants // Constants
// AutoComplete query type constants. // AutoComplete query type constants.
@@ -1548,4 +1546,4 @@ class ProviderPlaces extends UrlbarProvider {
} }
} }
var UrlbarProviderPlaces = new ProviderPlaces(); export var UrlbarProviderPlaces = new ProviderPlaces();

View File

@@ -10,8 +10,6 @@
* They can be both autofilled and provided as regular results. * They can be both autofilled and provided as regular results.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderPreloadedSites"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -293,4 +291,4 @@ class ProviderPreloadedSites extends UrlbarProvider {
} }
} }
var UrlbarProviderPreloadedSites = new ProviderPreloadedSites(); export var UrlbarProviderPreloadedSites = new ProviderPreloadedSites();

View File

@@ -8,8 +8,6 @@
* This module exports a provider returning a private search entry. * This module exports a provider returning a private search entry.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderPrivateSearch"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -132,4 +130,4 @@ class ProviderPrivateSearch extends UrlbarProvider {
} }
} }
var UrlbarProviderPrivateSearch = new ProviderPrivateSearch(); export var UrlbarProviderPrivateSearch = new ProviderPrivateSearch();

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarProviderQuickActions"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -231,4 +229,4 @@ class ProviderQuickActions extends UrlbarProvider {
} }
} }
var UrlbarProviderQuickActions = new ProviderQuickActions(); export var UrlbarProviderQuickActions = new ProviderQuickActions();

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarProviderQuickSuggest", "QUICK_SUGGEST_SOURCE"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -96,7 +94,7 @@ let TELEMETRY_IMPRESSION_CAP_EXTRA_KEYS = {
}; };
// Identifies the source of the QuickSuggest suggestion. // Identifies the source of the QuickSuggest suggestion.
const QUICK_SUGGEST_SOURCE = { export const QUICK_SUGGEST_SOURCE = {
REMOTE_SETTINGS: "remote-settings", REMOTE_SETTINGS: "remote-settings",
MERINO: "merino", MERINO: "merino",
}; };
@@ -1639,4 +1637,4 @@ class ProviderQuickSuggest extends UrlbarProvider {
_merinoSessionTimeoutMs = MERINO_SESSION_TIMEOUT_MS; _merinoSessionTimeoutMs = MERINO_SESSION_TIMEOUT_MS;
} }
var UrlbarProviderQuickSuggest = new ProviderQuickSuggest(); export var UrlbarProviderQuickSuggest = new ProviderQuickSuggest();

View File

@@ -8,8 +8,6 @@
* This module exports a provider that offers remote tabs. * This module exports a provider that offers remote tabs.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderRemoteTabs"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -256,4 +254,4 @@ class ProviderRemoteTabs extends UrlbarProvider {
} }
} }
var UrlbarProviderRemoteTabs = new ProviderRemoteTabs(); export var UrlbarProviderRemoteTabs = new ProviderRemoteTabs();

View File

@@ -8,8 +8,6 @@
* This module exports a provider that offers search engine suggestions. * This module exports a provider that offers search engine suggestions.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderSearchSuggestions"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -500,4 +498,4 @@ function makeFormHistoryResult(queryContext, engine, entry) {
); );
} }
var UrlbarProviderSearchSuggestions = new ProviderSearchSuggestions(); export var UrlbarProviderSearchSuggestions = new ProviderSearchSuggestions();

View File

@@ -9,8 +9,6 @@
* the newtab or starts an organic search with their default search engine. * the newtab or starts an organic search with their default search engine.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderSearchTips"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -533,4 +531,4 @@ async function lastBrowserUpdateDate() {
return (await age.firstUse) || age.created; return (await age.firstUse) || age.created;
} }
var UrlbarProviderSearchTips = new ProviderSearchTips(); export var UrlbarProviderSearchTips = new ProviderSearchTips();

View File

@@ -9,8 +9,6 @@
* typing a search engine domain. * typing a search engine domain.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderTabToSearch"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -491,5 +489,5 @@ function makeResult(context, engine, satisfiesAutofillThreshold = false) {
return result; return result;
} }
var UrlbarProviderTabToSearch = new ProviderTabToSearch(); export var UrlbarProviderTabToSearch = new ProviderTabToSearch();
initializeDynamicResult(); initializeDynamicResult();

View File

@@ -8,8 +8,6 @@
* This module exports a provider that offers token alias engines. * This module exports a provider that offers token alias engines.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProviderTokenAliasEngines"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -232,4 +230,4 @@ class ProviderTokenAliasEngines extends UrlbarProvider {
} }
} }
var UrlbarProviderTokenAliasEngines = new ProviderTokenAliasEngines(); export var UrlbarProviderTokenAliasEngines = new ProviderTokenAliasEngines();

View File

@@ -8,8 +8,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarProviderTopSites"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -378,4 +376,4 @@ class ProviderTopSites extends UrlbarProvider {
} }
} }
var UrlbarProviderTopSites = new ProviderTopSites(); export var UrlbarProviderTopSites = new ProviderTopSites();

View File

@@ -8,8 +8,6 @@
* Provide unit converter. * Provide unit converter.
*/ */
const EXPORTED_SYMBOLS = ["UrlbarProviderUnitConversion"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -189,4 +187,4 @@ class ProviderUnitConversion extends UrlbarProvider {
} }
} }
const UrlbarProviderUnitConversion = new ProviderUnitConversion(); export const UrlbarProviderUnitConversion = new ProviderUnitConversion();

View File

@@ -9,8 +9,6 @@
* the connection between such providers and a UrlbarController. * the connection between such providers and a UrlbarController.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarProvidersManager"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -329,7 +327,7 @@ class ProvidersManager {
} }
} }
var UrlbarProvidersManager = new ProvidersManager(); export var UrlbarProvidersManager = new ProvidersManager();
/** /**
* Tracks a query status. * Tracks a query status.

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
const EXPORTED_SYMBOLS = ["ONBOARDING_CHOICE", "UrlbarQuickSuggest"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -45,7 +43,7 @@ const DIALOG_VARIATION_PREF = "quickSuggestOnboardingDialogVariation";
// Values returned by the onboarding dialog depending on the user's response. // Values returned by the onboarding dialog depending on the user's response.
// These values are used in telemetry events, so be careful about changing them. // These values are used in telemetry events, so be careful about changing them.
const ONBOARDING_CHOICE = { export const ONBOARDING_CHOICE = {
ACCEPT_2: "accept_2", ACCEPT_2: "accept_2",
CLOSE_1: "close_1", CLOSE_1: "close_1",
DISMISS_1: "dismiss_1", DISMISS_1: "dismiss_1",
@@ -562,4 +560,4 @@ class QuickSuggest extends EventEmitter {
} }
} }
let UrlbarQuickSuggest = new QuickSuggest(); export let UrlbarQuickSuggest = new QuickSuggest();

View File

@@ -12,8 +12,6 @@
* the result types. * the result types.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarResult"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -29,7 +27,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
/** /**
* Class used to create a single result. * Class used to create a single result.
*/ */
class UrlbarResult { export class UrlbarResult {
/** /**
* Creates a result. * Creates a result.
* @param {integer} resultType one of UrlbarUtils.RESULT_TYPE.* values * @param {integer} resultType one of UrlbarUtils.RESULT_TYPE.* values

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarSearchOneOffs"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -24,7 +22,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
/** /**
* The one-off search buttons in the urlbar. * The one-off search buttons in the urlbar.
*/ */
class UrlbarSearchOneOffs extends SearchOneOffs { export class UrlbarSearchOneOffs extends SearchOneOffs {
/** /**
* Constructor. * Constructor.
* *

View File

@@ -11,8 +11,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarSearchUtils"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -356,4 +354,4 @@ class SearchUtils {
} }
} }
var UrlbarSearchUtils = new SearchUtils(); export var UrlbarSearchUtils = new SearchUtils();

View File

@@ -10,8 +10,6 @@
* of UrlbarTokenizer.TYPE. * of UrlbarTokenizer.TYPE.
*/ */
var EXPORTED_SYMBOLS = ["UrlbarTokenizer"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -25,7 +23,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
lazy.UrlbarUtils.getLogger({ prefix: "Tokenizer" }) lazy.UrlbarUtils.getLogger({ prefix: "Tokenizer" })
); );
var UrlbarTokenizer = { export var UrlbarTokenizer = {
// Regex matching on whitespaces. // Regex matching on whitespaces.
REGEXP_SPACES: /\s+/, REGEXP_SPACES: /\s+/,
REGEXP_SPACES_START: /^\s+/, REGEXP_SPACES_START: /^\s+/,

View File

@@ -9,16 +9,6 @@
* helper functions that are useful to all components of the urlbar. * helper functions that are useful to all components of the urlbar.
*/ */
var EXPORTED_SYMBOLS = [
"L10nCache",
"SkippableTimer",
"TaskQueue",
"UrlbarMuxer",
"UrlbarProvider",
"UrlbarQueryContext",
"UrlbarUtils",
];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -44,7 +34,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
UrlbarTokenizer: "resource:///modules/UrlbarTokenizer.jsm", UrlbarTokenizer: "resource:///modules/UrlbarTokenizer.jsm",
}); });
var UrlbarUtils = { export var UrlbarUtils = {
// Extensions are allowed to add suggestions if they have registered a keyword // Extensions are allowed to add suggestions if they have registered a keyword
// with the omnibox API. This is the maximum number of suggestions an extension // with the omnibox API. This is the maximum number of suggestions an extension
// is allowed to add for a given search string using the omnibox API. // is allowed to add for a given search string using the omnibox API.
@@ -1571,7 +1561,7 @@ UrlbarUtils.RESULT_PAYLOAD_SCHEMA = {
* It supplements it with details of how the search results should be obtained * It supplements it with details of how the search results should be obtained
* and what they consist of. * and what they consist of.
*/ */
class UrlbarQueryContext { export class UrlbarQueryContext {
/** /**
* Constructs the UrlbarQueryContext instance. * Constructs the UrlbarQueryContext instance.
* *
@@ -1754,7 +1744,7 @@ class UrlbarQueryContext {
* Base class for a muxer. * Base class for a muxer.
* The muxer scope is to sort a given list of results. * The muxer scope is to sort a given list of results.
*/ */
class UrlbarMuxer { export class UrlbarMuxer {
/** /**
* Unique name for the muxer, used by the context to sort results. * Unique name for the muxer, used by the context to sort results.
* Not using a unique name will cause the newest registration to win. * Not using a unique name will cause the newest registration to win.
@@ -1778,7 +1768,7 @@ class UrlbarMuxer {
* Base class for a provider. * Base class for a provider.
* The provider scope is to query a datasource and return results from it. * The provider scope is to query a datasource and return results from it.
*/ */
class UrlbarProvider { export class UrlbarProvider {
constructor() { constructor() {
XPCOMUtils.defineLazyGetter(this, "logger", () => XPCOMUtils.defineLazyGetter(this, "logger", () =>
UrlbarUtils.getLogger({ prefix: `Provider.${this.name}` }) UrlbarUtils.getLogger({ prefix: `Provider.${this.name}` })
@@ -2057,7 +2047,7 @@ class UrlbarProvider {
* // Wait for the timer to have elapsed. * // Wait for the timer to have elapsed.
* await timer.promise; * await timer.promise;
*/ */
class SkippableTimer { export class SkippableTimer {
/** /**
* Creates a skippable timer for the given callback and time. * Creates a skippable timer for the given callback and time.
* @param {object} options An object that configures the timer * @param {object} options An object that configures the timer
@@ -2150,7 +2140,7 @@ class SkippableTimer {
* only l10n strings with bare values but also strings that define attributes * only l10n strings with bare values but also strings that define attributes
* (e.g., ".label = My label value"). See `get` for details. * (e.g., ".label = My label value"). See `get` for details.
*/ */
class L10nCache { export class L10nCache {
/** /**
* @param {Localization} l10n * @param {Localization} l10n
* A `Localization` object like `document.l10n`. This class keeps a weak * A `Localization` object like `document.l10n`. This class keeps a weak
@@ -2349,7 +2339,7 @@ class L10nCache {
* of callbacks (or "tasks") where each callback is called and awaited in order, * of callbacks (or "tasks") where each callback is called and awaited in order,
* one at a time. * one at a time.
*/ */
class TaskQueue { export class TaskQueue {
/** /**
* @returns {Promise} * @returns {Promise}
* Resolves when the queue becomes empty. If the queue is already empty, * Resolves when the queue becomes empty. If the queue is already empty,

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarValueFormatter"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -22,7 +20,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
* Applies URL highlighting and other styling to the text in the urlbar input, * Applies URL highlighting and other styling to the text in the urlbar input,
* depending on the text. * depending on the text.
*/ */
class UrlbarValueFormatter { export class UrlbarValueFormatter {
/** /**
* @param {UrlbarInput} urlbarInput * @param {UrlbarInput} urlbarInput
*/ */

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
var EXPORTED_SYMBOLS = ["UrlbarView"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -50,7 +48,7 @@ function getUniqueId(prefix) {
/** /**
* Receives and displays address bar autocomplete results. * Receives and displays address bar autocomplete results.
*/ */
class UrlbarView { export class UrlbarView {
/** /**
* @param {UrlbarInput} input * @param {UrlbarInput} input
* The UrlbarInput instance belonging to this UrlbarView instance. * The UrlbarInput instance belonging to this UrlbarView instance.

View File

@@ -12,49 +12,49 @@ DIRS += [
] ]
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
"QuickActionsLoaderDefault.jsm", "QuickActionsLoaderDefault.sys.mjs",
"UrlbarController.jsm", "UrlbarController.sys.mjs",
"UrlbarEventBufferer.jsm", "UrlbarEventBufferer.sys.mjs",
"UrlbarInput.jsm", "UrlbarInput.sys.mjs",
"UrlbarMuxerUnifiedComplete.jsm", "UrlbarMuxerUnifiedComplete.sys.mjs",
"UrlbarPrefs.jsm", "UrlbarPrefs.sys.mjs",
"UrlbarProviderAboutPages.jsm", "UrlbarProviderAboutPages.sys.mjs",
"UrlbarProviderAliasEngines.jsm", "UrlbarProviderAliasEngines.sys.mjs",
"UrlbarProviderAutofill.jsm", "UrlbarProviderAutofill.sys.mjs",
"UrlbarProviderBookmarkKeywords.jsm", "UrlbarProviderBookmarkKeywords.sys.mjs",
"UrlbarProviderCalculator.jsm", "UrlbarProviderCalculator.sys.mjs",
"UrlbarProviderExtension.jsm", "UrlbarProviderExtension.sys.mjs",
"UrlbarProviderHeuristicFallback.jsm", "UrlbarProviderHeuristicFallback.sys.mjs",
"UrlbarProviderInputHistory.jsm", "UrlbarProviderInputHistory.sys.mjs",
"UrlbarProviderInterventions.jsm", "UrlbarProviderInterventions.sys.mjs",
"UrlbarProviderOmnibox.jsm", "UrlbarProviderOmnibox.sys.mjs",
"UrlbarProviderOpenTabs.jsm", "UrlbarProviderOpenTabs.sys.mjs",
"UrlbarProviderPlaces.jsm", "UrlbarProviderPlaces.sys.mjs",
"UrlbarProviderPreloadedSites.jsm", "UrlbarProviderPreloadedSites.sys.mjs",
"UrlbarProviderPrivateSearch.jsm", "UrlbarProviderPrivateSearch.sys.mjs",
"UrlbarProviderQuickActions.jsm", "UrlbarProviderQuickActions.sys.mjs",
"UrlbarProviderQuickSuggest.jsm", "UrlbarProviderQuickSuggest.sys.mjs",
"UrlbarProviderRemoteTabs.jsm", "UrlbarProviderRemoteTabs.sys.mjs",
"UrlbarProviderSearchSuggestions.jsm", "UrlbarProviderSearchSuggestions.sys.mjs",
"UrlbarProviderSearchTips.jsm", "UrlbarProviderSearchTips.sys.mjs",
"UrlbarProvidersManager.jsm", "UrlbarProvidersManager.sys.mjs",
"UrlbarProviderTabToSearch.jsm", "UrlbarProviderTabToSearch.sys.mjs",
"UrlbarProviderTokenAliasEngines.jsm", "UrlbarProviderTokenAliasEngines.sys.mjs",
"UrlbarProviderTopSites.jsm", "UrlbarProviderTopSites.sys.mjs",
"UrlbarProviderUnitConversion.jsm", "UrlbarProviderUnitConversion.sys.mjs",
"UrlbarQuickSuggest.jsm", "UrlbarQuickSuggest.sys.mjs",
"UrlbarResult.jsm", "UrlbarResult.sys.mjs",
"UrlbarSearchOneOffs.jsm", "UrlbarSearchOneOffs.sys.mjs",
"UrlbarSearchUtils.jsm", "UrlbarSearchUtils.sys.mjs",
"UrlbarTokenizer.jsm", "UrlbarTokenizer.sys.mjs",
"UrlbarUtils.jsm", "UrlbarUtils.sys.mjs",
"UrlbarValueFormatter.jsm", "UrlbarValueFormatter.sys.mjs",
"UrlbarView.jsm", "UrlbarView.sys.mjs",
] ]
TESTING_JS_MODULES += [ TESTING_JS_MODULES += [
"tests/quicksuggest/QuickSuggestTestUtils.jsm", "tests/quicksuggest/QuickSuggestTestUtils.sys.mjs",
"tests/UrlbarTestUtils.jsm", "tests/UrlbarTestUtils.sys.mjs",
] ]
BROWSER_CHROME_MANIFESTS += [ BROWSER_CHROME_MANIFESTS += [
"tests/browser-tips/browser.ini", "tests/browser-tips/browser.ini",

View File

@@ -3,8 +3,6 @@
"use strict"; "use strict";
const EXPORTED_SYMBOLS = ["UrlbarTestUtils"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -32,7 +30,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
UrlbarSearchUtils: "resource:///modules/UrlbarSearchUtils.jsm", UrlbarSearchUtils: "resource:///modules/UrlbarSearchUtils.jsm",
}); });
var UrlbarTestUtils = { export var UrlbarTestUtils = {
/** /**
* This maps the categories used by the FX_URLBAR_SELECTED_RESULT_METHOD and * This maps the categories used by the FX_URLBAR_SELECTED_RESULT_METHOD and
* FX_SEARCHBAR_SELECTED_RESULT_METHOD histograms to their indexes in the * FX_SEARCHBAR_SELECTED_RESULT_METHOD histograms to their indexes in the

View File

@@ -3,8 +3,6 @@
"use strict"; "use strict";
const EXPORTED_SYMBOLS = ["QuickSuggestTestUtils"];
const { XPCOMUtils } = ChromeUtils.importESModule( const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
@@ -806,4 +804,4 @@ class QSTestUtils {
} }
} }
var QuickSuggestTestUtils = new QSTestUtils(); export var QuickSuggestTestUtils = new QSTestUtils();

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
const EXPORTED_SYMBOLS = ["UnitConverterSimple"];
// NOTE: This units table need to be localized upon supporting multi locales // NOTE: This units table need to be localized upon supporting multi locales
// since it supports en-US only. // since it supports en-US only.
// e.g. Should support plugada or funty as well for pound. // e.g. Should support plugada or funty as well for pound.
@@ -172,7 +170,7 @@ const DECIMAL_PRECISION = 10;
/** /**
* This module converts simple unit such as angle and length. * This module converts simple unit such as angle and length.
*/ */
class UnitConverterSimple { export class UnitConverterSimple {
/** /**
* Convert the given search string. * Convert the given search string.
* *

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
const EXPORTED_SYMBOLS = ["UnitConverterTemperature"];
const ABSOLUTE = ["celsius", "kelvin", "fahrenheit"]; const ABSOLUTE = ["celsius", "kelvin", "fahrenheit"];
const ALIAS = ["c", "k", "f"]; const ALIAS = ["c", "k", "f"];
const UNITS = [...ABSOLUTE, ...ALIAS]; const UNITS = [...ABSOLUTE, ...ALIAS];
@@ -25,7 +23,7 @@ const DECIMAL_PRECISION = 10;
/** /**
* This module converts temperature unit. * This module converts temperature unit.
*/ */
class UnitConverterTemperature { export class UnitConverterTemperature {
/** /**
* Convert the given search string. * Convert the given search string.
* *

View File

@@ -4,8 +4,6 @@
"use strict"; "use strict";
const EXPORTED_SYMBOLS = ["UnitConverterTimezone"];
const TIMEZONES = { const TIMEZONES = {
IDLW: -12, IDLW: -12,
NT: -11, NT: -11,
@@ -69,7 +67,7 @@ const KEYWORD_NOW = "NOW";
/** /**
* This module converts timezone. * This module converts timezone.
*/ */
class UnitConverterTimezone { export class UnitConverterTimezone {
/** /**
* Convert the given search string. * Convert the given search string.
* *

View File

@@ -3,7 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
"UnitConverterSimple.jsm", "UnitConverterSimple.sys.mjs",
"UnitConverterTemperature.jsm", "UnitConverterTemperature.sys.mjs",
"UnitConverterTimezone.jsm", "UnitConverterTimezone.sys.mjs",
] ]