diff --git a/js/public/CompileOptions.h b/js/public/CompileOptions.h index 42ab7a3443f5..4640f7400260 100644 --- a/js/public/CompileOptions.h +++ b/js/public/CompileOptions.h @@ -114,7 +114,6 @@ class JS_PUBLIC_API TransitiveCompileOptions { public: // POD options. bool selfHostingMode = false; - bool canLazilyParse = true; bool extraWarningsOption = false; bool werrorOption = false; AsmJSOption asmJSOption = AsmJSOption::Disabled; @@ -408,11 +407,6 @@ class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final return *this; } - CompileOptions& setCanLazilyParse(bool clp) { - canLazilyParse = clp; - return *this; - } - CompileOptions& setSourceIsLazy(bool l) { sourceIsLazy = l; return *this; @@ -447,6 +441,11 @@ class MOZ_STACK_CLASS JS_PUBLIC_API CompileOptions final CompileOptions& setIntroductionInfoToCaller(JSContext* cx, const char* introductionType); + CompileOptions& setForceFullParse() { + forceFullParse_ = true; + return *this; + } + CompileOptions& setForceStrictMode() { forceStrictMode_ = true; return *this; diff --git a/js/src/builtin/ReflectParse.cpp b/js/src/builtin/ReflectParse.cpp index d4f0396fcbd5..25c255736e43 100644 --- a/js/src/builtin/ReflectParse.cpp +++ b/js/src/builtin/ReflectParse.cpp @@ -3631,7 +3631,7 @@ static bool reflect_parse(JSContext* cx, uint32_t argc, Value* vp) { CompileOptions options(cx); options.setFileAndLine(filename.get(), lineno); - options.setCanLazilyParse(false); + options.setForceFullParse(); options.allowHTMLComments = target == ParseGoal::Script; mozilla::Range chars = linearChars.twoByteRange(); UsedNameTracker usedNames(cx); diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp index 1bd1f8c0779a..59a41f938416 100644 --- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -402,8 +402,8 @@ bool BytecodeCompiler::createScriptSource( } bool BytecodeCompiler::canLazilyParse() const { - return options.canLazilyParse && !options.discardSource && - !options.sourceIsLazy && !options.forceFullParse(); + return !options.discardSource && !options.sourceIsLazy && + !options.forceFullParse(); } template diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 7225d8eab54c..f59caaac3bd0 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -3527,7 +3527,6 @@ void JS::TransitiveCompileOptions::copyPODTransitiveOptions( forceFullParse_ = rhs.forceFullParse_; forceStrictMode_ = rhs.forceStrictMode_; selfHostingMode = rhs.selfHostingMode; - canLazilyParse = rhs.canLazilyParse; extraWarningsOption = rhs.extraWarningsOption; werrorOption = rhs.werrorOption; asmJSOption = rhs.asmJSOption; diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index b2a620519c3f..dad61894bf5c 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -942,7 +942,7 @@ static bool InitModuleLoader(JSContext* cx) { options.setIntroductionType("shell module loader"); options.setFileAndLine("shell/ModuleLoader.js", 1); options.setSelfHostingMode(false); - options.setCanLazilyParse(false); + options.setForceFullParse(); options.werrorOption = true; options.setForceStrictMode(); diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index e9314f320559..1d1468076ac8 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -2626,7 +2626,7 @@ void js::FillSelfHostingCompileOptions(CompileOptions& options) { options.setIntroductionType("self-hosted"); options.setFileAndLine("self-hosted", 1); options.setSelfHostingMode(true); - options.setCanLazilyParse(false); + options.setForceFullParse(); options.werrorOption = true; options.extraWarningsOption = true; options.setForceStrictMode(); diff --git a/js/xpconnect/loader/ChromeScriptLoader.cpp b/js/xpconnect/loader/ChromeScriptLoader.cpp index e1d36b534275..36638aba1525 100644 --- a/js/xpconnect/loader/ChromeScriptLoader.cpp +++ b/js/xpconnect/loader/ChromeScriptLoader.cpp @@ -92,9 +92,11 @@ nsresult AsyncScriptCompiler::Start( mCharset = aOptions.mCharset; CompileOptions options(aCx); - options.setFile(mURL.get()) - .setNoScriptRval(!aOptions.mHasReturnValue) - .setCanLazilyParse(aOptions.mLazilyParse); + options.setFile(mURL.get()).setNoScriptRval(!aOptions.mHasReturnValue); + + if (!aOptions.mLazilyParse) { + options.setForceFullParse(); + } if (NS_WARN_IF(!mOptions.copy(aCx, options))) { return NS_ERROR_OUT_OF_MEMORY;