зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1270783. If we end up erroring out of a worker main-script load before we get to creating a global for the worker, don't try to enter that global's compartment to throw an exception. Just squelch it instead. r=khuey
This commit is contained in:
Родитель
7288d777c9
Коммит
0a8135300a
|
@ -1777,8 +1777,10 @@ ScriptExecutorRunnable::PreRun(WorkerPrivate* aWorkerPrivate)
|
|||
NS_WARNING("Failed to make global!");
|
||||
// There's no way to report the exception on jsapi right now, because there
|
||||
// is no way to even enter a compartment on this thread anymore. Just clear
|
||||
// the exception. We'll report some sort of error to our caller thread in
|
||||
// ShutdownScriptLoader.
|
||||
// the exception. We'll report some sort of error to our caller in
|
||||
// ShutdownScriptLoader, but it will get squelched for the same reason we're
|
||||
// squelching here: all the error reporting machinery relies on being able
|
||||
// to enter a compartment to report the error.
|
||||
jsapi.ClearException();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -521,6 +521,16 @@ private:
|
|||
rv.SuppressException();
|
||||
return false;
|
||||
}
|
||||
|
||||
WorkerGlobalScope* globalScope = aWorkerPrivate->GlobalScope();
|
||||
if (NS_WARN_IF(!globalScope)) {
|
||||
// We never got as far as calling GetOrCreateGlobalScope, or it failed.
|
||||
// We have no way to enter a compartment, hence no sane way to report this
|
||||
// error. :(
|
||||
rv.SuppressException();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure to propagate exceptions from rv onto aCx, so that they will get
|
||||
// reported after we return. We do this for all failures on rv, because now
|
||||
// we're using rv to track all the state we care about.
|
||||
|
@ -529,10 +539,8 @@ private:
|
|||
// set it up that way in our Run(), since we had not created the global at
|
||||
// that point yet. So we need to enter the compartment of our global,
|
||||
// because setting a pending exception on aCx involves wrapping into its
|
||||
// current compartment. Luckily we have a global now (else how would we
|
||||
// have a JS exception?) so we can just enter its compartment.
|
||||
JSAutoCompartment ac(aCx,
|
||||
aWorkerPrivate->GlobalScope()->GetGlobalJSObject());
|
||||
// current compartment. Luckily we have a global now.
|
||||
JSAutoCompartment ac(aCx, globalScope->GetGlobalJSObject());
|
||||
if (rv.MaybeSetPendingException(aCx)) {
|
||||
return false;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче