Host firebreath plugin in Node.js - node.js

I have created a browser plugin based on Firebreath framework. Now I want to load the plugin into Node.js and make the javascript code communicate with the plugin. My draft idea is creating a Node.js C++ add-on to wrapper the plugin. Node.js loads the add-on. The add-on loads the plugin. The function call between the javascript code and the plugin code is via the add-on.
I want to consult the experts before moving ahead. Does anyone have the experience to make the node.js script communicate with firebreath plugin? Is my idea possible? Please share more details.
Thanks,
Jeffrey

It's certainly possible, but it may be more trouble than it's worth. What I'd probably do instead is try to abstract out the JSAPI stuff (ScriptingCore project) and make an adapter that wraps a JSAPI object with a node object. Actually loading the full plugin as-is would require a lot of work. It's doable, but it would be a bit of a pain.
... I wrote FireBreath, so I do know what I'm talking about =]

Related

Using PNaCl with node.js?

Is there anyway to use PNaCl or just Google Native Client with node.js?
The V8 JavaScript engine can be configured to target NaCl and PNaCl (which node.js uses).
If you're trying to sandbox node.js outside of the browser then you may want to check out the Codius paper.
If you want to use node.js inside a PNaCl/NaCl process inside Chrome then you may want to look at other naclports and nacl_io: in general PNaCl/NaCl support POSIX interfaces but they have to conform to the Web model, for example you need to mount the html5 filesystem before being able to do the usual read/write calls. This should work for a regular web page (using PNaCl) or for a Chrome app or extension.
I recently wrote a few more details pertaining to porting PHP which may be helpful. If you do get it working, please let the naclports folks know, and if something breaks do let them know too!

How can I secure the source code of my Firefox OS application?

I have an app for Firefox OS, and I would not like to expose any of the source code, even obfuscated source. Is there currently any means to do this? Is this functionality even planned? Also, this app has ALL functionality implemented in the client, so "move the business logic to the server back-end" does not address this issue.
There is no real solution yet, since every web page exposes the JavaScript source code.
Why not trying obfuscate ?
Since JavaScript is executed on the client side, not only in Firefox OS but every other platform too. The possible options are limited to obfuscating with aforementioned transformations or hiding the application logic in server-side code.
You can read more about app source protection from Mozilla official blog here: https://hacks.mozilla.org/2013/12/protecting-your-firefox-os-app-code/
You could write your application logic in C/C++ and protect it by encryption libraries and convert them into JavaScript using, Mozilla’s Emscripten tool which compiles C and C++ to JavaScript: https://github.com/kripken/emscripten/wiki
You're asking "how do I give someone something, and simultaneously take it away?" You can't. This issue hasn't been solved with JS, and neither with native code.

Is it possible to develop Google Chrome extensions using node.js?

I'd like to start developing Google Chrome extension using node.js (since I've already written a "text-to-song" script in node.js, and I'd like to turn it into a Chrome extension.) What would be the most straightforward way of approaching this problem?
Actually it is. Look at this Developers Live-cast. This is something I've been looking for as well, and this would help you.
This brings your node applications bundled to your browser.
Here is the repo!
EDIT:
I've noticed that this old answer of mine keeps getting upvotes now and then (thank you all).
But nowadays I'm more an advocate of using web apps instead of bundling your application into many platforms like the chrome store or whatever.
You can check the google's post here and here indicating some directions.
In practice I advise for you to start building a progressive web app (PWA) with offline capabilities using service worker and progressive stuff.
There are plenty of resources around the web nowadays and you can offer a much richer application that may achieve a much broader audience if you do it the right way.
Thanks again, and good coding.
Simple answer is NO, unless you can find a way to install node.js with an extension using NPAPI.
Nodejs and a Google Chrome Extension do have a couple things in common i.e they both understand javascript and they both use the v8 javascript engine.
Google Chrome Extension
"Google Chrome Extensions are small software programs that can modify and enhance the functionality of the Chrome browser".
To develop a Google Chrome Extension you should write some javascript and or html/css.
Then you can run the extension in your browser.
If you wish for others to download your extension you will have to provide config.json file that describes you extension sets permissions etc.
Nodejs
"Node.js is a platform built on Google Chrome's JavaScript runtime for easily building fast, scalable network applications".
To develop applications in nodejs you write some javascript and or html/css for web applications.
If wish for others to use you application you start you nodejs server and listen for incoming requests.
Summary
Despite some of the similarities a Google Chrome Extension and Nodejs have nothing to with each other. You cannot use them together in some special way outside of the normal client/server communication.
You can use a WebPack (GitHub) or Browserify (see handbook) to build web-browser extension based on the node.js code.
With Browserify, to convert your code, you can simply run:
browserify node-code.js -o node-code-out.js
Read more:
Browserify vs Webpack.
Build a Chrome Extension with Preact and Webpack (see: Preact Chrome Extension Starter).

Getting started with Gmail Plugin development

I would like to get into Plugin development using the Gmail API and as such I would like to ask those who already have experience in it a few questions.
What language / languages should I be familiar with? I'm not familiar with Python, PHP, or JavaScript. Will I need to pick up on these?
What level of control do I have on what my plugin can do? Can I for example change the interface or add shortcuts or RSS feeds as a sidebar?
I know a lot of the examples mentioned already exist but I would like to try my own hand at it.
Peter posted a solid list of the official Gmail APIs.
On the other hand, most of the major plugins that you may have heard about are browser plugins that just modify the page source directly, even though there's no official API for it. There used to be a GreaseMonkey API that was a good starting point, but that wasn't supported and no longer works. Best place to start is with a copy of Chrome, creating a content-injection plugin that works on the Gmail page.
Happy to provide some further details if you can clarify what you're going for since I went through this myself a few months back.

Ready-to-use NPAPI-Plugin to launch external application?

I need to launch an external application from a Google Chrome extension. I need to pass a few parameters from javascript, wait until the external application is done and then use its output in javascript.
I did some reading and this should be possible using an NPAPI plugin (I only care about Windows so far).
Since my C/C++ got very rusty over the years and my requirements are quite simple I was wondering if somebody knows about a ready-to-use NPAPI DLL that does just the one thing I need: Launch an EXE with several parameters and return its output?
I tried Google of course, but didn't find anything. Thanks a lot.
It should be rather easy to write such a plugin in C++ with Firebreath. Writing a NPAPI plugin from scratch can be tricky, but luckily Firebreath abstracts away most of the details and makes it much easier.
As a plus, if you base the plugin on Firebreath, in addition to NPAPI on Windows you pretty much get free support for NPAPI on Mac/Linux and ActiveX on Windows.
http://www.firebreath.org

Resources