Diff
Modified: trunk/JSTests/ChangeLog (289151 => 289152)
--- trunk/JSTests/ChangeLog 2022-02-05 06:38:33 UTC (rev 289151)
+++ trunk/JSTests/ChangeLog 2022-02-05 07:26:52 UTC (rev 289152)
@@ -1,3 +1,13 @@
+2022-02-04 Yusuke Suzuki <ysuz...@apple.com>
+
+ WeakRef deref can return null instead of undefined
+ https://bugs.webkit.org/show_bug.cgi?id=235880
+
+ Reviewed by Sam Weinig and Alexey Shvayka.
+
+ * stress/v8-finalizationregistry-and-weakref.js:
+ (setTimeout):
+
2022-02-02 Alexey Shvayka <ashva...@apple.com>
Speed-up JSON.stringify() by avoiding "toJSON" property lookups
Modified: trunk/JSTests/stress/v8-finalizationregistry-and-weakref.js (289151 => 289152)
--- trunk/JSTests/stress/v8-finalizationregistry-and-weakref.js 2022-02-05 06:38:33 UTC (rev 289151)
+++ trunk/JSTests/stress/v8-finalizationregistry-and-weakref.js 2022-02-05 07:26:52 UTC (rev 289152)
@@ -40,6 +40,6 @@
// Check that cleanup callback was called in a follow up task
setTimeout(() => {
assertTrue(cleanup_called);
- assertTrue(weak_refs.some((weak_ref) => weak_ref.deref() === null));
+ assertTrue(weak_refs.some((weak_ref) => weak_ref.deref() === undefined));
}, 0);
}, 0);
Modified: trunk/LayoutTests/ChangeLog (289151 => 289152)
--- trunk/LayoutTests/ChangeLog 2022-02-05 06:38:33 UTC (rev 289151)
+++ trunk/LayoutTests/ChangeLog 2022-02-05 07:26:52 UTC (rev 289152)
@@ -1,3 +1,19 @@
+2022-02-04 Yusuke Suzuki <ysuz...@apple.com>
+
+ WeakRef deref can return null instead of undefined
+ https://bugs.webkit.org/show_bug.cgi?id=235880
+
+ Reviewed by Sam Weinig and Alexey Shvayka.
+
+ * js/script-tests/weakref-async-is-collected.js:
+ (async test):
+ * js/script-tests/weakref-eventually-collects-values.js:
+ (let.weakRefs.async test):
+ * js/script-tests/weakref-finalizationregistry.js:
+ (async test):
+ * js/script-tests/weakref-microtasks-dont-collect.js:
+ (async test):
+
2022-02-04 Myles C. Maxfield <mmaxfi...@apple.com>
ch unit fallback size doesn't match the spec
Modified: trunk/LayoutTests/js/script-tests/weakref-async-is-collected.js (289151 => 289152)
--- trunk/LayoutTests/js/script-tests/weakref-async-is-collected.js 2022-02-05 06:38:33 UTC (rev 289151)
+++ trunk/LayoutTests/js/script-tests/weakref-async-is-collected.js 2022-02-05 07:26:52 UTC (rev 289152)
@@ -36,7 +36,7 @@
}
gc();
- if (weakRefs.find((weak) => weak.deref() === null) === undefined)
+ if (weakRefs.find((weak) => weak.deref() === undefined) === undefined)
throw new Error("No weak ref value was collected");
asyncTestPassed();
}
Modified: trunk/LayoutTests/js/script-tests/weakref-eventually-collects-values.js (289151 => 289152)
--- trunk/LayoutTests/js/script-tests/weakref-eventually-collects-values.js 2022-02-05 06:38:33 UTC (rev 289151)
+++ trunk/LayoutTests/js/script-tests/weakref-eventually-collects-values.js 2022-02-05 07:26:52 UTC (rev 289152)
@@ -31,7 +31,7 @@
await turnEventLoop();
gc();
- if (!weakRefs.find((weak) => weak.deref() === null))
+ if (!weakRefs.find((weak) => weak.deref() === undefined))
throw new Error("no weak ref was collected");
asyncTestPassed();
}
Modified: trunk/LayoutTests/js/script-tests/weakref-finalizationregistry.js (289151 => 289152)
--- trunk/LayoutTests/js/script-tests/weakref-finalizationregistry.js 2022-02-05 06:38:33 UTC (rev 289151)
+++ trunk/LayoutTests/js/script-tests/weakref-finalizationregistry.js 2022-02-05 07:26:52 UTC (rev 289152)
@@ -45,7 +45,7 @@
await turnEventLoop();
assert(finalizerCalled === true);
- assert(weakRefs.some((weakRef) => weakRef.deref() === null) === true);
+ assert(weakRefs.some((weakRef) => weakRef.deref() === undefined) === true);
asyncTestPassed();
}
Modified: trunk/LayoutTests/js/script-tests/weakref-microtasks-dont-collect.js (289151 => 289152)
--- trunk/LayoutTests/js/script-tests/weakref-microtasks-dont-collect.js 2022-02-05 06:38:33 UTC (rev 289151)
+++ trunk/LayoutTests/js/script-tests/weakref-microtasks-dont-collect.js 2022-02-05 07:26:52 UTC (rev 289152)
@@ -37,7 +37,7 @@
}
gc();
- if (weakRefs.find((weak) => weak.deref() === null) === undefined)
+ if (weakRefs.find((weak) => weak.deref() === undefined) === undefined)
throw new Error("No weak ref value was collected");
asyncTestPassed();
}
Modified: trunk/Source/_javascript_Core/ChangeLog (289151 => 289152)
--- trunk/Source/_javascript_Core/ChangeLog 2022-02-05 06:38:33 UTC (rev 289151)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-02-05 07:26:52 UTC (rev 289152)
@@ -1,3 +1,17 @@
+2022-02-04 Yusuke Suzuki <ysuz...@apple.com>
+
+ WeakRef deref can return null instead of undefined
+ https://bugs.webkit.org/show_bug.cgi?id=235880
+
+ Reviewed by Sam Weinig and Alexey Shvayka.
+
+ WeakRef#deref should return undefined[1] when a wrapped object is collected.
+
+ [1]: https://tc39.es/ecma262/#sec-weakrefderef
+
+ * runtime/WeakObjectRefPrototype.cpp:
+ (JSC::JSC_DEFINE_HOST_FUNCTION):
+
2022-02-04 Commit Queue <commit-qu...@webkit.org>
Unreviewed, reverting r288996.
Modified: trunk/Source/_javascript_Core/runtime/WeakObjectRefPrototype.cpp (289151 => 289152)
--- trunk/Source/_javascript_Core/runtime/WeakObjectRefPrototype.cpp 2022-02-05 06:38:33 UTC (rev 289151)
+++ trunk/Source/_javascript_Core/runtime/WeakObjectRefPrototype.cpp 2022-02-05 07:26:52 UTC (rev 289152)
@@ -72,7 +72,7 @@
return JSValue::encode(jsUndefined());
auto* value = ref->deref(vm);
- return value ? JSValue::encode(value) : JSValue::encode(jsNull());
+ return value ? JSValue::encode(value) : JSValue::encode(jsUndefined());
}
}