Bug 1275508 - Remove werror. r=jandem
authorTom Schuster <evilpies@gmail.com>
Wed, 11 Mar 2020 12:20:21 +0000
changeset 518122 6dd02c648edb3990e67b25f905172497d5891aaa
parent 518121 a08637fb30c82ac079d5422422edbe47d0d101af
child 518123 f34c6e1c6fb504b24150e522cabab3f284ff79f6
push id37204
push userrmaries@mozilla.com
push dateWed, 11 Mar 2020 15:45:15 +0000
treeherdermozilla-central@5e32bdf73dc2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1275508
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1275508 - Remove werror. r=jandem This passes jit-test and jstest locally. I still see some references in jsapi-tests/binast, but I haven't looked into running those yet. The asm.js warning stuff is a bit confusing. It seems like there are multiple mistakes? asmLink claims that it should issue a warning. But it sets "werror", so this would always throw an exception if linking actually threw an exception. Some tests using assertAsmDirectiveFail aren't even valid JS programs .. Differential Revision: https://phabricator.services.mozilla.com/D66225
js/public/CompileOptions.h
js/public/ContextOptions.h
js/public/Warnings.h
js/src/frontend/ErrorReporter.h
js/src/frontend/Parser.cpp
js/src/jit-test/lib/asm.js
js/src/jit-test/lib/asserts.js
js/src/jit-test/tests/asm.js/testBasic.js
js/src/jit-test/tests/asm.js/testBug1117235.js
js/src/jit-test/tests/asm.js/testUseAsmWarnings.js
js/src/jit-test/tests/basic/bug821103.js
js/src/jit-test/tests/basic/bug823310.js
js/src/jit-test/tests/basic/werror-off-thread-parsing.js
js/src/jit-test/tests/basic/werror.js
js/src/jit-test/tests/binast/lazy/basic/bug821103.binjs
js/src/jit-test/tests/binast/lazy/basic/bug823310.binjs
js/src/jit-test/tests/binast/lazy/basic/werror-off-thread-parsing.binjs
js/src/jit-test/tests/binast/lazy/basic/werror-off-thread-parsing.dir
js/src/jit-test/tests/binast/lazy/debug/bug1121083.binjs
js/src/jit-test/tests/binast/lazy/debug/bug1121083.dir
js/src/jit-test/tests/binast/nonlazy/basic/bug821103.binjs
js/src/jit-test/tests/binast/nonlazy/basic/bug823310.binjs
js/src/jit-test/tests/binast/nonlazy/basic/werror-off-thread-parsing.binjs
js/src/jit-test/tests/binast/nonlazy/basic/werror-off-thread-parsing.dir
js/src/jit-test/tests/binast/nonlazy/debug/bug1121083.binjs
js/src/jit-test/tests/binast/nonlazy/debug/bug1121083.dir
js/src/jit-test/tests/debug/bug1121083.js
js/src/jsapi.cpp
js/src/jsexn.cpp
js/src/shell/js.cpp
js/src/tests/browser.js
js/src/vm/ErrorReporting.h
js/src/vm/JSContext.cpp
js/src/vm/SelfHosting.cpp
--- a/js/public/CompileOptions.h
+++ b/js/public/CompileOptions.h
@@ -109,17 +109,16 @@ class JS_PUBLIC_API TransitiveCompileOpt
 
   const char* filename_ = nullptr;
   const char* introducerFilename_ = nullptr;
   const char16_t* sourceMapURL_ = nullptr;
 
  public:
   // POD options.
   bool selfHostingMode = false;
-  bool werrorOption = false;
   AsmJSOption asmJSOption = AsmJSOption::Disabled;
   bool throwOnAsmJSValidationFailureOption = false;
   bool forceAsync = false;
   bool discardSource = false;
   bool sourceIsLazy = false;
   bool allowHTMLComments = true;
   bool hideScriptFromDebugger = false;
 
