Summary: | Image object onerr event not working, triggers onload instead | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Pedro Fayolle <pfayolle> |
Component: | khtml ecma | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | maksim |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
naive patch
fixes event type, too |
Description
Pedro Fayolle
2005-02-03 01:43:50 UTC
Created attachment 11505 [details]
naive patch
naive patch. Some code consolidation might be in order, and I don't understand
why the cast from ATTR_ONLOAD is there, seems like it's an internal detail?
Yeah, the event types are bogus, as can be seen by testing event.type in the handlers. Revised patch for that next comment.. Created attachment 11506 [details]
fixes event type, too
revised
To update you: I've fixed up a lot of stuff with Image, and it now does distinguish onload vs. onerror, but there is a confusion inside KHTML about what onerror means (there are basically 2 types!), and so the handler doesn't get invoked, but that should be easy to fix once I can talk to person who put that stuff in and ask for some rationale. SVN commit 502559 by orlovich: Make onerror work for images by actually using the same type of events for events and listeners. BUG:98461 M +2 -2 ecma/kjs_dom.cpp M +2 -2 ecma/kjs_window.cpp M +0 -2 xml/dom2_eventsimpl.cpp M +0 -1 xml/dom2_eventsimpl.h --- branches/KDE/3.5/kdelibs/khtml/ecma/kjs_dom.cpp #502558:502559 @@ -210,7 +210,7 @@ case OnDragDrop: return getListener(DOM::EventImpl::KHTML_DRAGDROP_EVENT); case OnError: - return getListener(DOM::EventImpl::KHTML_ERROR_EVENT); + return getListener(DOM::EventImpl::ERROR_EVENT); case OnFocus: return getListener(DOM::EventImpl::FOCUS_EVENT); case OnKeyDown: @@ -351,7 +351,7 @@ setListener(exec,DOM::EventImpl::KHTML_DRAGDROP_EVENT,value); break; case OnError: - setListener(exec,DOM::EventImpl::KHTML_ERROR_EVENT,value); + setListener(exec,DOM::EventImpl::ERROR_EVENT,value); break; case OnFocus: setListener(exec,DOM::EventImpl::FOCUS_EVENT,value); --- branches/KDE/3.5/kdelibs/khtml/ecma/kjs_window.cpp #502558:502559 @@ -752,7 +752,7 @@ case Ondragdrop: return getListener(exec,DOM::EventImpl::KHTML_DRAGDROP_EVENT); case Onerror: - return getListener(exec,DOM::EventImpl::KHTML_ERROR_EVENT); + return getListener(exec,DOM::EventImpl::ERROR_EVENT); case Onfocus: return getListener(exec,DOM::EventImpl::FOCUS_EVENT); case Onkeydown: @@ -928,7 +928,7 @@ return; case Onerror: if (isSafeScript(exec)) - setListener(exec,DOM::EventImpl::KHTML_ERROR_EVENT,value); + setListener(exec,DOM::EventImpl::ERROR_EVENT,value); return; case Onfocus: if (isSafeScript(exec)) --- branches/KDE/3.5/kdelibs/khtml/xml/dom2_eventsimpl.cpp #502558:502559 @@ -260,8 +260,6 @@ return "click"; case KHTML_DRAGDROP_EVENT: return "khtml_dragdrop"; - case KHTML_ERROR_EVENT: - return "khtml_error"; case KHTML_MOVE_EVENT: return "khtml_move"; case KHTML_READYSTATECHANGE_EVENT: --- branches/KDE/3.5/kdelibs/khtml/xml/dom2_eventsimpl.h #502558:502559 @@ -84,7 +84,6 @@ KHTML_ECMA_DBLCLICK_EVENT, // for html ondblclick KHTML_ECMA_CLICK_EVENT, // for html onclick KHTML_DRAGDROP_EVENT, - KHTML_ERROR_EVENT, KHTML_MOVE_EVENT, // XMLHttpRequest events KHTML_READYSTATECHANGE_EVENT SVN commit 502570 by orlovich: Regression test for #98461 CCBUG:98461 A baseline/events/img_on_error.html-dom A baseline/events/img_on_error.html-render M +1 -0 baseline/events/svnignore A tests/events/img_on_error.html --- trunk/tests/khtmltests/regression/baseline/events/svnignore #502569:502570 @@ -12,3 +12,4 @@ iframe_display.html-dom window_addevent.html-render wrong-type-1.html-dump.png +img_on_error.html-dump.png |