зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1216261 - Fix OOM handling of DebugScopes. (r=jonco)
This commit is contained in:
Родитель
f782f9d407
Коммит
d3a8744d8e
|
@ -0,0 +1,15 @@
|
|||
// |jit-test| exitstatus: 3
|
||||
|
||||
if (!('oomAfterAllocations' in this))
|
||||
quit(3);
|
||||
|
||||
var g = newGlobal();
|
||||
var dbg = new Debugger(g);
|
||||
dbg.onDebuggerStatement = function(frame) {
|
||||
oomAfterAllocations(5);
|
||||
// OOMs here, and possibly again in the error reporter when trying to
|
||||
// report the OOM, so the shell just exits with code 3.
|
||||
frame.older.eval("escaped = function() { return y }");
|
||||
}
|
||||
g.eval("function h() { debugger }");
|
||||
g.eval("(function () { var y = {p:42}; h(); yield })().next();");
|
|
@ -2354,7 +2354,7 @@ DebugScopes::DebugScopes(JSContext* cx)
|
|||
|
||||
DebugScopes::~DebugScopes()
|
||||
{
|
||||
MOZ_ASSERT(missingScopes.empty());
|
||||
MOZ_ASSERT_IF(missingScopes.initialized(), missingScopes.empty());
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -2454,15 +2454,14 @@ DebugScopes::ensureCompartmentData(JSContext* cx)
|
|||
if (c->debugScopes)
|
||||
return c->debugScopes;
|
||||
|
||||
c->debugScopes = cx->runtime()->new_<DebugScopes>(cx);
|
||||
if (c->debugScopes && c->debugScopes->init())
|
||||
return c->debugScopes;
|
||||
AutoInitGCManagedObject<DebugScopes> debugScopes(cx->make_unique<DebugScopes>(cx));
|
||||
if (!debugScopes || !debugScopes->init()) {
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (c->debugScopes)
|
||||
js_delete<DebugScopes>(c->debugScopes);
|
||||
c->debugScopes = nullptr;
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
c->debugScopes = debugScopes.release();
|
||||
return c->debugScopes;
|
||||
}
|
||||
|
||||
DebugScopeObject*
|
||||
|
|
Загрузка…
Ссылка в новой задаче