MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / runFinalizationRegistryCallbacks

Method runFinalizationRegistryCallbacks

src/JobQueue.cc:171–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171bool JobQueue::runFinalizationRegistryCallbacks(JSContext *cx) {
172 bool ranCallbacks = false;
173 JS::Rooted<FunctionVector> callbacks(cx);
174 std::swap(callbacks.get(), finalizationRegistryCallbacks->get());
175 for (JSFunction *f: callbacks) {
176 JS::ExposeObjectToActiveJS(JS_GetFunctionObject(f));
177
178 JSAutoRealm ar(cx, JS_GetFunctionObject(f));
179 JS::RootedFunction func(cx, f);
180 JS::RootedValue unused_rval(cx);
181 // we don't raise an exception here because there is nowhere to catch it
182 mozilla::Unused << JS_CallFunction(cx, NULL, func, JS::HandleValueArray::empty(), &unused_rval);
183 ranCallbacks = true;
184 }
185
186 return ranCallbacks;
187}

Callers 1

pythonmonkeyGCCallbackFunction · 0.80

Calls 1

getMethod · 0.80

Tested by

no test coverage detected