XUL/XBL Replacement Newsletter 18

This is the eighteenth edition of the XUL/XBL Replacement Newsletter. Even during the excitement of hitting 0 XBL bindings, there’s been a lot of progress and some updates to share.

GeckoView Is Built Without XBL

As we got close to 0 bindings, Brendan Dahl created a build option to disable XBL in Gecko. This wasn’t a simple task due to the amount of places throughout the codebase that reference or interact with XBL. Thanks to Brendan, and to Boris Zbarsky for reviewing this change.

One nice thing about introducing a build option is that we were able to turn off XBL entirely in GeckoView! So this is the first platform where we are shipping Gecko without XBL.

We also have a bug on file to disable XBL in desktop Firefox, which we plan to do after the upcoming merge to 72 on 2019-10-21.

Finally, we are tracking some of the tasks and improvements that can be made once XBL is turned off. This is done in the following metabug: remove XBL support from Gecko. If you know of changes that would be good to make post-XBL, please help us track the work by blocking that bug.

Renaming XUL Files

Emma Malysz has been making quick progress on scripting migrations of .xul files to .xhtml, one top-level directory at a time. As a reminder, we no longer load anything as a XULDocument so chrome xul files are effectively the same as xhtml files. Renaming the files is an important step in making that clear and finishing the “XUL Document Removal” project.

The majority of xul files in tree are tests. One tricky part with them is making sure that we don’t break intermittent test tracking. For instance, if there’s a bug titled:

Intermittent test_largemenu.xul | menu movement (6000, 100) x - got 2554, expected 1530

Then when a failure happens in treeherder with a test called test_largemenu.xul, it will automatically suggest the known intermittent bug based on the summary. However, renaming the file with the .xhtml extension breaks the tracking and the test appears as an unknown orange, which causes extra work for anyone viewing results from pushes to treeherder.

I had previously consulted with the sheriffs and migrated a single test file, confirming that by choosing a summary with both the old and new file name in it it will track intermittents on m-c (where it now has the new name), and beta/release (where it still has the old name). For example:

Intermittent test_largemenu.xhtml,test_largemenu.xul | menu movement (6000, 100) x - got 2554, expected 1530

There are around 100 intermittent bugs that reference xul files, so rather than manually making this change, Emma worked on scripts to:

  • Pull down the existing bugs and modify the summary string
  • Call the Bugzilla “Update Bug” API endpoint for each bug to update the title.

Thanks also to Emma Humphries for helping out with the Bugzilla integration for the above.

Improving the Keyboard Shortcut Handler Implementation

Keyboard shortcut handlers (anything declared with a <xul:key> element and various built in shortcuts like PgUp, PgDown and edit commands) were sharing the same event infrastructure as XBL <handler>. In order to make it possible to build with XBL disabled, Mossop removed the dependency on XBL. This is a followup to moving the definitions out of XBL, and throughout this work he’s been able to make improvements like adding missing test coverage for this core feature.

See the Keybindings in Firefox document for more details and a plan for how we can make it possible for JavaScript to register keyboard shortcuts at the system level so the events correctly wait for the content process to handle them as necessary.

Next up is replacing <xul:key> which has a number of longstanding issues including requiring an oncommand attribute in order to fire, which in turn stops us removing inline event handlers in browser.xhtml, which in turn blocks further improving CSP and eval() defense-in-depth security improvements. The idea will be to switch to JavaScript ways of registering handlers, either through a Custom Element or window initialization code.