mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Issue #1691 - Part 7f: Split up compile and execute so we can use ClassicScript. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Refactor nsJSUtils::ExecutionContext to separate compilation and execution steps and allow extraction of compiled JSScript. https://bugzilla.mozilla.org/show_bug.cgi?id=1366773 Move buffer argument from JS::StartIncrementalEncoding to JS::FinishIncrementalEncoding.
(cherry picked from commit d4b520b08b958e116dfeeffdc61f3425610d1ce9)
This commit is contained in:
parent
993476283d
commit
c69a47c393
10 changed files with 154 additions and 125 deletions
|
|
@ -2348,12 +2348,23 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
|||
{
|
||||
nsJSUtils::ExecutionContext exec(cx, global);
|
||||
if (aRequest->mOffThreadToken) {
|
||||
JS::Rooted<JSScript*> script(cx);
|
||||
rv = exec.JoinAndExec(&aRequest->mOffThreadToken, &script);
|
||||
rv = exec.JoinDecode(&aRequest->mOffThreadToken);
|
||||
} else {
|
||||
nsAutoString inlineData;
|
||||
SourceBufferHolder srcBuf = GetScriptSource(aRequest, inlineData);
|
||||
rv = exec.CompileAndExec(options, srcBuf);
|
||||
rv = exec.Compile(options, srcBuf);
|
||||
}
|
||||
if (rv == NS_OK) {
|
||||
JS::Rooted<JSScript*> script(cx);
|
||||
script = exec.GetScript();
|
||||
|
||||
// Create a ClassicScript object and associate it with the
|
||||
// JSScript.
|
||||
RefPtr<ClassicScript> classicScript = new ClassicScript(
|
||||
aRequest->mFetchOptions, aRequest->mBaseURL);
|
||||
classicScript->AssociateWithScript(script);
|
||||
|
||||
rv = exec.ExecScript();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue