Upcoming changes to frame scripts

Andreas Tolfsen ato at sny.no
Mon Aug 13 15:24:42 UTC 2018


Felipe, thanks for the head’s up.

Also sprach Felipe G:

> 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.

The goals stated here are laudable and I’m sure these changes are
for the better, but I’m scared of the cost involved in rewriting
large and complicated pieces of frame scripts will have on downstream

It seems like the focus of Fission so far has been to convert
stateless pieces of the Firefox frontend code to this ‘actor model’
you mention.  Where do we find documentation about this model?  Can
the ActorChild be used in conjunction with a regular frame script

> 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]

The Marionette frame script (testing/marionette/listener.js) is
rather large, complicated, and maintains a lot of state.  How can
you work with state across process-scoped and (presumably) isolated

One of the advantages of frame scripts is that they have a narrower
global scope than the child process JSMs do.

More information about the firefox-dev mailing list