summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/non262')
-rw-r--r--js/src/tests/non262/Array/regress-157652.js2
-rw-r--r--js/src/tests/non262/Array/regress-330812.js2
-rw-r--r--js/src/tests/non262/Date/15.9.5.5.js2
-rw-r--r--js/src/tests/non262/Date/15.9.5.7.js2
-rw-r--r--js/src/tests/non262/Date/dashed-date.js9
-rw-r--r--js/src/tests/non262/Date/parse-dashed-numeric-date.js3
-rw-r--r--js/src/tests/non262/Date/parse-from-tostring-methods.js2
-rw-r--r--js/src/tests/non262/Date/parse-period.js3
-rw-r--r--js/src/tests/non262/Date/parse-time-zone.js2
-rw-r--r--js/src/tests/non262/Date/parse-zulu-time.js2
-rw-r--r--js/src/tests/non262/Date/reset-time-zone-cache-same-offset.js2
-rw-r--r--js/src/tests/non262/Date/time-zone-etc_localetime.js2
-rw-r--r--js/src/tests/non262/Date/time-zone-path.js2
-rw-r--r--js/src/tests/non262/Date/time-zones-historic.js2
-rw-r--r--js/src/tests/non262/Date/time-zones-imported.js2
-rw-r--r--js/src/tests/non262/Date/time-zones-pedantic.js2
-rw-r--r--js/src/tests/non262/Date/time-zones-posix.js2
-rw-r--r--js/src/tests/non262/Date/time-zones.js2
-rw-r--r--js/src/tests/non262/Date/toString-localized.js2
-rw-r--r--js/src/tests/non262/Intl/DateTimeFormat/tz-environment-variable.js2
-rw-r--r--js/src/tests/non262/Math/f16round.js155
-rw-r--r--js/src/tests/non262/RegExp/regress-617935.js2
-rw-r--r--js/src/tests/non262/Temporal/PlainDate/browser.js0
-rw-r--r--js/src/tests/non262/Temporal/PlainDate/from-with-modified-array-iterator-state.js22
-rw-r--r--js/src/tests/non262/Temporal/PlainDate/shell.js0
-rw-r--r--js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species-wrap.js2
-rw-r--r--js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species.js1
-rw-r--r--js/src/tests/non262/TypedArray/constructor-byteoffsets-bounds.js1
-rw-r--r--js/src/tests/non262/TypedArray/constructor-iterator-primitive.js1
-rw-r--r--js/src/tests/non262/TypedArray/constructor-length-too-large.js2
-rw-r--r--js/src/tests/non262/TypedArray/constructor-non-detached.js1
-rw-r--r--js/src/tests/non262/TypedArray/constructor-typedarray-species-other-global.js1
-rw-r--r--js/src/tests/non262/TypedArray/filter-validation.js1
-rw-r--r--js/src/tests/non262/TypedArray/from-iterable-validation.js1
-rw-r--r--js/src/tests/non262/TypedArray/from-non-iterable-validation.js1
-rw-r--r--js/src/tests/non262/TypedArray/large-arrays.js2
-rw-r--r--js/src/tests/non262/TypedArray/map-validation.js1
-rw-r--r--js/src/tests/non262/TypedArray/of-validation.js1
-rw-r--r--js/src/tests/non262/TypedArray/set-wrapped.js1
-rw-r--r--js/src/tests/non262/TypedArray/shell.js10
-rw-r--r--js/src/tests/non262/TypedArray/slice-memcpy.js1
-rw-r--r--js/src/tests/non262/TypedArray/slice-species.js1
-rw-r--r--js/src/tests/non262/TypedArray/slice-validation.js1
-rw-r--r--js/src/tests/non262/TypedArray/sort_basics.js1
-rw-r--r--js/src/tests/non262/TypedArray/sort_byteoffset.js1
-rw-r--r--js/src/tests/non262/TypedArray/sort_comparators.js1
-rw-r--r--js/src/tests/non262/TypedArray/sort_modifications.js3
-rw-r--r--js/src/tests/non262/TypedArray/sort_modifications_concurrent.js6
-rw-r--r--js/src/tests/non262/TypedArray/subarray-validation.js1
-rw-r--r--js/src/tests/non262/TypedArray/subarray.js1
-rw-r--r--js/src/tests/non262/TypedArray/toLocaleString-detached.js1
-rw-r--r--js/src/tests/non262/extensions/dataview.js12
-rw-r--r--js/src/tests/non262/extensions/regress-336409-2.js2
-rw-r--r--js/src/tests/non262/extensions/regress-336410-2.js2
-rw-r--r--js/src/tests/non262/extensions/regress-342960.js2
-rw-r--r--js/src/tests/non262/extensions/regress-367589.js2
-rw-r--r--js/src/tests/non262/reflect-parse/declarations.js17
-rw-r--r--js/src/tests/non262/regress/regress-314401.js2
-rw-r--r--js/src/tests/non262/regress/regress-341360.js2
-rw-r--r--js/src/tests/non262/regress/regress-351116.js2
-rw-r--r--js/src/tests/non262/regress/regress-418540.js2
-rw-r--r--js/src/tests/non262/regress/regress-422348.js2
-rw-r--r--js/src/tests/non262/regress/regress-425360.js2
63 files changed, 267 insertions, 55 deletions
diff --git a/js/src/tests/non262/Array/regress-157652.js b/js/src/tests/non262/Array/regress-157652.js
index 32996ca629..fd48df3b1a 100644
--- a/js/src/tests/non262/Array/regress-157652.js
+++ b/js/src/tests/non262/Array/regress-157652.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.XPCOMABI.match(/x86_64|aarch64|ppc64|ppc64le|s390x|mips64|loongarch64|riscv64/)||Android) -- No test results
+// |reftest| skip-if(is64Bit||Android) -- No test results
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/Array/regress-330812.js b/js/src/tests/non262/Array/regress-330812.js
index be700714c2..82715b29a9 100644
--- a/js/src/tests/non262/Array/regress-330812.js
+++ b/js/src/tests/non262/Array/regress-330812.js
@@ -1,4 +1,4 @@
-// |reftest| slow-if(xulRuntime.XPCOMABI.match(/x86_64|aarch64|ppc64|ppc64le|s390x|mips64|loongarch64|riscv64/)||Android) -- No test results
+// |reftest| slow-if(is64Bit||Android) -- No test results
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/Date/15.9.5.5.js b/js/src/tests/non262/Date/15.9.5.5.js
index 1a21b33a63..e047bafeb9 100644
--- a/js/src/tests/non262/Date/15.9.5.5.js
+++ b/js/src/tests/non262/Date/15.9.5.5.js
@@ -1,4 +1,4 @@
-// |reftest| random-if(xulRuntime.OS=="Linux")
+// |reftest| random-if(gtkWidget)
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/Date/15.9.5.7.js b/js/src/tests/non262/Date/15.9.5.7.js
index 0ce2df9a26..980ca514d1 100644
--- a/js/src/tests/non262/Date/15.9.5.7.js
+++ b/js/src/tests/non262/Date/15.9.5.7.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT") -- Windows doesn't accept IANA names for the TZ env variable
+// |reftest| skip-if(winWidget) -- Windows doesn't accept IANA names for the TZ env variable
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/Date/dashed-date.js b/js/src/tests/non262/Date/dashed-date.js
index d7b4692e7f..58302713bc 100644
--- a/js/src/tests/non262/Date/dashed-date.js
+++ b/js/src/tests/non262/Date/dashed-date.js
@@ -8,8 +8,6 @@ const tests = [
["24-APRIL-2023", "2023-04-24T00:00:00"],
["24-Apr-2033", "2033-04-24T00:00:00"],
- ["24-Apr-0023", "0023-04-24T00:00:00"],
-
// dd-MMM-yy
["24-Apr-23", "2023-04-24T00:00:00"],
["24-Apr-33", "2033-04-24T00:00:00"],
@@ -24,7 +22,12 @@ const tests = [
["APRIL-24-2023", "2023-04-24T00:00:00"],
["Apr-24-2033", "2033-04-24T00:00:00"],
- ["Apr-24-0023", "0023-04-24T00:00:00"],
+ // Year should get fixed up even with leading 0s
+ ["Apr-24-23", "2023-04-24T00:00:00"],
+ ["Apr-24-0023", "2023-04-24T00:00:00"],
+ ["24-Apr-0023", "2023-04-24T00:00:00"],
+ ["24-Apr-00023", "2023-04-24T00:00:00"],
+ ["24-Apr-000023", "2023-04-24T00:00:00"],
// MMM-dd-yy
["Apr-24-23", "2023-04-24T00:00:00"],
diff --git a/js/src/tests/non262/Date/parse-dashed-numeric-date.js b/js/src/tests/non262/Date/parse-dashed-numeric-date.js
index b0bd1a35ec..b6a0d1e7f9 100644
--- a/js/src/tests/non262/Date/parse-dashed-numeric-date.js
+++ b/js/src/tests/non262/Date/parse-dashed-numeric-date.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT") -- Windows doesn't accept IANA names for the TZ env variable
+// |reftest| skip-if(winWidget) -- Windows doesn't accept IANA names for the TZ env variable
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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
@@ -28,6 +28,7 @@ inTimeZone("MST", () => {
// 1-12 for first number should be month
"1-09-12": new Date(2012, Month.January, 9),
+ "1-09-0012": new Date(2012, Month.January, 9),
"1-09-2012": new Date(2012, Month.January, 9),
"12-09-12": new Date(2012, Month.December, 9),
diff --git a/js/src/tests/non262/Date/parse-from-tostring-methods.js b/js/src/tests/non262/Date/parse-from-tostring-methods.js
index b6bf577bb0..f9c17fac37 100644
--- a/js/src/tests/non262/Date/parse-from-tostring-methods.js
+++ b/js/src/tests/non262/Date/parse-from-tostring-methods.js
@@ -1,6 +1,4 @@
let dates = [
- "0041-09-23", "+000041-09-23", "-000041-09-23",
- "0091-09-23", "+000091-09-23", "-000091-09-23",
"0217-09-23", "+000217-09-23", "-000217-09-23",
"2017-09-23", "+002017-09-23", "-002017-09-23",
"+022017-09-23", "-022017-09-23",
diff --git a/js/src/tests/non262/Date/parse-period.js b/js/src/tests/non262/Date/parse-period.js
index 835512823e..edd18dc7eb 100644
--- a/js/src/tests/non262/Date/parse-period.js
+++ b/js/src/tests/non262/Date/parse-period.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT") -- Windows doesn't accept IANA names for the TZ env variable
+// |reftest| skip-if(winWidget) -- Windows doesn't accept IANA names for the TZ env variable
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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
@@ -9,6 +9,7 @@ const tests = [
"Aug.. 15, 2015",
"Aug.15.2015",
"15.Aug.2015",
+ "15.Aug.0015",
"Aug 15 2015 12:00 am.",
"Sat. Aug 15 2015",
"2015.08.15",
diff --git a/js/src/tests/non262/Date/parse-time-zone.js b/js/src/tests/non262/Date/parse-time-zone.js
index c239822b04..692aa3af10 100644
--- a/js/src/tests/non262/Date/parse-time-zone.js
+++ b/js/src/tests/non262/Date/parse-time-zone.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT") -- Windows doesn't accept IANA names for the TZ env variable
+// |reftest| skip-if(winWidget) -- Windows doesn't accept IANA names for the TZ env variable
// bug 1676708
inTimeZone("Europe/London", () => {
diff --git a/js/src/tests/non262/Date/parse-zulu-time.js b/js/src/tests/non262/Date/parse-zulu-time.js
index a7bcd3bd00..2092ed400d 100644
--- a/js/src/tests/non262/Date/parse-zulu-time.js
+++ b/js/src/tests/non262/Date/parse-zulu-time.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT") -- Windows doesn't accept IANA names for the TZ env variable
+// |reftest| skip-if(winWidget) -- Windows doesn't accept IANA names for the TZ env variable
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/Date/reset-time-zone-cache-same-offset.js b/js/src/tests/non262/Date/reset-time-zone-cache-same-offset.js
index 56c9fc262c..c7e3915c95 100644
--- a/js/src/tests/non262/Date/reset-time-zone-cache-same-offset.js
+++ b/js/src/tests/non262/Date/reset-time-zone-cache-same-offset.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT") -- Windows doesn't accept IANA names for the TZ env variable
+// |reftest| skip-if(winWidget) -- Windows doesn't accept IANA names for the TZ env variable
const testCases = [
{
diff --git a/js/src/tests/non262/Date/time-zone-etc_localetime.js b/js/src/tests/non262/Date/time-zone-etc_localetime.js
index eaf8f7d940..f10056fb37 100644
--- a/js/src/tests/non262/Date/time-zone-etc_localetime.js
+++ b/js/src/tests/non262/Date/time-zone-etc_localetime.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT"||!xulRuntime.shell)
+// |reftest| skip-if(winWidget||!xulRuntime.shell)
assertEq(/^(PST|PDT)$/.test(getTimeZone()), true,
"The default time zone is set to PST8PDT for all jstests (when run in the shell)");
diff --git a/js/src/tests/non262/Date/time-zone-path.js b/js/src/tests/non262/Date/time-zone-path.js
index 0181093bac..266fe53ec8 100644
--- a/js/src/tests/non262/Date/time-zone-path.js
+++ b/js/src/tests/non262/Date/time-zone-path.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT"||!xulRuntime.shell||!this.hasOwnProperty("Intl"))
+// |reftest| skip-if(winWidget||!xulRuntime.shell||!this.hasOwnProperty("Intl"))
assertEq(/^(PST|PDT)$/.test(getTimeZone()), true,
"The default time zone is set to PST8PDT for all jstests (when run in the shell)");
diff --git a/js/src/tests/non262/Date/time-zones-historic.js b/js/src/tests/non262/Date/time-zones-historic.js
index 3117870687..e5649153b3 100644
--- a/js/src/tests/non262/Date/time-zones-historic.js
+++ b/js/src/tests/non262/Date/time-zones-historic.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT"||!this.hasOwnProperty("Intl")) -- Windows doesn't accept IANA names for the TZ env variable; Requires ICU time zone support
+// |reftest| skip-if(winWidget||!this.hasOwnProperty("Intl")) -- Windows doesn't accept IANA names for the TZ env variable; Requires ICU time zone support
// bug 487897
inTimeZone("Europe/London", () => {
diff --git a/js/src/tests/non262/Date/time-zones-imported.js b/js/src/tests/non262/Date/time-zones-imported.js
index 8a13e34981..f09cf22e13 100644
--- a/js/src/tests/non262/Date/time-zones-imported.js
+++ b/js/src/tests/non262/Date/time-zones-imported.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT"||!this.hasOwnProperty("Intl")) -- Windows doesn't accept IANA names for the TZ env variable; Requires ICU time zone support
+// |reftest| skip-if(winWidget||!this.hasOwnProperty("Intl")) -- Windows doesn't accept IANA names for the TZ env variable; Requires ICU time zone support
// Imported tests from es6draft and then adapted to use ICU/CLDR time zone display names.
diff --git a/js/src/tests/non262/Date/time-zones-pedantic.js b/js/src/tests/non262/Date/time-zones-pedantic.js
index c3445ed5fd..cd6d0c4490 100644
--- a/js/src/tests/non262/Date/time-zones-pedantic.js
+++ b/js/src/tests/non262/Date/time-zones-pedantic.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT"||xulRuntime.OS=="Darwin") -- Skip on OS X in addition to Windows
+// |reftest| skip-if(winWidget||cocoaWidget) -- Skip on OS X in addition to Windows
// Contains the tests from "time-zones.js" which fail on OS X.
diff --git a/js/src/tests/non262/Date/time-zones-posix.js b/js/src/tests/non262/Date/time-zones-posix.js
index c2d7cc20c9..21e81e9808 100644
--- a/js/src/tests/non262/Date/time-zones-posix.js
+++ b/js/src/tests/non262/Date/time-zones-posix.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT"&&!xulRuntime.shell) -- Windows browser in automation doesn't pick up new time zones correctly
+// |reftest| skip-if(winWidget&&!xulRuntime.shell) -- Windows browser in automation doesn't pick up new time zones correctly
// Repeats the test from "time-zones.js", but uses POSIX instead of IANA names
// for the time zones. This allows to run these tests on Windows, too.
diff --git a/js/src/tests/non262/Date/time-zones.js b/js/src/tests/non262/Date/time-zones.js
index da2b328be7..550b1494b8 100644
--- a/js/src/tests/non262/Date/time-zones.js
+++ b/js/src/tests/non262/Date/time-zones.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT") -- Windows doesn't accept IANA names for the TZ env variable
+// |reftest| skip-if(winWidget) -- Windows doesn't accept IANA names for the TZ env variable
// bug 158328
inTimeZone("Europe/London", () => {
diff --git a/js/src/tests/non262/Date/toString-localized.js b/js/src/tests/non262/Date/toString-localized.js
index 6baa535e5e..98bd3e54af 100644
--- a/js/src/tests/non262/Date/toString-localized.js
+++ b/js/src/tests/non262/Date/toString-localized.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="WINNT"||!this.hasOwnProperty("Intl")) -- Windows doesn't accept IANA names for the TZ env variable; Requires ICU time zone support
+// |reftest| skip-if(winWidget||!this.hasOwnProperty("Intl")) -- Windows doesn't accept IANA names for the TZ env variable; Requires ICU time zone support
// Date.prototype.toString includes a localized time zone name comment.
diff --git a/js/src/tests/non262/Intl/DateTimeFormat/tz-environment-variable.js b/js/src/tests/non262/Intl/DateTimeFormat/tz-environment-variable.js
index 6128abb9d1..9b184fd2b2 100644
--- a/js/src/tests/non262/Intl/DateTimeFormat/tz-environment-variable.js
+++ b/js/src/tests/non262/Intl/DateTimeFormat/tz-environment-variable.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(!this.hasOwnProperty("Intl")||(xulRuntime.OS=="WINNT"&&!xulRuntime.shell)) -- Windows browser in automation doesn't pick up new time zones correctly
+// |reftest| skip-if(!this.hasOwnProperty("Intl")||(winWidget&&!xulRuntime.shell)) -- Windows browser in automation doesn't pick up new time zones correctly
// From bug 1330149:
//
diff --git a/js/src/tests/non262/Math/f16round.js b/js/src/tests/non262/Math/f16round.js
new file mode 100644
index 0000000000..cf27346d37
--- /dev/null
+++ b/js/src/tests/non262/Math/f16round.js
@@ -0,0 +1,155 @@
+// |reftest| shell-option(--enable-float16array) skip-if(!Math.f16round)
+
+// Some tests regarding conversion to Float16
+assertEq(Math.f16round(), NaN);
+
+// Special values
+assertEq(Math.f16round(NaN), NaN);
+assertEq(Math.f16round(-Infinity), -Infinity);
+assertEq(Math.f16round(Infinity), Infinity);
+assertEq(Math.f16round(-0), -0);
+assertEq(Math.f16round(+0), +0);
+
+// Polyfill function for Float16 conversion, adapted from
+// https://github.com/petamoriken/float16/.
+// The original license is preseved below.
+function toFloat16(num) {
+ // MIT License
+
+ // Copyright (c) 2017-2024 Kenta Moriuchi
+
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
+ // of this software and associated documentation files (the "Software"), to deal
+ // in the Software without restriction, including without limitation the rights
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ // copies of the Software, and to permit persons to whom the Software is
+ // furnished to do so, subject to the following conditions:
+
+ // The above copyright notice and this permission notice shall be included in all
+ // copies or substantial portions of the Software.
+
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ // SOFTWARE.
+
+ const INVERSE_OF_EPSILON = 1 / Number.EPSILON;
+
+ /**
+ * rounds to the nearest value;
+ * if the number falls midway, it is rounded to the nearest value with an even least significant digit
+ * @param {number} num
+ * @returns {number}
+ */
+ function roundTiesToEven(num) {
+ return (num + INVERSE_OF_EPSILON) - INVERSE_OF_EPSILON;
+ }
+
+ const FLOAT16_MIN_VALUE = 6.103515625e-05;
+ const FLOAT16_MAX_VALUE = 65504;
+ const FLOAT16_EPSILON = 0.0009765625;
+
+ const FLOAT16_EPSILON_MULTIPLIED_BY_FLOAT16_MIN_VALUE = FLOAT16_EPSILON * FLOAT16_MIN_VALUE;
+ const FLOAT16_EPSILON_DEVIDED_BY_EPSILON = FLOAT16_EPSILON * INVERSE_OF_EPSILON;
+
+ function roundToFloat16(num) {
+ const number = +num;
+
+ // NaN, Infinity, -Infinity, 0, -0
+ if (!isFinite(number) || number === 0) {
+ return number;
+ }
+
+ // finite except 0, -0
+ const sign = number > 0 ? 1 : -1;
+ const absolute = Math.abs(number);
+
+ // small number
+ if (absolute < FLOAT16_MIN_VALUE) {
+ return sign * roundTiesToEven(absolute / FLOAT16_EPSILON_MULTIPLIED_BY_FLOAT16_MIN_VALUE) * FLOAT16_EPSILON_MULTIPLIED_BY_FLOAT16_MIN_VALUE;
+ }
+
+ const temp = (1 + FLOAT16_EPSILON_DEVIDED_BY_EPSILON) * absolute;
+ const result = temp - (temp - absolute);
+
+ // large number
+ if (result > FLOAT16_MAX_VALUE || isNaN(result)) {
+ return sign * Infinity;
+ }
+
+ return sign * result;
+ }
+
+ return roundToFloat16(num);
+};
+
+// A test on a certain range of numbers, including big numbers, so that
+// we get a loss in precision for some of them.
+for (var i = 0; i < 64; ++i) {
+ var p = Math.pow(2, i) + 1;
+ assertEq(Math.f16round(p), toFloat16(p));
+ assertEq(Math.f16round(-p), toFloat16(-p));
+}
+
+/********************************************
+/* Tests on maximal Float16 / Double values *
+/*******************************************/
+function maxValue(exponentWidth, significandWidth) {
+ var n = 0;
+ var maxExp = Math.pow(2, exponentWidth - 1) - 1;
+ for (var i = significandWidth; i >= 0; i--)
+ n += Math.pow(2, maxExp - i);
+ return n;
+}
+
+var DBL_MAX = maxValue(11, 52);
+assertEq(DBL_MAX, Number.MAX_VALUE); // sanity check
+
+// Finite as a double, too big for a float16
+assertEq(Math.f16round(DBL_MAX), Infinity);
+
+var FLT16_MAX = maxValue(5, 10);
+assertEq(Math.f16round(FLT16_MAX), FLT16_MAX);
+assertEq(Math.f16round(65519), FLT16_MAX); // round-nearest rounds down to FLT16_MAX
+assertEq(Math.f16round(65520), Infinity); // no longer rounds down to FLT16_MAX
+
+/*********************************************************
+/******* Tests on denormalizations and roundings *********
+/********************************************************/
+function minValue(exponentWidth, significandWidth) {
+ return Math.pow(2, -(Math.pow(2, exponentWidth - 1) - 2) - significandWidth);
+}
+
+var DBL_MIN = Math.pow(2, -1074);
+assertEq(DBL_MIN, Number.MIN_VALUE); // sanity check
+
+// Too small for a float16
+assertEq(Math.f16round(DBL_MIN), 0);
+
+var FLT16_MIN = minValue(5, 10);
+assertEq(Math.f16round(FLT16_MIN), FLT16_MIN);
+
+assertEq(Math.f16round(FLT16_MIN / 2), 0); // halfway, round-nearest rounds down to 0 (even)
+
+// FLT16_MIN + a small amount rounds up to FLT16_MIN
+// Constant taken from https://github.com/petamoriken/float16/
+assertEq(Math.f16round(2.980232238769531911744490042422139897126953655970282852649688720703125e-8), FLT16_MIN);
+
+assertEq(Math.f16round(-FLT16_MIN), -FLT16_MIN);
+assertEq(Math.f16round(-FLT16_MIN / 2), -0); // halfway, round-nearest rounds up to -0 (even)
+// -FLT16_MIN - a small amount rounds down to -FLT16_MIN
+// Constant taken from https://github.com/petamoriken/float16/
+assertEq(Math.f16round(2.980232238769531911744490042422139897126953655970282852649688720703125e-8), FLT16_MIN);
+
+// Test some constants from https://github.com/petamoriken/float16/
+assertEq(Math.f16round(0.499994), 0.5);
+assertEq(Math.f16round(1.337), 1.3369140625);
+
+// This will round incorrectly if the implementation first rounds to Float32,
+// then to Float16
+assertEq(Math.f16round(1.00048828125000022204), 1.0009765625);
+
+reportCompare(0, 0, "ok");
diff --git a/js/src/tests/non262/RegExp/regress-617935.js b/js/src/tests/non262/RegExp/regress-617935.js
index 3764d81b0e..77495151a5 100644
--- a/js/src/tests/non262/RegExp/regress-617935.js
+++ b/js/src/tests/non262/RegExp/regress-617935.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(!xulRuntime.shell&&(Android||xulRuntime.OS=="WINNT")) silentfail
+// |reftest| skip-if(!xulRuntime.shell&&(Android||winWidget)) silentfail
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
diff --git a/js/src/tests/non262/Temporal/PlainDate/browser.js b/js/src/tests/non262/Temporal/PlainDate/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/non262/Temporal/PlainDate/browser.js
diff --git a/js/src/tests/non262/Temporal/PlainDate/from-with-modified-array-iterator-state.js b/js/src/tests/non262/Temporal/PlainDate/from-with-modified-array-iterator-state.js
new file mode 100644
index 0000000000..ac0febc1e6
--- /dev/null
+++ b/js/src/tests/non262/Temporal/PlainDate/from-with-modified-array-iterator-state.js
@@ -0,0 +1,22 @@
+// |reftest| skip-if(!this.hasOwnProperty("Temporal"))
+
+const ArrayIteratorPrototype = Object.getPrototypeOf([][Symbol.iterator]());
+
+// Modify the ArrayIteratorPrototype prototype chain to disable optimisations.
+Object.setPrototypeOf(ArrayIteratorPrototype, {});
+
+let calendar = new Temporal.Calendar("iso8601");
+
+let dateLike = {
+ calendar,
+ day: 1,
+ month: 1,
+ year: 0,
+};
+
+let result = Temporal.PlainDate.from(dateLike);
+
+assertEq(result.toString(), "0000-01-01");
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/non262/Temporal/PlainDate/shell.js b/js/src/tests/non262/Temporal/PlainDate/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/non262/Temporal/PlainDate/shell.js
diff --git a/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species-wrap.js b/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species-wrap.js
index d454804f94..93c63e2922 100644
--- a/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species-wrap.js
+++ b/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species-wrap.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(!xulRuntime.shell)
+// |reftest| shell-option(--enable-float16array) skip-if(!xulRuntime.shell)
let g = newGlobal();
diff --git a/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species.js b/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species.js
index aa7830df67..9e27b2cd3d 100644
--- a/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species.js
+++ b/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
for (let ctor of typedArrayConstructors) {
let arr = new ctor([1, 2, 3, 4, 5, 6, 7, 8]);
diff --git a/js/src/tests/non262/TypedArray/constructor-byteoffsets-bounds.js b/js/src/tests/non262/TypedArray/constructor-byteoffsets-bounds.js
index ce213038d4..da26828da4 100644
--- a/js/src/tests/non262/TypedArray/constructor-byteoffsets-bounds.js
+++ b/js/src/tests/non262/TypedArray/constructor-byteoffsets-bounds.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
// Test bound checks around for |byteOffset| and |length| arguments.
diff --git a/js/src/tests/non262/TypedArray/constructor-iterator-primitive.js b/js/src/tests/non262/TypedArray/constructor-iterator-primitive.js
index 5a14d7d5a7..313aa5a750 100644
--- a/js/src/tests/non262/TypedArray/constructor-iterator-primitive.js
+++ b/js/src/tests/non262/TypedArray/constructor-iterator-primitive.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
var BUGNUMBER = 1021835;
var summary = "Returning non-object from @@iterator should throw";
diff --git a/js/src/tests/non262/TypedArray/constructor-length-too-large.js b/js/src/tests/non262/TypedArray/constructor-length-too-large.js
index 7a7a785041..456b6db284 100644
--- a/js/src/tests/non262/TypedArray/constructor-length-too-large.js
+++ b/js/src/tests/non262/TypedArray/constructor-length-too-large.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(!xulRuntime.shell)
+// |reftest| shell-option(--enable-float16array) skip-if(!xulRuntime.shell)
// Test that all TypedArray constructor variants throw a RangeError when
// attempting to create a too large array.
diff --git a/js/src/tests/non262/TypedArray/constructor-non-detached.js b/js/src/tests/non262/TypedArray/constructor-non-detached.js
index 9ec9329be8..b40c6cdcbe 100644
--- a/js/src/tests/non262/TypedArray/constructor-non-detached.js
+++ b/js/src/tests/non262/TypedArray/constructor-non-detached.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
for (var constructor of typedArrayConstructors) {
var buf = new constructor();
detachArrayBuffer(buf.buffer);
diff --git a/js/src/tests/non262/TypedArray/constructor-typedarray-species-other-global.js b/js/src/tests/non262/TypedArray/constructor-typedarray-species-other-global.js
index 872f46408a..281a764acb 100644
--- a/js/src/tests/non262/TypedArray/constructor-typedarray-species-other-global.js
+++ b/js/src/tests/non262/TypedArray/constructor-typedarray-species-other-global.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// 22.2.4.3 TypedArray ( typedArray )
// Test [[Prototype]] of newly created typed array and its array buffer, and
diff --git a/js/src/tests/non262/TypedArray/filter-validation.js b/js/src/tests/non262/TypedArray/filter-validation.js
index 450b4fa2cf..513f1de7f4 100644
--- a/js/src/tests/non262/TypedArray/filter-validation.js
+++ b/js/src/tests/non262/TypedArray/filter-validation.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
/* 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/. */
diff --git a/js/src/tests/non262/TypedArray/from-iterable-validation.js b/js/src/tests/non262/TypedArray/from-iterable-validation.js
index 50d46bb81f..ad0015492c 100644
--- a/js/src/tests/non262/TypedArray/from-iterable-validation.js
+++ b/js/src/tests/non262/TypedArray/from-iterable-validation.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
/* 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/. */
diff --git a/js/src/tests/non262/TypedArray/from-non-iterable-validation.js b/js/src/tests/non262/TypedArray/from-non-iterable-validation.js
index 3276426b28..69d09ced9c 100644
--- a/js/src/tests/non262/TypedArray/from-non-iterable-validation.js
+++ b/js/src/tests/non262/TypedArray/from-non-iterable-validation.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
/* 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/. */
diff --git a/js/src/tests/non262/TypedArray/large-arrays.js b/js/src/tests/non262/TypedArray/large-arrays.js
index 56ce117494..5d65c21464 100644
--- a/js/src/tests/non262/TypedArray/large-arrays.js
+++ b/js/src/tests/non262/TypedArray/large-arrays.js
@@ -1,4 +1,4 @@
-// |reftest| slow skip-if(!xulRuntime.shell)
+// |reftest| shell-option(--enable-float16array) slow skip-if(!xulRuntime.shell)
// Test that we can access TypedArrays beyond the 4GB mark, if large buffers are
// supported.
diff --git a/js/src/tests/non262/TypedArray/map-validation.js b/js/src/tests/non262/TypedArray/map-validation.js
index 1694ef50cb..8b5b2ab3e8 100644
--- a/js/src/tests/non262/TypedArray/map-validation.js
+++ b/js/src/tests/non262/TypedArray/map-validation.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
/* 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/. */
diff --git a/js/src/tests/non262/TypedArray/of-validation.js b/js/src/tests/non262/TypedArray/of-validation.js
index e7ab905195..e02eedf67e 100644
--- a/js/src/tests/non262/TypedArray/of-validation.js
+++ b/js/src/tests/non262/TypedArray/of-validation.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
/* 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/. */
diff --git a/js/src/tests/non262/TypedArray/set-wrapped.js b/js/src/tests/non262/TypedArray/set-wrapped.js
index 30a242bf0b..2b2ee813c8 100644
--- a/js/src/tests/non262/TypedArray/set-wrapped.js
+++ b/js/src/tests/non262/TypedArray/set-wrapped.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Test %TypedArray%.prototype.set(typedArray, offset) when called with wrapped
// typed array.
diff --git a/js/src/tests/non262/TypedArray/shell.js b/js/src/tests/non262/TypedArray/shell.js
index 2fb0ab8f1d..b31fa70f59 100644
--- a/js/src/tests/non262/TypedArray/shell.js
+++ b/js/src/tests/non262/TypedArray/shell.js
@@ -2,7 +2,7 @@
"use strict";
const {
- Float32Array, Float64Array, Object, Reflect, SharedArrayBuffer, WeakMap,
+ Float16Array, Float32Array, Float64Array, Object, Reflect, SharedArrayBuffer, WeakMap,
assertEq
} = global;
const {
@@ -69,7 +69,7 @@
Uint32Array,
Float32Array,
Float64Array,
- ]);
+ ].concat(Float16Array ?? []));
/**
* All TypedArray constructors for shared memory.
@@ -97,13 +97,13 @@
/**
* Returns `true` if `constructor` is a TypedArray constructor for shared
- * or unshared memory, with an underlying element type of either Float32 or
- * Float64.
+ * or unshared memory, with an underlying element type of one of Float16, Float32
+ * or Float64.
*/
function isFloatConstructor(constructor) {
if (isSharedConstructor(constructor))
constructor = Reflect_apply(WeakMap_prototype_get, sharedConstructors, [constructor]);
- return constructor == Float32Array || constructor == Float64Array;
+ return constructor == Float32Array || constructor == Float64Array || (Float16Array && constructor == Float16Array);
}
global.typedArrayConstructors = typedArrayConstructors;
diff --git a/js/src/tests/non262/TypedArray/slice-memcpy.js b/js/src/tests/non262/TypedArray/slice-memcpy.js
index a20010ed16..e40ff0e4cc 100644
--- a/js/src/tests/non262/TypedArray/slice-memcpy.js
+++ b/js/src/tests/non262/TypedArray/slice-memcpy.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
const otherGlobal = newGlobal();
// Create with new ArrayBuffer and offset.
diff --git a/js/src/tests/non262/TypedArray/slice-species.js b/js/src/tests/non262/TypedArray/slice-species.js
index 8a03f2f6ee..df73c65cad 100644
--- a/js/src/tests/non262/TypedArray/slice-species.js
+++ b/js/src/tests/non262/TypedArray/slice-species.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
for (var constructor of typedArrayConstructors) {
// Basic tests for our SpeciesConstructor implementation.
var undefConstructor = new constructor(2);
diff --git a/js/src/tests/non262/TypedArray/slice-validation.js b/js/src/tests/non262/TypedArray/slice-validation.js
index 28d50e36f4..cb8deb813b 100644
--- a/js/src/tests/non262/TypedArray/slice-validation.js
+++ b/js/src/tests/non262/TypedArray/slice-validation.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
/* 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/. */
diff --git a/js/src/tests/non262/TypedArray/sort_basics.js b/js/src/tests/non262/TypedArray/sort_basics.js
index 3338861507..685215eed6 100644
--- a/js/src/tests/non262/TypedArray/sort_basics.js
+++ b/js/src/tests/non262/TypedArray/sort_basics.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Note: failed runs should include their "SEED" value in error messages,
// setting "const SEED" to that value will recreate the data from any such run.
const SEED = (Math.random() * 10) + 1;
diff --git a/js/src/tests/non262/TypedArray/sort_byteoffset.js b/js/src/tests/non262/TypedArray/sort_byteoffset.js
index b4e262c450..b8af8bda83 100644
--- a/js/src/tests/non262/TypedArray/sort_byteoffset.js
+++ b/js/src/tests/non262/TypedArray/sort_byteoffset.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Ensure that when sorting TypedArrays we don't
// ignore byte offsets (bug 1290579).
diff --git a/js/src/tests/non262/TypedArray/sort_comparators.js b/js/src/tests/non262/TypedArray/sort_comparators.js
index ca190948fc..6578bb066c 100644
--- a/js/src/tests/non262/TypedArray/sort_comparators.js
+++ b/js/src/tests/non262/TypedArray/sort_comparators.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Ensure that sorts finish even if a comparator adds items
// Note: the array is not expected to be properly sorted.
let outsideArray = new Int32Array([1, 99, 2]);
diff --git a/js/src/tests/non262/TypedArray/sort_modifications.js b/js/src/tests/non262/TypedArray/sort_modifications.js
index 2a6ed49eb7..7098dedc95 100644
--- a/js/src/tests/non262/TypedArray/sort_modifications.js
+++ b/js/src/tests/non262/TypedArray/sort_modifications.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
const TAConstructors = [
Int8Array,
Uint8Array,
@@ -10,7 +11,7 @@ const TAConstructors = [
Float64Array,
BigInt64Array,
BigUint64Array,
-];
+].concat(this.Float16Array ?? []);
// Use different size classes to catch any implementation-specific
// optimisations.
diff --git a/js/src/tests/non262/TypedArray/sort_modifications_concurrent.js b/js/src/tests/non262/TypedArray/sort_modifications_concurrent.js
index 99493df800..60f58b0e0e 100644
--- a/js/src/tests/non262/TypedArray/sort_modifications_concurrent.js
+++ b/js/src/tests/non262/TypedArray/sort_modifications_concurrent.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(!xulRuntime.shell)
+// |reftest| shell-option(--enable-float16array) skip-if(!xulRuntime.shell)
if (helperThreadCount() === 0) {
if (typeof reportCompare === "function")
@@ -18,7 +18,7 @@ const TAConstructors = [
Float64Array,
BigInt64Array,
BigUint64Array,
-];
+].concat(this.Float16Array ?? []);
// Use different size classes to catch any implementation-specific
// optimisations.
@@ -46,6 +46,8 @@ function ToAtomicTA(TA) {
return TA;
case Uint8ClampedArray:
return Uint8Array;
+ case globalThis.Float16Array:
+ return Uint16Array;
case Float32Array:
return Uint32Array;
case Float64Array:
diff --git a/js/src/tests/non262/TypedArray/subarray-validation.js b/js/src/tests/non262/TypedArray/subarray-validation.js
index 4ad8c86095..76ae10fb6f 100644
--- a/js/src/tests/non262/TypedArray/subarray-validation.js
+++ b/js/src/tests/non262/TypedArray/subarray-validation.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
/* 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/. */
diff --git a/js/src/tests/non262/TypedArray/subarray.js b/js/src/tests/non262/TypedArray/subarray.js
index a7bfab0efd..7ae41a0c93 100644
--- a/js/src/tests/non262/TypedArray/subarray.js
+++ b/js/src/tests/non262/TypedArray/subarray.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
// Bug 1291003
if (typeof detachArrayBuffer === "function") {
for (let constructor of typedArrayConstructors) {
diff --git a/js/src/tests/non262/TypedArray/toLocaleString-detached.js b/js/src/tests/non262/TypedArray/toLocaleString-detached.js
index 0ba22cc68e..ce0fe3e640 100644
--- a/js/src/tests/non262/TypedArray/toLocaleString-detached.js
+++ b/js/src/tests/non262/TypedArray/toLocaleString-detached.js
@@ -1,3 +1,4 @@
+// |reftest| shell-option(--enable-float16array)
if (typeof detachArrayBuffer === "function") {
const originalNumberToLocaleString = Number.prototype.toLocaleString;
diff --git a/js/src/tests/non262/extensions/dataview.js b/js/src/tests/non262/extensions/dataview.js
index b6514df26a..17faf8e57b 100644
--- a/js/src/tests/non262/extensions/dataview.js
+++ b/js/src/tests/non262/extensions/dataview.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(!xulRuntime.shell)
+// |reftest| shell-option(--enable-float16array) skip-if(!xulRuntime.shell)
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
@@ -1638,6 +1638,16 @@ function test(sharedMem) {
dv.setInt8(dv.byteLength - 10, 99);
assertEq(dv.getInt8(dv.byteLength - 10), 99);
+ // get/setFloat16
+ dv = new DataView(new ArrayBuffer(4));
+ if (DataView.prototype.getFloat16) {
+ dv.setInt16(0, 18688);
+ assertEq(dv.getFloat16(0), 10);
+ dv.setFloat16(1, 10);
+ assertEq(dv.getFloat16(1), 10);
+ assertEq(dv.getInt16(1), 18688);
+ }
+
reportCompare(0, 0, 'done.');
}
diff --git a/js/src/tests/non262/extensions/regress-336409-2.js b/js/src/tests/non262/extensions/regress-336409-2.js
index 545350150b..c6ba2addcc 100644
--- a/js/src/tests/non262/extensions/regress-336409-2.js
+++ b/js/src/tests/non262/extensions/regress-336409-2.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(!Object.prototype.toSource||(!xulRuntime.shell&&((Android||(isDebugBuild&&xulRuntime.OS=="Linux")||xulRuntime.XPCOMABI.match(/x86_64/))))) slow -- can fail silently due to out of memory, bug 615011 - timeouts on slow debug Linux
+// |reftest| skip-if(!Object.prototype.toSource||(!xulRuntime.shell&&((Android||(isDebugBuild&&gtkWidget)||is64Bit)))) slow -- can fail silently due to out of memory, bug 615011 - timeouts on slow debug Linux
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/extensions/regress-336410-2.js b/js/src/tests/non262/extensions/regress-336410-2.js
index bd0952e9e6..8690d5f179 100644
--- a/js/src/tests/non262/extensions/regress-336410-2.js
+++ b/js/src/tests/non262/extensions/regress-336410-2.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(!Object.prototype.toSource||(!xulRuntime.shell&&((isDebugBuild&&xulRuntime.OS=="Linux")||Android||xulRuntime.XPCOMABI.match(/x86_64/)||xulRuntime.OS=="WINNT"))) slow -- can fail silently due to out of memory, bug 621348 - timeouts on slow debug Linux
+// |reftest| skip-if(!Object.prototype.toSource||(!xulRuntime.shell&&((isDebugBuild&&gtkWidget)||Android||is64Bit||winWidget))) slow -- can fail silently due to out of memory, bug 621348 - timeouts on slow debug Linux
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/extensions/regress-342960.js b/js/src/tests/non262/extensions/regress-342960.js
index d7d8f8a0c1..ad6f063d09 100644
--- a/js/src/tests/non262/extensions/regress-342960.js
+++ b/js/src/tests/non262/extensions/regress-342960.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(!Object.prototype.toSource||(!xulRuntime.shell&&(Android||xulRuntime.OS=="WINNT"||xulRuntime.OS=="Linux"))) silentfail slow -- bug 528464
+// |reftest| skip-if(!Object.prototype.toSource||(!xulRuntime.shell&&(Android||winWidget||gtkWidget))) silentfail slow -- bug 528464
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/extensions/regress-367589.js b/js/src/tests/non262/extensions/regress-367589.js
index 29aa1b61b6..aa11846f20 100644
--- a/js/src/tests/non262/extensions/regress-367589.js
+++ b/js/src/tests/non262/extensions/regress-367589.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.shell||(xulRuntime.OS=="WINNT"&&isDebugBuild)) slow
+// |reftest| skip-if(xulRuntime.shell||(winWidget&&isDebugBuild)) slow
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/reflect-parse/declarations.js b/js/src/tests/non262/reflect-parse/declarations.js
index 4962f4cee9..b65fda3536 100644
--- a/js/src/tests/non262/reflect-parse/declarations.js
+++ b/js/src/tests/non262/reflect-parse/declarations.js
@@ -49,11 +49,11 @@ assertDecl("function f(a,[x,y]) { function a() { } }",
[ident("a"), arrPatt([assignElem("x"), assignElem("y")])],
blockStmt([funDecl(ident("a"), [], blockStmt([]))])));
-// Bug 591450: this test currently crashes because of a bug in jsparse
-// assertDecl("function f(a,[x,y],b,[w,z],c) { function b() { } }",
-// funDecl(ident("f"),
-// [ident("a"), arrPatt([ident("x"), ident("y")]), ident("b"), arrPatt([ident("w"), ident("z")]), ident("c")],
-// blockStmt([funDecl(ident("b"), [], blockStmt([]))])));
+// Bug 591450: this test was crashing because of a bug in jsparse
+assertDecl("function f(a,[x,y],b,[w,z],c) { function b() { } }",
+ funDecl(ident("f"),
+ [ident("a"), arrPatt([ident("x"), ident("y")]), ident("b"), arrPatt([ident("w"), ident("z")]), ident("c")],
+ blockStmt([funDecl(ident("b"), [], blockStmt([]))])));
// redeclarations (TOK_NAME nodes with lexdef)
@@ -61,10 +61,9 @@ assertStmt("function f() { function g() { } function g() { } }",
funDecl(ident("f"), [], blockStmt([funDecl(ident("g"), [], blockStmt([])),
funDecl(ident("g"), [], blockStmt([]))])));
-// Fails due to parser quirks (bug 638577)
-//assertStmt("function f() { function g() { } function g() { return 42 } }",
-// funDecl(ident("f"), [], blockStmt([funDecl(ident("g"), [], blockStmt([])),
-// funDecl(ident("g"), [], blockStmt([returnStmt(lit(42))]))])));
+assertStmt("function f() { function g() { } function g() { return 42 } }",
+ funDecl(ident("f"), [], blockStmt([funDecl(ident("g"), [], blockStmt([])),
+ funDecl(ident("g"), [], blockStmt([returnStmt(lit(42))]))])));
assertStmt("function f() { var x = 42; var x = 43; }",
funDecl(ident("f"), [], blockStmt([varDecl([{ id: ident("x"), init: lit(42) }]),
diff --git a/js/src/tests/non262/regress/regress-314401.js b/js/src/tests/non262/regress/regress-314401.js
index e6a9b8f863..4d73ca439c 100644
--- a/js/src/tests/non262/regress/regress-314401.js
+++ b/js/src/tests/non262/regress/regress-314401.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.shell||(xulRuntime.OS=="WINNT"&&isDebugBuild)) slow
+// |reftest| skip-if(xulRuntime.shell||(winWidget&&isDebugBuild)) slow
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/regress/regress-341360.js b/js/src/tests/non262/regress/regress-341360.js
index 1ff7192dda..aba2af501e 100644
--- a/js/src/tests/non262/regress/regress-341360.js
+++ b/js/src/tests/non262/regress/regress-341360.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.shell||(xulRuntime.OS=="WINNT"&&isDebugBuild)) slow
+// |reftest| skip-if(xulRuntime.shell||(winWidget&&isDebugBuild)) slow
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/regress/regress-351116.js b/js/src/tests/non262/regress/regress-351116.js
index 477457735a..a645bd0bb0 100644
--- a/js/src/tests/non262/regress/regress-351116.js
+++ b/js/src/tests/non262/regress/regress-351116.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.OS=="Linux"&&!xulRuntime.shell&&!xulRuntime.XPCOMABI.match(/x86_64/)&&isDebugBuild) -- bug 521549
+// |reftest| skip-if(gtkWidget&&!xulRuntime.shell&&!is64Bit&&isDebugBuild) -- bug 521549
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/regress/regress-418540.js b/js/src/tests/non262/regress/regress-418540.js
index 855ec1e593..ff473ee9fd 100644
--- a/js/src/tests/non262/regress/regress-418540.js
+++ b/js/src/tests/non262/regress/regress-418540.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.shell||(xulRuntime.OS=="WINNT"&&isDebugBuild)) slow
+// |reftest| skip-if(xulRuntime.shell||(winWidget&&isDebugBuild)) slow
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/regress/regress-422348.js b/js/src/tests/non262/regress/regress-422348.js
index 9a35e22d6a..7be60ba9f2 100644
--- a/js/src/tests/non262/regress/regress-422348.js
+++ b/js/src/tests/non262/regress/regress-422348.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.XPCOMABI.match(/x86_64|aarch64|ppc64|ppc64le|s390x|mips64|loongarch64|riscv64/)) -- On 64-bit, takes forever rather than throwing
+// |reftest| skip-if(is64Bit) -- On 64-bit, takes forever rather than throwing
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
diff --git a/js/src/tests/non262/regress/regress-425360.js b/js/src/tests/non262/regress/regress-425360.js
index 6daf871022..f21dfc2843 100644
--- a/js/src/tests/non262/regress/regress-425360.js
+++ b/js/src/tests/non262/regress/regress-425360.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(xulRuntime.shell||(xulRuntime.OS=="WINNT"&&isDebugBuild)) slow
+// |reftest| skip-if(xulRuntime.shell||(winWidget&&isDebugBuild)) slow
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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