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)

defect
Not set
normal

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)

Whiteboard: [tw-dom] btpp-fixlater
WIP patch that passes comment 0 test. Will verify flow based on spec and run try.
Assignee: nobody → btian
Whiteboard: [tw-dom] btpp-fixlater → [tw-dom] btpp-active
Change: - dispatch error event as long as method |StringToURI| fails.
Attachment #8755688 - Attachment is obsolete: true
Change - dispatch error event AFTER canceling image requests, per comment 0 spec - add some comment to clarify
Attachment #8756204 - Attachment is obsolete: true
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).
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 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.
(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.
(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.
(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)
(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 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+
Thanks for the review! Revise per reviewer's comment.
Attachment #8757799 - Attachment is obsolete: true
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
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
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.
Component: DOM → DOM: Core & HTML
Regressions: 1321300
Blocks: 1329603
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: