Remove XULDocument::AddSubtreeToDocumentPre.

RESOLVED FIXED in Firefox 65

Status

()

enhancement
P3
normal
RESOLVED FIXED
7 months ago
7 months ago

People

(Reporter: emilio, Assigned: emilio)

Tracking

unspecified
mozilla65
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox65 fixed)

Details

Attachments

(4 attachments)

(Assignee)

Description

7 months ago
BindToTree takes care of adding to the ID table.
(Assignee)

Comment 1

7 months ago
The ID table is managed in BindToTree / UnbindFromTree.

I guess this was more important when XUL templates were a thing.
Not sure if it's related to this, but we've been finding and removing cases where we were relying on `document.getElementById("foo")` traversing into XBL anon content (bug 1502151, bug 1500240), since that doesn't work in HTML documents. As far as I know there aren't any more places where we do that, and if there are we can remove them.
Depends on: 1425356
(Assignee)

Comment 4

7 months ago
(In reply to Brian Grinstead [:bgrins] from comment #3)
> Not sure if it's related to this, but we've been finding and removing cases
> where we were relying on `document.getElementById("foo")` traversing into
> XBL anon content (bug 1502151, bug 1500240), since that doesn't work in HTML
> documents. As far as I know there aren't any more places where we do that,
> and if there are we can remove them.

Oh, that's awesome.

Updated

7 months ago
Priority: -- → P3
(In reply to Emilio Cobos Álvarez (:emilio) from comment #5)
> Created attachment 9020811 [details]
> Bug 1502875 - Don't let GetElementById work across anonymous subtree
> boundaries in XUL documents. r=smaug
> 
> According to comment 3 the front-end no longer needs it.

Richard, if TB is relying on document.getElementById traversing into XBL content, behavior can be restored by using something like `document.getAnonymousElementByAttribute(xblHostElement, "id", id)` (see bug 1502151 and bug 1500240).
Flags: needinfo?(richard.marti)
(Assignee)

Comment 7

7 months ago
This is needed to make the "Simplify AddToIdTable" patch work. I'll
land it before that one.
(In reply to Brian Grinstead [:bgrins] from comment #6)
> (In reply to Emilio Cobos Álvarez (:emilio) from comment #5)
> > Created attachment 9020811 [details]
> > Bug 1502875 - Don't let GetElementById work across anonymous subtree
> > boundaries in XUL documents. r=smaug
> > 
> > According to comment 3 the front-end no longer needs it.
> 
> Richard, if TB is relying on document.getElementById traversing into XBL
> content, behavior can be restored by using something like
> `document.getAnonymousElementByAttribute(xblHostElement, "id", id)` (see bug
> 1502151 and bug 1500240).

Thank you for the heads-up, Brian. I'll n-i other c-c people which know this a lot better than me.
Flags: needinfo?(richard.marti)
Flags: needinfo?(mkmelin+mozilla)
Flags: needinfo?(jorgk)
Flags: needinfo?(acelists)

Comment 9

7 months ago
Thank you. We know that you need to use getAnonymousElementByAttribute() to get an anonymous element so if there is use of getElementById instead, it should be by mistake and we will fix it.

I'll do some test run asserting when there is an ID and IsInAnonymousSubtree().
Flags: needinfo?(acelists)

Updated

7 months ago
Depends on: 1502997

Comment 10

7 months ago
I have created bug 1502997 for the cases found in Thunderbird.
Flags: needinfo?(mkmelin+mozilla)
Flags: needinfo?(jorgk)

Comment 12

7 months ago
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4fb88c6c2223
Remove AddElementToDocumentPre and RemoveSubtreeFromDocument. r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/7a38544a9172
Don't call AddToIdTable when moving around a shadow root. r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/8157760bbde1
Simplify AddIdElement. r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/b7a966ea9ad3
Don't let GetElementById work across anonymous subtree boundaries in XUL documents. r=smaug
You need to log in before you can comment on or make changes to this bug.