Bug 1475228 - Make synchronous compile APIs take SourceBufferHolders exclusively r=jandem r=fitzgen

This commit is contained in:
Jon Coppeard
2018-07-17 14:30:22 +01:00
parent 9598133e75
commit e3be65283a
15 changed files with 78 additions and 137 deletions

View File

@@ -487,8 +487,9 @@ XPCShellEnvironment::EvaluateString(const nsString& aString,
JS::CompileOptions options(cx);
options.setFileAndLine("typein", 0);
JS::Rooted<JSScript*> script(cx);
if (!JS_CompileUCScript(cx, aString.get(), aString.Length(), options,
&script))
JS::SourceBufferHolder srcBuf(aString.get(), aString.Length(),
JS::SourceBufferHolder::NoOwnership);
if (!JS_CompileUCScript(cx, srcBuf, options, &script))
{
return false;
}