Upcoming changes to frame scripts

Felipe G felipc at gmail.com
Wed Aug 8 19:42:24 UTC 2018


Hello firefox-dev!

If you’ve ever written code inside of a frame script, and communicated with
it over a message manager, you’re going to want to pay close attention,
because the world is about to change.

Over the past couple of months we’ve been splitting most of the code from
frame scripts into .jsms to load them on demand. We’ve been doing this to
improve content process memory consumption as part of the Fission effort,
and have been doing this mostly in an ad-hoc way. Bug 1472491 [1] is
creating a general structure to solve this class of problem, and moving
most of the frame scripts code to this new structure.

In short, the messages/listeners/observers will be listed in a declarative
way, specifying which module should be loaded and instantiated to respond
to these messages.
These modules are classes exported from these .jsms, extending an
ActorChild class, which has access to the document, the docshell and the
message manager. Now you should access them through the class instead of
the globals in the frame script. A good example: [2]

In order to spread knowledge about this change, we’ll be spreading the
reviews from bug 1472491 to several people so that everyone can look at
their corresponding areas of the code and see what the changes look like.

Let us know if you have any questions or concerns!

Also, a note: in a not-so-distant future, the frame scripts are likely to
be fully phased out, and once the JS IPDL API is ironed out (Bug 1475415),
the messages sent through the message manager will be replaced by real IPC
messages.


[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1472491
[2] https://reviewboard.mozilla.org/r/260636/diff/1#index_header
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/firefox-dev/attachments/20180808/4b663fe7/attachment-0001.html>


More information about the firefox-dev mailing list