[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Patch for Bug#35663: Konqueror crashes at www.slovnik.cz
From:       Koos Vriezen <koos.vriezen () xs4all ! nl>
Date:       2002-02-23 22:20:45
[Download RAW message or body]

Hi,

I commited a patch for document.close that causes causes a recursion in
body.onLoad. It seems to work, but since its more like a hack, please
review this one.

--- xml/dom_docimpl.cpp 2002/02/23 16:38:33     1.164
+++ xml/dom_docimpl.cpp 2002/02/23 22:14:34
@@ -1859,7 +1859,16 @@ void DocumentImpl::defaultEventHandler(E
     for (; it.current(); ++it) {
         if (it.current()->id == evt->id()) {
             evt->setCurrentTarget(this);
-            it.current()->listener->handleEvent(ev);
+            if (evt->id() == EventImpl::LOAD_EVENT) {
+                // document.close can cause a recursion in body.onLoad
+                // since it's fired once, we remove it here
+                EventListener *listener = it.current()->listener;
+                listener->ref();
+                m_windowEventListeners.removeRef(it.current());
+                listener->handleEvent(ev);
+                listener->deref();
+            } else
+                it.current()->listener->handleEvent(ev);
            return;
        }
     }

Even this test case keeps working
<html>
<body onLoad='alert("Hi")' onClick='alert(document.b.onLoad)' id="b">
</body></html>

Koos


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic