Backed out 2 changesets (bug 1673440) for SM Bustages on testPrintError.cpp. CLOSED TREE
authorRazvan Maries <rmaries@mozilla.com>
Tue, 27 Oct 2020 16:46:54 +0200
changeset 554668 ab66bd46c2d6874336d5fad4faceaa9b9448ff5f
parent 554667 e6dcf7fa653df399dd51a398bb2ff72a1bb866bf
child 554669 dff839f08039beb0d8db6c46daf956b6dfe87fc8
push id37897
push userncsoregi@mozilla.com
push dateTue, 27 Oct 2020 21:20:52 +0000
treeherdermozilla-central@ab66bd46c2d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1673440
milestone84.0a1
backs outc4448be58fcb409e1aac608238cb5d38a4d29509
5a0e794b51bf4ad859c1350542577545051ffe5d
first release with
nightly linux32
ab66bd46c2d6 / 84.0a1 / 20201027212052 / files
nightly linux64
ab66bd46c2d6 / 84.0a1 / 20201027212052 / files
nightly mac
ab66bd46c2d6 / 84.0a1 / 20201027212052 / files
nightly win32
ab66bd46c2d6 / 84.0a1 / 20201027212052 / files
nightly win64
ab66bd46c2d6 / 84.0a1 / 20201027212052 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1673440) for SM Bustages on testPrintError.cpp. CLOSED TREE Backed out changeset c4448be58fcb (bug 1673440) Backed out changeset 5a0e794b51bf (bug 1673440)
devtools/client/webconsole/test/browser/browser_webconsole_eval_error.js
devtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js
js/public/friend/ErrorNumbers.msg
js/src/frontend/TokenStream.cpp
js/src/frontend/TokenStream.h
js/src/jit-test/tests/parser/syntax-error-illegal-character.js
js/src/tests/non262/extensions/regress-274152.js
--- a/devtools/client/webconsole/test/browser/browser_webconsole_eval_error.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_eval_error.js
@@ -73,17 +73,17 @@ add_task(async function() {
   is(oiNodes.length, 3, "There is the expected number of nodes in the tree");
 
   ok(oiNodes[0].textContent.includes(`{\u2026}`));
   ok(oiNodes[1].textContent.includes(`fav: "eggplant"`));
   ok(oiNodes[2].textContent.includes(`<prototype>: Object { \u2026 }`));
 
   execute(hud, `1 + @`);
   const messageNode = await waitFor(() =>
-    findMessage(hud, "illegal character U+0040")
+    findMessage(hud, "illegal character")
   );
   is(
     messageNode.querySelector(".frames"),
     null,
     "There's no stacktrace for a SyntaxError evaluation"
   );
 });
 
--- a/devtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js
+++ b/devtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js
@@ -103,26 +103,26 @@ rawPackets.set(`1 + @`, {
       "ownPropertyLength": 4,
       "extensible": true,
       "frozen": false,
       "sealed": false,
       "isError": true,
       "preview": {
         "kind": "Error",
         "name": "SyntaxError",
-        "message": "illegal character U+0040",
+        "message": "illegal character",
         "stack": "",
         "fileName": "debugger eval code",
         "lineNumber": 1,
         "columnNumber": 4
       }
     },
     "actorID": "server0.conn0.child1/obj26"
   },
-  "exceptionMessage": "SyntaxError: illegal character U+0040",
+  "exceptionMessage": "SyntaxError: illegal character",
   "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Illegal_character?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default",
   "hasException": true,
   "frame": {
     "source": "debugger eval code",
     "line": 1,
     "column": 4
   },
   "input": "1 + @",
