summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/bug744285.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/jit-test/tests/basic/bug744285.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/basic/bug744285.js')
-rw-r--r--js/src/jit-test/tests/basic/bug744285.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/bug744285.js b/js/src/jit-test/tests/basic/bug744285.js
new file mode 100644
index 0000000000..a1033f764a
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug744285.js
@@ -0,0 +1,71 @@
+// |jit-test| error: TypeError;
+var TZ_DIFF = getTimeZoneDiff();
+var now = new Date;
+var TZ_DIFF = getTimeZoneDiff();
+var now = new Date;
+var MAX_UNIX_TIMET = 2145859200;
+var RANGE_EXPANSION_AMOUNT = 60;
+function tzOffsetFromUnixTimestamp(timestamp) {
+ new Date
+ }
+function clearDSTOffsetCache(undesiredTimestamp) {
+ tzOffsetFromUnixTimestamp()
+ tzOffsetFromUnixTimestamp()
+ tzOffsetFromUnixTimestamp()
+ tzOffsetFromUnixTimestamp()
+ tzOffsetFromUnixTimestamp()
+ }
+function computeCanonicalTZOffset(timestamp) {
+ clearDSTOffsetCache()
+ tzOffsetFromUnixTimestamp()
+ }
+var TEST_TIMESTAMPS_SECONDS = [
+ 0,
+ RANGE_EXPANSION_AMOUNT,
+ MAX_UNIX_TIMET,
+ ];
+var TEST_TIMESTAMPS = TEST_TIMESTAMPS_SECONDS.map(function(v) { });
+var CORRECT_TZOFFSETS = TEST_TIMESTAMPS.map(computeCanonicalTZOffset);
+var TZ_DIFF = getTimeZoneDiff();
+var now = new Date;
+var TZ_DIFF = getTimeZoneDiff();
+var now = new Date;function getTimeZoneDiff() {
+ new Date/60
+}
+function check(b, desc) {
+ function classOf(obj) {
+ return Object.prototype.toString.call(obj);
+ }
+ function ownProperties(obj) {
+ return Object.getOwnPropertyNames(obj).
+ map(function (p) { return [p, Object.getOwnPropertyDescriptor(obj, p)]; });
+ }
+ function isCloneable(pair) { }
+ function assertIsCloneOf(a, b, path) {
+ ca = classOf(a)
+ assertEq(ca, classOf(b), path)
+ assertEq(Object.getPrototypeOf(a), ca == "[object Object]" ? Object.prototype : Array.prototype, path)
+ pb = ownProperties(b).filter(isCloneable)
+ pa = ownProperties(a)
+ function byName(a, b) { return 0; }
+ byName
+ (pa.length, pb.length, "should see the same number of properties " + path)
+ for (var i = 0; i < pa.length; i++) {
+ gczeal(4)
+ }
+ }
+ banner = desc || String()
+ a = deserialize(serialize(b))
+ var queue = [[a, b, banner]];
+ while (queue.length) {
+ var triple = queue.shift();
+ assertIsCloneOf(triple[0], triple[1], triple[2])
+ }
+}
+check({x: 0.7, p: "forty-two", y: null, z: undefined});
+check(Object.prototype);
+b=[, , 2, 3];
+b.expando=true;
+b[5]=5;
+b[0]=0;b[4]=4;
+check(b)([, , , , , , 6])