diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2022-11-06 20:58:42 -0800 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2022-11-06 21:14:11 -0800 |
commit | 167c5e9cf716f61571642348c4f09d2b907e0abe (patch) | |
tree | ab6669ed4421ec0c8a6a84d851fc16912f05402a /gjs | |
parent | 6aca7b50785fa1638f144b17060870d721e3f65a (diff) | |
download | gjs-167c5e9cf716f61571642348c4f09d2b907e0abe.tar.gz |
Revert "closure: Store JSFunction* pointer instead of JSObject*"
This is basically a revert of commit 7140cac8, although so much has
changed in the meantime that none of the revert applied cleanly, so it's
more of an "un-rewrite". This fixes a regression that has been present for
almost exactly 4 years.
Storing a JSFunction* pointer in closures did not take into account the
fact that not all callable JSObjects have an associated JSFunction. They
could be exotic objects with a [[Call]] method. In particular,
introspected functions are this, so this prevented g-i function objects
from being used as signal handlers.
(Less importantly, the same probably applied to callable Proxy objects.)
Also adds a regression test so that this doesn't happen again.
Closes: #518
Diffstat (limited to 'gjs')
-rw-r--r-- | gjs/jsapi-util-root.h | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/gjs/jsapi-util-root.h b/gjs/jsapi-util-root.h index 80f4d875..11ce0ca2 100644 --- a/gjs/jsapi-util-root.h +++ b/gjs/jsapi-util-root.h @@ -78,17 +78,6 @@ struct GjsHeapOperation<JSObject *> { } }; -template <> -struct GjsHeapOperation<JSFunction*> { - static void expose_to_js(const JS::Heap<JSFunction*>& thing) { - JSFunction* func = thing.unbarrieredGet(); - if (!func || !JS::GetGCThingZone(JS::GCCellPtr(func))) - return; - if (!JS::RuntimeHeapIsCollecting()) - js::gc::ExposeGCThingToActiveJS(JS::GCCellPtr(func)); - } -}; - /* GjsMaybeOwned is intended for use as a member of classes that are allocated * on the heap. Do not allocate GjsMaybeOwned on the stack, and do not allocate * any instances of classes that have it as a member on the stack either. */ |