Closed
Bug 1264768
Opened 10 years ago
Closed 9 years ago
Image loads for URLs that fail to resolve don't dispatch error event
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla50
| Tracking | Status | |
|---|---|---|
| firefox50 | --- | fixed |
People
(Reporter: jdm, Assigned: ben.tian)
References
Details
(Whiteboard: [tw-dom] btpp-active)
Attachments
(1 file, 3 obsolete files)
According to the specification (https://html.spec.whatwg.org/multipage/embedded-content.html#update-the-image-data), in step 11.4 we should be dispatching an error event.
http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=4060
Updated•10 years ago
|
Whiteboard: [tw-dom] btpp-fixlater
| Assignee | ||
Comment 1•9 years ago
|
||
WIP patch that passes comment 0 test. Will verify flow based on spec and run try.
Assignee: nobody → btian
| Assignee | ||
Updated•9 years ago
|
Whiteboard: [tw-dom] btpp-fixlater → [tw-dom] btpp-active
| Assignee | ||
Comment 2•9 years ago
|
||
Change:
- dispatch error event as long as method |StringToURI| fails.
Attachment #8755688 -
Attachment is obsolete: true
| Assignee | ||
Comment 3•9 years ago
|
||
Change
- dispatch error event AFTER canceling image requests, per comment 0 spec
- add some comment to clarify
Attachment #8756204 -
Attachment is obsolete: true
| Assignee | ||
Comment 4•9 years ago
|
||
Try result: https://treeherder.mozilla.org/#/jobs?repo=try&revision=aab607f59038
Comment 3 patch seems irrelevant to the failed test cases (all copy/paste related on Win7).
| Assignee | ||
Comment 5•9 years ago
|
||
Comment on attachment 8757799 [details] [diff] [review]
Patch 1 (v3): Dispatch error event when image loads for URLs that fail to resolve
Henri,
Can you review my patch that dispatches error event when image loads for URLs that fail to resolve? The patch is based on comment 0 spec and passes comment 0 test. Try result is in comment 4.
Attachment #8757799 -
Flags: review?(hsivonen)
Comment 6•9 years ago
|
||
Comment on attachment 8757799 [details] [diff] [review]
Patch 1 (v3): Dispatch error event when image loads for URLs that fail to resolve
Review of attachment 8757799 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/base/nsImageLoadingContent.cpp
@@ +755,5 @@
> + if (NS_FAILED(rv)) {
> + // Cancel image requests and fire error event per spec
> + CancelImageRequests(aNotify);
> + FireEvent(NS_LITERAL_STRING("error"));
> + return rv;
Why is rv returned instead of NS_OK? The other similar cases where "error" is fired, NS_OK is returned.
| Assignee | ||
Comment 7•9 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #6)
> Why is rv returned instead of NS_OK? The other similar cases where "error"
> is fired, NS_OK is returned.
I just want to keep original behavior that returns rv in NS_ENSURE_SUCCESS, in case any existing caller expects rv returned. I'm fine to return NS_OK if you suggest.
| Assignee | ||
Comment 8•9 years ago
|
||
(In reply to Ben Tian [:btian][PTO: 6/20 ~ 7/1] from comment #7)
> I just want to keep original behavior that returns rv in NS_ENSURE_SUCCESS,
> in case any existing caller expects rv returned. I'm fine to return NS_OK if
> you suggest.
If NS_OK is returned here, both |LoadImage| methods can return void instead for always returning NS_OK. And so does method |FireEvent|. I can open another bug to clean these up.
| Assignee | ||
Comment 9•9 years ago
|
||
(In reply to Ben Tian [:btian][PTO: 6/18 ~ 7/3] from comment #7)
> (In reply to Henri Sivonen (:hsivonen) from comment #6)
> > Why is rv returned instead of NS_OK? The other similar cases where "error"
> > is fired, NS_OK is returned.
>
> I just want to keep original behavior that returns rv in NS_ENSURE_SUCCESS,
> in case any existing caller expects rv returned. I'm fine to return NS_OK if
> you suggest.
Henri, do you suggest to return NS_OK instead? Let me know for any other suggestion on my patch.
Flags: needinfo?(hsivonen)
Comment 10•9 years ago
|
||
(In reply to Ben Tian [:btian][PTO: 6/18 ~ 7/3] from comment #9)
> (In reply to Ben Tian [:btian][PTO: 6/18 ~ 7/3] from comment #7)
> > (In reply to Henri Sivonen (:hsivonen) from comment #6)
> > > Why is rv returned instead of NS_OK? The other similar cases where "error"
> > > is fired, NS_OK is returned.
> >
> > I just want to keep original behavior that returns rv in NS_ENSURE_SUCCESS,
> > in case any existing caller expects rv returned. I'm fine to return NS_OK if
> > you suggest.
>
> Henri, do you suggest to return NS_OK instead? Let me know for any other
> suggestion on my patch.
Based on an MXR search, yes, I'm suggesting return NS_OK instead.
Flags: needinfo?(hsivonen)
Comment 11•9 years ago
|
||
Comment on attachment 8757799 [details] [diff] [review]
Patch 1 (v3): Dispatch error event when image loads for URLs that fail to resolve
r+ if the return value is changed to NS_OK.
Attachment #8757799 -
Flags: review?(hsivonen) → review+
| Assignee | ||
Comment 12•9 years ago
|
||
Thanks for the review! Revise per reviewer's comment.
Attachment #8757799 -
Attachment is obsolete: true
| Assignee | ||
Comment 13•9 years ago
|
||
Try result of comment 12 patch:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=73914b2ea3e4
Keywords: checkin-needed
Comment 14•9 years ago
|
||
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/066be6391756
Dispatch error event when image loads for URLs that fail to resolve, r=hsivonen
Keywords: checkin-needed
Comment 15•9 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox50:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Comment 16•9 years ago
|
||
This cause a unexpected error event in non-responsive mode, see bug 1321300 comment #7.
It is because we load image for each src attribute assignment if in non-responsive mode. Bug 1076583 will fix that (load image from last associated src value only). However, bug 1076583 still has ongoning work and may not be landed soon, so we consider back out this change first (at least we have consistent behavior as 49 and earlier versions) and reland it after bug 1076583 is fixed.
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•