зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1732362 part 2 - Initialize JS engine after parsing command line options. r=jonco
This allows us to have shell flags that affect JS_Init. Depends on D136722 Differential Revision: https://phabricator.services.mozilla.com/D136723
This commit is contained in:
Родитель
83fb21552d
Коммит
41b6a25500
|
@ -11896,20 +11896,6 @@ int main(int argc, char** argv) {
|
|||
SetOutputFile("JS_STDOUT", &rcStdout, &gOutFile);
|
||||
SetOutputFile("JS_STDERR", &rcStderr, &gErrFile);
|
||||
|
||||
// Start the engine.
|
||||
if (const char* message = JS_InitWithFailureDiagnostic()) {
|
||||
fprintf(gErrFile->fp, "JS_Init failed: %s\n", message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// `selfHostedXDRBuffer` contains XDR buffer of the self-hosted JS.
|
||||
// A part of it is borrowed by ImmutableScriptData of the self-hosted scripts.
|
||||
//
|
||||
// This buffer's should outlive JS_Shutdown.
|
||||
Maybe<FileContents> selfHostedXDRBuffer;
|
||||
|
||||
auto shutdownEngine = MakeScopeExit([] { JS_ShutDown(); });
|
||||
|
||||
OptionParser op("Usage: {progname} [options] [[script] scriptArgs*]");
|
||||
|
||||
op.setDescription(
|
||||
|
@ -12359,6 +12345,20 @@ int main(int argc, char** argv) {
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
// Start the engine.
|
||||
if (const char* message = JS_InitWithFailureDiagnostic()) {
|
||||
fprintf(gErrFile->fp, "JS_Init failed: %s\n", message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// `selfHostedXDRBuffer` contains XDR buffer of the self-hosted JS.
|
||||
// A part of it is borrowed by ImmutableScriptData of the self-hosted scripts.
|
||||
//
|
||||
// This buffer's should outlive JS_Shutdown.
|
||||
Maybe<FileContents> selfHostedXDRBuffer;
|
||||
|
||||
auto shutdownEngine = MakeScopeExit([] { JS_ShutDown(); });
|
||||
|
||||
// Record aggregated telemetry data on disk. Do this as early as possible such
|
||||
// that the telemetry is recording both before starting the context and after
|
||||
// closing it.
|
||||
|
|
Загрузка…
Ссылка в новой задаче