зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
cad2de7926
Коммит
3dba4c9b72
|
@ -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)
|
||||
errorGlobal = xpc::PrivilegedJunkScope();
|
||||
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче