Bug 8511

Summary: onerror JS property does not register listener properly
Product: WebKit Reporter: Maciej Stachowiak <mjs>
Component: WebCore JavaScriptAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, jon
Priority: P2 Keywords: EasyFix
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Patch using maciej's fix.
ggaren: review-
test case
none
Patch plus test case.
none
Better patch and test case.
none
Patch with working test and results. ggaren: review+

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. ***