Bug 1275508 - Remove JavaScript werror from browser. r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D66255

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Schuster 2020-03-11 12:20:21 +00:00
Родитель 82fbd1a7b3
Коммит 00218dcac0
6 изменённых файлов: 15 добавлений и 64 удалений

Просмотреть файл

@ -274,6 +274,9 @@ void LoadContextOptions(const char* aPrefName, void* /* aClosure */) {
// Context options.
JS::ContextOptions contextOptions;
contextOptions.setAsmJS(GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs")))
#ifdef FUZZING
.setFuzzing(GetWorkerPref<bool>(NS_LITERAL_CSTRING("fuzzing.enabled")))
#endif
.setWasm(GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm")))
.setWasmForTrustedPrinciples(
GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm_trustedprincipals")))
@ -290,11 +293,7 @@ void LoadContextOptions(const char* aPrefName, void* /* aClosure */) {
.setWasmVerbose(GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm_verbose")))
.setThrowOnAsmJSValidationFailure(GetWorkerPref<bool>(
NS_LITERAL_CSTRING("throw_on_asmjs_validation_failure")))
.setAsyncStack(GetWorkerPref<bool>(NS_LITERAL_CSTRING("asyncstack")))
#ifdef FUZZING
.setFuzzing(GetWorkerPref<bool>(NS_LITERAL_CSTRING("fuzzing.enabled")))
#endif
.setWerror(GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror")));
.setAsyncStack(GetWorkerPref<bool>(NS_LITERAL_CSTRING("asyncstack")));
nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
if (xr) {

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
if (xr) {

Просмотреть файл

@ -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<nsIPrincipal> systemprincipal;
// Fetch the system principal and store it away in a global, to use for