Bug 815010 - Create lazy interpreted function's script in the jsdbg API's JS_GetFunctionScript. r=luke

--HG--
extra : rebase_source : 3f326115a955bdb99789bf17a6ba1631c6ea3440
This commit is contained in:
Till Schneidereit 2012-12-10 15:46:52 +01:00
parent 4616ea75b7
commit cea46cd79a

View File

@ -448,7 +448,18 @@ JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mark)
JS_PUBLIC_API(JSScript *)
JS_GetFunctionScript(JSContext *cx, JSFunction *fun)
{
return fun->maybeNonLazyScript();
if (fun->isNative())
return NULL;
RawScript script;
if (fun->isInterpretedLazy()) {
AutoCompartment funCompartment(cx, fun);
script = fun->getOrCreateScript(cx);
if (!script)
MOZ_CRASH();
} else {
script = fun->nonLazyScript();
}
return script;
}
JS_PUBLIC_API(JSNative)