Bug 8511 - onerror JS property does not register listener properly
Summary: onerror JS property does not register listener properly
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 420+
Hardware: Macintosh OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords: EasyFix
: 6688 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-21 00:40 PDT by Maciej Stachowiak
Modified: 2006-05-03 04:51 PDT (History)
2 users (show)

See Also:


Attachments
Patch using maciej's fix. (924 bytes, patch)
2006-04-21 10:06 PDT, Jon
ggaren: review-
Details | Formatted Diff | Diff
test case (1.06 KB, text/html)
2006-04-21 10:23 PDT, Geoffrey Garen
no flags Details
Patch plus test case. (6.27 KB, patch)
2006-04-21 11:51 PDT, Jon
no flags Details | Formatted Diff | Diff
Better patch and test case. (6.52 KB, patch)
2006-04-21 12:01 PDT, Jon
no flags Details | Formatted Diff | Diff
Patch with working test and results. (6.34 KB, patch)
2006-04-21 12:40 PDT, Jon
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Stachowiak 2006-04-21 00:40:08 PDT
The onerror JS property doesn't properly register an error listener on img elements (the onerror HTML attribute does):

<img src="http://www.google.com/intl/en/images/logo.giffff" id="foo">
<script>
document.getElementById("foo").onerror = function(event) { alert('error property'); };
</script>

I believe this is because in kjs_dom.cpp the bindings code registers a listener for khtmlErrorEvent instead of errorEvent for this property.
Comment 1 Jon 2006-04-21 10:06:29 PDT
Created attachment 7875 [details]
Patch using maciej's fix.

Here's a patch using Maciej's suggested fix.
Comment 2 Geoffrey Garen 2006-04-21 10:23:25 PDT
Created attachment 7876 [details]
test case
Comment 3 Geoffrey Garen 2006-04-21 10:24:15 PDT
Comment on attachment 7875 [details]
Patch using maciej's fix.

we talked about this on irc -- no changelog, no test case, doesn't fix window.onerror.
Comment 4 Jon 2006-04-21 11:51:20 PDT
Created attachment 7879 [details]
Patch plus test case.
Comment 5 Jon 2006-04-21 12:01:59 PDT
Created attachment 7880 [details]
Better patch and test case.
Comment 6 Jon 2006-04-21 12:40:25 PDT
Created attachment 7882 [details]
Patch with working test and results.
Comment 7 Geoffrey Garen 2006-04-21 12:45:00 PDT
Comment on attachment 7882 [details]
Patch with working test and results.

r=me
Comment 8 Eric Seidel (no email) 2006-04-21 14:28:44 PDT
Sweet!  A new contributer!  Now we just need to convince Jon to join us on #webkit. :)
Comment 9 Darin Adler 2006-04-21 22:31:24 PDT
Yes, removes khtmlError entirely! Hooray!
Comment 10 Alexey Proskuryakov 2006-05-03 04:51:13 PDT
*** Bug 6688 has been marked as a duplicate of this bug. ***