On 4/21/13 7:51 PM, Justin Lebar wrote:
Since most of these features implemented in JS seem to be DOM features, I'm
particularly interested in the opinions of the DOM folks.
Opinions differ. ;)
I think for DOM features that are not invoked on most pages,
implementing them in JS seems like a reasonable choice. We are actively
working on making this easier to do than it is now.
This is only a viable implementation strategy for objects you don't
expect to have lots of around, since there is a lot more per-object
overhead for a JS-implemented DOM object. But lots of things that are
currently implemented in JS are per-page singletons, so that's ok.
I'm very sympathetic to Andreas' points about memory-safety (especially
for hard-to-fuzz things) and ease of prototyping and implementation.
But on the flip side, there are security bugs that JS implementations
are subject to (involving content passing in unexpected objects and
whatnot) that a C++ implementation simply never has to deal with. See
https://bugzilla.mozilla.org/show_bug.cgi?id=856042 for those with the
access... I'm hoping that putting a WebIDL layer in front of the JS
implementations will help, but will of course add to the per-object
overhead.
One other thing to keep in mind is that doing an implementation in JS
does not involve having to figure out cycle collection, etc, boilerplate...
So to the extent that b2g is in a "not enough hands" situation,
implementing in JS makes sense.
To the extent that we have code whose performance we want to maximize or
whose memory footprint we need to minimize, a JS implementation right
now is not a good idea.
I'm afraid in practice the right decision should probably be made on a
per-component basis, and the hard part with that is making sure informed
decisions are made. :(
-Boris
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform