Parse the urlbar input's markup without MozXULElement
Categories
(Firefox :: Address Bar, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox156 | --- | fixed |
People
(Reporter: dao, Assigned: dao)
References
(Blocks 1 open bug)
Details
(Whiteboard: [sng][mcab-hnt])
Attachments
(2 files)
UrlbarInputBase.fragment builds the input's DOM with window.MozXULElement.parseXULToFragment(), which a content realm doesn't have, so <moz-urlbar> can't construct itself on about:newtab.
parseXULToFragment is a DOMParser parse of the markup wrapped in a XUL <box> declaring the XUL and XHTML namespaces, followed by stripping whitespace-only text nodes. Two pieces of it are chrome-only: forceEnableXULXBL() and parseFromSafeString(). The first is load-bearing -- a content DOMParser cannot create XUL elements at all -- so a content realm has to map the markup's XUL default namespace to HTML rather than reproduce the parse as-is.
That works because the markup is almost entirely html:-prefixed: 35 tags across 9 element types, against a single XUL moz-input-box, which then parses as an undefined custom element. Whether the input needs a substitute for it in a content document is still open.
Updated•1 day ago
|
| Assignee | ||
Comment 1•1 day ago
|
||
parseXULToFragment is chrome-only, and one of the reasons is load-bearing: a
content document can hold no XUL elements at all, which is what
forceEnableXULXBL grants. So the content branch maps the markup's XUL default
namespace to HTML, and its lone XUL element, moz-input-box, parses as an
undefined custom element. Whether the input needs a substitute there is the next
thing to find out.
Updated•1 day ago
|
Updated•1 day ago
|
| Assignee | ||
Comment 3•16 hours ago
|
||
DOMParser keeps the whitespace between the markup's elements, and those text nodes change the accessibility tree the input exposes: the search bar gains an empty section child, which browser_searchbar_new.js catches. Only a build slow enough to assert the tree before it settles sees it, so opt is green while asan, tsan and debug fail; MOZ_CHAOSMODE with --repeat reproduces it on an opt build.
Comment 4•14 hours ago
|
||
Reverted this because it was causing mochitests failures in browser_searchbar_new.js.
- Revert link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | accessible/tests/browser/tree/browser_searchbar_new.js | test_searchbar_a11y_tree - [DOM node id: searchbar-new, role: grouping, address: [xpconnect wrapped nsIAccessible]] has an extra child at index 1 : [role: section, address: [xpconnect wrapped nsIAccessible]]
Updated•14 hours ago
|
Comment 6•12 hours ago
|
||
| bugherder | ||
Comment 8•1 hour ago
|
||
| bugherder | ||
Description
•