diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-01-28 23:18:44 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-01-28 23:31:25 +0100 |
| commit | 77207b9c1780685a6f23be3672c41f8d26601c76 (patch) | |
| tree | 1f732e1ea3bba06a8afabfef1521a1860699b9ed /test | |
| parent | b557402db961ea6d367dca097dffeb05a2676ad7 (diff) | |
| download | chawan-77207b9c1780685a6f23be3672c41f8d26601c76.tar.gz | |
javascript: fix .jsget on JSValue
Since toJS doesn't create a new value, `node' must be dup'd if it is
a JSValue.
Also, forbid .jsset on JSValue as it was broken as well and it's not
obvious what the intention is when using it. (Probably it should free
the old value, but did the user think of setting it? :P)
I can see why I made toJS not dup the value - to make returning
consistent with Nim's semantics - but it really makes things
confusing... implicitly behaving as lent might be better, albeit less
convenient.
Diffstat (limited to 'test')
| -rw-r--r-- | test/js/jsget.html | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/js/jsget.html b/test/js/jsget.html new file mode 100644 index 00000000..004df995 --- /dev/null +++ b/test/js/jsget.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<title>Test if .jsget handles ownership correctly.</title> +<script> +let a = {}; +let x = new CustomEvent("hi", {detail: a}); +x.detail; +x.detail; +x.detail; +x.detail; +x.detail; +x.detail; +x.detail; +x.detail; +x.detail; +x.detail; +</script> +Success |