--- a/js/public/friend/ErrorNumbers.msg
+++ b/js/public/friend/ErrorNumbers.msg
@@ -283,17 +283,17 @@ MSG_DEF(JSMSG_FOR_AWAIT_OUTSIDE_ASYNC, 0
 MSG_DEF(JSMSG_FROM_AFTER_IMPORT_CLAUSE, 0, JSEXN_SYNTAXERR, "missing keyword 'from' after import clause")
 MSG_DEF(JSMSG_FROM_AFTER_EXPORT_STAR,  0, JSEXN_SYNTAXERR, "missing keyword 'from' after export *")
 MSG_DEF(JSMSG_GARBAGE_AFTER_INPUT,     2, JSEXN_SYNTAXERR, "unexpected garbage after {0}, starting with {1}")
 MSG_DEF(JSMSG_IDSTART_AFTER_NUMBER,    0, JSEXN_SYNTAXERR, "identifier starts immediately after numeric literal")
 MSG_DEF(JSMSG_BAD_ESCAPE,              0, JSEXN_SYNTAXERR, "invalid escape sequence")
 MSG_DEF(JSMSG_MISSING_PRIVATE_NAME,    0, JSEXN_SYNTAXERR, "'#' not followed by identifier")
 MSG_DEF(JSMSG_PRIVATE_DELETE,          0, JSEXN_SYNTAXERR, "private fields can't be deleted")
 MSG_DEF(JSMSG_MISSING_PRIVATE_DECL,    1, JSEXN_SYNTAXERR, "reference to undeclared private field or method {0}")
-MSG_DEF(JSMSG_ILLEGAL_CHARACTER,       1, JSEXN_SYNTAXERR, "illegal character {0}")
+MSG_DEF(JSMSG_ILLEGAL_CHARACTER,       0, JSEXN_SYNTAXERR, "illegal character")
 MSG_DEF(JSMSG_IMPORT_META_OUTSIDE_MODULE, 0, JSEXN_SYNTAXERR, "import.meta may only appear in a module")
 MSG_DEF(JSMSG_IMPORT_DECL_AT_TOP_LEVEL, 0, JSEXN_SYNTAXERR, "import declarations may only appear at top level of a module")
 MSG_DEF(JSMSG_OF_AFTER_FOR_LOOP_DECL,  0, JSEXN_SYNTAXERR, "a declaration in the head of a for-of loop can't have an initializer")
 MSG_DEF(JSMSG_IN_AFTER_LEXICAL_FOR_DECL,0,JSEXN_SYNTAXERR, "a lexical declaration in the head of a for-in loop can't have an initializer")
 MSG_DEF(JSMSG_INVALID_FOR_IN_DECL_WITH_INIT,0,JSEXN_SYNTAXERR,"for-in loop head declarations may not have initializers")
 MSG_DEF(JSMSG_INVALID_ID,              1, JSEXN_SYNTAXERR, "{0} is an invalid identifier")
 MSG_DEF(JSMSG_SEPARATOR_IN_ZERO_PREFIXED_NUMBER, 0, JSEXN_SYNTAXERR, "numeric separators '_' are not allowed in numbers that start with '0'")
 MSG_DEF(JSMSG_LABEL_NOT_FOUND,         0, JSEXN_SYNTAXERR, "label not found")
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -31,17 +31,16 @@
 #include "jsexn.h"
 #include "jsnum.h"
 
 #include "frontend/BytecodeCompiler.h"
 #include "frontend/Parser.h"
 #include "frontend/ParserAtom.h"
 #include "frontend/ReservedWords.h"
 #include "js/CharacterEncoding.h"
-#include "js/Printf.h"       // JS_smprintf
 #include "js/RegExpFlags.h"  // JS::RegExpFlags
 #include "js/UniquePtr.h"
 #include "util/StringBuffer.h"
 #include "util/Unicode.h"
 #include "vm/FrameIter.h"  // js::{,NonBuiltin}FrameIter
 #include "vm/HelperThreads.h"
 #include "vm/JSAtom.h"
 #include "vm/JSContext.h"
@@ -1825,27 +1824,16 @@ bool TokenStreamSpecific<Unit, AnyCharsA
     // Add a line of context from this TokenStream to help with debugging.
     return internalComputeLineOfContext(err, offset);
   }
 
   // We can't fill in any more here.
   return true;
 }
 
-template <typename Unit, class AnyCharsAccess>
-void TokenStreamSpecific<Unit, AnyCharsAccess>::reportIllegalCharacter(
-    int32_t cp) {
-  UniqueChars display = JS_smprintf("U+%04X", cp);
-  if (!display) {
-    ReportOutOfMemory(anyCharsAccess().cx);
-    return;
-  }
-  error(JSMSG_ILLEGAL_CHARACTER, display.get());
-}
-
 // We have encountered a '\': check for a Unicode escape sequence after it.
 // Return the length of the escape sequence and the encoded code point (by
 // value) if we found a Unicode escape sequence, and skip all code units
 // involed.  Otherwise, return 0 and don't advance along the buffer.
 template <typename Unit, class AnyCharsAccess>
 uint32_t GeneralTokenStreamChars<Unit, AnyCharsAccess>::matchUnicodeEscape(
     uint32_t* codePoint) {
   MOZ_ASSERT(this->sourceUnits.previousCodeUnit() == Unit('\\'));
@@ -2842,17 +2830,17 @@ MOZ_MUST_USE bool TokenStreamSpecific<Un
                    "IdentifierStart must guarantee !IsLineTerminator "
                    "or else we'll fail to maintain line-info/flags "
                    "for EOL here");
 
         return identifierName(start, identStart, IdentifierEscapes::None,
                               modifier, NameVisibility::Public, ttp);
       }
 
