From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs') 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; + } } -- cgit v1.2.3