Bug 761723 - Add a context option to only save source for compileAndGo and function body scripts. r=jornedorff

This commit is contained in:
Benjamin Peterson
2012-07-20 20:19:02 +02:00
parent 3176b95c86
commit 594c0c752a
6 changed files with 36 additions and 18 deletions

View File

@@ -83,10 +83,13 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
return NULL;
AutoAttachToRuntime attacher(cx->runtime);
SourceCompressionToken sct(cx->runtime);
ScriptSource *ss = ScriptSource::createFromSource(cx, chars, length, false, &sct);
if (!ss)
return NULL;
attacher.ss = ss;
ScriptSource *ss = NULL;
if (!cx->hasRunOption(JSOPTION_ONLY_CNG_SOURCE) || compileAndGo) {
ss = ScriptSource::createFromSource(cx, chars, length, false, &sct);
if (!ss)
return NULL;
attacher.ss = ss;
}
Parser parser(cx, principals, originPrincipals, chars, length, filename, lineno, version,
/* foldConstants = */ true, compileAndGo);