From d988a687b9d97be1e2563779dd3f1f28362506e0 Mon Sep 17 00:00:00 2001 From: Noemi Erli Date: Mon, 9 Sep 2019 03:37:09 +0300 Subject: [PATCH] Backed out 9 changesets (bug 1578623) for causing Windows build bustages CLOSED TREE Backed out changeset 52a86c60c866 (bug 1578623) Backed out changeset e4fddd3d24b4 (bug 1578623) Backed out changeset 65a7c4daec27 (bug 1578623) Backed out changeset 3badf9215788 (bug 1578623) Backed out changeset 71e58ee8f684 (bug 1578623) Backed out changeset 0128e12a910f (bug 1578623) Backed out changeset 8242877392bd (bug 1578623) Backed out changeset 6d7be8a22f8b (bug 1578623) Backed out changeset 3be609a9be36 (bug 1578623) --HG-- extra : amend_source : b76d374926d247982773b58d12cb26e33d9972e8 --- .eslintignore | 3 -- caps/nsJSPrincipals.cpp | 13 +++---- caps/nsJSPrincipals.h | 9 ----- .../webconsole/test/browser/.eslintrc.js | 5 +-- .../webconsole/test/browser/browser.ini | 4 -- .../browser_webconsole_worklet_error.js | 27 -------------- .../test/browser/test-error-worklet.html | 24 ------------ .../test/browser/test-error-worklet.js | 21 ----------- .../test/browser/test-syntaxerror-worklet.js | 6 --- dom/base/SerializedStackHolder.cpp | 8 ++-- dom/base/SerializedStackHolder.h | 5 +-- dom/base/nsJSEnvironment.cpp | 27 -------------- dom/base/nsJSEnvironment.h | 19 ++++------ dom/console/Console.cpp | 6 +-- dom/worklet/WorkletImpl.cpp | 26 ++++++------- dom/worklet/WorkletImpl.h | 37 ++++++++++--------- dom/worklet/WorkletPrincipals.cpp | 9 ++--- dom/worklet/WorkletThread.cpp | 16 +------- 18 files changed, 59 insertions(+), 206 deletions(-) delete mode 100644 devtools/client/webconsole/test/browser/browser_webconsole_worklet_error.js delete mode 100644 devtools/client/webconsole/test/browser/test-error-worklet.html delete mode 100644 devtools/client/webconsole/test/browser/test-error-worklet.js delete mode 100644 devtools/client/webconsole/test/browser/test-syntaxerror-worklet.js diff --git a/.eslintignore b/.eslintignore index 21f93239a9b6..d2b98dbc6ac7 100644 --- a/.eslintignore +++ b/.eslintignore @@ -149,9 +149,6 @@ devtools/server/tests/unit/babel_and_browserify_script_with_source_map.js devtools/server/tests/unit/setBreakpoint* devtools/server/tests/unit/sourcemapped.js -# Testing syntax error -devtools/client/webconsole/test/browser/test-syntaxerror-worklet.js - # devtools specific format test file devtools/server/tests/unit/xpcshell_debugging_script.js diff --git a/caps/nsJSPrincipals.cpp b/caps/nsJSPrincipals.cpp index aee99870c017..61d95ebab7a6 100644 --- a/caps/nsJSPrincipals.cpp +++ b/caps/nsJSPrincipals.cpp @@ -344,14 +344,13 @@ static bool WritePrincipalInfo(JSStructuredCloneWriter* aWriter, JS_WriteBytes(aWriter, aBaseDomain.get(), aBaseDomain.Length()); } -/* static */ -bool nsJSPrincipals::WritePrincipalInfo(JSStructuredCloneWriter* aWriter, - const PrincipalInfo& aInfo) { +static bool WritePrincipalInfo(JSStructuredCloneWriter* aWriter, + const PrincipalInfo& aInfo) { if (aInfo.type() == PrincipalInfo::TNullPrincipalInfo) { const NullPrincipalInfo& nullInfo = aInfo; return JS_WriteUint32Pair(aWriter, SCTAG_DOM_NULL_PRINCIPAL, 0) && - ::WritePrincipalInfo(aWriter, nullInfo.attrs(), nullInfo.spec(), - EmptyCString(), EmptyCString()); + WritePrincipalInfo(aWriter, nullInfo.attrs(), nullInfo.spec(), + EmptyCString(), EmptyCString()); } if (aInfo.type() == PrincipalInfo::TSystemPrincipalInfo) { return JS_WriteUint32Pair(aWriter, SCTAG_DOM_SYSTEM_PRINCIPAL, 0); @@ -374,8 +373,8 @@ bool nsJSPrincipals::WritePrincipalInfo(JSStructuredCloneWriter* aWriter, MOZ_ASSERT(aInfo.type() == PrincipalInfo::TContentPrincipalInfo); const ContentPrincipalInfo& cInfo = aInfo; return JS_WriteUint32Pair(aWriter, SCTAG_DOM_CONTENT_PRINCIPAL, 0) && - ::WritePrincipalInfo(aWriter, cInfo.attrs(), cInfo.spec(), - cInfo.originNoSuffix(), cInfo.baseDomain()); + WritePrincipalInfo(aWriter, cInfo.attrs(), cInfo.spec(), + cInfo.originNoSuffix(), cInfo.baseDomain()); } bool nsJSPrincipals::write(JSContext* aCx, JSStructuredCloneWriter* aWriter) { diff --git a/caps/nsJSPrincipals.h b/caps/nsJSPrincipals.h index e72323064e33..a7504affbdec 100644 --- a/caps/nsJSPrincipals.h +++ b/caps/nsJSPrincipals.h @@ -9,12 +9,6 @@ #include "jsapi.h" #include "nsIPrincipal.h" -namespace mozilla { -namespace ipc { -class PrincipalInfo; -} // namespace ipc -} // namespace mozilla - class nsJSPrincipals : public nsIPrincipal, public JSPrincipals { public: /* SpiderMonkey security callbacks. */ @@ -30,9 +24,6 @@ class nsJSPrincipals : public nsIPrincipal, public JSPrincipals { uint32_t aTag, JSPrincipals** aOutPrincipals); - /* For write() implementations of off-main-thread JSPrincipals. */ - static bool WritePrincipalInfo(JSStructuredCloneWriter* aWriter, - const mozilla::ipc::PrincipalInfo& aInfo); // This class is used on the main thread to specify which principal to use // when reading principals data that was set on a DOM worker thread. // DOM workers do not use principals from Gecko's point of view, and any diff --git a/devtools/client/webconsole/test/browser/.eslintrc.js b/devtools/client/webconsole/test/browser/.eslintrc.js index 9a3b883a23e7..dd345712f031 100644 --- a/devtools/client/webconsole/test/browser/.eslintrc.js +++ b/devtools/client/webconsole/test/browser/.eslintrc.js @@ -4,10 +4,7 @@ module.exports = { // Extend from the shared list of defined globals for mochitests. "extends": "../../../../.eslintrc.mochitests.js", "overrides": [{ - "files": [ - "test-dynamic-import.js", - "test-error-worklet.js", - ], + "files": ["test-dynamic-import.js"], "parserOptions": { "sourceType": "module", }, diff --git a/devtools/client/webconsole/test/browser/browser.ini b/devtools/client/webconsole/test/browser/browser.ini index 8594b725ca5e..65851cff6a92 100644 --- a/devtools/client/webconsole/test/browser/browser.ini +++ b/devtools/client/webconsole/test/browser/browser.ini @@ -59,8 +59,6 @@ support-files = test-error-worker.html test-error-worker.js test-error-worker2.js - test-error-worklet.html - test-error-worklet.js test-eval-error.html test-eval-in-stackframe.html test-eval-sources.html @@ -142,7 +140,6 @@ support-files = test-subresource-security-error.html test-subresource-security-error.js test-subresource-security-error.js^headers^ - test-syntaxerror-worklet.js test-time-methods.html test-trackingprotection-securityerrors.html test-warning-groups.html @@ -504,4 +501,3 @@ skip-if = (os == "win" && bits == 32) && !debug # Bug 1560261 [browser_webconsole_websocket.js] [browser_webconsole_worker_error.js] [browser_webconsole_worker_evaluate.js] -[browser_webconsole_worklet_error.js] diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_worklet_error.js b/devtools/client/webconsole/test/browser/browser_webconsole_worklet_error.js deleted file mode 100644 index d369eee28b26..000000000000 --- a/devtools/client/webconsole/test/browser/browser_webconsole_worklet_error.js +++ /dev/null @@ -1,27 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Tests that syntax errors in worklet scripts show in the console and that -// throwing uncaught errors and primitive values in worklets shows a stack. - -"use strict"; - -const TEST_URI = - "https://example.com/browser/devtools/client/webconsole/" + - "test/browser/test-error-worklet.html"; - -add_task(async function() { - await SpecialPowers.pushPrefEnv({ - set: [["dom.audioworklet.enabled", true], ["dom.worklet.enabled", true]], - }); - - const hud = await openNewTabAndConsole(TEST_URI); - - await waitFor(() => - findMessage(hud, "SyntaxError: duplicate formal argument") - ); - ok(true, "Received expected SyntaxError"); - - await checkMessageStack(hud, "addModule", [18, 21]); - await checkMessageStack(hud, "process", [7, 12]); -}); diff --git a/devtools/client/webconsole/test/browser/test-error-worklet.html b/devtools/client/webconsole/test/browser/test-error-worklet.html deleted file mode 100644 index 249e184fe637..000000000000 --- a/devtools/client/webconsole/test/browser/test-error-worklet.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - Worklet error generator - - - - diff --git a/devtools/client/webconsole/test/browser/test-error-worklet.js b/devtools/client/webconsole/test/browser/test-error-worklet.js deleted file mode 100644 index cca6667d1997..000000000000 --- a/devtools/client/webconsole/test/browser/test-error-worklet.js +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -function throw_process() { - throw "process"; // eslint-disable-line no-throw-literal -} - -class ErrorProcessor extends AudioWorkletProcessor { - process() { - throw_process(); - } -} -registerProcessor("error", ErrorProcessor); - -function throw_error() { - throw new Error("addModule"); -} - -throw_error(); diff --git a/devtools/client/webconsole/test/browser/test-syntaxerror-worklet.js b/devtools/client/webconsole/test/browser/test-syntaxerror-worklet.js deleted file mode 100644 index 8b2ac630004f..000000000000 --- a/devtools/client/webconsole/test/browser/test-syntaxerror-worklet.js +++ /dev/null @@ -1,6 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -function f(a, a) {} diff --git a/dom/base/SerializedStackHolder.cpp b/dom/base/SerializedStackHolder.cpp index 1ed854117b9f..c832839bbc9e 100644 --- a/dom/base/SerializedStackHolder.cpp +++ b/dom/base/SerializedStackHolder.cpp @@ -27,9 +27,9 @@ void SerializedStackHolder::WriteStack(JSContext* aCx, JS_ClearPendingException(aCx); } -void SerializedStackHolder::SerializeMainThreadOrWorkletStack( - JSContext* aCx, JS::HandleObject aStack) { - MOZ_ASSERT(!IsCurrentThreadRunningWorker()); +void SerializedStackHolder::SerializeMainThreadStack(JSContext* aCx, + JS::HandleObject aStack) { + MOZ_ASSERT(NS_IsMainThread()); WriteStack(aCx, aStack); } @@ -59,7 +59,7 @@ void SerializedStackHolder::SerializeCurrentStack(JSContext* aCx) { if (stack) { if (NS_IsMainThread()) { - SerializeMainThreadOrWorkletStack(aCx, stack); + SerializeMainThreadStack(aCx, stack); } else { WorkerPrivate* currentWorker = GetCurrentThreadWorkerPrivate(); SerializeWorkerStack(aCx, currentWorker, stack); diff --git a/dom/base/SerializedStackHolder.h b/dom/base/SerializedStackHolder.h index 0ad0fb6e10e0..979ca50aed9f 100644 --- a/dom/base/SerializedStackHolder.h +++ b/dom/base/SerializedStackHolder.h @@ -30,9 +30,8 @@ class SerializedStackHolder { public: SerializedStackHolder(); - // Fill this holder with a main or worklet thread stack. - void SerializeMainThreadOrWorkletStack(JSContext* aCx, - JS::HandleObject aStack); + // Fill this holder with a main thread stack. + void SerializeMainThreadStack(JSContext* aCx, JS::HandleObject aStack); // Fill this holder with a worker thread stack. void SerializeWorkerStack(JSContext* aCx, WorkerPrivate* aWorkerPrivate, diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 4fdc08feeae9..9be0df61736e 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -65,7 +65,6 @@ #include "mozilla/dom/ErrorEvent.h" #include "mozilla/dom/FetchUtil.h" #include "mozilla/dom/ScriptSettings.h" -#include "mozilla/dom/SerializedStackHolder.h" #include "mozilla/CycleCollectedJSRuntime.h" #include "mozilla/SystemGroup.h" #include "nsRefreshDriver.h" @@ -2617,32 +2616,6 @@ void mozilla::dom::ShutdownJSEnvironment() { sDidShutdown = true; } -AsyncErrorReporter::AsyncErrorReporter(xpc::ErrorReport* aReport) - : Runnable("dom::AsyncErrorReporter"), mReport(aReport) {} - -void AsyncErrorReporter::SerializeStack(JSContext* aCx, - JS::Handle aStack) { - mStackHolder = MakeUnique(); - mStackHolder->SerializeMainThreadOrWorkletStack(aCx, aStack); -} - -NS_IMETHODIMP AsyncErrorReporter::Run() { - AutoJSAPI jsapi; - DebugOnly ok = jsapi.Init(xpc::UnprivilegedJunkScope()); - MOZ_ASSERT(ok, "Problem with junk scope?"); - JSContext* cx = jsapi.cx(); - JS::Rooted stack(cx); - JS::Rooted stackGlobal(cx); - if (mStackHolder) { - stack = mStackHolder->ReadStack(cx); - if (stack) { - stackGlobal = JS::CurrentGlobalOrNull(cx); - } - } - mReport->LogToConsoleWithStack(stack, stackGlobal); - return NS_OK; -} - // A fast-array class for JS. This class supports both nsIJSScriptArray and // nsIArray. If it is JS itself providing and consuming this class, all work // can be done via nsIJSScriptArray, and avoid the conversion of elements diff --git a/dom/base/nsJSEnvironment.h b/dom/base/nsJSEnvironment.h index 2bc35e25db8b..2a197cd0bdb1 100644 --- a/dom/base/nsJSEnvironment.h +++ b/dom/base/nsJSEnvironment.h @@ -151,27 +151,22 @@ class nsJSContext : public nsIScriptContext { namespace mozilla { namespace dom { -class SerializedStackHolder; - void StartupJSEnvironment(); void ShutdownJSEnvironment(); // Runnable that's used to do async error reporting class AsyncErrorReporter final : public mozilla::Runnable { public: - explicit AsyncErrorReporter(xpc::ErrorReport* aReport); - // SerializeStack is suitable for main or worklet thread use. - // Stacks from worker threads are not supported. - // See https://bugzilla.mozilla.org/show_bug.cgi?id=1578968 - void SerializeStack(JSContext* aCx, JS::Handle aStack); + explicit AsyncErrorReporter(xpc::ErrorReport* aReport) + : Runnable("dom::AsyncErrorReporter"), mReport(aReport) {} + + NS_IMETHOD Run() override { + mReport->LogToConsole(); + return NS_OK; + } protected: - NS_IMETHOD Run() override; - RefPtr mReport; - // This may be used to marshal a stack from an arbitrary thread/runtime into - // the main thread/runtime where the console service runs. - UniquePtr mStackHolder; }; } // namespace dom diff --git a/dom/console/Console.cpp b/dom/console/Console.cpp index 7d974a88a24e..24ff2eef30b0 100644 --- a/dom/console/Console.cpp +++ b/dom/console/Console.cpp @@ -570,7 +570,7 @@ class ConsoleCallDataWorkletRunnable final : public ConsoleWorkletRunnable { AutoSafeJSContext cx; JSObject* sandbox = - mConsole->GetOrCreateSandbox(cx, mWorkletImpl->Principal()); + mConsole->GetOrCreateSandbox(cx, mWorkletImpl->LoadInfo().Principal()); JS::Rooted global(cx, sandbox); if (NS_WARN_IF(!global)) { return; @@ -818,7 +818,7 @@ class ConsoleProfileWorkletRunnable final : public ConsoleWorkletRunnable { AutoSafeJSContext cx; JSObject* sandbox = - mConsole->GetOrCreateSandbox(cx, mWorkletImpl->Principal()); + mConsole->GetOrCreateSandbox(cx, mWorkletImpl->LoadInfo().Principal()); JS::Rooted global(cx, sandbox); if (NS_WARN_IF(!global)) { return; @@ -1445,7 +1445,7 @@ void Console::MethodInternal(JSContext* aCx, MethodName aMethodName, } else if (WorkletThread::IsOnWorkletThread()) { nsCOMPtr global = do_QueryInterface(mGlobal); MOZ_ASSERT(global); - oa = global->Impl()->OriginAttributesRef(); + oa = global->Impl()->LoadInfo().OriginAttributesRef(); } else { WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate(); MOZ_ASSERT(workerPrivate); diff --git a/dom/worklet/WorkletImpl.cpp b/dom/worklet/WorkletImpl.cpp index e4b2020452c4..fb4e109b9c58 100644 --- a/dom/worklet/WorkletImpl.cpp +++ b/dom/worklet/WorkletImpl.cpp @@ -10,7 +10,6 @@ #include "WorkletThread.h" #include "mozilla/BasePrincipal.h" -#include "mozilla/NullPrincipal.h" #include "mozilla/dom/RegisterWorkletBindings.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/WorkletBinding.h" @@ -20,8 +19,11 @@ namespace mozilla { // --------------------------------------------------------------------------- // WorkletLoadInfo -WorkletLoadInfo::WorkletLoadInfo(nsPIDOMWindowInner* aWindow) - : mInnerWindowID(aWindow->WindowID()) { +WorkletLoadInfo::WorkletLoadInfo(nsPIDOMWindowInner* aWindow, + nsIPrincipal* aPrincipal) + : mInnerWindowID(aWindow->WindowID()), + mOriginAttributes(BasePrincipal::Cast(aPrincipal)->OriginAttributesRef()), + mPrincipal(aPrincipal) { MOZ_ASSERT(NS_IsMainThread()); nsPIDOMWindowOuter* outerWindow = aWindow->GetOuterWindow(); if (outerWindow) { @@ -31,21 +33,17 @@ WorkletLoadInfo::WorkletLoadInfo(nsPIDOMWindowInner* aWindow) } } +WorkletLoadInfo::~WorkletLoadInfo() { + MOZ_ASSERT(!mPrincipal || NS_IsMainThread()); +} + // --------------------------------------------------------------------------- // WorkletImpl WorkletImpl::WorkletImpl(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal) - : mPrincipal(NullPrincipal::CreateWithInheritedAttributes(aPrincipal)), - mWorkletLoadInfo(aWindow), - mTerminated(false) { - Unused << NS_WARN_IF( - NS_FAILED(ipc::PrincipalToPrincipalInfo(mPrincipal, &mPrincipalInfo))); -} + : mWorkletLoadInfo(aWindow, aPrincipal), mTerminated(false) {} -WorkletImpl::~WorkletImpl() { - MOZ_ASSERT(!mGlobalScope); - MOZ_ASSERT(!mPrincipal || NS_IsMainThread()); -} +WorkletImpl::~WorkletImpl() { MOZ_ASSERT(!mGlobalScope); } JSObject* WorkletImpl::WrapWorklet(JSContext* aCx, dom::Worklet* aWorklet, JS::Handle aGivenProto) { @@ -98,7 +96,7 @@ void WorkletImpl::NotifyWorkletFinished() { mWorkletThread->Terminate(); mWorkletThread = nullptr; } - mPrincipal = nullptr; + mWorkletLoadInfo.mPrincipal = nullptr; } nsresult WorkletImpl::SendControlMessage( diff --git a/dom/worklet/WorkletImpl.h b/dom/worklet/WorkletImpl.h index d879095b6ee4..a9fcc1276d33 100644 --- a/dom/worklet/WorkletImpl.h +++ b/dom/worklet/WorkletImpl.h @@ -9,7 +9,6 @@ #include "MainThreadUtils.h" #include "mozilla/OriginAttributes.h" -#include "mozilla/ipc/PBackgroundSharedTypes.h" class nsPIDOMWindowInner; class nsIPrincipal; @@ -27,15 +26,31 @@ class WorkletThread; class WorkletLoadInfo { public: - explicit WorkletLoadInfo(nsPIDOMWindowInner* aWindow); + WorkletLoadInfo(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal); + ~WorkletLoadInfo(); uint64_t OuterWindowID() const { return mOuterWindowID; } uint64_t InnerWindowID() const { return mInnerWindowID; } + const OriginAttributes& OriginAttributesRef() const { + return mOriginAttributes; + } + + nsIPrincipal* Principal() const { + MOZ_ASSERT(NS_IsMainThread()); + return mPrincipal; + } + private: // Modified only in constructor. uint64_t mOuterWindowID; const uint64_t mInnerWindowID; + const OriginAttributes mOriginAttributes; + // Accessed on only worklet parent thread. + nsCOMPtr mPrincipal; + + friend class WorkletImpl; + friend class WorkletThread; }; /** @@ -56,11 +71,6 @@ class WorkletImpl { virtual nsresult SendControlMessage(already_AddRefed aRunnable); - nsIPrincipal* Principal() const { - MOZ_ASSERT(NS_IsMainThread()); - return mPrincipal; - } - void NotifyWorkletFinished(); // Execution thread only. @@ -69,10 +79,6 @@ class WorkletImpl { // Any thread. const WorkletLoadInfo& LoadInfo() const { return mWorkletLoadInfo; } - const OriginAttributes& OriginAttributesRef() const { - return mPrincipalInfo.get_NullPrincipalInfo().attrs(); - } - const ipc::PrincipalInfo& PrincipalInfo() const { return mPrincipalInfo; } protected: WorkletImpl(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal); @@ -80,12 +86,9 @@ class WorkletImpl { virtual already_AddRefed ConstructGlobalScope() = 0; - // Modified only in constructor. - ipc::PrincipalInfo mPrincipalInfo; - // Accessed on only worklet parent thread. - nsCOMPtr mPrincipal; - - const WorkletLoadInfo mWorkletLoadInfo; + // The only WorkletLoadInfo member modified is mPrincipal which is accessed + // on only the parent thread. + WorkletLoadInfo mWorkletLoadInfo; // Parent thread only. RefPtr mWorkletThread; diff --git a/dom/worklet/WorkletPrincipals.cpp b/dom/worklet/WorkletPrincipals.cpp index 519a4e3089de..9eef61473e3f 100644 --- a/dom/worklet/WorkletPrincipals.cpp +++ b/dom/worklet/WorkletPrincipals.cpp @@ -6,7 +6,7 @@ #include "WorkletPrincipals.h" -#include "nsJSPrincipals.h" +#include "mozilla/Assertions.h" namespace mozilla { namespace dom { @@ -20,11 +20,8 @@ WorkletPrincipals::~WorkletPrincipals() = default; bool WorkletPrincipals::write(JSContext* aCx, JSStructuredCloneWriter* aWriter) { - // This is a serialization of the NullPrincipal corresponding to the worklet - // environment settings object for the WorkletGlobalScope. - // https://drafts.css-houdini.org/worklets/#set-up-a-worklet-environment-settings-object - return nsJSPrincipals::WritePrincipalInfo(aWriter, - mWorkletImpl->PrincipalInfo()); + MOZ_CRASH("WorkletPrincipals::write not implemented"); + return false; } void WorkletPrincipals::Destroy(JSPrincipals* aPrincipals) { diff --git a/dom/worklet/WorkletThread.cpp b/dom/worklet/WorkletThread.cpp index f28d23e38a9c..b324cec416ed 100644 --- a/dom/worklet/WorkletThread.cpp +++ b/dom/worklet/WorkletThread.cpp @@ -186,22 +186,8 @@ void WorkletJSContext::ReportError(JSErrorReport* aReport, RefPtr xpcReport = new xpc::ErrorReport(); xpcReport->Init(aReport, aToStringResult.c_str(), IsSystemCaller(), GetCurrentWorkletWindowID()); + RefPtr reporter = new AsyncErrorReporter(xpcReport); - - JSContext* cx = Context(); - JS::Rooted exn(cx); - if (JS_GetPendingException(cx, &exn)) { - JS::Rooted exnStack(cx, JS::GetPendingExceptionStack(cx)); - JS_ClearPendingException(cx); - JS::Rooted stack(cx); - JS::Rooted stackGlobal(cx); - xpc::FindExceptionStackForConsoleReport(nullptr, exn, exnStack, &stack, - &stackGlobal); - if (stack) { - reporter->SerializeStack(cx, stack); - } - } - NS_DispatchToMainThread(reporter); }