Note: There are a few cases of duplicates in user autocompletion which are being worked on.

svg image onerror fails to fire on any error

RESOLVED FIXED in mozilla30

Status

()

Core
SVG
RESOLVED FIXED
8 years ago
4 years ago

People

(Reporter: Bill Wallace, Assigned: Robert Longson)

Tracking

(Depends on: 1 bug)

unspecified
mozilla30
x86
Windows XP
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(4 attachments, 2 obsolete attachments)

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11

If there is an onerror method attached to either an svg:image or xhtml:img tag, they will fail to fire if either the server is missing or a 404 is returned.  I didn't have any easy way to test other error codes, but I expect this is generally true.  Note that this is a super-set of the bug reported in 299138, where that issue is only about 404 errors returning an image.  In this case, any 404 returned, even html, or a 0 (server gone) is silently ignored, and no image is displayed, nor is the callback called.

Reproducible: Always

Steps to Reproduce:
Try loading the following file as XHTML.  It should give you 2 error alerts, but instead gives you none.

<html  xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" >
<body>

<p>This is an HTML paragraph</p>

<div style="width:300px; height:100px; background:cyan; position: relative;">

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="300" height="100"
viewBox="0 0 100 100" preserveAspectRatio="xMidYMid slice"
style="width:300px; height:100px; ">
<image width="300" height="100" xlink:href="http://localhost/noServer.gif" preserveAspectRatio="none" onerror="alert(1)" /> 
</svg>
</div>

Done.
<img src="http://localhost/noServer.gif" onerror="alert(2)" /> 

</body>
</html> 


Actual Results:  
onerror is ignored every time.  I was unable to find any case where onerror was successfully called.

Expected Results:  
alert 1 and 2 are both shown (unless you happen to have the gif I reference which seems unlikely)
(Reporter)

Updated

8 years ago
Summary: Both regular and svg img and image tags onerror fail to fire on any error → svg image onerror fails to fire on any error
(Reporter)

Comment 1

8 years ago
I had noscript for files on - the svg image onerror still fails, but the second alert(2) displays just fine.
Also, for the svg reference about having onerror, I'm using:
http://www.w3.org/TR/SVG11/interact.html#SVGEvents
(Assignee)

Updated

8 years ago
Component: General → SVG
Product: Firefox → Core
QA Contact: general → general
(Assignee)

Comment 2

8 years ago
Can you add the testcase as an attachment please? Ideally as two separate attachments (one for html only and another containing only as the svg example)
(Assignee)

Comment 3

8 years ago
Created attachment 385018 [details] [diff] [review]
patch
Attachment #385018 - Flags: review?(jwatt)
(Assignee)

Updated

8 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Updated

8 years ago
Assignee: nobody → longsonr
(Reporter)

Comment 4

8 years ago
Created attachment 385087 [details]
HTML passing testcase (for comparison with SVG testcase)

This is the html test case that already passes.
(Reporter)

Comment 5

8 years ago
Created attachment 385088 [details]
This is the SVG testcase that fails.
Comment on attachment 385018 [details] [diff] [review]
patch

This seems wrong to me. The spec says that the 'onerror' attribute on SVG content triggers for the 'SVGError' event, not the 'error' event. Hence what nsSVGElement::GetEventNameForAttr is for.
Any thoughts on that Robert?
(Assignee)

Comment 8

8 years ago
I think you're right. Unfortunately I'm not sure what to do about it :-( You know the events code better than me I think.
(Assignee)

Updated

8 years ago
Attachment #385018 - Flags: review?(jwatt)
(Assignee)

Comment 9

8 years ago
Created attachment 404500 [details] [diff] [review]
better patch
Attachment #385018 - Attachment is obsolete: true
Attachment #404500 - Flags: review?(jwatt)
(Assignee)

Updated

8 years ago
Attachment #404500 - Flags: review?(Olli.Pettay)
Comment on attachment 404500 [details] [diff] [review]
better patch

Could you add some simple testcase for this.

I'm not sure we actually fire abort, but dispatching abort manually should be handle by onabort listener.
(Assignee)

Comment 11

8 years ago
Created attachment 404522 [details] [diff] [review]
reftest
(Assignee)

Comment 12

8 years ago
(In reply to comment #10)
> (From update of attachment 404500 [details] [diff] [review])
> Could you add some simple testcase for this.

Done.

> 
> I'm not sure we actually fire abort, but dispatching abort manually should be
> handle by onabort listener.

I don't fire abort internally either.
(Assignee)

Updated

8 years ago
Attachment #404500 - Flags: review?(Olli.Pettay)
(Assignee)

Updated

8 years ago
Assignee: longsonr → nobody
(Assignee)

Comment 13

7 years ago
Comment on attachment 404500 [details] [diff] [review]
better patch

bitrotted now
Attachment #404500 - Attachment is obsolete: true
Attachment #404500 - Flags: review?(jwatt)
(Assignee)

Updated

7 years ago
Depends on: 620002
(Assignee)

Comment 14

4 years ago
Created attachment 8375406 [details] [diff] [review]
The SVG 2 way

Seems that SVG 2 will use the standard CSS error and abort events per http://www.w3.org/TR/SVG2/interact.html#SVGEvents

We never fired the SVG 1.1 SVGError event so we've no backwards compatibility worries.
Attachment #8375406 - Flags: review?(cam)
Comment on attachment 8375406 [details] [diff] [review]
The SVG 2 way

Review of attachment 8375406 [details] [diff] [review]:
-----------------------------------------------------------------

r=me for the SVG bits but can you get smaug or masayuki to review the dom/events/ bits?
Attachment #8375406 - Flags: review?(cam) → review+
(Assignee)

Updated

4 years ago
Attachment #8375406 - Flags: superreview?(bugs)
(Assignee)

Updated

4 years ago
Assignee: nobody → longsonr

Updated

4 years ago
Attachment #8375406 - Flags: superreview?(bugs) → superreview+
(Assignee)

Comment 16

4 years ago
https://tbpl.mozilla.org/?tree=Try&rev=8b1ba1894057
(Assignee)

Comment 17

4 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/e3a09f5cec6b
Flags: in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/e3a09f5cec6b
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.