Open Bug 1698135 Opened 4 years ago Updated 4 years ago

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

Categories

(Toolkit :: Reader Mode, enhancement)

enhancement

Tracking

()

People

(Reporter: nika, Unassigned)

References

Details

(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: https://searchfox.org/mozilla-central/rev/9ae77e4ce3378bd683ac9a86b729ea6b6bd22cb8/browser/actors/AboutReaderChild.jsm#153-158)

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.