Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google chrome extension with NPAPI moving to NaCl

I have recently developed a google chrome extension that uses an NPAPI plugin made using the FireBreath framework. I just now found out that google will shortly discontinue these types of plugins and eventually ban all existing extensions that use them. So, I would like to eventually move to the NaCl / PPAPI architecture, but I am not sure if this architecture can even support what I am currently doing in the NPAPI plugin.

In my current NPAPI plugin I am supporting OSX and Windows. On the OSX version, the plugin executes the system() function which executes a small 1 line applescript. It looks like this:

osascript -e 'tell app ... 

On the windows version, it executes functions in a COM library. Both versions end up doing the same exact thing. Another option I have is executing a python script, if I were to go this route, I would most likely want to embed python in the native component.

Is any of this possible anymore with NaCl / PPAPI?

like image 886
Ian Herbert Avatar asked Oct 02 '13 19:10

Ian Herbert


People also ask

When did Chrome stop supporting Npapi?

Google Chrome NPAPI plugin support was disabled by default in version 42. NPAPI plugin support was removed in version 45 and later.

Why was NPAPI removed?

In September 2013, Google announced that it would phase out NPAPI support in its Google Chrome browser during 2014, stating that "[its] 90s-era architecture has become a leading cause of hangs, crashes, security incidents, and code complexity".

Does Chrome support NPAPI?

Enabling #enable-npapi The second step to enable NPAPI plugin support is to click the enable button below the Enable NPAPI option on the chrome://flags page.


2 Answers

The ability to run arbitrary system() function or execute arbitrary functions from a COM library is #1 reason for NPAPI deprecation. Ditto for execution of a python script (you can execute python script in NaCl, of course - but it'll not be able to call system() function or a COM library either).

It's not news: as was noted in the Chrome Comic book on the day of Chromium release NPAPI plugins are unrestricted and that it's a big problem: http://www.google.com/googlebooks/chrome/small_30.html

It was obvious even back then that this situation can only be tolerated for so long. Plugins were tolerated for five years because some important things were unimplemenatble without them but now it's time to kill plugins and make sure nothing in browser can access OS directly.

If you want to implement some functionality which can not be implemented in browser currently because there are no appropriate API the right way is to ask about it on chromium-dev and add this API to Chromium (and perhaps other browsers, too). For example access to COM ports (not libraries) was added recently (see http://developer.chrome.com/apps/app_hardware.html).

like image 78
khim Avatar answered Sep 29 '22 06:09

khim


Since you are already using an extension, you may want to look at Native Messaging as a replacement for your use of NPAPI.

like image 43
smorgan Avatar answered Sep 29 '22 05:09

smorgan