--- a/js/public/ContextOptions.h
+++ b/js/public/ContextOptions.h
@@ -31,17 +31,16 @@ class JS_PUBLIC_API ContextOptions {
         enableWasmBigInt_(true),
 #endif
         throwOnAsmJSValidationFailure_(false),
         disableIon_(false),
         disableEvalSecurityChecks_(false),
         asyncStack_(true),
         throwOnDebuggeeWouldRun_(true),
         dumpStackOnDebuggeeWouldRun_(false),
-        werror_(false),
         strictMode_(false),
 #ifdef JS_ENABLE_SMOOSH
         trySmoosh_(false),
 #endif
         fuzzing_(false) {
   }
 
   bool asmJS() const { return asmJS_; }
@@ -154,26 +153,16 @@ class JS_PUBLIC_API ContextOptions {
   bool dumpStackOnDebuggeeWouldRun() const {
     return dumpStackOnDebuggeeWouldRun_;
   }
   ContextOptions& setDumpStackOnDebuggeeWouldRun(bool flag) {
     dumpStackOnDebuggeeWouldRun_ = flag;
     return *this;
   }
 
-  bool werror() const { return werror_; }
-  ContextOptions& setWerror(bool flag) {
-    werror_ = flag;
-    return *this;
-  }
-  ContextOptions& toggleWerror() {
-    werror_ = !werror_;
-    return *this;
-  }
-
   bool strictMode() const { return strictMode_; }
   ContextOptions& setStrictMode(bool flag) {
     strictMode_ = flag;
     return *this;
   }
   ContextOptions& toggleStrictMode() {
     strictMode_ = !strictMode_;
     return *this;
@@ -215,17 +204,16 @@ class JS_PUBLIC_API ContextOptions {
   bool enableWasmBigInt_ : 1;
 #endif
   bool throwOnAsmJSValidationFailure_ : 1;
   bool disableIon_ : 1;
   bool disableEvalSecurityChecks_ : 1;
   bool asyncStack_ : 1;
   bool throwOnDebuggeeWouldRun_ : 1;
   bool dumpStackOnDebuggeeWouldRun_ : 1;
-  bool werror_ : 1;
   bool strictMode_ : 1;
 #ifdef JS_ENABLE_SMOOSH
   bool trySmoosh_ : 1;
 #endif
   bool fuzzing_ : 1;
 };
 
 JS_PUBLIC_API ContextOptions& ContextOptionsRef(JSContext* cx);
--- a/js/public/Warnings.h
+++ b/js/public/Warnings.h
@@ -4,20 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * Functionality for issuing and handling warnings.
  *
  * Warnings are situations that aren't inherently full-blown errors (and perhaps
  * for spec compliance *can't* be), but that may represent dubious programming
- * practice that embeddings may wish to know about.  (That said, SpiderMonkey
- * exposes various options that, when active, automatically upgrade warnings to
- * errors.  See |JS::TransitiveCompileOptions::werrorOptions| and
- * |JS::ContextOptions::werror()|.)
+ * practice that embeddings may wish to know about.
  *
  * SpiderMonkey recognizes an unspecified set of syntactic patterns and runtime
  * behaviors as triggering a warning.  Embeddings may also recognize and report
  * additional warnings.
  */
 
 #ifndef js_Warnings_h
 #define js_Warnings_h
--- a/js/src/frontend/ErrorReporter.h
+++ b/js/src/frontend/ErrorReporter.h
@@ -342,23 +342,16 @@ class ErrorReportMixin : public StrictMo
     return false;
   }
 
   // Reports a warning, or an error if the warning is treated as an error.
   MOZ_MUST_USE bool compileWarning(ErrorMetadata&& metadata,
                                    UniquePtr<JSErrorNotes> notes,
                                    unsigned flags, unsigned errorNumber,
                                    va_list* args) {
-    if (options().werrorOption) {
-      flags &= ~JSREPORT_WARNING;
-      ReportCompileErrorLatin1(getContext(), std::move(metadata),
-                               std::move(notes), flags, errorNumber, args);
-      return false;
-    }
-
     return ReportCompileWarning(getContext(), std::move(metadata),
                                 std::move(notes), flags, errorNumber, args);
   }
 };
 
 // An interface class to provide miscellaneous methods used by error reporting
 // etc.  They're mostly used by BytecodeCompiler, BytecodeEmitter, and helper
 // classes for emitter.
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -8824,18 +8824,17 @@ bool GeneralParser<ParseHandler, Unit>::
         return false;
       }
     }
   } else if (handler_.isPropertyAccess(operand)) {
     // Permitted: no additional testing/fixup needed.
   } else if (handler_.isFunctionCall(operand)) {
     // Assignment to function calls is forbidden in ES6.  We're still
     // somewhat concerned about sites using this in dead code, so forbid it
-    // only in strict mode code (or if the werror option has been set), and
-    // otherwise warn.
+    // only in strict mode code.
     if (!strictModeErrorAt(operandOffset, JSMSG_BAD_INCOP_OPERAND)) {
       return false;
     }
   } else {
     errorAt(operandOffset, JSMSG_BAD_INCOP_OPERAND);
     return false;
   }
 
--- a/js/src/jit-test/lib/asm.js
+++ b/js/src/jit-test/lib/asm.js
@@ -1,14 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-const ASM_TYPE_FAIL_STRING = "asm.js type error:";
-const ASM_DIRECTIVE_FAIL_STRING = "\"use asm\" is only meaningful in the Directive Prologue of a function body";
+load(libdir + "asserts.js");
 
 const USE_ASM = '"use asm";';
 const HEAP_IMPORTS = "const i8=new glob.Int8Array(b);var u8=new glob.Uint8Array(b);"+
                      "const i16=new glob.Int16Array(b);var u16=new glob.Uint16Array(b);"+
                      "const i32=new glob.Int32Array(b);var u32=new glob.Uint32Array(b);"+
                      "const f32=new glob.Float32Array(b);var f64=new glob.Float64Array(b);";
 const BUF_MIN = 64 * 1024;
 const BUF_CHANGE_MIN = 16 * 1024 * 1024;
@@ -31,54 +30,38 @@ function asmCompileCached()
     return f;
 }
 
 function assertAsmDirectiveFail(str)
 {
     if (!isAsmJSCompilationAvailable())
         return;
 
-    // Turn on warnings-as-errors
-    var oldOpts = options("werror");
-    assertEq(oldOpts.indexOf("werror"), -1);
-
-    // Verify an error is thrown
-    var caught = false;
-    try {
-        eval(str);
-    } catch (e) {
-        if ((''+e).indexOf(ASM_DIRECTIVE_FAIL_STRING) == -1)
-            throw new Error("Didn't catch the expected directive failure error; instead caught: " + e + "\nStack: " + new Error().stack);
-        caught = true;
-    }
-    if (!caught)
-        throw new Error("Didn't catch the directive failure error");
-
-    // Turn warnings-as-errors back off
-    options("werror");
+    assertWarning(() => {
+        eval(str)
+    }, /meaningful in the Directive Prologue/);
 }
 
 function assertAsmTypeFail()
 {
     if (!isAsmJSCompilationAvailable())
         return;
 
     // Verify no error is thrown with warnings off
     Function.apply(null, arguments);
 
     // Turn on throwing on validation errors
     var oldOpts = options("throw_on_asmjs_validation_failure");
     assertEq(oldOpts.indexOf("throw_on_asmjs_validation_failure"), -1);
 
-    // Verify an error is thrown
     var caught = false;
     try {
         Function.apply(null, arguments);
     } catch (e) {
-        if ((''+e).indexOf(ASM_TYPE_FAIL_STRING) == -1)
+        if (!e.message.includes("asm.js type error:"))
             throw new Error("Didn't catch the expected type failure error; instead caught: " + e + "\nStack: " + new Error().stack);
         caught = true;
     }
     if (!caught)
         throw new Error("Didn't catch the type failure error");
 
     // Turn warnings-as-errors back off
     options("throw_on_asmjs_validation_failure");
@@ -90,107 +73,54 @@ function assertAsmLinkFail(f, ...args)
         return;
 
     assertEq(isAsmJSModule(f), true);
 
     // Verify no error is thrown with warnings off
     var ret = f.apply(null, args);
 
     assertEq(isAsmJSFunction(ret), false);
-    if (typeof ret === 'object')
-        for (var i in ret)
+    if (typeof ret === 'object') {
+        for (var i in ret) {
             assertEq(isAsmJSFunction(ret[i]), false);
-
-    // Turn on warnings-as-errors
-    var oldOpts = options("werror");
-    assertEq(oldOpts.indexOf("werror"), -1);
+        }
+    }
 
-    // Verify an error is thrown
-    var caught = false;
-    try {
+    assertWarning(() => {
         f.apply(null, args);
-    } catch (e) {
-        // Arbitrary code an run in the GetProperty, so don't assert any
-        // particular string
-        caught = true;
-    }
-    if (!caught)
-        throw new Error("Didn't catch the link failure error");
-
-    // Turn warnings-as-errors back off
-    options("werror");
+    }, /Disabled by .*? runtime option/);
 }
 
 // Linking should throw an exception even without warnings-as-errors
 function assertAsmLinkAlwaysFail(f, ...args)
 {
     var caught = false;
     try {
         f.apply(null, args);
     } catch (e) {
         caught = true;
     }
     if (!caught)
         throw new Error("Didn't catch the link failure error");
-
-    // Turn on warnings-as-errors
-    var oldOpts = options("werror");
-    assertEq(oldOpts.indexOf("werror"), -1);
-
-    // Verify an error is thrown
-    var caught = false;
-    try {
-        f.apply(null, args);
-    } catch (e) {
-        caught = true;
-    }
-    if (!caught)
-        throw new Error("Didn't catch the link failure error");
-
-    // Turn warnings-as-errors back off
-    options("werror");
 }
 
 function assertAsmLinkDeprecated(f, ...args)
 {
     if (!isAsmJSCompilationAvailable())
         return;
 
-    // Verify no error is thrown with warnings off
-    f.apply(null, args);
-
-    // Turn on warnings-as-errors
-    var oldOpts = options("werror");
-    assertEq(oldOpts.indexOf("werror"), -1);
-
-    // Verify an error is thrown
-    var caught = false;
-    try {
+    assertWarning(() => {
         f.apply(null, args);
-    } catch (e) {
-        // Arbitrary code an run in the GetProperty, so don't assert any
-        // particular string
-        caught = true;
-    }
-    if (!caught)
-        throw new Error("Didn't catch the link failure error");
-
-    // Turn warnings-as-errors back off
-    options("werror");
+    }, /asm.js type error:/)
 }
 
