This commit is contained in:
Ms2ger 2024-09-06 12:25:42 +02:00
parent bed425a2a4
commit c900769f3a
7 changed files with 6 additions and 276 deletions

View File

@ -1,171 +0,0 @@
// Copyright (C) 2024 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
includes:
- non262-Date-shell.js
- non262-shell.js
- shell.js
flags:
- noStrict
description: |
pending
esid: pending
---*/const tests = [
// ==== Date only ====
// dd-MMM-yyyy
["24-Apr-2023", "2023-04-24T00:00:00"],
["24-apr-2023", "2023-04-24T00:00:00"],
["24-April-2023", "2023-04-24T00:00:00"],
["24-APRIL-2023", "2023-04-24T00:00:00"],
["24-Apr-2033", "2033-04-24T00:00:00"],
// dd-MMM-yy
["24-Apr-23", "2023-04-24T00:00:00"],
["24-Apr-33", "2033-04-24T00:00:00"],
// dd-MMM-yyy
["24-Apr-023", "2023-04-24T00:00:00"],
// MMM-dd-yyyy
["Apr-24-2023", "2023-04-24T00:00:00"],
["apr-24-2023", "2023-04-24T00:00:00"],
["April-24-2023", "2023-04-24T00:00:00"],
["APRIL-24-2023", "2023-04-24T00:00:00"],
["Apr-24-2033", "2033-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"],
["Apr-24-33", "2033-04-24T00:00:00"],
// MMM-dd-yyy
["Apr-24-023", "2023-04-24T00:00:00"],
// yyyy-MM-dd
["2023-Apr-24", "2023-04-24T00:00:00"],
["2033-Apr-24", "2033-04-24T00:00:00"],
// yy-MM-dd
["33-Apr-24", "2033-04-24T00:00:00"],
// yyy-MM-dd
["033-Apr-24", "2033-04-24T00:00:00"],
// ==== Date followed by hour and TZ ====
["24-Apr-2023 12:34:56", "2023-04-24T12:34:56"],
["24-Apr-2023 (Mon) 12:34:56", "2023-04-24T12:34:56"],
["24-Apr-2023(Mon)12:34:56", "2023-04-24T12:34:56"],
["24-Apr-2023,12:34:56", "2023-04-24T12:34:56"],
["24-Apr-2023 12:34:56 GMT", "2023-04-24T12:34:56Z"],
["24-Apr-2023 12:34:56 +04", "2023-04-24T12:34:56+04:00"],
["24-Apr-2023 12:34:56 +04:30", "2023-04-24T12:34:56+04:30"],
["24-Apr-2023 12:34:56 -04", "2023-04-24T12:34:56-04:00"],
["24-Apr-2023 12:34:56 -04:30", "2023-04-24T12:34:56-04:30"],
["24-Apr-2023 GMT", "2023-04-24T00:00:00Z"],
["24-Apr-2023GMT", "2023-04-24T00:00:00Z"],
["24-Apr-2023GMT-04", "2023-04-24T00:00:00-04:00"],
["24-Apr-2023GMT-04:30", "2023-04-24T00:00:00-04:30"],
["24-Apr-2023GMT+04", "2023-04-24T00:00:00+04:00"],
["24-Apr-2023GMT+04:30", "2023-04-24T00:00:00+04:30"],
["24-Apr-2023,GMT", "2023-04-24T00:00:00Z"],
["24-Apr-2023/GMT", "2023-04-24T00:00:00Z"],
["24-Apr-2023/12:34:56", "2023-04-24T12:34:56"],
["Apr-24-2023 12:34:56", "2023-04-24T12:34:56"],
["Apr-24-2023 12:34:56 GMT", "2023-04-24T12:34:56Z"],
["Apr-24-2023 12:34:56 +04", "2023-04-24T12:34:56+04:00"],
["Apr-24-2023 12:34:56 +04:30", "2023-04-24T12:34:56+04:30"],
// ==== non dd-MMM-yyyy. Uses fallback path ====
// Extra delimiter.
["24-Apr- 2023", "2023-04-24T00:00:00"],
["24-Apr -2023", "-002023-04-24T00:00:00"],
["24- Apr-2023", "-002023-04-24T00:00:00"],
["24 -Apr-2023", "-002023-04-24T00:00:00"],
["24-Apr-/2023", "2023-04-24T00:00:00"],
["24-Apr/-2023", "-002023-04-24T00:00:00"],
["24-/Apr-2023", "-002023-04-24T00:00:00"],
["24/-Apr-2023", "-002023-04-24T00:00:00"],
["24-Apr-()2023", "2023-04-24T00:00:00"],
["24-Apr()-2023", "-002023-04-24T00:00:00"],
["24-()Apr-2023", "-002023-04-24T00:00:00"],
["24()-Apr-2023", "-002023-04-24T00:00:00"],
// mday being 3+ digits
["024-Apr-2023", "-002023-04-24T00:00:00"],
["0024-Apr-2023", "-002023-04-24T00:00:00"],
// year w/ 5 or 6 digits
["24-Apr-10000", "+010000-04-24T00:00:00"],
["24-Apr-10000 10:00", "+010000-04-24T10:00:00"],
["24-Apr-275760", "+275760-04-24T00:00:00"],
// Delimiter other than space after prefix
["24-Apr-2312.10:13:14", "2312-04-24T10:13:14"],
["24-Apr-2312,10:13:14", "2312-04-24T10:13:14"],
["24-Apr-2312-10:13:14", "2312-04-24T10:13:14"],
["24-Apr-2312-04:30", "2312-04-24T04:30:00"],
["24-Apr-2312/10:13:14", "2312-04-24T10:13:14"],
["24-Apr-2312()10:13:14", "2312-04-24T10:13:14"],
// Open paren only comments out the time
["24-Apr-2312(10:13:14", "2312-04-24T00:00:00"],
// mday being 3+ digits, while year being 2-3 digits.
["024-Apr-23", "2023-04-24T00:00:00"],
["024-Apr-023", "2023-04-24T00:00:00"],
];
for (const [testString, isoString] of tests) {
const testDate = new Date(testString);
const isoDate = new Date(isoString);
assert.sameValue(testDate.getTime(), isoDate.getTime(),
testString);
}
const invalidTests = [
// mday being out of range.
"32-01-32",
// Duplicate date.
"2012-Apr-08 12/12/12",
// > TimeClip limit
"13-Sep-275760 00:00:01 GMT",
// Rejected delimiters after prefix
"24-Apr-2312T10:13:14",
"24-Apr-2312:10:13:14",
"24-Apr-2312^10:13:14",
"24-Apr-2312|10:13:14",
"24-Apr-2312~10:13:14",
"24-Apr-2312+10:13:14",
"24-Apr-2312=10:13:14",
"24-Apr-2312?10:13:14",
// Late weekday
"24-Apr-2023 Mon 12:34:56",
"24-Apr-2023,Mon 12:34:56",
];
for (const testString of invalidTests) {
assert.sameValue(Number.isNaN(new Date(testString).getTime()), true, testString);
}

