Bug 1782569 - Pass ErrorContext to ReportoutOfMemory for Stencil. r=nbp
To keep this patch simple to follow, I introduce some temporary functions (initVector, initMap, setInitial, addDelazification) so I can plumb ErrorContext through StencilXdr and ParseAtom in separate patches. Differential Revision: https://phabricator.services.mozilla.com/D153971
This commit is contained in:
@@ -5397,7 +5397,7 @@ static bool DumpAST(JSContext* cx, const JS::ReadOnlyCompileOptions& options,
|
||||
// Emplace the top-level stencil.
|
||||
MOZ_ASSERT(compilationState.scriptData.length() ==
|
||||
CompilationStencil::TopLevelIndex);
|
||||
if (!compilationState.appendScriptStencilAndData(cx)) {
|
||||
if (!compilationState.appendScriptStencilAndData(&ec)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5673,8 +5673,9 @@ static bool FrontendTest(JSContext* cx, unsigned argc, Value* vp,
|
||||
}
|
||||
|
||||
LifoAllocScope allocScope(&cx->tempLifoAlloc());
|
||||
MainThreadErrorContext ec(cx);
|
||||
frontend::CompilationState compilationState(cx, allocScope, input.get());
|
||||
if (!compilationState.init(cx)) {
|
||||
if (!compilationState.init(cx, &ec)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5748,12 +5749,12 @@ static bool SyntaxParse(JSContext* cx, unsigned argc, Value* vp) {
|
||||
}
|
||||
|
||||
LifoAllocScope allocScope(&cx->tempLifoAlloc());
|
||||
MainThreadErrorContext ec(cx);
|
||||
frontend::CompilationState compilationState(cx, allocScope, input.get());
|
||||
if (!compilationState.init(cx)) {
|
||||
if (!compilationState.init(cx, &ec)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MainThreadErrorContext ec(cx);
|
||||
Parser<frontend::SyntaxParseHandler, char16_t> parser(
|
||||
cx, &ec, cx->stackLimitForCurrentPrincipal(), options, chars, length,
|
||||
/* foldConstants = */ false, compilationState,
|
||||
|
||||
Reference in New Issue
Block a user