"JavaScriptCore"中的"OpaqueJSValue"从何而来?



我在JavaScriptCore框架中找不到OpaqueJSValue的定义。只有关于它的有价值的提示在Base.hAPICast.h中(在两个文件中相同的代码(:

typedef const struct OpaqueJSValue* JSValueRef;
typedef struct OpaqueJSValue* JSObjectRef;

所以我们知道其他类型是基于它的,但OpaqueJSValue本身是什么?或者至少它来自哪里?它在哪里定义?

尝试在调试器中读取OpaqueJSValue的值会导致错误,指出调试器也不知道它是什么:

(lldb) e *variable
error: incomplete type 'const OpaqueJSValue' where a complete type is required
forward declaration of 'OpaqueJSValue'

其中变量是JSValueRef类型,所以实际上是const struct OpaqueJSValue*.

我用JavaScriptCore框架,libWTF和webkit克隆了存储库,但我没有找到任何东西。

来源:

  • 网络工具包 https://github.com/WebKit/webkit.git
  • JavaScriptCore 和 libWTF: https://opensource.apple.com/release/ios-110.html

很乐意更新该问题的标题和正文,使其更具描述性和易于查找,但是由于我真的不知道OpaqueJSValue是什么以及它是如何工作的,因此我无法以更具体的方式询问它。

没有 OpaqueJSValue 的定义。实际上 JSValueRef 只是一个不透明的指针,JSValueRef 和 JSC::JSValue 之间有一些转换,你可以在 "API\APICast.h" 中看到。JSC::JSValue 是内部数据结构。

最新更新