From 6c2884eb9e81e9926a17a6288fbbff4d7fe4fb49 Mon Sep 17 00:00:00 2001 From: Justin Grant Date: Mon, 13 Dec 2021 13:19:38 -0800 Subject: [PATCH] Verify that `Temporal.*.prototype` isn't writeable --- .../Temporal/Calendar/prototype/prop-desc.js | 18 ++++++++++++++++++ .../Temporal/Duration/prototype/prop-desc.js | 18 ++++++++++++++++++ .../Temporal/Instant/prototype/prop-desc.js | 12 +++++------- .../Temporal/PlainDate/prototype/prop-desc.js | 18 ++++++++++++++++++ .../PlainDateTime/prototype/prop-desc.js | 18 ++++++++++++++++++ .../PlainMonthDay/prototype/prop-desc.js | 18 ++++++++++++++++++ .../Temporal/PlainTime/prototype/prop-desc.js | 18 ++++++++++++++++++ .../PlainYearMonth/prototype/prop-desc.js | 18 ++++++++++++++++++ .../Temporal/TimeZone/prototype/prop-desc.js | 18 ++++++++++++++++++ .../ZonedDateTime/prototype/prop-desc.js | 18 ++++++++++++++++++ 10 files changed, 167 insertions(+), 7 deletions(-) create mode 100644 test/built-ins/Temporal/Calendar/prototype/prop-desc.js create mode 100644 test/built-ins/Temporal/Duration/prototype/prop-desc.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/prop-desc.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/prop-desc.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/prop-desc.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/prop-desc.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/prop-desc.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/prop-desc.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/prop-desc.js diff --git a/test/built-ins/Temporal/Calendar/prototype/prop-desc.js b/test/built-ins/Temporal/Calendar/prototype/prop-desc.js new file mode 100644 index 0000000000..bf03d384ca --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal-calendar-prototype +description: The "prototype" property of Temporal.Calendar +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue(typeof Temporal.Calendar.prototype, "object"); +assert.notSameValue(Temporal.Calendar.prototype, null); + +verifyProperty(Temporal.Calendar, "prototype", { + writable: false, + enumerable: false, + configurable: false, +}); diff --git a/test/built-ins/Temporal/Duration/prototype/prop-desc.js b/test/built-ins/Temporal/Duration/prototype/prop-desc.js new file mode 100644 index 0000000000..b9fe480608 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal-duration-prototype +description: The "prototype" property of Temporal.Duration +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue(typeof Temporal.Duration.prototype, "object"); +assert.notSameValue(Temporal.Duration.prototype, null); + +verifyProperty(Temporal.Duration, "prototype", { + writable: false, + enumerable: false, + configurable: false, +}); diff --git a/test/built-ins/Temporal/Instant/prototype/prop-desc.js b/test/built-ins/Temporal/Instant/prototype/prop-desc.js index 69c73f5930..77af03ff51 100644 --- a/test/built-ins/Temporal/Instant/prototype/prop-desc.js +++ b/test/built-ins/Temporal/Instant/prototype/prop-desc.js @@ -1,19 +1,17 @@ -// Copyright (C) 2020 Igalia, S.L. All rights reserved. +// Copyright (C) 2021 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-temporal-instant-objects +esid: sec-temporal-instant-prototype description: The "prototype" property of Temporal.Instant includes: [propertyHelper.js] features: [Temporal] ---*/ -const { Instant } = Temporal; +assert.sameValue(typeof Temporal.Instant.prototype, "object"); +assert.notSameValue(Temporal.Instant.prototype, null); -assert.sameValue(typeof Instant.prototype, "object"); -assert.notSameValue(Instant.prototype, null); - -verifyProperty(Instant, "prototype", { +verifyProperty(Temporal.Instant, "prototype", { writable: false, enumerable: false, configurable: false, diff --git a/test/built-ins/Temporal/PlainDate/prototype/prop-desc.js b/test/built-ins/Temporal/PlainDate/prototype/prop-desc.js new file mode 100644 index 0000000000..89e4eb9346 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal-plaindate-prototype +description: The "prototype" property of Temporal.PlainDate +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue(typeof Temporal.PlainDate.prototype, "object"); +assert.notSameValue(Temporal.PlainDate.prototype, null); + +verifyProperty(Temporal.PlainDate, "prototype", { + writable: false, + enumerable: false, + configurable: false, +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/prop-desc.js b/test/built-ins/Temporal/PlainDateTime/prototype/prop-desc.js new file mode 100644 index 0000000000..e93bcb987a --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal-plaindatetime-prototype +description: The "prototype" property of Temporal.PlainDateTime +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue(typeof Temporal.PlainDateTime.prototype, "object"); +assert.notSameValue(Temporal.PlainDateTime.prototype, null); + +verifyProperty(Temporal.PlainDateTime, "prototype", { + writable: false, + enumerable: false, + configurable: false, +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/prop-desc.js b/test/built-ins/Temporal/PlainMonthDay/prototype/prop-desc.js new file mode 100644 index 0000000000..200a51d839 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal-plainmonthday-prototype +description: The "prototype" property of Temporal.PlainMonthDay +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue(typeof Temporal.PlainMonthDay.prototype, "object"); +assert.notSameValue(Temporal.PlainMonthDay.prototype, null); + +verifyProperty(Temporal.PlainMonthDay, "prototype", { + writable: false, + enumerable: false, + configurable: false, +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/prop-desc.js b/test/built-ins/Temporal/PlainTime/prototype/prop-desc.js new file mode 100644 index 0000000000..7b000b1aa7 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal-plaintime-prototype +description: The "prototype" property of Temporal.PlainTime +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue(typeof Temporal.PlainTime.prototype, "object"); +assert.notSameValue(Temporal.PlainTime.prototype, null); + +verifyProperty(Temporal.PlainTime, "prototype", { + writable: false, + enumerable: false, + configurable: false, +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/prop-desc.js b/test/built-ins/Temporal/PlainYearMonth/prototype/prop-desc.js new file mode 100644 index 0000000000..b7567778e2 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal-plainyearmonth-prototype +description: The "prototype" property of Temporal.PlainYearMonth +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue(typeof Temporal.PlainYearMonth.prototype, "object"); +assert.notSameValue(Temporal.PlainYearMonth.prototype, null); + +verifyProperty(Temporal.PlainYearMonth, "prototype", { + writable: false, + enumerable: false, + configurable: false, +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/prop-desc.js b/test/built-ins/Temporal/TimeZone/prototype/prop-desc.js new file mode 100644 index 0000000000..d76945b80d --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal-timezone-prototype +description: The "prototype" property of Temporal.TimeZone +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue(typeof Temporal.TimeZone.prototype, "object"); +assert.notSameValue(Temporal.TimeZone.prototype, null); + +verifyProperty(Temporal.TimeZone, "prototype", { + writable: false, + enumerable: false, + configurable: false, +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/prop-desc.js b/test/built-ins/Temporal/ZonedDateTime/prototype/prop-desc.js new file mode 100644 index 0000000000..17061e5b51 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal-zoneddatetime-prototype +description: The "prototype" property of Temporal.ZonedDateTime +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue(typeof Temporal.ZonedDateTime.prototype, "object"); +assert.notSameValue(Temporal.ZonedDateTime.prototype, null); + +verifyProperty(Temporal.ZonedDateTime, "prototype", { + writable: false, + enumerable: false, + configurable: false, +});