Open Bug 1756910 Opened 3 years ago Updated 3 years ago

Write test to ensure scripts aren't loaded in content process before content-process-ready-for-script

Categories

(Core :: XPCOM, task)

Unspecified
All
task

Tracking

()

People

(Reporter: mcomella, Unassigned)

References

(Blocks 1 open bug)

Details

In bug 1632682, we implemented a new observer topic, content-process-ready-for-script, and moved all scripts in the content process to start at or after that topic to ensure they are cached and have optimal performance. To prevent regressions, we should write a test to ensure no scripts are started before content-process-ready-for-script in the content process.

Component: General → XPCOM
Product: GeckoView → Core

For the impact a regression could cause, see https://bugzilla.mozilla.org/show_bug.cgi?id=1632682#c5 and https://bugzilla.mozilla.org/show_bug.cgi?id=1632682#c8.

Here are some suggestions from :mccr8 in the dependent bug's review on what this test could look like:

@mccr8 Do you know if this is feasible to write a test for? If so, can you point me in the right direction?

It would probably be possible to write a test that checks which scripts can be loaded at various phases in the content process. browser/base/content/test/performance/browser_startup.js does that for the main process, and the browser_startup_content.js test in the same directory checks which scripts we load in content processes, so presumably you could modify the latter to check scripts a bit. I think it is a bit tricky because there's no guarantee about the order that observers are called in, so they have to check what scripts are loaded in the next phase. For app-startup in the main process, it looks like the test is using "profile-do-change", but I'm not sure that exists in the content process. I'm not sure if it is worth the hassle.

You need to log in before you can comment on or make changes to this bug.