Bug 1530879 - Update the test262 import to upstream rev afe1b5adc7d961e4daf261867ffa9fd3d22b1235. r=jorendorff
authorJeff Walden <jwalden@mit.edu>
Tue, 26 Feb 2019 17:06:48 -0800
changeset 461664 c86ae31a259544cc0e54d816a4d6e5c445306388
parent 461663 1f34e2faf03052c4f8867a79129bded61451f784
child 461665 2990c1cb854817a60abf6c6d71bd22abd7dc23e6
push id35626
push usercsabou@mozilla.com
push dateThu, 28 Feb 2019 11:31:08 +0000
treeherdermozilla-central@2ea0c1db7e60 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1530879
milestone67.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 1530879 - Update the test262 import to upstream rev afe1b5adc7d961e4daf261867ffa9fd3d22b1235. r=jorendorff
js/src/tests/test262/GIT-INFO
js/src/tests/test262/annexB/language/eval-code/direct/var-env-lower-lex-catch-non-strict.js
js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-in-var.js
js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js
js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-var.js
js/src/tests/test262/built-ins/Math/fround/ties.js
js/src/tests/test262/intl402/Locale/constructor-options-language-valid.js
js/src/tests/test262/intl402/Locale/constructor-tag.js
js/src/tests/test262/intl402/Locale/extensions-private.js
js/src/tests/test262/intl402/Locale/getters-privateuse.js
js/src/tests/test262/intl402/Locale/likely-subtags.js
js/src/tests/test262/intl402/NumberFormat/prototype/format/format-fraction-digits-precision.js
js/src/tests/test262/intl402/NumberFormat/prototype/format/format-significant-digits-precision.js
js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-catch-non-strict.js
js/src/tests/test262/language/statements/try/early-catch-var.js
--- a/js/src/tests/test262/GIT-INFO
+++ b/js/src/tests/test262/GIT-INFO
@@ -1,5 +1,5 @@
-commit 5eab51827b434131d71c6aa0d306284eb50f3cc9
-Author: Frank Yung-Fong Tang <41213225+FrankYFTang@users.noreply.github.com>
-Date:   Mon Jan 28 07:59:54 2019 -0800
+commit afe1b5adc7d961e4daf261867ffa9fd3d22b1235
+Author: Ross Kirsling <rkirsling@gmail.com>
+Date:   Tue Jan 29 21:33:39 2019 -0800
 
-    Add "numberingSystem" to resolvedOptions() (#2011)
+    Align copyright line with repo license.
--- a/js/src/tests/test262/annexB/language/eval-code/direct/var-env-lower-lex-catch-non-strict.js
+++ b/js/src/tests/test262/annexB/language/eval-code/direct/var-env-lower-lex-catch-non-strict.js
@@ -1,34 +1,34 @@
 // Copyright (C) 2016 the V8 project authors. All rights reserved.
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-variablestatements-in-catch-blocks
-es6id: B.3.5
 description: Re-declaration of catch parameter
 info: |
     [...]
 
     This modified behaviour also applies to var and function declarations
     introduced by direct evals contained within the Block of a Catch clause.
-    This change is accomplished by modify the algorithm of 18.2.1.2 as follows:
+    This change is accomplished by modifying the algorithm of 18.2.1.3 as follows:
 
     Step 5.d.ii.2.a.i is replaced by:
 
     i. If thisEnvRec is not the Environment Record for a Catch clause, throw a
        SyntaxError exception.
-    ii. If name is bound by any syntactic form other than a
-        FunctionDeclaration, a VariableStatement, the VariableDeclarationList
-        of a for statement, or the ForBinding of a for-in statement, throw a
-        SyntaxError exception.
 flags: [noStrict]
 ---*/
 
 try {
   throw null;
 } catch (err) {
   eval('function err() {}');
+  eval('function* err() {}');
+  eval('async function err() {}');
+  eval('async function* err() {}');
+
   eval('var err;');
   eval('for (var err; false; ) {}');
   eval('for (var err in []) {}');
+  eval('for (var err of []) {}');
 }
 
 reportCompare(0, 0);
--- a/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-in-var.js
+++ b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-in-var.js
@@ -1,19 +1,18 @@
 // Copyright (C) 2016 the V8 project authors. All rights reserved.
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-variablestatements-in-catch-blocks
 es6id: B.3.5
 description: Re-declaration of catch parameter (for-in statement)
 info: |
     It is a Syntax Error if any element of the BoundNames of CatchParameter
-    also occurs in the VarDeclaredNames of Block, unless that element is only
-    bound by a VariableStatement or the VariableDeclarationList of a for
-    statement, or the ForBinding of a for-in statement.
+    also occurs in the VarDeclaredNames of Block, unless CatchParameter is
+    CatchParameter : BindingIdentifier.
 ---*/
 
 var before, during, after;
 
 try {
   throw 'exception';
 } catch (err) {
   before = err;
new file mode 100644
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2019 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+author: Ross Kirsling
+esid: sec-variablestatements-in-catch-blocks
+description: Re-declaration of catch parameter (for-of statement)
+info: |
+    It is a Syntax Error if any element of the BoundNames of CatchParameter
+    also occurs in the VarDeclaredNames of Block, unless CatchParameter is
+    CatchParameter : BindingIdentifier.
+---*/
+
+var before, during, after;
+
+try {
+  throw 'exception';
+} catch (err) {
+  before = err;
+  for (var err of [2]) {
+    during = err;
+  }
+  after = err;
+}
+
+assert.sameValue(before, 'exception');
+assert.sameValue(during, 2, 'during loop body evaluation');
+assert.sameValue(after, 2, 'after loop body evaluation');
+
+reportCompare(0, 0);
--- a/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-var.js
+++ b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-var.js
@@ -1,19 +1,18 @@
 // Copyright (C) 2016 the V8 project authors. All rights reserved.
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-variablestatements-in-catch-blocks
 es6id: B.3.5
-description: Re-declaration of catch parameter (for-in statement)
+description: Re-declaration of catch parameter (for statement)
 info: |
     It is a Syntax Error if any element of the BoundNames of CatchParameter
-    also occurs in the VarDeclaredNames of Block, unless that element is only
-    bound by a VariableStatement or the VariableDeclarationList of a for
-    statement, or the ForBinding of a for-in statement.
+    also occurs in the VarDeclaredNames of Block, unless CatchParameter is
+    CatchParameter : BindingIdentifier.
 ---*/
 
 var before, during, after;
 
 try {
   throw 'exception';
 } catch (err) {
   before = err;
new file mode 100644
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Math/fround/ties.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2019 Tiancheng "Timothy" Gu. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-math.fround
+description: Math.fround should use roundTiesToEven for conversion to binary32.
+---*/
+
+// We test five values against Math.fround, with their binary64 representation
+// shown:
+// a0 := 1.0                = 0x1p+0
+// a1 := 1.0000000596046448 = 0x1.000001p+0
+// a2 := 1.0000001192092896 = 0x1.000002p+0
+// a3 := 1.0000001788139343 = 0x1.000003p+0
+// a4 := 1.000000238418579  = 0x1.000004p+0
+// a5 := 1.0000002980232239 = 0x1.000005p+0
+// a6 := 1.0000003576278687 = 0x1.000006p+0
+// (Note: they are separated by 2 ** -24.)
+//
+// a0, a2, a4, and a6 are all representable exactly in binary32; however, while
+// a0 and a4 have even mantissas in binary32, a2 and a6 have an odd mantissa
+// when represented in that way.
+//
+// a1 is exactly halfway between a0 and a2, a3 between a2 and a4, and a5
+// between a4 and a6. By roundTiesToEven, Math.fround should favor a0 and a4
+// over a2 when they are equally close, and a4 over a6 when they are equally
+// close.
+
+var a0 = 1.0;
+var a1 = 1.0000000596046448;
+var a2 = 1.0000001192092896;
+var a3 = 1.0000001788139343;
+var a4 = 1.000000238418579;
+var a5 = 1.0000002980232239;
+var a6 = 1.0000003576278687;
+
+assert.sameValue(Math.fround(a0), a0, 'Math.fround(a0)');
+assert.sameValue(Math.fround(a1), a0, 'Math.fround(a1)');
+assert.sameValue(Math.fround(a2), a2, 'Math.fround(a2)');
+assert.sameValue(Math.fround(a3), a4, 'Math.fround(a3)');
+assert.sameValue(Math.fround(a4), a4, 'Math.fround(a4)');
+assert.sameValue(Math.fround(a5), a4, 'Math.fround(a5)');
+assert.sameValue(Math.fround(a6), a6, 'Math.fround(a6)');
+
+assert.sameValue(Math.fround(-a0), -a0, 'Math.fround(-a0)');
+assert.sameValue(Math.fround(-a1), -a0, 'Math.fround(-a1)');
+assert.sameValue(Math.fround(-a2), -a2, 'Math.fround(-a2)');
+assert.sameValue(Math.fround(-a3), -a4, 'Math.fround(-a3)');
+assert.sameValue(Math.fround(-a4), -a4, 'Math.fround(-a4)');
+assert.sameValue(Math.fround(-a5), -a4, 'Math.fround(-a5)');
+assert.sameValue(Math.fround(-a6), -a6, 'Math.fround(-a6)');
+
+reportCompare(0, 0);
--- a/js/src/tests/test262/intl402/Locale/constructor-options-language-valid.js
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-language-valid.js
@@ -11,32 +11,32 @@ info: |
     10. If options is undefined, then
     11. Else
         a. Let options be ? ToObject(options).
     12. Set tag to ? ApplyOptionsToTag(tag, options).
 
     ApplyOptionsToTag( tag, options )
     ...
     2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+    3. Let language be ? GetOption(options, "language", "string", undefined, undefined).
+    4. If language is not undefined, then
+       a. If language does not match the unicode_language_subtag production, throw a RangeError exception.
 
     IsStructurallyValidLanguageTag ( locale )
 
     The IsStructurallyValidLanguageTag abstract operation verifies that the
     locale argument (which must be a String value)
 
     represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
     Unicode Technical Standard 35 section 3.2, or successor,
 
 features: [Intl.Locale]
 ---*/
 
 const validLanguageOptions = [
-  [null, 'null'],
-  ['zh-cmn', 'cmn'],
-  ['ZH-CMN', 'cmn'],
   [{ toString() { return 'de' } }, 'de'],
 ];
 for (const [language, expected] of validLanguageOptions) {
   let expect = expected || 'en';
 
   assert.sameValue(
     new Intl.Locale('en', {language}).toString(),
     expect,
@@ -50,16 +50,19 @@ for (const [language, expected] of valid
     `new Intl.Locale('en-US', {language: "${language}"}).toString() returns "${expect}"`
   );
 
   assert.throws(RangeError, () => new Intl.Locale('en-els', {language}));
 
 }
 
 const invalidLanguageOptions = [
+    null,
+    'zh-cmn',
+    'ZH-CMN',
     'abcd',
 ];
 for (const language of invalidLanguageOptions) {
   assert.throws(RangeError, () => new Intl.Locale('en', {language}));
   assert.throws(RangeError, () => new Intl.Locale('en-US', {language}));
   assert.throws(RangeError, () => new Intl.Locale('en-els', {language}));
 }
 
--- a/js/src/tests/test262/intl402/Locale/constructor-tag.js
+++ b/js/src/tests/test262/intl402/Locale/constructor-tag.js
@@ -3,36 +3,34 @@
 // This code is governed by the BSD license found in the LICENSE file.
 
 /*---
 esid: sec-intl.locale
 description: >
     Verifies canonicalization of specific tags.
 info: |
     ApplyOptionsToTag( tag, options )
-    10. Return CanonicalizeLanguageTag(tag).
+    2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+    ...
+    13. Return CanonicalizeLanguageTag(tag).
 features: [Intl.Locale]
 ---*/
 
 const validLanguageTags = {
   "eN": "en",
   "en-gb": "en-GB",
   "IT-LATN-iT": "it-Latn-IT",
   "th-th-u-nu-thai": "th-TH-u-nu-thai",
-  "X-u-foo": "x-u-foo",
   "en-x-u-foo": "en-x-u-foo",
   "en-a-bar-x-u-foo": "en-a-bar-x-u-foo",
   "en-x-u-foo-a-bar": "en-x-u-foo-a-bar",
   "en-u-baz-a-bar-x-u-foo": "en-a-bar-u-baz-x-u-foo",
-  "Flob": "flob",
-  "ZORK": "zork",
-  "Blah-latn": "blah-Latn",
-  "QuuX-latn-us": "quux-Latn-US",
-  "SPAM-gb-x-Sausages-BACON-eggs": "spam-GB-x-sausages-bacon-eggs",
-  "DE-1996": "de-1996",
+  "DE-1996": "de-1996", // unicode_language_subtag sep unicode_variant_subtag
+  
+  // unicode_language_subtag (sep unicode_variant_subtag)*
   "sl-ROZAJ-BISKE-1994": "sl-rozaj-biske-1994",
   "zh-latn-pinyin-pinyin2": "zh-Latn-pinyin-pinyin2",
 };
 
 for (const [langtag, canonical] of Object.entries(validLanguageTags)) {
   assert.sameValue(
     new Intl.Locale(canonical).toString(),
     canonical,
@@ -40,9 +38,23 @@ for (const [langtag, canonical] of Objec
   );
   assert.sameValue(
     new Intl.Locale(langtag).toString(),
     canonical,
     `new Intl.Locale("${langtag}").toString() returns "${canonical}"`
   );
 }
 
+// unicode_language_subtag	= alpha{2,3} | alpha{5,8};
+const invalidLanguageTags = {
+  "X-u-foo", 
+  "Flob",
+  "ZORK",
+  "Blah-latn",
+  "QuuX-latn-us",
+  "SPAM-gb-x-Sausages-BACON-eggs",
+};
+
+for (const langtag of Object.entries(invalidLanguageTags)) {
+  assert.throws(RangeError, () => new Intl.Locale(langtag));
+}
+
 reportCompare(0, 0);
--- a/js/src/tests/test262/intl402/Locale/extensions-private.js
+++ b/js/src/tests/test262/intl402/Locale/extensions-private.js
@@ -4,46 +4,24 @@
 
 /*---
 esid: sec-intl.locale
 description: >
     Verifies handling of options with privateuse tags.
 info: |
     ApplyOptionsToTag( tag, options )
 
+    
     ...
     9. If tag matches neither the privateuse nor the grandfathered production, then
     ...
 
-    ApplyUnicodeExtensionToTag( tag, options, relevantExtensionKeys )
-
-    ...
-    2. If tag matches the privateuse or the grandfathered production, then
-        a. Let result be a new Record.
-        b. Repeat for each element key of relevantExtensionKeys in List order,
-            i. Set result.[[<key>]] to undefined.
-        c. Set result.[[locale]] to tag.
-        d. Return result.
-    ...
-    7. Repeat for each element key of relevantExtensionKeys in List order,
-        e. Let optionsValue be options.[[<key>]].
-        f. If optionsValue is not undefined, then
-            ii. Let value be optionsValue.
-            iv. Else,
-                1. Append the Record{[[Key]]: key, [[Value]]: value} to keywords.
-    ...
-
 features: [Intl.Locale]
 ---*/
 
-const loc = new Intl.Locale("x-default", {
+assert.throws(RangeError, () => new Intl.Locale("x-default", {
   language: "fr",
   script: "Cyrl",
   region: "DE",
   numberingSystem: "latn",
-});
-assert.sameValue(loc.toString(), "fr-Cyrl-DE-u-nu-latn");
-assert.sameValue(loc.language, "fr");
-assert.sameValue(loc.script, "Cyrl");
-assert.sameValue(loc.region, "DE");
-assert.sameValue(loc.numberingSystem, "latn");
+}));
 
 reportCompare(0, 0);
deleted file mode 100644
--- a/js/src/tests/test262/intl402/Locale/getters-privateuse.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// |reftest| skip -- Intl.Locale is not supported
-// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-esid: sec-intl.locale
-description: >
-    Verifies getters with privateuse tags.
-info: |
-    get Intl.Locale.prototype.baseName
-    4. If locale does not match the langtag production, return locale.
-
-    get Intl.Locale.prototype.language
-    4. If locale matches the privateuse or the grandfathered production, return locale.
-
-    get Intl.Locale.prototype.script
-    4. If locale matches the privateuse or the grandfathered production, return undefined.
-
-    get Intl.Locale.prototype.region
-    4. If locale matches the privateuse or the grandfathered production, return undefined.
-features: [Intl.Locale]
----*/
-
-// Privateuse only language tag.
-var loc = new Intl.Locale("x-private");
-assert.sameValue(loc.baseName, "x-private");
-assert.sameValue(loc.language, "x-private");
-assert.sameValue(loc.script, undefined);
-assert.sameValue(loc.region, undefined);
-
-reportCompare(0, 0);
--- a/js/src/tests/test262/intl402/Locale/likely-subtags.js
+++ b/js/src/tests/test262/intl402/Locale/likely-subtags.js
@@ -33,19 +33,16 @@ const testDataMaximal = {
     "it-Kana-CA": "it-Kana-CA",
 
     // Undefined primary language.
     "und": "en-Latn-US",
     "und-Thai": "th-Thai-TH",
     "und-419": "es-Latn-419",
     "und-150": "ru-Cyrl-RU",
     "und-AT": "de-Latn-AT",
-
-    // privateuse only.
-    "x-private": "x-private",
 };
 
 const testDataMinimal = {
     // Language subtag is present.
     "en": "en",
 
     // Language and script subtags are present.
     "en-Latn": "en",
@@ -61,19 +58,16 @@ const testDataMinimal = {
     "en-Arab-US": "en-Arab",
     "en-Latn-GB": "en-GB",
     "en-Latn-FR": "en-FR",
     "it-Kana-CA": "it-Kana-CA",
     "th-Thai-TH": "th",
     "es-Latn-419": "es-419",
     "ru-Cyrl-RU": "ru",
     "de-Latn-AT": "de-AT",
-
-    // privateuse only.
-    "x-private": "x-private",
 };
 
 // Add variants, extensions, and privateuse subtags and ensure they don't
 // modify the result of the likely subtags algorithms.
 const extras = [
     "",
     "-fonipa",
     "-a-not-assigned",
@@ -102,9 +96,14 @@ for (const [tag, minimal] of Object.entr
     for (const extra of extras) {
         const input = tag + extra;
         const output = minimal + extra;
         assert.sameValue(new Intl.Locale(input).minimize().toString(), output,
                          `"${input}".minimize() should be "${output}"`);
     }
 }
 
+// privateuse only.
+// "x" in "x-private" does not match unicode_language_subtag
+// unicode_language_subtag = alpha{2,3} | alpha{5,8};
+assert.throws(RangeError, () => new Intl.Locale("x-private"));
+
 reportCompare(0, 0);
--- a/js/src/tests/test262/intl402/NumberFormat/prototype/format/format-fraction-digits-precision.js
+++ b/js/src/tests/test262/intl402/NumberFormat/prototype/format/format-fraction-digits-precision.js
@@ -18,17 +18,17 @@ var locales = [
 var numberingSystems = [
     "arab",
     "latn",
     "thai",
     "hanidec"
 ];
 var testData = {
     // Ref tc39/ecma402#128
-    "12344501000000000000000000000000000": "12344501000000000487815444678311936.0",
-    "-12344501000000000000000000000000000": "-12344501000000000487815444678311936.0"
+    "12344501000000000000000000000000000": "12344501000000000000000000000000000.0",
+    "-12344501000000000000000000000000000": "-12344501000000000000000000000000000.0"
 };
 
 testNumberFormat(locales, numberingSystems,
     {useGrouping: false, minimumIntegerDigits: 3, minimumFractionDigits: 1, maximumFractionDigits: 3},
     testData);
 
 reportCompare(0, 0);
--- a/js/src/tests/test262/intl402/NumberFormat/prototype/format/format-significant-digits-precision.js
+++ b/js/src/tests/test262/intl402/NumberFormat/prototype/format/format-significant-digits-precision.js
@@ -18,17 +18,17 @@ var locales = [
 var numberingSystems = [
     "arab",
     "latn",
     "thai",
     "hanidec"
 ];
 var testData = {
     // Ref tc39/ecma402#128
-    "123.44500": "123.44",
-    "-123.44500": "-123.44",
+    "123.44500": "123.45",
+    "-123.44500": "-123.45",
 };
 
 testNumberFormat(locales, numberingSystems,
     {useGrouping: false, minimumSignificantDigits: 3, maximumSignificantDigits: 5},
     testData);
 
 reportCompare(0, 0);
deleted file mode 100644
--- a/js/src/tests/test262/language/eval-code/direct/var-env-lower-lex-catch-non-strict.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2016 the V8 project authors. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-/*---
-esid: sec-evaldeclarationinstantiation
-es6id: 18.2.1.2
-description: Variable collision with lexical binding in lower scope
-info: |
-    Annex B extensions permit re-declarations from FunctionDeclaration,
-    VariableStatement, the VariableDeclarationList of a for statement, and the
-    ForBinding of a for-in statement. Bindings from the ForBinding of a for-of
-    statement are restricted regardless of the application of Annex B.
-flags: [noStrict]
----*/
-
-assert.throws(SyntaxError, function() {
-  try {
-    throw null;
-  } catch (err) {
-    eval('for (var err of []) {}');
-  }
-});
-
-reportCompare(0, 0);
deleted file mode 100644
--- a/js/src/tests/test262/language/statements/try/early-catch-var.js
+++ /dev/null
@@ -1,22 +0,0 @@
-// |reftest| error:SyntaxError
-// Copyright (C) 2016 the V8 project authors. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-/*---
-esid: sec-try-statement-static-semantics-early-errors
-es6id: 13.15.1
-description: >
-    It is a Syntax Error if any element of the BoundNames of CatchParameter
-    also occurs in the VarDeclaredNames of Block.
-info: |
-    Annex B extensions permit re-declarations from VariableStatement, the
-    VariableDeclarationList of a for statement, and the ForBinding of a for-of
-    statement. Bindings from the ForBinding of a for-in statement are
-    restricted regardless of the application of Annex B.
-negative:
-  phase: parse
-  type: SyntaxError
----*/
-
-$DONOTEVALUATE();
-
-try { } catch (x) { for (var x of []) {} }