Open Bug 1425619 Opened 7 years ago Updated 2 years ago

Reduce use of getInterface in frontend code

Categories

(Firefox :: General, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox59 --- affected

People

(Reporter: Gijs, Unassigned)

References

(Blocks 1 open bug)

Details

getInterface is not great for several reasons. Long-term, from what I understand, we would like to get rid of it. Happily, a lot of the uses in frontend code have non-XPCOM-y equivalents via webidl properties or direct getters that don't require getInterface. Where they don't, we should consider adding some (e.g. we should consider what we use DOMWindowUtils methods for and maybe add them directly to Element.webidl as [ChromeOnly] methods). This would be a good idea both for perf and for ergonomics and cleaning up hard to read goop from our code, like atrocities such as: window.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(nsIWebNavigation) .QueryInterface(Ci.nsIDocShellTreeItem).treeOwner .QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIXULWindow) .XULBrowserWindow = window.XULBrowserWindow; etc. Florian, my understanding is that you have scripts that would help with this. Can you attach an example, perhaps?
Flags: needinfo?(florian)
Flags: needinfo?(florian)
Depends on: 1446940
Depends on: 1479569
Depends on: 1479570
Depends on: 1480310
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.