brizental pushed to branch mullvad-browser-149.0a1-16.0-2 at The Tor Project / 
Applications / Mullvad Browser


Commits:
f8742cad by Beatriz Rizental at 2026-03-24T15:04:38-03:00
BB 43243 [android]: Keep processing pending inits after failure

This is in the process of being uplifted.

Bug 2021618: bugzilla.mozilla.org/show_bug.cgi?id=2021618

Differential Revision: https://phabricator.services.mozilla.com/D286669

- - - - -


3 changed files:

- mobile/shared/modules/geckoview/DelayedInit.sys.mjs
- + mobile/shared/modules/geckoview/test/xpcshell/test_DelayedInit.js
- mobile/shared/modules/geckoview/test/xpcshell/xpcshell.toml


Changes:

=====================================
mobile/shared/modules/geckoview/DelayedInit.sys.mjs
=====================================
@@ -96,7 +96,11 @@ var Impl = {
           return false;
         }
         this.complete = true;
-        this.fn.call();
+        try {
+          this.fn.call();
+        } catch (e) {
+          console.error("Error running init", e);
+        }
         this.fn = null;
         return true;
       },


=====================================
mobile/shared/modules/geckoview/test/xpcshell/test_DelayedInit.js
=====================================
@@ -0,0 +1,48 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
+const { DelayedInit } = ChromeUtils.importESModule(
+  "resource://gre/modules/DelayedInit.sys.mjs"
+);
+
+add_task(async function test_delayed_init_continues_queue_on_failure() {
+  const results = [];
+  const waitMs = 0;
+
+  DelayedInit.schedule(
+    () => {
+      results.push("first");
+    },
+    null,
+    null,
+    waitMs
+  );
+
+  DelayedInit.schedule(
+    () => {
+      results.push("second");
+      throw new Error("Deliberate error for testing");
+    },
+    null,
+    null,
+    waitMs
+  );
+
+  DelayedInit.schedule(
+    () => {
+      results.push("third");
+    },
+    null,
+    null,
+    waitMs
+  );
+
+  await new Promise(resolve => ChromeUtils.idleDispatch(resolve));
+
+  Assert.deepEqual(
+    results,
+    ["first", "second", "third"],
+    "Queue processes all inits even when one fails"
+  );
+});


=====================================
mobile/shared/modules/geckoview/test/xpcshell/xpcshell.toml
=====================================
@@ -7,6 +7,8 @@ prefs = "browser.crashReports.onDemand=true"
 
 ["test_ChildCrashHandler.js"]
 
+["test_DelayedInit.js"]
+
 ["test_GeckoViewAppConstants.js"]
 
 ["test_RemoteSettingsCrashPull.js"]



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/f8742cadd1f9ec4aeda46296a643d658c2a6957a

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/f8742cadd1f9ec4aeda46296a643d658c2a6957a
You're receiving this email because of your account on gitlab.torproject.org. 
Manage all notifications: https://gitlab.torproject.org/-/profile/notifications 
| Help: https://gitlab.torproject.org/help


_______________________________________________
tbb-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to