Bug 1724236 - Inline Compile(JS::SourceText) r=arai

The remaining Compile(nsAString) could be inlined as well, but it is only used
in nsJSThunk::EvaluateScript and WindowScriptTimeoutHandler::Call. Right now,
I'm just focusing on use by ScriptLoader.

Differential Revision: https://phabricator.services.mozilla.com/D218452
This commit is contained in:
Bryan Thrall
2024-10-30 13:41:44 +00:00
parent 8e00518582
commit 6f37de74e2
3 changed files with 8 additions and 36 deletions

View File

@@ -2822,7 +2822,10 @@ void ScriptLoader::InstantiateClassicScriptFromMaybeEncodedSource(
RefPtr<JS::Stencil> stencil;
ErrorResult erv;
auto compile = [&](auto& source) {
Compile(aCx, aCompileOptions, source, stencil, erv);
stencil = CompileGlobalScriptToStencil(aCx, aCompileOptions, source);
if (!stencil) {
erv.NoteJSContextException(aCx);
}
};
MOZ_ASSERT(!maybeSource.empty());