quickjs-done-nextgen/tests/bug652.js
Ben Noordhuis 83fe8f1166
Fix exception in WeakRef.prototype.deref (#653)
Set the object's opaque to a sentinel value instead of NULL, to stop
JS_GetOpaque2 from raising an "illegal class" exception.

Fixes: https://github.com/quickjs-ng/quickjs/issues/651
2024-11-06 22:54:47 +01:00

4 lines
132 B
JavaScript

import { assert } from "./assert.js"
const ref = new WeakRef({})
const val = ref.deref() // should not throw
assert(val, undefined)