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

List:       kde-devel
Subject:    small bug in khtml/ecma (maybe)
From:       Alessandro Praduroux <pradu () thekompany ! com>
Date:       2001-01-06 23:34:44
[Download RAW message or body]

Hi all,

I use an online home banking service that is based on javascript and frames. 
javascript is used to open different files in frames depending on the user 
choiche on a combobox, using the following code

	top.body.location.href = "/HTML/Info.asp?Area=" + area + "&Rapporto=";
	top.head.dll.location.href = "/HTML/rapporti.asp?Area=" + area;

where body and head are two frames.

in kjs_window.cpp, function Window::get, the dom tree is searched for an 
element with value = 'body' or 'head', the element is found and retured.

but the interpreter here needs a frame element, not a dom node. Code to 
retrieve the frame is just below the dom tree search, but never reached.

I see two solution here:
1- reorganize the code to look first for a frame and then for a dom node,
2- check if the found node is a frame and ignore the node

I did the former and it seems to work here, but since I do not know well the 
khtml code, I submit a patch here for review.

bye
-- 
Pradu
-----------------------------------------
Alessandro Praduroux
pradu@thekompany.com
http://www.thekompany.com


["ecma.patch" (text/x-c++)]

Index: kjs_window.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/ecma/kjs_window.cpp,v
retrieving revision 1.70
diff -u -3 -p -r1.70 kjs_window.cpp
--- kjs_window.cpp	2000/12/27 16:05:31	1.70
+++ kjs_window.cpp	2001/01/06 23:40:10
@@ -217,6 +217,10 @@ KJSO Window::get(const UString &p) const
   if (v.isDefined())
       return v;
 
+  KHTMLPart *kp = part->findFrame( p.qstring() );
+  if (kp)
+    return KJSO(newWindow(kp));
+
   // allow shortcuts like 'Image1' instead of document.images.Image1
   if (part->document().isHTMLDocument()) { // might be XML
     DOM::HTMLCollection coll = part->htmlDocument().all();
@@ -225,10 +229,6 @@ KJSO Window::get(const UString &p) const
         return getDOMNode(element);
     }
   }
-
-  KHTMLPart *kp = part->findFrame( p.qstring() );
-  if (kp)
-    return KJSO(newWindow(kp));
 
   return Undefined();
 }

>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


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

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