Closed Bug 608809 Opened 9 years ago Closed 8 years ago
Fire an error event when a script fails to load
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 Hello, 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." See http://www.w3.org/TR/DOM-Level-3-Events/#event-type-error 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
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 : http://dev.w3.org/html5/spec/Overview.html#scripting-1 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.
Status: UNCONFIRMED → NEW
Component: DOM: Events → DOM: Core & HTML
Ever confirmed: true
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
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Do we have tests for this?
(In reply to Kyle Huey [:khuey] (firstname.lastname@example.org) 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.