зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1535071 - Use the debugger global scope for worker error reporting if necessary, r=smaug,baku.
Differential Revision: https://phabricator.services.mozilla.com/D24270 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
5e81ad2260
Коммит
b851bf262e
|
@ -483,6 +483,11 @@ void AutoJSAPI::ReportException() {
|
|||
errorGlobal = xpc::PrivilegedJunkScope();
|
||||
} else {
|
||||
errorGlobal = GetCurrentThreadWorkerGlobal();
|
||||
if (!errorGlobal) {
|
||||
// We might be reporting an error in debugger code that ran before the
|
||||
// worker's global was created. Use the debugger global instead.
|
||||
errorGlobal = GetCurrentThreadWorkerDebuggerGlobal();
|
||||
}
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(JS_IsGlobalObject(errorGlobal));
|
||||
|
|
|
@ -2491,5 +2491,17 @@ JSObject* GetCurrentThreadWorkerGlobal() {
|
|||
return scope->GetGlobalJSObject();
|
||||
}
|
||||
|
||||
JSObject* GetCurrentThreadWorkerDebuggerGlobal() {
|
||||
WorkerPrivate* wp = GetCurrentThreadWorkerPrivate();
|
||||
if (!wp) {
|
||||
return nullptr;
|
||||
}
|
||||
WorkerDebuggerGlobalScope* scope = wp->DebuggerGlobalScope();
|
||||
if (!scope) {
|
||||
return nullptr;
|
||||
}
|
||||
return scope->GetGlobalJSObject();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -32,6 +32,8 @@ JSContext* GetCurrentWorkerThreadJSContext();
|
|||
|
||||
JSObject* GetCurrentThreadWorkerGlobal();
|
||||
|
||||
JSObject* GetCurrentThreadWorkerDebuggerGlobal();
|
||||
|
||||
void CancelWorkersForWindow(nsPIDOMWindowInner* aWindow);
|
||||
|
||||
void FreezeWorkersForWindow(nsPIDOMWindowInner* aWindow);
|
||||
|
|
Загрузка…
Ссылка в новой задаче