зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1414174 - Baldr: fix OOM handling in compileStreaming (r=bbouvier)
This commit is contained in:
Родитель
91920b5742
Коммит
6c95d15df7
|
@ -0,0 +1,6 @@
|
|||
if (!this.oomAfterAllocations)
|
||||
quit();
|
||||
oomAfterAllocations(1, 2);
|
||||
var x = wasmTextToBinary('(module (func (export "run") (result i32) i32.const 42))');
|
||||
WebAssembly.compileStreaming(x);
|
||||
drainJobQueue();
|
|
@ -1848,17 +1848,25 @@ WebAssembly_toSource(JSContext* cx, unsigned argc, Value* vp)
|
|||
}
|
||||
#endif
|
||||
|
||||
static bool
|
||||
RejectWithPendingException(JSContext* cx, Handle<PromiseObject*> promise)
|
||||
{
|
||||
if (!cx->isExceptionPending())
|
||||
return false;
|
||||
|
||||
RootedValue rejectionValue(cx);
|
||||
if (!GetAndClearException(cx, &rejectionValue))
|
||||
return false;
|
||||
|
||||
return PromiseObject::reject(cx, promise, rejectionValue);
|
||||
}
|
||||
|
||||
static bool
|
||||
Reject(JSContext* cx, const CompileArgs& args, UniqueChars error, Handle<PromiseObject*> promise)
|
||||
{
|
||||
if (!error) {
|
||||
ReportOutOfMemory(cx);
|
||||
|
||||
RootedValue rejectionValue(cx);
|
||||
if (!cx->getPendingException(&rejectionValue))
|
||||
return false;
|
||||
|
||||
return PromiseObject::reject(cx, promise, rejectionValue);
|
||||
return RejectWithPendingException(cx, promise);
|
||||
}
|
||||
|
||||
RootedObject stack(cx, promise->allocationSite());
|
||||
|
@ -1889,19 +1897,6 @@ Reject(JSContext* cx, const CompileArgs& args, UniqueChars error, Handle<Promise
|
|||
return PromiseObject::reject(cx, promise, rejectionValue);
|
||||
}
|
||||
|
||||
static bool
|
||||
RejectWithPendingException(JSContext* cx, Handle<PromiseObject*> promise)
|
||||
{
|
||||
if (!cx->isExceptionPending())
|
||||
return false;
|
||||
|
||||
RootedValue rejectionValue(cx);
|
||||
if (!GetAndClearException(cx, &rejectionValue))
|
||||
return false;
|
||||
|
||||
return PromiseObject::reject(cx, promise, rejectionValue);
|
||||
}
|
||||
|
||||
static bool
|
||||
Resolve(JSContext* cx, Module& module, const CompileArgs& compileArgs,
|
||||
Handle<PromiseObject*> promise, bool instantiate, HandleObject importObj)
|
||||
|
@ -2519,7 +2514,7 @@ ResolveResponse(JSContext* cx, CallArgs callArgs, Handle<PromiseObject*> promise
|
|||
|
||||
RootedFunction onRejected(cx, NewNativeFunction(cx, ResolveResponse_OnRejected, 1, nullptr,
|
||||
gc::AllocKind::FUNCTION_EXTENDED));
|
||||
if (!onResolved)
|
||||
if (!onRejected)
|
||||
return false;
|
||||
|
||||
onResolved->setExtendedSlot(0, ObjectValue(*closure));
|
||||
|
|
Загрузка…
Ссылка в новой задаче