
Introducing node-firefox - cleverjake
https://hacks.mozilla.org/2015/02/introducing-node-firefox/
======
camhenlin
I am kind of disappointed in the naming of this. There's another project named
Node-WebKit:
[https://github.com/nwjs/nw.js/tree/master](https://github.com/nwjs/nw.js/tree/master)
It allows you to build a native app using node and webkit.

Reading the name of this project got my hopes up, thinking I was going to have
the option of using Firefox instead of Webkit as my rendering engine. Oh well.

~~~
Mahn
That would be node-gecko (if it existed), wouldn't it? But yes, it's a bit
misleading, by node-firefox I was expecting the full blown browser written in
javascript myself.

~~~
treeform
Or some thing like node-js but using SpiderMonkey instead of V8. Name really
does not fit and blows up expectations. node-firefox-simulator would be more
apt.

~~~
lastontheboat
[https://github.com/zpao/spidernode](https://github.com/zpao/spidernode)

~~~
giancarlostoro
No longer maintained, sadly.

------
binarycrusader
I was hoping (sadly) that based on the name, this meant there was a port of
node.js to spidermonkey by the Mozilla team. Other posters have mentioned this
as well.

This is sort of a "lazy web" request, but does anyone know why node.js needs
v8 specifically? Would it really be that hard to support node.js on
spidermonkey?

~~~
mbrubeck
There was a "Spidernode" project started a while ago:
[http://zpao.com/posts/about-that-hybrid-v8monkey-
engine/](http://zpao.com/posts/about-that-hybrid-v8monkey-engine/)

I believe it fizzled out partly due to lack of contributor time and partly
because the mainstream Node maintainers were wary of fragmenting the Node.js
ecosystem/community.

~~~
cpeterso
In the name of competition and architectural flexibility, perhaps the io.js
team will be more receptive. :)

AFAIK, though, V8 is so tightly integrated into Node core that a third-party
library, NaN ("Native Abstractions for Node.js"), was created to improve API
compatibility for Node binary addons:

[https://github.com/rvagg/nan](https://github.com/rvagg/nan)

------
yeldarb
Can anyone sum up what this is? I got through the first 6 paragraphs and still
don't have a clue.

~~~
wodenokoto
It's a command-line / programmatic interface for deploying FirefoxOS apps to
your test environment. Before the easiest way to deploy an app was clicking a
button in a piece of software called WebIDE, but now you can do that from the
command-line, inside your test-case script or where ever you want it.

------
adrusi
Maybe this isn't the best place to ask, but how is the performance of Firefox
OS? Its mostly marketed for low-cost devices, how well do apps based on web
tech actually run on these relatively slow SoCs? Firefox for android performs
admirably for webpages on my nexus 5, but I have yet to find an interactive
web app, whether in Firefox or packaged as a Cordova app (and therefore
WebKit+v8), that doesn't feel very sluggish.

I love the concept and philosophy of Firefox OS, but none of that matters if
its too slow to use.

If performance is actually acceptable on these devices, then what tricks are
they using to make it faster than on higher end android devices?

~~~
daleharvey
I work on Firefox OS so probably worth taking bias into account.

On low end devices fxos runs reasonably well but with noticeable lag, we have
put in huge amounts of effort on the low end to make that possible. On high
end devices the 'native' fxos application are incredibly snappy and there has
been very little done to improve performance on high end devices.

Most of the stuff we have done is common sense, some you will see a lot of
people doing, some almost no people do.

1\. Shorten the path to rendering first screen, dont block on reading some
data, load all scripts async etc.

2\. Never animate top / left, use CSS transitions for everything.

3\. We use 'will-change' to ensure that the graphics are properly layered for
when they do animate ([https://developer.mozilla.org/en-US/docs/Web/CSS/will-
change](https://developer.mozilla.org/en-US/docs/Web/CSS/will-change))

4\. Offline assets, in fxos we use packaged apps for various reasons, however
one of the benefits is that reading from the filesystem is faster than reading
over the network.

If I had one performance tip for web developers, look into how far you can use
appcache to store resources offline (or if your feeling fancy, service
workers). Offline capable web apps have a night and day difference.

~~~
jordanlev
> look into how far you can use appcache to store resources offline

Maybe this question isn't specific to firefox OS, but... what is the benefit
of using appcache -- doesn't the browser already cache assets that it has
loaded?

~~~
daleharvey
It tries to, but browsers generally load a lot of assets meaning high chances
of eviction etc along with the problems in dealing how servers / browser deal
with cache directives.

I mean try it against 2 fairly comparable static sites -
[http://backbonejs.org/](http://backbonejs.org/) \+
[http://pouchdb.com/](http://pouchdb.com/), keep on refreshing them, that case
is gonna give you the highest cache hit rate you can get and its still
noticeable.

------
ArtDev
"You can also install and run Web apps on your Windows, Mac, or Linux desktop
using Firefox"

This is brilliant.

------
jtwebman
Are people building Firefox OS Apps?

~~~
berbaquero
Well, that's the thing — if you're building "regular Web Apps", you're
_almost_ building Firefox OS Apps, too!

For instance, I built Reeddit [1] for The Web, and with just a couple of
config files here and icons there, it's on the Firefox Marketplace [2].

Now, a "stricter" FFOS App would be one that uses FFOS' APIs for more specific
stuff, I guess.

[1] [http://reedditapp.com](http://reedditapp.com) [2]
[https://marketplace.firefox.com/app/reeddit](https://marketplace.firefox.com/app/reeddit)

~~~
jtwebman
This is good to know, I'll have to take a look!

------
_almosnow
v8 powering Firefox, who would've known...

~~~
aikah
... IIRC , there is a node-spidermonkey version,but Mozilla doesn't seem to be
interested in working seriously on that project. Which is crazy because one
would expect Mozilla to do exactly that.

~~~
Ygg2
I'd rather see the node-servo version ;)

As far as I understand, Servo will come with a WebKit embedding API, so the
possibilities are pretty much endless.

~~~
fabrice_d
Servo uses spidermonkey as JS engine, so I don't think it brings anything in a
"run js headless" context.

~~~
servobut
Although it's possible that some of the changes required to integrate
Spidermonkey and Servo might make the former easier to embed?

------
hitlin37
that name is confusing.

------
revskill
The site is terribly slow. I don't know how a software could be good if its
main site is in that slow quality. Bad developers or bad policy ?

------
josteink
> Also, support on platforms other than Mac OS is largely lacking.

I realize you have to start somewhere, but for a foundation which claims to
value freedom first, it seems like first targeting a fully open platform like
Linux with a cross-platform toolkit like Gtk or Qt would make more sense.

TLDR: Not going to spend $1000+ to get a new machine which runs a lesser free
Unix just to run Mozilla-tools.

