有人可以在 WebKit shell 中使用 Mozilla 的 Rhino JS 引擎吗?
我的印象是 WebKit 是一个更通用的框架,可以插入多个 JavaScript 引擎。最突出的是,我们拥有 Apple 的 JavaScriptCore 和 Google 的 V8。
有人尝试过插入 Mozilla 的 Rhino 吗?如果他们还没有,你能给我提供一些有关所涉及内容的简短资源吗? (我不太可能自己承担这个任务,但我对这个领域的 WebKit 扩展点的结构感兴趣,只是出于好奇。)
另外,如果我的理解WebKit、JavaScriptCore 和 V8 之间的关系的描述是不正确的,直接告诉我会得到一个很好的答案。
I am under the impression that WebKit is a more general framework into which multiple JavaScript engines can be plugged. Most prominently, we have both Apple's JavaScriptCore, and Google's V8.
Has anyone tried to plug in Mozilla's Rhino? If they haven't, can you point me to some brief resources on what is involved? (I'm very unlikely to take this on by myself, but I am interested in how the WebKit extension points in this area are structured, just for curiosity's sake.)
Also, if my understanding of the relationship between WebKit, JavaScriptCore, and V8 is incorrect, setting me straight there would make a fine answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
忽略 webkit 中支持多个 js 引擎带来的许多问题,支持任何 js 引擎需要做很多工作。
大多数 DOM 绑定都是自动生成的,但是执行此操作(并正确执行)的脚本庞大、复杂,并且对于每个目标都完全不同(webkit 中有针对 JSC、V8、Objective-C 和 gtk 的 dom 绑定) 。也就是说 > 的存在2 组绑定应该表明支持另一组绑定不会太困难(主要是时间,而不是费心)。
JS 的问题尤其在于浏览器本质上必须能够以更多方式与其交互(脚本标签等)。这主要是从核心引擎中抽象出来的,但是需要实现很多逻辑,这会很困难,而且仍然不能保证能够正常工作。最后,V8 是用 webkit 作为嵌入目标来设计的,因此它支持 webkit 所需的奇怪的东西,并且不能保证 Spidermonkey、Rhino 或任何其他引擎能够提供它们。
Ignoring the many issues that come from supporting multiple js engines in webkit, there is a lot of work into supporting any js engine.
The majority of the DOM bindings are automatically generated, but the scripts that do this (and do it correctly) are large, complex and completely different for every target (there are dom bindings in webkit for JSC, V8, Objective-C and gtk). That said the existence of > 2 sets of bindings should be an indication that supporting an additional set of binding would not be too difficult (largely time, rather than mind-f*cking).
The problem with JS in particular is that the browser inherently has to be able to interact with it in more ways (script tags and the like). This is mostly abstracted out from the core engine, but there's a lot of logic that would need to be implemented which would be difficult, and it's still not guaranteed to work. Lastly V8 was designed with webkit as an embedding target so it supported the weird stuff the webkit needs, and there's no guarantee that spidermonkey, rhino, or any other engine would be able to provide them.