简体   繁体   中英

Is it possible to add javascript extensions in google 's V8 JS engine?

With http://doc.qt.nokia.com/4.7-snapshot/qtwebkit-bridge.html we can expose Qt 's QObject as glabal JS objects in browser, this helps in exposing native functionality, or to expose new set of JS helper APIs, Currently QtWebkit has implemented QtWebkit bridge on top of JavaScriptCore.

Is there any way to expose native C++/C objects/structures in Google 's V8 JS engine?

Yes. See the examples under http://code.google.com/p/v8/source/browse/trunk/src/extensions/?r=8431 that extend v8::Extension which I believe are manipulated via api.h .

You can also create objects to expose to V8 and intercept property accesses on them via property interception .

You may prefer writing an NPAPI plugin than a V8 extension since V8 engine is sandboxed by default within Chromium. That means your extension cannot access external resources out of sandbox neither. Some libraries, such as FireBreath , may help you write an NPAPI plugin easier.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM