mirror of https://github.com/tc39/test262.git
Temporal: Test observable calls on fields object from PrepareTemporalFields
As of https://github.com/tc39/proposal-temporal/pull/2219 the object returned from the PrepareTemporalFields abstract operation should be a null-prototype object. There are a number of places where this is observable in one of the calendar's ...FromFields() methods. This adds tests for this behaviour everywhere it is observable.
This commit is contained in:
parent
ca74e801b2
commit
f314ecb9f4
|
@ -895,6 +895,44 @@ var TemporalHelpers = {
|
|||
assert.compareArray(actual, expected, "property getters not called");
|
||||
},
|
||||
|
||||
/*
|
||||
* A custom calendar used in prototype pollution checks. Verifies that the
|
||||
* fromFields methods are always called with a null-prototype fields object.
|
||||
*/
|
||||
calendarCheckFieldsPrototypePollution() {
|
||||
class CalendarCheckFieldsPrototypePollution extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
this.dateFromFieldsCallCount = 0;
|
||||
this.yearMonthFromFieldsCallCount = 0;
|
||||
this.monthDayFromFieldsCallCount = 0;
|
||||
}
|
||||
|
||||
// toString must remain "iso8601", so that some methods don't throw due to
|
||||
// incompatible calendars
|
||||
|
||||
dateFromFields(fields, options = {}) {
|
||||
this.dateFromFieldsCallCount++;
|
||||
assert.sameValue(Object.getPrototypeOf(fields), null, "dateFromFields should be called with null-prototype fields object");
|
||||
return super.dateFromFields(fields, options);
|
||||
}
|
||||
|
||||
yearMonthFromFields(fields, options = {}) {
|
||||
this.yearMonthFromFieldsCallCount++;
|
||||
assert.sameValue(Object.getPrototypeOf(fields), null, "yearMonthFromFields should be called with null-prototype fields object");
|
||||
return super.yearMonthFromFields(fields, options);
|
||||
}
|
||||
|
||||
monthDayFromFields(fields, options = {}) {
|
||||
this.monthDayFromFieldsCallCount++;
|
||||
assert.sameValue(Object.getPrototypeOf(fields), null, "monthDayFromFields should be called with null-prototype fields object");
|
||||
return super.monthDayFromFields(fields, options);
|
||||
}
|
||||
}
|
||||
|
||||
return new CalendarCheckFieldsPrototypePollution();
|
||||
},
|
||||
|
||||
/*
|
||||
* A custom calendar used in prototype pollution checks. Verifies that methods
|
||||
* are always called with a null-prototype options object.
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.dateadd
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.dateAdd(arg, new Temporal.Duration());
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.dateuntil
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg1 = { year: 2000, month: 5, day: 2, calendar };
|
||||
const arg2 = new Temporal.PlainDate(1977, 11, 19);
|
||||
|
||||
instance.dateUntil(arg1, arg2);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar (first argument)");
|
||||
|
||||
calendar.dateFromFieldsCallCount = 0;
|
||||
|
||||
instance.dateUntil(arg2, arg1);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar (second argument)");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.day
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.day(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.dayofweek
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.dayOfWeek(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.dayofyear
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.dayOfYear(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.daysinmonth
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.daysInMonth(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.daysinweek
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.daysInWeek(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.daysinyear
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.daysInYear(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.inleapyear
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.inLeapYear(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.month
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.month(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.monthcode
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.monthCode(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.monthsinyear
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.monthsInYear(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.weekofyear
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.weekOfYear(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.year
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.year(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.add
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Duration(1, 0, 0, 1);
|
||||
const relativeTo = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.add(new Temporal.Duration(0, 0, 0, 0, -24), { relativeTo });
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.round
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Duration(1, 0, 0, 0, 24);
|
||||
const relativeTo = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.round({ largestUnit: "years", relativeTo });
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.subtract
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Duration(1, 0, 0, 1);
|
||||
const relativeTo = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.subtract(new Temporal.Duration(0, 0, 0, 0, 24), { relativeTo });
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.total
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Duration(1, 0, 0, 0, 24);
|
||||
const relativeTo = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.total({ unit: "days", relativeTo });
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.compare
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const arg1 = { year: 2000, month: 5, day: 2, calendar };
|
||||
const arg2 = new Temporal.PlainDate(1976, 11, 18);
|
||||
|
||||
Temporal.PlainDate.compare(arg1, arg2);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar (first argument)");
|
||||
|
||||
calendar.dateFromFieldsCallCount = 0;
|
||||
|
||||
Temporal.PlainDate.compare(arg2, arg1);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar (first argument)");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.from
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
Temporal.PlainDate.from(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.equals
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.equals(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.since
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.since(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.toplainmonthday
|
||||
description: >
|
||||
Calendar.monthDayFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2, calendar);
|
||||
instance.toPlainMonthDay();
|
||||
assert.sameValue(calendar.monthDayFromFieldsCallCount, 1, "monthDayFromFields should have been called on the calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.toplainyearmonth
|
||||
description: >
|
||||
Calendar.yearMonthFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2, calendar);
|
||||
instance.toPlainYearMonth();
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should have been called on the calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.until
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.until(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.with
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2, calendar);
|
||||
instance.with({ day: 24 });
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should have been called on the calendar");
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.compare
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const arg1 = { year: 2000, month: 5, day: 2, calendar };
|
||||
const arg2 = new Temporal.PlainDateTime(1976, 11, 18);
|
||||
|
||||
Temporal.PlainDateTime.compare(arg1, arg2);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar (first argument)");
|
||||
|
||||
calendar.dateFromFieldsCallCount = 0;
|
||||
|
||||
Temporal.PlainDateTime.compare(arg2, arg1);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar (second argument)");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.from
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
Temporal.PlainDateTime.from(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.equals
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.equals(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.since
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.since(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.toplainmonthday
|
||||
description: >
|
||||
Calendar.monthDayFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar);
|
||||
instance.toPlainMonthDay();
|
||||
assert.sameValue(calendar.monthDayFromFieldsCallCount, 1, "monthDayFromFields should have been called on the calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.toplainyearmonth
|
||||
description: >
|
||||
Calendar.yearMonthFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar);
|
||||
instance.toPlainYearMonth();
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should have been called on the calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.until
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.until(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.with
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar);
|
||||
instance.with({ day: 24 });
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should have been called on the calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.withplaindate
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.withPlainDate(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainmonthday.from
|
||||
description: >
|
||||
Calendar.monthDayFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const arg = { monthCode: "M05", day: 2, calendar };
|
||||
Temporal.PlainMonthDay.from(arg);
|
||||
assert.sameValue(calendar.monthDayFromFieldsCallCount, 1, "monthDayFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainmonthday.prototype.equals
|
||||
description: >
|
||||
Calendar.monthDayFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainMonthDay(5, 2);
|
||||
const arg = { monthCode: "M05", day: 2, calendar };
|
||||
instance.equals(arg);
|
||||
assert.sameValue(calendar.monthDayFromFieldsCallCount, 1, "monthDayFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainmonthday.prototype.toplaindate
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainMonthDay(5, 2, calendar);
|
||||
instance.toPlainDate({ year: 2019 });
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should have been called on the calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainmonthday.prototype.with
|
||||
description: >
|
||||
Calendar.monthDayFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainMonthDay(5, 2, calendar);
|
||||
instance.with({ day: 24 });
|
||||
assert.sameValue(calendar.monthDayFromFieldsCallCount, 1, "monthDayFromFields should have been called on the calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.toplaindatetime
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.toPlainDateTime(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.tozoneddatetime
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" });
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.compare
|
||||
description: >
|
||||
Calendar.yearMonthFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const arg1 = { year: 2000, month: 5, calendar };
|
||||
const arg2 = new Temporal.PlainYearMonth(2019, 6);
|
||||
|
||||
Temporal.PlainYearMonth.compare(arg1, arg2);
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should be called on the property bag's calendar (first argument)");
|
||||
|
||||
calendar.yearMonthFromFieldsCallCount = 0;
|
||||
|
||||
Temporal.PlainYearMonth.compare(arg2, arg1);
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should be called on the property bag's calendar (second argument)");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.from
|
||||
description: >
|
||||
Calendar.yearMonthFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const arg = { year: 2000, month: 5, calendar };
|
||||
Temporal.PlainYearMonth.from(arg);
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.add
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5, calendar);
|
||||
instance.add(new Temporal.Duration(1));
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should have been called on the calendar");
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should have been called on the calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.equals
|
||||
description: >
|
||||
Calendar.yearMonthFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
const arg = { year: 2000, month: 5, calendar };
|
||||
instance.equals(arg);
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.since
|
||||
description: >
|
||||
Calendar.yearMonthFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
const arg = { year: 2000, month: 5, calendar };
|
||||
instance.since(arg);
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.since
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5, calendar);
|
||||
instance.since(new Temporal.PlainYearMonth(2019, 2));
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 2, "dateFromFields should have been called on the calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.subtract
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5, calendar);
|
||||
instance.subtract(new Temporal.Duration(1));
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should have been called on the calendar");
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should have been called on the calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.toplaindate
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5, calendar);
|
||||
instance.toPlainDate({ day: 24 });
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should have been called on the calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.until
|
||||
description: >
|
||||
Calendar.yearMonthFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
const arg = { year: 2000, month: 5, calendar };
|
||||
instance.until(arg);
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.until
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5, calendar);
|
||||
instance.until(new Temporal.PlainYearMonth(2019, 2));
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 2, "dateFromFields should have been called on the calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.with
|
||||
description: >
|
||||
Calendar.yearMonthFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5, calendar);
|
||||
instance.with({ year: 2019 });
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should have been called on the calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.timezone.prototype.getinstantfor
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.TimeZone("UTC");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.getInstantFor(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.timezone.prototype.getpossibleinstantsfor
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.TimeZone("UTC");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.getPossibleInstantsFor(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.compare
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const arg1 = { year: 2000, month: 5, day: 2, timeZone, calendar };
|
||||
const arg2 = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, timeZone);
|
||||
|
||||
Temporal.ZonedDateTime.compare(arg1, arg2);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar (first argument)");
|
||||
|
||||
calendar.dateFromFieldsCallCount = 0;
|
||||
|
||||
Temporal.ZonedDateTime.compare(arg2, arg1);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar (first argument)");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.from
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const arg = { year: 2000, month: 5, day: 2, timeZone, calendar };
|
||||
Temporal.ZonedDateTime.from(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.equals
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const instance = new Temporal.ZonedDateTime(0n, timeZone);
|
||||
const arg = { year: 2000, month: 5, day: 2, timeZone, calendar };
|
||||
instance.equals(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.since
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const instance = new Temporal.ZonedDateTime(0n, timeZone);
|
||||
const arg = { year: 2000, month: 5, day: 2, timeZone, calendar };
|
||||
instance.since(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.toplainmonthday
|
||||
description: >
|
||||
Calendar.monthDayFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.ZonedDateTime(0n, "UTC", calendar);
|
||||
instance.toPlainMonthDay();
|
||||
assert.sameValue(calendar.monthDayFromFieldsCallCount, 1, "monthDayFromFields should have been called on the calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth
|
||||
description: >
|
||||
Calendar.yearMonthFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.ZonedDateTime(0n, "UTC", calendar);
|
||||
instance.toPlainYearMonth();
|
||||
assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should have been called on the calendar");
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.until
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const instance = new Temporal.ZonedDateTime(0n, timeZone);
|
||||
const arg = { year: 2000, month: 5, day: 2, timeZone, calendar };
|
||||
instance.until(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.with
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.ZonedDateTime(0n, "UTC", calendar);
|
||||
instance.with({ day: 24 });
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should have been called on the calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.withplaindate
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.withPlainDate(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.era
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.era(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.erayear
|
||||
description: >
|
||||
Calendar.dateFromFields method is called with a null-prototype fields object
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution();
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const arg = { year: 2000, month: 5, day: 2, calendar };
|
||||
instance.eraYear(arg);
|
||||
assert.sameValue(calendar.dateFromFieldsCallCount, 1, "dateFromFields should be called on the property bag's calendar");
|
Loading…
Reference in New Issue