diff options
Diffstat (limited to 'browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs')
-rw-r--r-- | browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs b/browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs index 12a4a43a1b..0ab9c4c83e 100644 --- a/browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs +++ b/browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs @@ -303,6 +303,9 @@ function shuffle(array, seed) { * Loads the default QuickActions. */ export class QuickActionsLoaderDefault { + // Track the loading of the QuickActions to ensure they aren't loaded multiple times. + static #loadedPromise = null; + static async load() { let keys = Object.keys(DEFAULT_ACTIONS); if (lazy.UrlbarPrefs.get("quickactions.randomOrderActions")) { @@ -328,4 +331,10 @@ export class QuickActionsLoaderDefault { lazy.UrlbarProviderQuickActions.addAction(key, actionData); } } + static async ensureLoaded() { + if (!this.#loadedPromise) { + this.#loadedPromise = this.load(); + } + await this.#loadedPromise; + } } |