mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1248719. Fix things so that taking ownership of error reporting on an AutoJSAPI on a worker is OK even if that AutoJSAPI was initialized without an explicit global. r=bholley
This commit is contained in:
parent
82f8a5e482
commit
2ad08651e7
@ -507,8 +507,13 @@ AutoJSAPI::ReportException()
|
||||
// In this case, we enter the privileged junk scope and don't dispatch any
|
||||
// error events.
|
||||
JS::Rooted<JSObject*> errorGlobal(cx(), JS::CurrentGlobalOrNull(cx()));
|
||||
if (!errorGlobal)
|
||||
if (!errorGlobal) {
|
||||
if (mIsMainThread) {
|
||||
errorGlobal = xpc::PrivilegedJunkScope();
|
||||
} else {
|
||||
errorGlobal = workers::GetCurrentThreadWorkerGlobal();
|
||||
}
|
||||
}
|
||||
JSAutoCompartment ac(cx(), errorGlobal);
|
||||
JS::Rooted<JS::Value> exn(cx());
|
||||
js::ErrorReport jsReport(cx());
|
||||
|
@ -3247,8 +3247,7 @@ UnprivilegedJunkScopeOrWorkerGlobal()
|
||||
return xpc::UnprivilegedJunkScope();
|
||||
}
|
||||
|
||||
return workers::GetCurrentThreadWorkerPrivate()->
|
||||
GlobalScope()->GetGlobalJSObject();
|
||||
return workers::GetCurrentThreadWorkerGlobal();
|
||||
}
|
||||
} // namespace binding_detail
|
||||
|
||||
|
@ -1369,6 +1369,12 @@ GetCurrentThreadJSContext()
|
||||
return GetCurrentThreadWorkerPrivate()->GetJSContext();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
GetCurrentThreadWorkerGlobal()
|
||||
{
|
||||
return GetCurrentThreadWorkerPrivate()->GlobalScope()->GetGlobalJSObject();
|
||||
}
|
||||
|
||||
END_WORKERS_NAMESPACE
|
||||
|
||||
struct RuntimeService::IdleThreadInfo
|
||||
|
@ -1446,6 +1446,9 @@ IsCurrentThreadRunningChromeWorker();
|
||||
JSContext*
|
||||
GetCurrentThreadJSContext();
|
||||
|
||||
JSObject*
|
||||
GetCurrentThreadWorkerGlobal();
|
||||
|
||||
class AutoSyncLoopHolder
|
||||
{
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
|
Loading…
Reference in New Issue
Block a user