mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1465693 - Disallow toggling werror in the JS shell when there are off-thread jobs. r=jonco
This commit is contained in:
parent
82b85b177c
commit
ecac9eb954
7
js/src/jit-test/tests/basic/werror-off-thread-parsing.js
Normal file
7
js/src/jit-test/tests/basic/werror-off-thread-parsing.js
Normal file
@ -0,0 +1,7 @@
|
||||
// |jit-test| error:toggle werror
|
||||
if (helperThreadCount() === 0)
|
||||
throw "toggle werror";
|
||||
options("werror");
|
||||
offThreadCompileScript("function f(){return 1;''}");
|
||||
options("werror");
|
||||
runOffThreadScript();
|
@ -1481,15 +1481,22 @@ Options(JSContext* cx, unsigned argc, Value* vp)
|
||||
if (!opt.encodeUtf8(cx, str))
|
||||
return false;
|
||||
|
||||
if (strcmp(opt.ptr(), "strict") == 0)
|
||||
if (strcmp(opt.ptr(), "strict") == 0) {
|
||||
JS::ContextOptionsRef(cx).toggleExtraWarnings();
|
||||
else if (strcmp(opt.ptr(), "werror") == 0)
|
||||
} else if (strcmp(opt.ptr(), "werror") == 0) {
|
||||
// Disallow toggling werror when there are off-thread jobs, to avoid
|
||||
// confusing CompileError::throwError.
|
||||
ShellContext* sc = GetShellContext(cx);
|
||||
if (!sc->offThreadJobs.empty()) {
|
||||
JS_ReportErrorASCII(cx, "can't toggle werror when there are off-thread jobs");
|
||||
return false;
|
||||
}
|
||||
JS::ContextOptionsRef(cx).toggleWerror();
|
||||
else if (strcmp(opt.ptr(), "throw_on_asmjs_validation_failure") == 0)
|
||||
} else if (strcmp(opt.ptr(), "throw_on_asmjs_validation_failure") == 0) {
|
||||
JS::ContextOptionsRef(cx).toggleThrowOnAsmJSValidationFailure();
|
||||
else if (strcmp(opt.ptr(), "strict_mode") == 0)
|
||||
} else if (strcmp(opt.ptr(), "strict_mode") == 0) {
|
||||
JS::ContextOptionsRef(cx).toggleStrictMode();
|
||||
else {
|
||||
} else {
|
||||
JS_ReportErrorUTF8(cx,
|
||||
"unknown option name '%s'."
|
||||
" The valid names are strict,"
|
||||
|
Loading…
Reference in New Issue
Block a user