Hello,

I need the JSContext to declare JS::RootedObjects or Values.
Especially for the case of WeakMap/Map/Set-Hasher I don't have the
JSContext.

At the moment I use the following implementation to get the JSContext
(this is a code snipped of a hash-function):

JSRuntime * rt = JS_GetObjectRuntime(&value.toObject());
JSContext *cx = DefaultJSContext(rt);
return DefaultHasher<JSObject
*>::hash(value.toObject().GetIdentityObject(cx));

If I want to change the operator== of Value.h, I cannot use the first
two functions, because they aren't known and I cannot include jsapi.h
because of circle include errors.

Is there a better way to retrieve the JSContext from JS::Value or JSObject?

My sencond question is:
Where is the best place for the GetIdentityObject-function? Because
JSObject and most other files are also not known to Value.h. I've tried
to include jsproxy.h with my function, which leads also to a circle include.

The call hierarchy of the GetIdentityObject-function is as follows:
GetIdentityObject-function(...):at the moment jsobj.cpp, but I must move
it somewhere because of the problem of above (last place was jsproxy.h).
-->Proxy::isTransparent(...): jsproxy.cpp
---->BaseProxyHandler::isTransparent(...) and
ScriptedDirectProxyHandler::isTransparent(...): jsproxy.cpp
...

Thanks a lot and a happy new year
Andreas
_______________________________________________
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to