Closed Bug 1497975 Opened 6 years ago Closed 6 years ago

browser.xhtml: Hide root element during parse, then show it and call onBeforeInitialXULLayout afterwards

Categories

(Firefox :: General, enhancement, P5)

enhancement

Tracking

()

RESOLVED FIXED
Firefox 64
Tracking Status
firefox64 --- fixed

People

(Reporter: bgrins, Assigned: bgrins)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1497599 +++

We are currently doing layouts during the browser.xhtml document parse, which causes strange interactions with XBL construction where we have bindings that get created in the middle of parse. Those bindings are generally expecting the DOM to be mostly-ready when constructed (i.e. after MozBeforeInitialXULLayout).

Based on discussion starting around https://bugzilla.mozilla.org/show_bug.cgi?id=1497599#c15, I think we can more closely match XUL document behavior if we hide the documentElement during parse (which should prevent us from doing layouts and constructing XBL).

This needs a bit more testing, but initial try pushes indicate this may also fix some tests (since instead of waiting for DOMContentLoaded to run gBrowserInit.onBeforeInitialXULLayout we could do it immediately before unhiding the documentElement)
Assignee: nobody → bgrinstead
Status: NEW → ASSIGNED
By hiding the documentElement with display:none and then waiting to
show it until readystatechange, we can avoid inadvertently constructing
XBL bindings as a result scripts running during parse like connectedCallback.

This more closely matches XUL document behavior, where the initial
layout doesn't happen until everything is parsed and loaded. It also
lets us call gBrowserInit.onBeforeInitialXULLayout actually before
layout happens.
Pushed by bgrinstead@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bb7c6b3e49c7
Prevent layouts during parse of browser.xhtml;r=Gijs,emilio
https://hg.mozilla.org/mozilla-central/rev/bb7c6b3e49c7
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 64
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: