Closed Bug 608809 Opened 9 years ago Closed 8 years ago

Fire an error event when a script fails to load


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

Not set





(Reporter: Jeremie, Unassigned)



(Keywords: html5)


(1 file)

User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:2.0b8pre) Gecko/20101018 Firefox/4.0b8pre
Build Identifier: Build identifier: Mozilla/5.0 (X11; Linux x86_64; rv:2.0b8pre) Gecko/20101018 Firefox/4.0b8pre


According to the the DOM 3 Events specification any HTML element can fire an error event : "A user agent must dispatch this event when a resource failed to load, or has been loaded but cannot be interpreted according to its semantics, such as an invalid image, a script execution error, or non-well-formed XML."


This would be very useful when users deal with the Script Element (for example when they try to load scripts on the fly)

Reproducible: Always

Steps to Reproduce:
1. See the testcase
The test case contain both an image and a script element that should fire an error
Actual Results:  
When you run the test case, you can see an alert box that mention an error on an image (which is correct in a DOM 2 point of view).

Expected Results:  
In fact, in a DOM 3 point of view, you should see 2 alert boxes : One for the image and one for the script element
Attached file Testcase
Script element's load and error event handling is defined (if defined at all) in
 HTML5 draft, not in DOM 3 Events draft.
(In reply to comment #2)

Ah! Ok... it's a bit odd, but ok. But for what I understand of both spec, they are consistent. HTML5 explicitly relay on DOM 3 Events and for the scripts, I've found this :

(at step 12) : "If the src attribute's value is the empty string or if it could not be resolved, then the user agent must queue a task to fire a simple event named error at the element, and abort these steps."

(end at step 13) : "If the load resulted in an error (for example a DNS error, or an HTTP 404 error) -> Executing the script block must just consist of firing a simple event named error at the element."

see :

So, to me the problem remain and, IMHO, seams to become a bit more important because FF4 will be ship with a HTML5 parser. So people could expect that behavior.
Duplicate of this bug: 616248
Component: DOM: Events → DOM: Core & HTML
Ever confirmed: true
Keywords: html5
OS: Linux → All
QA Contact: events → general
Hardware: x86_64 → All
Summary: DOM error events do not follow the DOM 3 Spec on Script elements → Fire an error event when a script fails to load
Version: unspecified → Trunk
Closed: 8 years ago
Resolution: --- → WORKSFORME
Do we have tests for this?
Flags: in-testsuite?
(In reply to Kyle Huey [:khuey] ( from comment #5)
> Do we have tests for this.

None that I'm aware of.

I've just check the test case I provided and it works now.
You need to log in before you can comment on or make changes to this bug.