View File

@ -1,40 +0,0 @@
// Copyright (C) 2024 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
includes:
- non262-Date-shell.js
- non262-shell.js
- shell.js
flags:
- noStrict
description: |
pending
esid: pending
---*/let dates = [
"0217-09-23", "+000217-09-23", "-000217-09-23",
"2017-09-23", "+002017-09-23", "-002017-09-23",
"+022017-09-23", "-022017-09-23",
"+202017-09-23", "-202017-09-23",
];
for (let date of dates) {
let d = new Date(date);
let timeValue = d.valueOf();
assert.sameValue(Number.isNaN(timeValue), false, `Cannot parse "${date}" as ISO date-only form`);
// Ensure parsing the results of toString(), toUTCString(), and toISOString()
// gives the same time value as required by 20.3.3.2 Date.parse.
//
// Additional requirement not present in ES2019 draft rev 7acacc524213058a2368b5fa751fac7ea08ba230:
// The time zone offset must not contain seconds (or milliseconds) for |Date.parse(x.toString())|
// to be equal to |x.valueOf()|.
let tz = d.getTimezoneOffset();
if (Math.trunc(tz) === tz) {
assert.sameValue(Date.parse(d.toString()), timeValue, `Cannot parse from toString() of "${date}"`);
}
assert.sameValue(Date.parse(d.toUTCString()), timeValue, `Cannot parse from toUTCString() of "${date}"`);
assert.sameValue(Date.parse(d.toISOString()), timeValue, `Cannot parse from toISOString() of "${date}"`);
}

