mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 96580db9b356 (bug 1252565) for test_recursion.html failures
MozReview-Commit-ID: 1ycmM8vfG3d
This commit is contained in:
parent
558a1cf79f
commit
cfefea5c8d
@ -349,10 +349,9 @@ AutoJSAPI::InitInternal(JSObject* aGlobal, JSContext* aCx, bool aIsMainThread)
|
||||
mAutoNullableCompartment.emplace(mCx, aGlobal);
|
||||
}
|
||||
|
||||
JSRuntime* rt = JS_GetRuntime(aCx);
|
||||
mOldErrorReporter.emplace(JS_GetErrorReporter(rt));
|
||||
|
||||
if (aIsMainThread) {
|
||||
JSRuntime* rt = JS_GetRuntime(aCx);
|
||||
mOldErrorReporter.emplace(JS_GetErrorReporter(rt));
|
||||
JS_SetErrorReporter(rt, xpc::SystemErrorReporter);
|
||||
}
|
||||
}
|
||||
@ -466,21 +465,8 @@ AutoJSAPI::InitWithLegacyErrorReporting(nsGlobalWindow* aWindow)
|
||||
void
|
||||
WarningOnlyErrorReporter(JSContext* aCx, const char* aMessage, JSErrorReport* aRep)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(JSREPORT_IS_WARNING(aRep->flags));
|
||||
if (!NS_IsMainThread()) {
|
||||
// Reporting a warning on workers is a bit complicated because we have to
|
||||
// climb our parent chain until we get to the main thread. So go ahead and
|
||||
// just go through the worker ReportError codepath here.
|
||||
//
|
||||
// That said, it feels like we should be able to short-circuit things a bit
|
||||
// here by posting an appropriate runnable to the main thread directly...
|
||||
// Worth looking into sometime.
|
||||
workers::WorkerPrivate* worker = workers::GetWorkerPrivateFromContext(aCx);
|
||||
MOZ_ASSERT(worker);
|
||||
|
||||
worker->ReportError(aCx, aMessage, aRep);
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
|
||||
nsGlobalWindow* win = xpc::CurrentWindowOrNull(aCx);
|
||||
@ -498,7 +484,13 @@ AutoJSAPI::TakeOwnershipOfErrorReporting()
|
||||
JSRuntime *rt = JS_GetRuntime(cx());
|
||||
mOldAutoJSAPIOwnsErrorReporting = JS::ContextOptionsRef(cx()).autoJSAPIOwnsErrorReporting();
|
||||
JS::ContextOptionsRef(cx()).setAutoJSAPIOwnsErrorReporting(true);
|
||||
JS_SetErrorReporter(rt, WarningOnlyErrorReporter);
|
||||
// Workers have their own error reporting mechanism which deals with warnings
|
||||
// as well, so don't change the worker error reporter for now. Once we switch
|
||||
// all of workers to TakeOwnershipOfErrorReporting(), we will just make the
|
||||
// default worker error reporter assert that it only sees warnings.
|
||||
if (mIsMainThread) {
|
||||
JS_SetErrorReporter(rt, WarningOnlyErrorReporter);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -559,6 +559,15 @@ LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ErrorReporter(JSContext* aCx, const char* aMessage, JSErrorReport* aReport)
|
||||
{
|
||||
WorkerPrivate* worker = GetWorkerPrivateFromContext(aCx);
|
||||
MOZ_ASSERT(worker);
|
||||
|
||||
return worker->ReportError(aCx, aMessage, aReport);
|
||||
}
|
||||
|
||||
bool
|
||||
InterruptCallback(JSContext* aCx)
|
||||
{
|
||||
@ -803,6 +812,8 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate, JSRuntime* aRuntime)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JS_SetErrorReporter(aRuntime, ErrorReporter);
|
||||
|
||||
JS_SetInterruptCallback(aRuntime, InterruptCallback);
|
||||
|
||||
js::SetCTypesActivityCallback(aRuntime, CTypesActivityCallback);
|
||||
|
@ -454,12 +454,6 @@ CycleCollectedJSRuntime::~CycleCollectedJSRuntime()
|
||||
NS_RELEASE(mOwningThread);
|
||||
}
|
||||
|
||||
static void
|
||||
MozCrashErrorReporter(JSContext*, const char*, JSErrorReport*)
|
||||
{
|
||||
MOZ_CRASH("Why is someone touching JSAPI without an AutoJSAPI?");
|
||||
}
|
||||
|
||||
nsresult
|
||||
CycleCollectedJSRuntime::Initialize(JSRuntime* aParentRuntime,
|
||||
uint32_t aMaxBytes,
|
||||
@ -503,9 +497,6 @@ CycleCollectedJSRuntime::Initialize(JSRuntime* aParentRuntime,
|
||||
JS_SetContextCallback(mJSRuntime, ContextCallback, this);
|
||||
JS_SetDestroyZoneCallback(mJSRuntime, XPCStringConvert::FreeZoneCache);
|
||||
JS_SetSweepZoneCallback(mJSRuntime, XPCStringConvert::ClearZoneCache);
|
||||
// XPCJSRuntime currently overrides this because we don't
|
||||
// TakeOwnershipOfErrorReporting everwhere on the main thread yet.
|
||||
JS_SetErrorReporter(mJSRuntime, MozCrashErrorReporter);
|
||||
|
||||
static js::DOMCallbacks DOMcallbacks = {
|
||||
InstanceClassHasProtoAtDepth
|
||||
|
Loading…
Reference in New Issue
Block a user