Closed Bug 1434819 Opened 2 years ago Closed 2 years ago

Remove XPCOM DOM traversal interfaces

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(9 files)

No description provided.
Summary: Remove nsIDOMNodeIterator → Remove XPCOM DOM traversal interfaces
MozReview-Commit-ID: 6mVDmDNxx4p
Attachment #8947352 - Flags: review?(kyle)
MozReview-Commit-ID: 7ln10gj1cLP
Attachment #8947353 - Flags: review?(kyle)
MozReview-Commit-ID: GmY7L4p00D1
Attachment #8947354 - Flags: review?(kyle)
MozReview-Commit-ID: BDxOLArlCYb
Attachment #8947355 - Flags: review?(kyle)
MozReview-Commit-ID: QmxoxVhppG
Attachment #8947356 - Flags: review?(kyle)
Now that TreeWalker and NodeIterator only use webidl APIs, they always have a
NodeFilter, not nsIDOMNodeFilter.

MozReview-Commit-ID: 5pzn9V3Kxzy
Attachment #8947357 - Flags: review?(kyle)
MozReview-Commit-ID: 7E2KZkLfbSI
Attachment #8947358 - Flags: review?(kyle)
MozReview-Commit-ID: LSDXZVGDtBc
Attachment #8947359 - Flags: review?(kyle)
MozReview-Commit-ID: JsxGp9HQ2ak
Attachment #8947360 - Flags: review?(kyle)
Priority: -- → P2
Attachment #8947352 - Flags: review?(kyle) → review+
Attachment #8947353 - Flags: review?(kyle) → review+
Attachment #8947354 - Flags: review?(kyle) → review+
Attachment #8947355 - Flags: review?(kyle) → review+
Attachment #8947356 - Flags: review?(kyle) → review+
Attachment #8947357 - Flags: review?(kyle) → review+
Attachment #8947358 - Flags: review?(kyle) → review+
Attachment #8947359 - Flags: review?(kyle) → review+
Attachment #8947360 - Flags: review?(kyle) → review+
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4e46d45e3fb7
part 1.  Remove unused methods from nsIDOMNodeIterator.  r=qdot
https://hg.mozilla.org/integration/mozilla-inbound/rev/dd777984656c
part 2.  Remove nsIDOMNodeIterator.  r=qdot
https://hg.mozilla.org/integration/mozilla-inbound/rev/fe13d3d55123
part 3.  Stop using XPCOM treewalker bits in webbrowserpersist.  r=qdot
https://hg.mozilla.org/integration/mozilla-inbound/rev/09156c683ba7
part 4.  Remove all the methods from nsIDOMTreeWalker.  r=qdot
https://hg.mozilla.org/integration/mozilla-inbound/rev/bba7d4e476bb
part 5.  Remove nsIDOMTreeWalker.  r=qdot
https://hg.mozilla.org/integration/mozilla-inbound/rev/6a93f9c7d0f3
part 6.  Get rid of NodeFilterHolder.  r=qdot
https://hg.mozilla.org/integration/mozilla-inbound/rev/062e1d691fc5
part 7.  Remove the SHOW_* constants from nsIDOMNodeFilter.  r=qdot
https://hg.mozilla.org/integration/mozilla-inbound/rev/8ad255c6fd62
part 8.  Remove the FILTER_* constants from nsIDOMNodeFilter.  r=qdot
https://hg.mozilla.org/integration/mozilla-inbound/rev/bffbab07fdc4
part 9.  Remove nsIDOMNodeFilter.  r=qdot
Adding this as a dependency of Bug 1387178, since we need to establish telemetry markers for seeing how many websites use Ci.nsINodeFilter.
Depends on: 1387178
https://addons.mozilla.org/en-US/firefox/addon/tab-counter/ uses Ci.nsIDOMNodeFilter.SHOW_TEXT
Now you removed it, NodeFilter is not defined in that context, Cu.importGlobalProperties can't import it, and the tree walker is created in a document with no defaultView.
So what I am supposed to do other than hardcode 4?
Well, I guess I can always create a windowless browser, but it seems so ugly:
Services.appShell.createWindowlessBrowser().document.defaultView.NodeFilter.SHOW_TEXT
Better ideas?
In that situation, I hardcoded 4 with a comment that it's NodeFilter.SHOW_TEXT.

Though if this is being enough of a problem, we can make Cu.importGlobalProperties work for NodeFilter.  It's pretty simple to do.
(In reply to Boris Zbarsky [:bz] (no decent commit message means r-) from comment #15)
> Though if this is being enough of a problem, we can make
> Cu.importGlobalProperties work for NodeFilter.  It's pretty simple to do.

This would be useful, thanks. One can use Cu.importGlobalProperties to import XMLHttpRequest,
so I think it should also be possible to import NodeFilter in order to create a tree walker
in the resulting responseXML.

In fact I think that Cu.importGlobalProperties should be able to import any global property,
I don't understand why the list is so limited.
> I don't understand why the list is so limited.

Because many DOM things don't work properly in a JSM.  The ones that are available are the ones that have been either audited or fixed to ensure they _do_ work there.
I filed bug 1435764 on adding NodeFilter to importGlobalProperties.
Bug 1435764 landed, but...  How is https://addons.mozilla.org/en-US/firefox/addon/tab-counter/ using Ci.nsIDOMNodeFilter?  I thought we didn't expose that stuff to addons anymore.  And if that addon only works with pre-57 Firefox versions, this fix would seem irrelevant to it...
Flags: needinfo?(oriol-bugzilla)
Yes, it's a legacy add-on. With the appropriate about:config flags I can run it on firefox 60. It just needed some small fixes because of bug 437381, bug 1098412 and bug 1319512. With bug 1435764 I will be able to fix this properly, thanks.
Flags: needinfo?(oriol-bugzilla)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.