-      reportIllegalCharacter(cp);
+      error(JSMSG_ILLEGAL_CHARACTER);
       return badToken();
     }  // !isAsciiCodePoint(unit)
 
     consumeKnownCodeUnit(unit);
 
     // Get the token kind, based on the first char.  The ordering of c1kind
     // comparison is based on the frequency of tokens in real code:
     // Parsemark (which represents typical JS code on the web) and the
@@ -3354,17 +3342,17 @@ MOZ_MUST_USE bool TokenStreamSpecific<Un
               matchCodeUnit('=') ? TokenKind::SubAssign : TokenKind::Sub;
         }
         break;
 
       default:
         // We consumed a bad ASCII code point/unit.  Put it back so the
         // error location is the bad code point.
         ungetCodeUnit(unit);
-        reportIllegalCharacter(unit);
+        error(JSMSG_ILLEGAL_CHARACTER);
         return badToken();
     }  // switch (AssertedCast<uint8_t>(CodeUnitValue(toUnit(unit))))
 
     MOZ_ASSERT(simpleKind != TokenKind::Limit,
                "switch-statement should have set |simpleKind| before "
                "breaking");
 
     newSimpleToken(simpleKind, start, modifier, ttp);
--- a/js/src/frontend/TokenStream.h
+++ b/js/src/frontend/TokenStream.h
@@ -2560,18 +2560,16 @@ class MOZ_STACK_CLASS TokenStreamSpecifi
         errorAt(offset, JSMSG_UNICODE_OVERFLOW, "escape sequence");
         return;
       case InvalidEscapeType::Octal:
         errorAt(offset, JSMSG_DEPRECATED_OCTAL);
         return;
     }
   }
 
-  void reportIllegalCharacter(int32_t cp);
-
   MOZ_MUST_USE bool putIdentInCharBuffer(const Unit* identStart);
 
   using IsIntegerUnit = bool (*)(int32_t);
   MOZ_MUST_USE MOZ_ALWAYS_INLINE bool matchInteger(IsIntegerUnit isIntegerUnit,
                                                    int32_t* nextUnit);
   MOZ_MUST_USE MOZ_ALWAYS_INLINE bool matchIntegerAfterFirstDigit(
       IsIntegerUnit isIntegerUnit, int32_t* nextUnit);
 
--- a/js/src/jit-test/tests/parser/syntax-error-illegal-character.js
+++ b/js/src/jit-test/tests/parser/syntax-error-illegal-character.js
@@ -1,20 +1,14 @@
 load(libdir + "syntax.js");
 
-function check_syntax_error_at(e, code, name) {
-  assertEq(e instanceof SyntaxError, true, name + ": " + code);
-  assertEq(e.message, "illegal character U+0040", name + ": " + code);
-}
-test_syntax(["@"], check_syntax_error_at, false);
+var JSMSG_ILLEGAL_CHARACTER = "illegal character";
 
-function check_syntax_error_ellipsis(e, code, name) {
+var postfixes = [
+  "@",
+];
+
+function check_syntax_error(e, code, name) {
   assertEq(e instanceof SyntaxError, true, name + ": " + code);
-  assertEq(e.message, "illegal character U+2026", name + ": " + code);
+  assertEq(e.message, JSMSG_ILLEGAL_CHARACTER, name + ": " + code);
 }
-test_syntax(["…"], check_syntax_error_ellipsis, false);
 
-function check_syntax_error_clown(e, code, name) {
-  assertEq(e instanceof SyntaxError, true, name + ": " + code);
-  assertEq(e.message, "illegal character U+1F921", name + ": " + code);
-}
-test_syntax(["🤡"], check_syntax_error_clown, false);
-
+test_syntax(postfixes, check_syntax_error, false);
--- a/js/src/tests/non262/extensions/regress-274152.js
+++ b/js/src/tests/non262/extensions/regress-274152.js
@@ -26,23 +26,20 @@ function test()
                             '\u0601', 
                             '\u0602', 
                             '\u0603', 
                             '\u06DD', 
                             '\u070F'];
 
   for (var i = 0; i < formatcontrolchars.length; i++)
   {
-    var char = formatcontrolchars[i];
-
     try
     {
-      eval("hi" + char + "there = 'howdie';");
+      eval("hi" + formatcontrolchars[i] + "there = 'howdie';");
     }
     catch(ex)
     {
       actual = ex + '';
     }
 
-    var hex = char.codePointAt(0).toString(16).toUpperCase().padStart(4, '0');
-    reportCompare(`${expect} U+${hex}`, actual, summary + ': ' + i);
+    reportCompare(expect, actual, summary + ': ' + i);
   }
 }