Closed Bug 1488226 Opened 7 years ago Closed 5 years ago

Iframe that failed to load doesn't fire load or error events

Categories

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

defect

Tracking

()

RESOLVED DUPLICATE of bug 1418975

People

(Reporter: evilpies, Unassigned)

Details

Attachments

(1 file)

I am not quite sure if this is actually a Firefox bug, but an iframe that fails to load will not trigger a load or error event. In Chrome the load event is always triggered. This came up with Adblock Plus, because the extension uses the load events to hide the iframe element, if it was blocked. I wrote a testcase for this that includes a webextension that blocks the iframe request, before I realized that a WebExtension is not necessary to observe this behavior. https://github.com/evilpie/iframe-block-testcase
Attached file Test case
Attachment #9006018 - Attachment mime type: text/plain → text/html
Turns out testing this on bmo actually produces a different behavior, because it uses a strict CSP, and that apparently even generates error events.
For reference, on Chrome, <iframe> elements always emit a "load" event, regardless whether they succeed to load, or failed for whichever reason. I'm not sure whether an <iframe> that failed to load should rather emit a "load" or "error" event, since technically if loading the requested URL failed to load, it is loading an error page (or an empty document). However, if no event is emitted at all it looks like to any JavaScript listening to these events like the <iframe> is still loading, which not only prevents us to hide blocked <iframe> elements in Adblock Plus (giving more space to the actual content), but might also cause problems with websites that rely on an event eventually being triggered.
Possibly a duplicate of bug 444165.
Priority: -- → P2
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: