Commit 4292b358 authored by Tooru Fujisawa's avatar Tooru Fujisawa
Browse files

Bug 1705762 - Check null script when iterating and traversing lazy script in...

Bug 1705762 - Check null script when iterating and traversing lazy script in debugger. r=tcampbell a=RyanVM

Differential Revision: https://phabricator.services.mozilla.com/D112834
parent 862a2e28
......@@ -5189,10 +5189,16 @@ class MOZ_STACK_CLASS Debugger::ScriptQuery : public Debugger::QueryBase {
if (!thing.is<JSObject>() || !thing.as<JSObject>().is<JSFunction>()) {
continue;
}
if (!thing.as<JSObject>().as<JSFunction>().hasBaseScript()) {
JSFunction* fun = &thing.as<JSObject>().as<JSFunction>();
if (!fun->hasBaseScript()) {
continue;
}
BaseScript* inner = fun->baseScript();
MOZ_ASSERT(inner);
if (!inner) {
// If the function doesn't have script, ignore it.
continue;
}
BaseScript* inner = thing.as<JSObject>().as<JSFunction>().baseScript();
if (!scriptIsPartialLineMatch(inner)) {
continue;
......
......@@ -503,6 +503,11 @@ static bool PushFunctionScript(JSContext* cx, Debugger* dbg, HandleFunction fun,
}
Rooted<BaseScript*> script(cx, fun->baseScript());
MOZ_ASSERT(script);
if (!script) {
// If the function doesn't have script, ignore it.
return true;
}
RootedObject wrapped(cx, dbg->wrapScript(cx, script));
if (!wrapped) {
return false;
......
......@@ -98,7 +98,18 @@ static void TraverseInnerLazyScriptsForLazyScript(
"All objects in lazy scripts should be functions");
JSFunction* fun = &obj->as<JSFunction>();
if (!fun->hasBaseScript() || fun->hasBytecode()) {
if (!fun->hasBaseScript()) {
// Ignore asm.js.
continue;
}
MOZ_ASSERT(fun->baseScript());
if (!fun->baseScript()) {
// If the function doesn't have script, ignore it.
continue;
}
if (fun->hasBytecode()) {
// Ignore non lazy function.
continue;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment