Closed Bug 1855427 Opened 1 year ago Closed 1 year ago

DOMLinkRemoved event never fires to the document for removed link elements

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox121 --- fixed

People

(Reporter: mossop, Assigned: mossop)

Details

Attachments

(1 file)

When removing a link element from the DOM we attempt to fire a DOMLinkRemoved event but because the event is dispatched asynchronously by the time the event is actually dispatched the element is no longer in the DOM and so any listeners attached to the document do not see the event. Maybe listeners attached to the element itself do? This is unlikely to be what was intended though.

However we also never appear to listen to this event anywhere so we should probably just consider removing it. Presumably we used to use it to track removed favicons, I guess I'm a little surprised that we still don't.

Severity: -- → S3

Marco, does it make sense that we don't remove the tab icon if its <link> element is removed from the document? If so we can just remove the DOMLinkRemoved events entirely.

Flags: needinfo?(mak)

My expectation is that a web site rarely intends to "remove" an icon persistently and change to a no-icon state.
Though, I suspect it may do something like:

  1. have default icons
  2. add a state icon (unread content, notifications...)
  3. remove the state icon to revert to the default icons
    I guess they may do this by adding/removing links dynamically, rather than changing the href of an existing link or keep adding links.

We apparently only listen to DOMLinkAdded and DOMLinkChanged and I don't remember bugs complaining about us not handling DOMLinkRemoved.
Thus it's probably ok to remove it from our point of view, but I'd suggest to first check how other browsers handle this case, to avoid WebCompat issues.

Flags: needinfo?(mak)

I'll look at what other browser do here

Flags: needinfo?(dtownsend)

Looks like Chrome doesn't change the tab icon when removing the current icon's link element from the DOM so we probably shouldn't either.

Assignee: nobody → dtownsend
Flags: needinfo?(dtownsend)

The event isn't dispatched correctly for DOM manipulations anymore. It is
dispatched when swapping docshells but we don't actually use this event anywhere
except tests so we might as well just remove it entirely.

Pushed by dtownsend@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7c942f4e0530 The DOMLinkRemoved chrome event is not used anywhere. r=emilio
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: