Open Bug 1698135 Opened 2 years ago Updated 2 years ago

Move some of `AboutReaderChild`'s readerable detection into platform


(Toolkit :: Reader Mode, enhancement)





(Reporter: nika, Unassigned)



(Whiteboard: [fission-perf])

The AboutReaderChild actor is loaded for every toplevel content window in order to detect whether that window is eligible for readermode & make the decision about whether to show the reader mode icon. This has some overhead and can slow down fission loads due to the need to load extra content JS and fire events for documents such as the initial about:blank going away.

The main events being listened to in content are DOMContentLoaded and pageshow to start off the reader button query, and pagehide to cancel pending queries & clear the button state. If we moved this in platform, we could make the AboutReaderChild actor only be automatically loaded for about:reader documents, and avoid creating the actor at all for documents which aren't eligible for reader-mode (e.g. due to one of these failing:

We'd probably do this by moving the core checks in the actor into native code run from a native web progress listener, and adding an xpcom interface for the Readerable.jsm module which we can call from the native listeners. The UpdateReaderButton messages would be sent over native actors instead of JS actors, and an observer notification or similar would be fired in the parent instead.

We'd still need to load Readerable.jsm under this model, but I don't see a way to avoid that as the readability library is intentionally shared & implemented in an external repo, so it'd be nice to avoid rewriting it in c++.

Whiteboard: [fission-perf]
You need to log in before you can comment on or make changes to this bug.