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

List:       kde-commits
Subject:    Re: kdelibs/khtml [POSSIBLY UNSAFE]
From:       Allan Sandfeld Jensen <allan () carewolf ! com>
Date:       2004-11-01 18:08:53
Message-ID: 200411011908.53305.allan () carewolf ! com
[Download RAW message or body]

On Monday 01 November 2004 16:56, David Faure wrote:
> On Saturday 30 October 2004 12:34, Allan Sandfeld Jensen wrote:
> > On Friday 29 October 2004 20:46, you wrote:
> > > On Friday 29 October 2004 20:40, David Faure wrote:
> > > i.e. document.layers would only work when choosing a netscape UA.
> >
> > As I understand NetscapeCompat is also set when we emulate Mozilla. When
> > doing that we still dont want to be treated as a Netscape4.
>
> Right. Well you could use  KProtocolManager::userAgentForHost( url.host() )
> to check for NS4, a bit like KJSProxyImpl::applyUserAgent().

No, I just needed to improve the hiding feature.

Here is a nice and evil patch for you.

I am leaning towards reverting, but being evil is fun ;)

`Allan

["evil-hack.diff" (text/x-diff)]

Index: ecma/kjs_html.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/ecma/kjs_html.cpp,v
retrieving revision 1.277
diff -u -3 -p -r1.277 kjs_html.cpp
--- ecma/kjs_html.cpp	27 Oct 2004 09:15:54 -0000	1.277
+++ ecma/kjs_html.cpp	1 Nov 2004 18:01:29 -0000
@@ -1088,6 +1088,7 @@ const ClassInfo* KJS::HTMLElement::class
   left		  KJS::HTMLElement::LayerLeft			DontDelete
   visibility	  KJS::HTMLElement::LayerVisibility		DontDelete
   bgColor	  KJS::HTMLElement::LayerBgColor		DontDelete
+  document  	  KJS::HTMLElement::LayerDocument		DontDelete|ReadOnly
   clip	  	  KJS::HTMLElement::LayerClip			DontDelete|ReadOnly
   layers	  KJS::HTMLElement::LayerLayers			DontDelete|ReadOnly
 @end
@@ -1842,6 +1843,7 @@ Value KJS::HTMLElement::getValueProperty
     case LayerVisibility:     return getString(layerElement.visibility());
     case LayerBgColor:        return getString(layerElement.bgColor());
     /*case LayerClip:           return getLayerClip(exec, layerElement); */
+    case LayerDocument:       return Undefined();
     case LayerLayers:         return getHTMLCollection(exec,layerElement.layers());
     }
   }
@@ -3055,6 +3057,13 @@ bool KJS::HTMLCollection::toBoolean(Exec
     return !hidden;
 }
 
+Type KJS::HTMLCollection::type() const {
+    if (hidden) // what, me? No, I do not exist..
+        return UndefinedType;
+    else
+        return ObjectImp::type();
+}
+
 // We have to implement hasProperty since we don't use a hashtable for 'selectedIndex' and 'length'
 // ## this breaks "for (..in..)" though.
 bool KJS::HTMLCollection::hasProperty(ExecState *exec, const Identifier &p) const
Index: ecma/kjs_html.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/ecma/kjs_html.h,v
retrieving revision 1.81
diff -u -3 -p -r1.81 kjs_html.h
--- ecma/kjs_html.h	21 Oct 2004 14:14:57 -0000	1.81
+++ ecma/kjs_html.h	1 Nov 2004 18:01:29 -0000
@@ -146,7 +146,7 @@ namespace KJS {
            IFrameFrameBorder, IFrameSrc, IFrameName, IFrameHeight,
            IFrameMarginHeight, IFrameMarginWidth, IFrameScrolling, IFrameWidth, IFrameContentDocument,
            MarqueeStart, MarqueeStop,
-           LayerTop, LayerLeft, LayerVisibility, LayerBgColor, LayerClip, LayerLayers,
+           LayerTop, LayerLeft, LayerVisibility, LayerBgColor, LayerClip, LayerDocument, LayerLayers,
            ElementInnerHTML, ElementTitle, ElementId, ElementDir, ElementLang,
            ElementClassName, ElementInnerText, ElementDocument, ElementChildren, ElementAll };
 
@@ -171,6 +171,7 @@ namespace KJS {
     virtual Value tryCall(ExecState *exec, Object &thisObj, const List&args);
     virtual bool implementsCall() const { return true; }
     virtual bool toBoolean(ExecState *) const;
+    virtual Type type() const;
     virtual bool hasProperty(ExecState *exec, const Identifier &p) const;
     enum { Item, NamedItem, Tags };
     Value getNamedItems(ExecState *exec, const Identifier &propertyName) const;


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

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