-// Linking should throw a warning-as-error but otherwise run fine
 function asmLink(f, ...args)
 {
     if (!isAsmJSCompilationAvailable())
         return f.apply(null, args);
 
-    // Turn on warnings-as-errors
-    var oldOpts = options("werror");
-    assertEq(oldOpts.indexOf("werror"), -1);
-
-    var ret = f.apply(null, args);
-
-    // Turn warnings-as-errors back off
-    options("werror");
+    var ret;
+    assertNoWarning(() => {
+        ret = f.apply(null, args);
+    }, "No warning for asmLink")
 
     return ret;
 }
--- a/js/src/jit-test/lib/asserts.js
+++ b/js/src/jit-test/lib/asserts.js
@@ -2,68 +2,55 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 load(libdir + "../../tests/non262/shell.js");
 
 if (typeof assertWarning === 'undefined') {
     var assertWarning = function assertWarning(f, pattern) {
-        var hadWerror = options().split(",").indexOf("werror") !== -1;
+        enableLastWarning();
 
-        // Ensure the "werror" option is disabled.
-        if (hadWerror)
-            options("werror");
+        // Verify that a warning is issued.
+        clearLastWarning();
+        f();
+        var warning = getLastWarning();
+        clearLastWarning();
 
-        try {
-            f();
-        } catch (exc) {
-            if (hadWerror)
-                options("werror");
+        disableLastWarning();
 
-            print("assertWarning: Unexpected exception calling " + f +
-                  " with warnings-as-errors disabled");
-            throw exc;
+        if (warning) {
+            if (!warning.message.match(pattern)) {
+                throw new Error(`assertWarning failed: "${warning.message}" does not match "${pattern}"`);
+            }
+            return;
         }
 
-        // Enable the "werror" option.
-        options("werror");
-
-        try {
-            f();
-        } catch (exc) {
-            if (!String(exc).match(pattern))
-                throw new Error(`assertWarning failed: "${exc}" does not match "${pattern}"`);
-            return;
-        } finally {
-            if (!hadWerror)
-                options("werror");
-        }
         throw new Error("assertWarning failed: no warning");
     };
 }
 
 if (typeof assertNoWarning === 'undefined') {
     var assertNoWarning = function assertNoWarning(f, msg) {
-        // Ensure the "werror" option is enabled.
-        var hadWerror = options().split(",").indexOf("werror") !== -1;
-        if (!hadWerror)
-            options("werror");
+        enableLastWarning();
+
+        // Verify that no warning is issued.
+        clearLastWarning();
+        f();
+        var warning = getLastWarning();
+        clearLastWarning();
 
-        try {
-            f();
-        } catch (exc) {
-            if (msg)
+        disableLastWarning();
+
+        if (warning) {
+            if (msg) {
                 print("assertNoWarning: " + msg);
-            print("assertNoWarning: Unexpected exception calling " + f +
-                  "with warnings-as-errors enabled");
-            throw exc;
-        } finally {
-            if (!hadWerror)
-                options("werror");
+            }
+
+            throw Error("assertNoWarning: Unexpected warning when calling: " + f);
         }
     };
 }
 
 if (typeof assertErrorMessage === 'undefined') {
     var assertErrorMessage = function assertErrorMessage(f, ctor, test) {
         try {
             f();
--- a/js/src/jit-test/tests/asm.js/testBasic.js
+++ b/js/src/jit-test/tests/asm.js/testBasic.js
@@ -110,27 +110,19 @@ assertEq(exp.h1(), 4);
 assertEq(Object.keys(exp).join(), 'f,g1,h1');
 
 // can't test destructuring args with Function constructor
 function assertTypeFailInEval(str)
 {
     if (!isAsmJSCompilationAvailable())
         return;
 
-    var caught = false;
-    var oldOpts = options("werror");
-    assertEq(oldOpts.indexOf("werror"), -1);
-    try {
+    assertWarning(() => {
         eval(str);
-    } catch (e) {
-        assertEq((''+e).indexOf(ASM_TYPE_FAIL_STRING) == -1, false);
-        caught = true;
-    }
-    assertEq(caught, true);
-    options("werror");
+    }, /asm.js type error:/)
 }
 assertTypeFailInEval('function f({}) { "use asm"; function g() {} return g }');
 assertTypeFailInEval('function f({global}) { "use asm"; function g() {} return g }');
 assertTypeFailInEval('function f(global, {imports}) { "use asm"; function g() {} return g }');
 assertTypeFailInEval('function f(g = 2) { "use asm"; function g() {} return g }');
 assertTypeFailInEval('function *f() { "use asm"; function g() {} return g }');
 assertAsmTypeFail(USE_ASM + 'function *f(){}');
 assertTypeFailInEval('f => { "use asm"; function g() {} return g }');
deleted file mode 100644
--- a/js/src/jit-test/tests/asm.js/testBug1117235.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// |jit-test| skip-if: helperThreadCount() === 0
-
-load(libdir + "asserts.js");
-
-options('werror');
-offThreadCompileScript("function f() {'use asm'}");
-assertThrowsInstanceOf(()=>runOffThreadScript(), TypeError);
--- a/js/src/jit-test/tests/asm.js/testUseAsmWarnings.js
+++ b/js/src/jit-test/tests/asm.js/testUseAsmWarnings.js
@@ -1,14 +1,14 @@
 load(libdir + "asm.js");
 
 assertAsmDirectiveFail("'use asm'");
 assertAsmDirectiveFail("eval('\"use asm\";');");
 assertAsmDirectiveFail("{ eval('\"use asm\";'); }");
 assertAsmDirectiveFail("if (Math) { 'use asm'; }");
 assertAsmDirectiveFail("function f(){ { 'use asm'; } }");
-assertAsmDirectiveFail("function f(){ ; 'use asm'; } }");
-assertAsmDirectiveFail("function f(){ 1; 'use asm'; } }");
-assertAsmDirectiveFail("function f(){ var x; 'use asm'; } }");
+assertAsmDirectiveFail("function f(){ ; 'use asm'; }");
+assertAsmDirectiveFail("function f(){ 1; 'use asm'; }");
+assertAsmDirectiveFail("function f(){ var x; 'use asm'; }");
 assertAsmDirectiveFail("function f(){ if (Math) { 'use asm'; } }");
 assertAsmDirectiveFail("(function(){ eval('\"use asm\";') })()");
 assertAsmDirectiveFail("new Function('{\"use asm\";}')");
 assertAsmDirectiveFail("new Function('if (Math){\"use asm\";}')");
deleted file mode 100644
--- a/js/src/jit-test/tests/basic/bug821103.js
+++ /dev/null
@@ -1,4 +0,0 @@
-options("werror");
-load(libdir + "asserts.js");
-
-eval("function x() { var x= 4; 'hi'; }");
deleted file mode 100644
--- a/js/src/jit-test/tests/basic/bug823310.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-options("werror");
-
-// This construct causes a strict warning, but we shouldn't get one since
-// JSOPTION_EXTRA_WARNINGS isn't enabled.
-var x;
-eval("if (x = 3) {}");
deleted file mode 100644
--- a/js/src/jit-test/tests/basic/werror-off-thread-parsing.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// |jit-test| error:toggle werror
-if (helperThreadCount() === 0)
-    throw "toggle werror";
-options("werror");
-offThreadCompileScript("function f(){return 1;''}");
-options("werror");
-runOffThreadScript();
deleted file mode 100644
--- a/js/src/jit-test/tests/basic/werror.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// |jit-test| error: unreachable code; skip-if: isLcovEnabled()
-
-function f() {
-    return 1;
-    return 2;
-}
-options("werror");
-f();
deleted file mode 100644
index d61317afe031769cc3f99ece8d441753299ff0b8..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 46a93c72e429af0f6845e70647b4ed6ce84a222c..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 338d0ec52a024e9a52831b0b3663cfa4ec0f63c2..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/js/src/jit-test/tests/binast/lazy/basic/werror-off-thread-parsing.dir
+++ /dev/null
@@ -1,1 +0,0 @@
-// |jit-test| error:toggle werror
deleted file mode 100644
index d9da5b8fe07cb698a6b00968209f5bec1c5d691e..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/js/src/jit-test/tests/binast/lazy/debug/bug1121083.dir
+++ /dev/null
@@ -1,1 +0,0 @@
-// |jit-test| error:terminated
deleted file mode 100644
index d61317afe031769cc3f99ece8d441753299ff0b8..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 46a93c72e429af0f6845e70647b4ed6ce84a222c..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 338d0ec52a024e9a52831b0b3663cfa4ec0f63c2..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/js/src/jit-test/tests/binast/nonlazy/basic/werror-off-thread-parsing.dir
+++ /dev/null
@@ -1,1 +0,0 @@
-// |jit-test| error:toggle werror
deleted file mode 100644
index 8146cf42177805d75f0b6935e55973e48b4311a7..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/js/src/jit-test/tests/binast/nonlazy/debug/bug1121083.dir
+++ /dev/null
@@ -1,1 +0,0 @@
-// |jit-test| error:terminated
--- a/js/src/jit-test/tests/debug/bug1121083.js
+++ b/js/src/jit-test/tests/debug/bug1121083.js
@@ -1,10 +1,9 @@
-// |jit-test| error:terminated
-options('werror');
+// |jit-test| exitstatus: 6
 
 g = newGlobal({newCompartment: true});
 g.parent = this;
 g.eval("Debugger(parent).onExceptionUnwind = function () {};");
 
 function f(x) {
     if (x === 0) {
         return;
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -3430,17 +3430,16 @@ extern JS_PUBLIC_API JSFunction* JS_Defi
 }
 
 void JS::TransitiveCompileOptions::copyPODTransitiveOptions(
     const TransitiveCompileOptions& rhs) {
   mutedErrors_ = rhs.mutedErrors_;
   forceFullParse_ = rhs.forceFullParse_;
   forceStrictMode_ = rhs.forceStrictMode_;
   selfHostingMode = rhs.selfHostingMode;
-  werrorOption = rhs.werrorOption;
   asmJSOption = rhs.asmJSOption;
   throwOnAsmJSValidationFailureOption = rhs.throwOnAsmJSValidationFailureOption;
   forceAsync = rhs.forceAsync;
   discardSource = rhs.discardSource;
   sourceIsLazy = rhs.sourceIsLazy;
   introductionType = rhs.introductionType;
   introductionLineno = rhs.introductionLineno;
   introductionOffset = rhs.introductionOffset;
@@ -3525,17 +3524,16 @@ bool JS::OwningCompileOptions::copy(JSCo
 
 JS::CompileOptions::CompileOptions(JSContext* cx)
     : ReadOnlyCompileOptions(),
       elementRoot(cx),
       elementAttributeNameRoot(cx),
       introductionScriptRoot(cx),
       scriptOrModuleRoot(cx) {
   discardSource = cx->realm()->behaviors().discardSource();
-  werrorOption = cx->options().werror();
   if (!cx->options().asmJS()) {
     asmJSOption = AsmJSOption::Disabled;
   } else if (cx->realm()->debuggerObservesAsmJS()) {
     asmJSOption = AsmJSOption::DisabledByDebugger;
   } else {
     asmJSOption = AsmJSOption::Enabled;
   }
   throwOnAsmJSValidationFailureOption =
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -290,24 +290,17 @@ void js::ErrorToException(JSContext* cx,
   // Find the exception index associated with this error.
   JSErrNum errorNumber = static_cast<JSErrNum>(reportp->errorNumber);
   if (!callback) {
     callback = GetErrorMessage;
   }
   const JSErrorFormatString* errorString = callback(userRef, errorNumber);
   JSExnType exnType =
       errorString ? static_cast<JSExnType>(errorString->exnType) : JSEXN_ERR;
-  MOZ_ASSERT(exnType < JSEXN_LIMIT);
-  MOZ_ASSERT(exnType != JSEXN_NOTE);
-
-  if (exnType == JSEXN_WARN) {
-    // werror must be enabled, so we use JSEXN_ERR.
-    MOZ_ASSERT(cx->options().werror());
-    exnType = JSEXN_ERR;
-  }
+  MOZ_ASSERT(exnType < JSEXN_ERROR_LIMIT);
 
   // Prevent infinite recursion.
   if (cx->generatingError) {
     return;
   }
 
   cx->generatingError = true;
   auto restore = mozilla::MakeScopeExit([cx] { cx->generatingError = false; });
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -962,17 +962,16 @@ static bool InitModuleLoader(JSContext* 
     return false;
   }
 
   CompileOptions options(cx);
   options.setIntroductionType("shell module loader");
   options.setFileAndLine("shell/ModuleLoader.js", 1);
   options.setSelfHostingMode(false);
   options.setForceFullParse();
-  options.werrorOption = true;
   options.setForceStrictMode();
 
   JS::SourceText<Utf8Unit> srcBuf;
   if (!srcBuf.init(cx, std::move(src), srcLen)) {
     return false;
   }
 
   RootedValue rv(cx);
@@ -1731,51 +1730,37 @@ static bool Options(JSContext* cx, unsig
       return false;
     }
 
     RootedLinearString opt(cx, str->ensureLinear(cx));
     if (!opt) {
       return false;
     }
 
-    if (StringEqualsLiteral(opt, "werror")) {
-      // 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 (StringEqualsLiteral(opt, "throw_on_asmjs_validation_failure")) {
+    if (StringEqualsLiteral(opt, "throw_on_asmjs_validation_failure")) {
       JS::ContextOptionsRef(cx).toggleThrowOnAsmJSValidationFailure();
     } else if (StringEqualsLiteral(opt, "strict_mode")) {
       JS::ContextOptionsRef(cx).toggleStrictMode();
     } else {
       UniqueChars optChars = QuoteString(cx, opt, '"');
       if (!optChars) {
         return false;
       }
 
       JS_ReportErrorASCII(cx,
                           "unknown option name %s."
-                          " The valid names are werror and strict_mode.",
+                          " The valid names are "
+                          "throw_on_asmjs_validation_failure and strict_mode.",
                           optChars.get());
       return false;
     }
   }
 
   UniqueChars names = DuplicateString("");
   bool found = false;
-  if (names && oldContextOptions.werror()) {
-    names =
-        JS_sprintf_append(std::move(names), "%s%s", found ? "," : "", "werror");
-    found = true;
-  }
   if (names && oldContextOptions.throwOnAsmJSValidationFailure()) {
     names = JS_sprintf_append(std::move(names), "%s%s", found ? "," : "",
                               "throw_on_asmjs_validation_failure");
     found = true;
   }
   if (names && oldContextOptions.strictMode()) {
     names = JS_sprintf_append(std::move(names), "%s%s", found ? "," : "",
                               "strict_mode");
--- a/js/src/tests/browser.js
+++ b/js/src/tests/browser.js
@@ -427,17 +427,17 @@
 
   /****************************************
    * HARNESS SETUP AND TEARDOWN FUNCTIONS *
    ****************************************/
 
   function jsTestDriverBrowserInit() {
     // Unset all options before running any test code, cf. the call to
     // |shellOptionsClear| in shell.js' set-up code.
-    for (var optionName of ["werror", "strict_mode"]) {
+    for (var optionName of ["strict_mode"]) {
       if (!HasOwnProperty(SpecialPowersCu, optionName))
         throw "options is out of sync with Components.utils";
 
       // Option is set, toggle it to unset. (Reading an option is a cheap
       // operation, but setting is relatively expensive, so only assign if
       // necessary.)
       if (SpecialPowersCu[optionName])
         SpecialPowersCu[optionName] = false;
--- a/js/src/vm/ErrorReporting.h
+++ b/js/src/vm/ErrorReporting.h
@@ -92,19 +92,16 @@ extern void ReportCompileErrorUTF8(JSCon
                                    UniquePtr<JSErrorNotes> notes,
                                    unsigned flags, unsigned errorNumber,
                                    va_list* args);
 
 /**
  * Report a compile warning during script processing prior to execution of the
  * script.  Returns true if the warning was successfully reported, false if an
  * error occurred.
- *
- * This function DOES NOT respect an existing werror option.  If the caller
- * wishes such option to be respected, it must do so itself.
  */
 extern MOZ_MUST_USE bool ReportCompileWarning(
     JSContext* cx, ErrorMetadata&& metadata, UniquePtr<JSErrorNotes> notes,
     unsigned flags, unsigned errorNumber, va_list* args);
 
 class GlobalObject;
 
 /**
--- a/js/src/vm/JSContext.cpp
+++ b/js/src/vm/JSContext.cpp
@@ -355,31 +355,20 @@ void js::ReportAllocationOverflow(JSCont
   if (cx->isHelperThreadContext()) {
     return;
   }
 
   gc::AutoSuppressGC suppressGC(cx);
   JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_ALLOC_OVERFLOW);
 }
 
-// Warnings become errors when JSOPTION_WERROR is set.
-static unsigned ApplyWerrorFlag(JSContext* cx, unsigned flags) {
-  if (JSREPORT_IS_WARNING(flags) && cx->options().werror()) {
-    return flags & ~JSREPORT_WARNING;
-  }
-
-  return flags;
-}
-
 bool js::ReportErrorVA(JSContext* cx, unsigned flags, const char* format,
                        ErrorArgumentsType argumentsType, va_list ap) {
   JSErrorReport report;
 
-  flags = ApplyWerrorFlag(cx, flags);
-
   UniqueChars message(JS_vsmprintf(format, ap));
   if (!message) {
     ReportOutOfMemory(cx);
     return false;
   }
 
   MOZ_ASSERT_IF(argumentsType == ArgumentsAreASCII,
                 JS::StringIsASCII(message.get()));
@@ -830,17 +819,16 @@ bool js::ExpandErrorArgumentsVA(JSContex
 
 bool js::ReportErrorNumberVA(JSContext* cx, unsigned flags,
                              JSErrorCallback callback, void* userRef,
                              const unsigned errorNumber,
                              ErrorArgumentsType argumentsType, va_list ap) {
   JSErrorReport report;
   bool warning;
 
-  flags = ApplyWerrorFlag(cx, flags);
   warning = JSREPORT_IS_WARNING(flags);
 
   report.flags = flags;
   report.errorNumber = errorNumber;
   PopulateReportBlame(cx, &report);
 
   if (!ExpandErrorArgumentsVA(cx, callback, userRef, errorNumber, argumentsType,
                               &report, ap)) {
@@ -872,17 +860,16 @@ static bool ReportErrorNumberArray(JSCon
                                    JSErrorCallback callback, void* userRef,
                                    const unsigned errorNumber,
                                    const CharT** args) {
   static_assert(
       (argType == ArgumentsAreUnicode && std::is_same_v<CharT, char16_t>) ||
           (argType != ArgumentsAreUnicode && std::is_same_v<CharT, char>),
       "Mismatch between character type and argument type");
 
-  flags = ApplyWerrorFlag(cx, flags);
   bool warning = JSREPORT_IS_WARNING(flags);
 
   JSErrorReport report;
   report.flags = flags;
   report.errorNumber = errorNumber;
   PopulateReportBlame(cx, &report);
 
   if (!ExpandErrorArguments(cx, callback, userRef, errorNumber, args, argType,
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -2551,17 +2551,16 @@ void js::FillSelfHostingCompileOptions(C
    * is supported, for which bytecode is emitted that invokes |fun| with
    * |receiver| as the this-object and ...args as the arguments.
    */
   options.setIntroductionType("self-hosted");
   options.setFileAndLine("self-hosted", 1);
   options.setSkipFilenameValidation(true);
   options.setSelfHostingMode(true);
   options.setForceFullParse();
-  options.werrorOption = true;
   options.setForceStrictMode();
 }
 
 GlobalObject* JSRuntime::createSelfHostingGlobal(JSContext* cx) {
   MOZ_ASSERT(!cx->isExceptionPending());
   MOZ_ASSERT(!cx->realm());
 
   JS::RealmOptions options;