mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 795104 - Load source if needed in JS_DecompileScript. r=jorendorff
This commit is contained in:
parent
6194cd565d
commit
151faf7a36
@ -5478,16 +5478,20 @@ JS_CompileFunction(JSContext *cx, JSObject *objArg, const char *name,
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, unsigned indent)
|
||||
JS_DecompileScript(JSContext *cx, JSScript *scriptArg, const char *name, unsigned indent)
|
||||
{
|
||||
JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment);
|
||||
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
RootedScript script(cx, scriptArg);
|
||||
RootedFunction fun(cx, script->function());
|
||||
if (fun)
|
||||
return JS_DecompileFunction(cx, fun, indent);
|
||||
return script->sourceData(cx);
|
||||
bool haveSource = script->scriptSource()->hasSourceData();
|
||||
if (!haveSource && !JSScript::loadSource(cx, script, &haveSource))
|
||||
return NULL;
|
||||
return haveSource ? script->sourceData(cx) : js_NewStringCopyZ(cx, "[no source]");
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
|
Loading…
Reference in New Issue
Block a user