diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index 902c32aa60d1..e34067374b29 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -274,6 +274,9 @@ void LoadContextOptions(const char* aPrefName, void* /* aClosure */) { // Context options. JS::ContextOptions contextOptions; contextOptions.setAsmJS(GetWorkerPref(NS_LITERAL_CSTRING("asmjs"))) +#ifdef FUZZING + .setFuzzing(GetWorkerPref(NS_LITERAL_CSTRING("fuzzing.enabled"))) +#endif .setWasm(GetWorkerPref(NS_LITERAL_CSTRING("wasm"))) .setWasmForTrustedPrinciples( GetWorkerPref(NS_LITERAL_CSTRING("wasm_trustedprincipals"))) @@ -290,11 +293,7 @@ void LoadContextOptions(const char* aPrefName, void* /* aClosure */) { .setWasmVerbose(GetWorkerPref(NS_LITERAL_CSTRING("wasm_verbose"))) .setThrowOnAsmJSValidationFailure(GetWorkerPref( NS_LITERAL_CSTRING("throw_on_asmjs_validation_failure"))) - .setAsyncStack(GetWorkerPref(NS_LITERAL_CSTRING("asyncstack"))) -#ifdef FUZZING - .setFuzzing(GetWorkerPref(NS_LITERAL_CSTRING("fuzzing.enabled"))) -#endif - .setWerror(GetWorkerPref(NS_LITERAL_CSTRING("werror"))); + .setAsyncStack(GetWorkerPref(NS_LITERAL_CSTRING("asyncstack"))); nsCOMPtr xr = do_GetService("@mozilla.org/xre/runtime;1"); if (xr) { diff --git a/js/src/tests/user.js b/js/src/tests/user.js index 164b9af099c2..595b66000568 100644 --- a/js/src/tests/user.js +++ b/js/src/tests/user.js @@ -18,7 +18,6 @@ user_pref("browser.cache.check_doc_frequency", 1); user_pref("extensions.checkCompatibility", false); user_pref("extensions.checkUpdateSecurity", false); user_pref("browser.EULA.override", true); -user_pref("javascript.options.werror", false); user_pref("toolkit.startup.max_resumed_crashes", -1); user_pref("security.turn_off_all_security_so_that_viruses_can_take_over_this_computer", true); user_pref("datareporting.healthreport.uploadEnabled", false); diff --git a/js/xpconnect/idl/xpccomponents.idl b/js/xpconnect/idl/xpccomponents.idl index 8032ff6026a6..0c4a818557f9 100644 --- a/js/xpconnect/idl/xpccomponents.idl +++ b/js/xpconnect/idl/xpccomponents.idl @@ -501,19 +501,11 @@ interface nsIXPCComponents_Utils : nsISupports void dispatch(in jsval runnable, [optional] in jsval scope); /* - * To be called from JS only. + * Bug 1621603 - Remove strict_mode. * - * These are the set of JSContext options that privileged script - * is allowed to control for the purposes of testing. These - * options should be kept in sync with what's controllable in the - * jsshell and by setting prefs in nsJSEnvironment. - * - * NB: Assume that getting any of these attributes is relatively - * cheap, but setting any of them is relatively expensive. + * Do not use this API! Instead use "use strict"; at the top of your JS + * file. */ - [implicit_jscontext] - attribute boolean werror; - [implicit_jscontext] attribute boolean strict_mode; diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index f3ad8532f042..e81c0ef1a8dc 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -2096,7 +2096,6 @@ nsXPCComponents_Utils::Dispatch(HandleValue runnableArg, HandleValue scope, return NS_OK; \ } -GENERATE_JSCONTEXTOPTION_GETTER_SETTER(Werror, werror, setWerror) GENERATE_JSCONTEXTOPTION_GETTER_SETTER(Strict_mode, strictMode, setStrictMode) #undef GENERATE_JSCONTEXTOPTION_GETTER_SETTER diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp index 2537a631cf77..7e4a14072903 100644 --- a/js/xpconnect/src/XPCJSContext.cpp +++ b/js/xpconnect/src/XPCJSContext.cpp @@ -911,8 +911,6 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) { bool dumpStackOnDebuggeeWouldRun = Preferences::GetBool( JS_OPTIONS_DOT_STR "dump_stack_on_debuggee_would_run"); - bool werror = Preferences::GetBool(JS_OPTIONS_DOT_STR "werror"); - sSharedMemoryEnabled = Preferences::GetBool(JS_OPTIONS_DOT_STR "shared_memory"); sStreamsEnabled = Preferences::GetBool(JS_OPTIONS_DOT_STR "streams"); @@ -938,6 +936,9 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) { JS::ContextOptionsRef(cx) .setAsmJS(useAsmJS) +#ifdef FUZZING + .setFuzzing(fuzzingEnabled) +#endif .setWasm(useWasm) .setWasmForTrustedPrinciples(useWasmTrustedPrincipals) .setWasmIon(useWasmIon) @@ -952,11 +953,7 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) { .setThrowOnAsmJSValidationFailure(throwOnAsmJSValidationFailure) .setAsyncStack(useAsyncStack) .setThrowOnDebuggeeWouldRun(throwOnDebuggeeWouldRun) - .setDumpStackOnDebuggeeWouldRun(dumpStackOnDebuggeeWouldRun) -#ifdef FUZZING - .setFuzzing(fuzzingEnabled) -#endif - .setWerror(werror); + .setDumpStackOnDebuggeeWouldRun(dumpStackOnDebuggeeWouldRun); nsCOMPtr xr = do_GetService("@mozilla.org/xre/runtime;1"); if (xr) { diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp index b1c2f4e0af11..a0211923c1c9 100644 --- a/js/xpconnect/src/XPCShellImpl.cpp +++ b/js/xpconnect/src/XPCShellImpl.cpp @@ -485,28 +485,18 @@ static bool Options(JSContext* cx, unsigned argc, Value* vp) { return false; } - if (strcmp(opt.get(), "werror") == 0) { - ContextOptionsRef(cx).toggleWerror(); - } else if (strcmp(opt.get(), "strict_mode") == 0) { + if (strcmp(opt.get(), "strict_mode") == 0) { ContextOptionsRef(cx).toggleStrictMode(); } else { JS_ReportErrorUTF8(cx, - "unknown option name '%s'. The valid names are " - "werror and strict_mode.", + "unknown option name '%s'. The valid name is " + "strict_mode.", opt.get()); return false; } } UniqueChars names; - if (oldContextOptions.werror()) { - names = - JS_sprintf_append(std::move(names), "%s%s", names ? "," : "", "werror"); - if (!names) { - JS_ReportOutOfMemory(cx); - return false; - } - } if (names && oldContextOptions.strictMode()) { names = JS_sprintf_append(std::move(names), "%s%s", names ? "," : "", "strict_mode"); @@ -838,7 +828,7 @@ static int usage() { fprintf(gErrFile, "%s\n", JS_GetImplementationVersion()); fprintf( gErrFile, - "usage: xpcshell [-g gredir] [-a appdir] [-r manifest]... [-WwxiCSmIp] " + "usage: xpcshell [-g gredir] [-a appdir] [-r manifest]... [-WwxiCmIp] " "[-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n"); return 2; } @@ -848,27 +838,6 @@ static bool printUsageAndSetExitCode() { return false; } -static void ProcessArgsForCompartment(JSContext* cx, char** argv, int argc) { - for (int i = 0; i < argc; i++) { - if (argv[i][0] != '-' || argv[i][1] == '\0') { - break; - } - - switch (argv[i][1]) { - case 'v': - case 'f': - case 'e': - if (++i == argc) { - return; - } - break; - case 'S': - ContextOptionsRef(cx).toggleWerror(); - break; - } - } -} - static bool ProcessArgs(AutoJSAPI& jsapi, char** argv, int argc, XPCShellDirProvider* aDirProvider) { JSContext* cx = jsapi.cx(); @@ -996,9 +965,6 @@ static bool ProcessArgs(AutoJSAPI& jsapi, char** argv, int argc, compileOnly = true; isInteractive = false; break; - case 'S': - // These options are processed in ProcessArgsForCompartment. - break; case 'p': { // plugins path char* pluginPath = argv[++i]; @@ -1260,7 +1226,6 @@ int XRE_XPCShellMain(int argc, char** argv, char** envp, argc--; argv++; - ProcessArgsForCompartment(cx, argv, argc); nsCOMPtr systemprincipal; // Fetch the system principal and store it away in a global, to use for