Skip to content

Commit fa96beb

Browse files
authored
Merge branch 'main' into patch-11
2 parents 9cfaa7c + 9adf3c0 commit fa96beb

File tree

95 files changed

+2194
-33
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+2194
-33
lines changed

features.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#
1212
# https://github.com/tc39/process-document
1313

14+
# Intl Era Monthcode
15+
# https://github.com/tc39/proposal-intl-era-monthcode
16+
Intl.Era-monthcode
17+
1418
# Intl.Locale Info
1519
# https://github.com/tc39/proposal-intl-locale-info
1620
Intl.Locale-info
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// Copyright 2015 Microsoft Corporation. All rights reserved.
2+
// This code is governed by the license found in the LICENSE file.
3+
4+
/*---
5+
esid: sec-object.assign
6+
description: >
7+
Object.assign with an Array Exotic Object target employs the corresponding
8+
internal methods.
9+
info: |
10+
Object.assign ( _target_, ..._sources_ )
11+
3.a.iii.2.b. Perform ? Set(_to_, _nextKey_, _propValue_, *true*).
12+
13+
Set ( _O_, _P_, _V_, _Throw_ )
14+
1. Let _success_ be ? _O_.[[Set]](_P_, _V_, _O_).
15+
16+
OrdinarySet ( _O_, _P_, _V_, _Receiver_ )
17+
1. Let _ownDesc_ be ? _O_.[[GetOwnProperty]](_P_).
18+
2. Return ? OrdinarySetWithOwnDescriptor(_O_, _P_, _V_, _Receiver_, _ownDesc_).
19+
20+
OrdinarySetWithOwnDescriptor ( _O_, _P_, _V_, _Receiver_, _ownDesc_ )
21+
1. If _ownDesc_ is *undefined*, then
22+
a. Let _parent_ be ? O.[[GetPrototypeOf]]().
23+
b. If _parent_ is not *null*, then
24+
i. Return ? _parent_.[[Set]](_P_, _V_, _Receiver_).
25+
c. Else,
26+
i. Set _ownDesc_ to the PropertyDescriptor { [[Value]]: *undefined*, [[Writable]]: *true*, [[Enumerable]]: *true*, [[Configurable]]: *true* }.
27+
2. If IsDataDescriptor(_ownDesc_) is *true*, then
28+
...
29+
c. Let _existingDescriptor_ be ? _Receiver_.[[GetOwnProperty]](_P_).
30+
d. If _existingDescriptor_ is not *undefined*, then
31+
...
32+
iii. Let _valueDesc_ be the PropertyDescriptor { [[Value]]: _V_ }.
33+
iv. Return ? _Receiver_.[[DefineOwnProperty]](_P_, _valueDesc_).
34+
e. Else,
35+
i. Assert: _Receiver_ does not currently have a property _P_.
36+
ii. Return ? CreateDataProperty(_Receiver_, _P_, _V_).
37+
38+
CreateDataProperty ( _O_, _P_, _V_ )
39+
1. Let _newDesc_ be the PropertyDescriptor { [[Value]]: _V_, [[Writable]]: *true*, [[Enumerable]]: *true*, [[Configurable]]: *true* }.
40+
2. Return ? _O_.[[DefineOwnProperty]](_P_, _newDesc_).
41+
42+
Array exotic object [[DefineOwnProperty]] ( _P_, _Desc_ )
43+
1. If _P_ is *"length"*, then
44+
a. Return ? ArraySetLength(_A_, _Desc_).
45+
2. Else if _P_ is an array index, then
46+
...
47+
k. If _index_ ≥ _length_, then
48+
i. Set _lengthDesc_.[[Value]] to _index_ + *1*𝔽.
49+
ii. Set _succeeded_ to ! OrdinaryDefineOwnProperty(_A_, *"length"*, _lengthDesc_).
50+
3. Return ? OrdinaryDefineOwnProperty(_A_, _P_, _Desc_).
51+
52+
The Object Type
53+
An **integer index** is a property name _n_ such that CanonicalNumericIndexString(_n_) returns an
54+
integral Number in the inclusive interval from *+0*𝔽 to 𝔽(2**53 - 1). An **array index** is an
55+
integer index _n_ such that CanonicalNumericIndexString(_n_) returns an integral Number in the
56+
inclusive interval from *+0*𝔽 to 𝔽(2**32 - 2).
57+
---*/
58+
59+
var target = [7, 8, 9];
60+
var result = Object.assign(target, [1]);
61+
assert.sameValue(result, target);
62+
assert.compareArray(result, [1, 8, 9],
63+
"elements must be assigned from an array source onto an array target");
64+
65+
var sparseArraySource = [];
66+
sparseArraySource[2] = 3;
67+
result = Object.assign(target, sparseArraySource);
68+
assert.sameValue(result, target);
69+
assert.compareArray(result, [1, 8, 3], "holes in a sparse array source must not be copied");
70+
71+
var shortObjectSource = { 1: 2, length: 2 };
72+
shortObjectSource["-0"] = -1;
73+
shortObjectSource["1.5"] = -2;
74+
shortObjectSource["4294967295"] = -3; // 2**32 - 1
75+
result = Object.assign(target, shortObjectSource);
76+
assert.sameValue(result, target);
77+
assert.compareArray(result, [1, 2],
78+
"array index properties must be copied from a non-array source");
79+
assert.sameValue(result["-0"], -1,
80+
"a property with name -0 must be assigned onto an array target");
81+
assert.sameValue(result["1.5"], -2,
82+
"a property with name 1.5 must be assigned onto an array target");
83+
assert.sameValue(result["4294967295"], -3,
84+
"a property with name 4294967295 (2**32 - 1) must be assigned onto an array target");
85+
86+
result = Object.assign(target, { length: 1 });
87+
assert.sameValue(result, target);
88+
assert.compareArray(result, [1], "assigning a short length must shrink an array target");
89+
90+
result = Object.assign(target, { 2: 0 });
91+
assert.sameValue(result, target);
92+
assert.compareArray(result, [1, undefined, 0],
93+
"assigning a high array index must grow an array target");
94+
95+
if (typeof Proxy !== 'undefined') {
96+
var accordionSource = new Proxy({ length: 0, 1: 9 }, {
97+
ownKeys: function() {
98+
return ["length", "1"];
99+
}
100+
});
101+
result = Object.assign(target, accordionSource);
102+
assert.sameValue(result, target);
103+
assert.compareArray(result, [undefined, 9],
104+
"assigning a short length before a high array index must shrink and then grow an array target");
105+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
2+
// This code is governed by the BSD license found in the LICENSE file.
3+
4+
/*---
5+
esid: sec-temporal.duration.prototype.compare
6+
description: >
7+
A property bag missing optional properties is equivalent to a property bag
8+
with all the optional properties having their default values
9+
features: [Temporal]
10+
---*/
11+
12+
const oneProperty = {
13+
hours: 1,
14+
};
15+
const allProperties = {
16+
years: 0,
17+
months: 0,
18+
weeks: 0,
19+
days: 0,
20+
hours: 1,
21+
minutes: 0,
22+
seconds: 0,
23+
milliseconds: 0,
24+
microseconds: 0,
25+
nanoseconds: 0,
26+
};
27+
const resultWithout = Temporal.Duration.compare(oneProperty, oneProperty);
28+
const resultWith = Temporal.Duration.compare(allProperties, allProperties);
29+
assert.sameValue(resultWithout, resultWith, "results should be the same with and without optional properties");
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
2+
// This code is governed by the BSD license found in the LICENSE file.
3+
4+
/*---
5+
esid: sec-temporal.duration.prototype.compare
6+
description: >
7+
A property bag missing optional properties is equivalent to a property bag
8+
with all the optional properties having their default values
9+
features: [Temporal]
10+
---*/
11+
12+
const duration1 = new Temporal.Duration(1);
13+
const duration2 = new Temporal.Duration(0, 1);
14+
15+
let relativeTo = {
16+
year: 2021,
17+
month: 10,
18+
day: 28,
19+
timeZone: "UTC",
20+
};
21+
const resultWithout = Temporal.Duration.compare(duration1, duration2, { relativeTo });
22+
relativeTo = {
23+
year: 2021,
24+
month: 10,
25+
day: 28,
26+
hour: 0,
27+
minute: 0,
28+
second: 0,
29+
millisecond: 0,
30+
microsecond: 0,
31+
nanosecond: 0,
32+
offset: "+00:00",
33+
timeZone: "UTC",
34+
calendar: "iso8601",
35+
};
36+
const resultWith = Temporal.Duration.compare(duration1, duration2, { relativeTo });
37+
assert.sameValue(resultWithout, resultWith, "results should be the same with and without optional properties");
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
2+
// This code is governed by the BSD license found in the LICENSE file.
3+
4+
/*---
5+
esid: sec-temporal.duration.prototype.from
6+
description: >
7+
A property bag missing optional properties is equivalent to a property bag
8+
with all the optional properties having their default values
9+
includes: [temporalHelpers.js]
10+
features: [Temporal]
11+
---*/
12+
13+
const oneProperty = {
14+
hours: 1,
15+
};
16+
const allProperties = {
17+
years: 0,
18+
months: 0,
19+
weeks: 0,
20+
days: 0,
21+
hours: 1,
22+
minutes: 0,
23+
seconds: 0,
24+
milliseconds: 0,
25+
microseconds: 0,
26+
nanoseconds: 0,
27+
};
28+
const resultWithout = Temporal.Duration.from(oneProperty);
29+
const resultWith = Temporal.Duration.from(allProperties);
30+
TemporalHelpers.assertDurationsEqual(resultWithout, resultWith, "results should be the same with and without optional properties");
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
2+
// This code is governed by the BSD license found in the LICENSE file.
3+
4+
/*---
5+
esid: sec-temporal.duration.prototype.add
6+
description: >
7+
A property bag missing optional properties is equivalent to a property bag
8+
with all the optional properties having their default values
9+
includes: [temporalHelpers.js]
10+
features: [Temporal]
11+
---*/
12+
13+
const instance = new Temporal.Duration();
14+
15+
const oneProperty = {
16+
hours: 1,
17+
};
18+
const allProperties = {
19+
years: 0,
20+
months: 0,
21+
weeks: 0,
22+
days: 0,
23+
hours: 1,
24+
minutes: 0,
25+
seconds: 0,
26+
milliseconds: 0,
27+
microseconds: 0,
28+
nanoseconds: 0,
29+
};
30+
const resultWithout = instance.add(oneProperty);
31+
const resultWith = instance.add(allProperties);
32+
TemporalHelpers.assertDurationsEqual(resultWithout, resultWith, "results should be the same with and without optional properties");

test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-calendar-wrong-type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const instance = new Temporal.Duration(1, 0, 0, 0, 24);
1414
const wrongTypeTests = [
1515
[null, "null"],
1616
[true, "boolean"],
17-
[1, "number that doesn't convert to a valid ISO string"],
17+
[1, "number"],
1818
[1n, "bigint"],
1919
[19970327, "large number"],
2020
[-19970327, "negative number"],
@@ -32,6 +32,6 @@ for (const [calendar, description] of wrongTypeTests) {
3232
assert.throws(
3333
TypeError,
3434
() => instance.round({ largestUnit: "years", relativeTo }),
35-
`${description} does not convert to a valid ISO string`
35+
`${description} is not a valid calendar`
3636
);
3737
}

test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-invalid-offset-string.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ badOffsets.forEach((offset) => {
2424
assert.throws(
2525
typeof(offset) === 'string' ? RangeError : TypeError,
2626
() => instance.round({ largestUnit: "years", relativeTo }),
27-
`"${offset} is not a valid offset string`
27+
`"${offset}" is not a valid offset string`
2828
);
2929
});
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
2+
// This code is governed by the BSD license found in the LICENSE file.
3+
4+
/*---
5+
esid: sec-temporal.duration.prototype.round
6+
description: >
7+
A property bag missing optional properties is equivalent to a property bag
8+
with all the optional properties having their default values
9+
includes: [temporalHelpers.js]
10+
features: [Temporal]
11+
---*/
12+
13+
const timeZone = "UTC";
14+
const instance = new Temporal.Duration(1, 0, 0, 0, 24);
15+
16+
let relativeTo = {
17+
year: 2021,
18+
month: 10,
19+
day: 28,
20+
timeZone,
21+
};
22+
const resultWithout = instance.round({ largestUnit: "years", relativeTo });
23+
relativeTo = {
24+
year: 2021,
25+
month: 10,
26+
day: 28,
27+
hour: 0,
28+
minute: 0,
29+
second: 0,
30+
millisecond: 0,
31+
microsecond: 0,
32+
nanosecond: 0,
33+
offset: "+00:00",
34+
timeZone,
35+
calendar: "iso8601",
36+
};
37+
const resultWith = instance.round({ largestUnit: "years", relativeTo });
38+
TemporalHelpers.assertDurationsEqual(resultWithout, resultWith, "results should be the same with and without optional properties");

test/built-ins/Temporal/Duration/prototype/round/relativeto-wrong-type.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const primitiveTests = [
1717
[null, 'null'],
1818
[true, 'boolean'],
1919
['', 'empty string'],
20-
[1, "number that doesn't convert to a valid ISO string"],
20+
[1, 'number'],
2121
[1n, 'bigint']
2222
];
2323

0 commit comments

Comments
 (0)