View File

@ -119,6 +119,9 @@ esid: pending
})();
(function checkCrossCompartmentWrappers() {
if (!globalThis.isCCW) {
return;
}
var gbl = newGlobal({newCompartment: true});
// the created context object should be wrapped in this compartment

View File

@ -160,18 +160,3 @@ for (var method of BOTH) {
}
}
// Many arguments can be passed.
var many = 65537;
var args = {length: many, 0: "zero", [many - 1]: "last"};
function testMany(...args) {
for (var i = 0; i < many; i++) {
assert.sameValue(i in args, true);
assert.sameValue(args[i], i === 0 ? "zero" : i === many - 1 ? "last" : undefined);
}
return this;
}
assert.sameValue(Reflect.apply(testMany, "pass", args).toString(), "pass");
assert.sameValue(Reflect.construct(testMany, args) instanceof testMany, true);
assert.sameValue(Reflect.apply(new Proxy(testMany, {}), "pass", args).toString(), "pass");
assert.sameValue(Reflect.construct(new Proxy(testMany, {}), args) instanceof testMany, true);

View File

@ -1,29 +0,0 @@
// Copyright (C) 2024 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
includes:
- non262-RegExp-shell.js
- non262-shell.js
- shell.js
flags:
- noStrict
description: |
pending
esid: pending
---*/var BUGNUMBER = 1135377;
var summary = "Implement RegExp unicode flag -- Pattern match should start from lead surrogate when lastIndex points corresponding trail surrogate.";
print(BUGNUMBER + ": " + summary);
var r = /\uD83D\uDC38/ug;
r.lastIndex = 1;
var str = "\uD83D\uDC38";
var result = r.exec(str);
assert.notSameValue(result, null);
assert.sameValue(result.length, 1);
assert.sameValue(result[0], "\uD83D\uDC38");
// This does not match to ES6 spec, but the spec will be changed.
assert.sameValue(result.index, 0);

View File

@ -29,18 +29,7 @@ class derived extends base {
}
};
assertThrowsInstanceOf(() => delete super[key], ReferenceError);
assert.sameValue(sideEffect, 1);
}
testDeleteElemPropValFirst() {
// The deletion error is a reference error, even after munging the prototype
// chain.
let key = {
toString() {
Object.setPrototypeOf(derived.prototype, null);
return "";
}
};
delete super[key];
assert.sameValue(sideEffect, 0);
}
}
@ -60,12 +49,12 @@ class derivedTestDeleteElem extends base {
super();
assertThrowsInstanceOf(() => delete super[key], ReferenceError);
assert.sameValue(sideEffect, 1);
assert.sameValue(sideEffect, 0);
Object.setPrototypeOf(derivedTestDeleteElem.prototype, null);
assertThrowsInstanceOf(() => delete super[key], ReferenceError);
assert.sameValue(sideEffect, 2);
assert.sameValue(sideEffect, 0);
return {};
}
@ -73,7 +62,6 @@ class derivedTestDeleteElem extends base {
var d = new derived();
d.testDeleteElem();
assertThrowsInstanceOf(() => d.testDeleteElemPropValFirst(), ReferenceError);
new derivedTestDeleteElem();

View File

@ -26,17 +26,11 @@ class derived extends base {
assertThrowsInstanceOf(() => delete super[sideEffect = 1], ReferenceError);
assert.sameValue(sideEffect, 1);
}
testDeleteElemPropValFirst() {
// The deletion error is a reference error, but by munging the prototype
// chain, we can force a typeerror from JSOP_SUPERBASE
delete super[Object.setPrototypeOf(derived.prototype, null)];
}
}
var d = new derived();
assertThrowsInstanceOf(() => d.testDeleteProp(), ReferenceError);
d.testDeleteElem();
assertThrowsInstanceOf(() => d.testDeleteElemPropValFirst(), TypeError);
// |delete super.x| does not delete anything before throwing.
var thing1 = {