A quick heads-up on some incoming changes to the JS component loader
that may affect some existing JSM or JS component code:
1) As of bug 1394556[1], all JS module and component scripts are
automatically compiled in strict mode[2]. While I fixed all of the
resulting issues that showed up in automated tests, new issues may turn
up in code with incomplete test coverage. Please be on the lookout for
errors like "TypeError: this is null", "TypeError: setting a property
that has only a getter", and "ReferenceError: assignment to undeclared
variable", and if you see any, file bugs blocking bug 1394556.
2) Andrew McCreight has been working on changing the component loader to
load most modules and components into a single global[3], with each
module still getting its own top-level variable scope (similar to a
with() block). Most of the blockers for this have been resolved, and it
should hopefully be ready to land within the next week.
This change will significantly reduce the memory overhead of JS modules,
along with the performance overhead of creating dozens module globals at
startup, and of creating thousands of cross-compartment object wrappers
at runtime.
But it does so at the cost of decreased isolation among module scripts.
All (non-add-on) modules will now share prototypes for built-in objects.
It will be possible to define objects on the shared global that affect
all modules. getGlobalForObject will no longer return the root scope for
a module. In short, it's possible we will see subtle issues as a
result of this change (as we often saw on b2g, which its module loader
differed from the desktop module loader), so please be on the look-out
over the next few weeks.
Thanks.
-Kris
[1]: https://bugzil.la/1394556
[2]:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
[3]: https://bugzil.la/1186409
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform