tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 3b0274e6507ad43822f1138a981bfab85ba0f5d1
parent 379c4b1dd7914b2a852bb99797738d4410d77adf
Author: Greg Tatum <tatum.creative@gmail.com>
Date:   Fri,  3 Oct 2025 18:24:12 +0000

Bug 1990084 - Fix an issue with EXCEPTION_NAMES being empty in the execution environment; r=tarek

There is something strange going on with the PromiseWorker where the
local variables are not showing up. This causes an exception that hides
an error from being properly propagated from the worker.

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

Diffstat:
Mtoolkit/components/promiseworker/worker/PromiseWorker.template.worker.js | 27++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/toolkit/components/promiseworker/worker/PromiseWorker.template.worker.js b/toolkit/components/promiseworker/worker/PromiseWorker.template.worker.js @@ -36,20 +36,6 @@ importScripts("resource://gre/modules/workers/require.js"); // #END_SCRIPT_ONLY /** - * Built-in JavaScript exceptions that may be serialized without - * loss of information. - */ -const EXCEPTION_NAMES = { - EvalError: "EvalError", - InternalError: "InternalError", - RangeError: "RangeError", - ReferenceError: "ReferenceError", - SyntaxError: "SyntaxError", - TypeError: "TypeError", - URIError: "URIError", -}; - -/** * A constructor used to return data to the caller thread while * also executing some specific treatment (e.g. shutting down * the current thread, transmitting data instead of copying it). @@ -104,6 +90,17 @@ function AbstractWorker(agent) { this._agent = agent; this._deferredJobs = new Map(); this._deferredJobId = 0; + // Built-in JavaScript exceptions that may be serialized without + // loss of information. + this._exceptionNames = { + EvalError: "EvalError", + InternalError: "InternalError", + RangeError: "RangeError", + ReferenceError: "ReferenceError", + SyntaxError: "SyntaxError", + TypeError: "TypeError", + URIError: "URIError", + }; } AbstractWorker.prototype = { @@ -225,7 +222,7 @@ AbstractWorker.prototype = { message: exn.message, }; this.postMessage({ fail: error, id, durationMs }); - } else if (exn.constructor.name in EXCEPTION_NAMES) { + } else if (exn.constructor.name in this._exceptionNames) { // Rather than letting the DOM mechanism [de]serialize built-in // JS errors, which loses lots of information (in particular, // the constructor name, the moduleName and the moduleStack),