Bug 892187 - Fix spurious uses of ExclusiveContext->asJSContext(), r=billm.

This commit is contained in:
Brian Hackett
2013-07-15 08:12:40 -06:00
parent 3fd0c0e96a
commit 69eee2d4f4
19 changed files with 154 additions and 74 deletions

View File

@@ -128,6 +128,20 @@ CanLazilyParse(JSContext *cx, const CompileOptions &options)
!cx->compartment()->debugMode();
}
inline void
MaybeCallSourceHandler(JSContext *cx, const CompileOptions &options,
const jschar *chars, size_t length)
{
JSSourceHandler listener = cx->runtime()->debugHooks.sourceHandler;
void *listenerData = cx->runtime()->debugHooks.sourceHandlerData;
if (listener) {
void *listenerTSData;
listener(options.filename, options.lineno, chars, length,
&listenerTSData, listenerData);
}
}
JSScript *
frontend::CompileScript(JSContext *cx, HandleObject scopeChain,
HandleScript evalCaller,
@@ -140,6 +154,8 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain,
RootedString source(cx, source_);
SkipRoot skip(cx, &chars);
MaybeCallSourceHandler(cx, options, chars, length);
/*
* The scripted callerFrame can only be given for compile-and-go scripts
* and non-zero static level requires callerFrame.
@@ -405,6 +421,8 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
// ProgramElements respectively.
SkipRoot skip(cx, &chars);
MaybeCallSourceHandler(cx, options, chars, length);
if (!CheckLength(cx, length))
return false;
ScriptSource *ss = cx->new_<ScriptSource>();