Bug 123507 - KHTML renders incorrectly http://www.linkedfeed.com/
Summary: KHTML renders incorrectly http://www.linkedfeed.com/
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-12 18:31 UTC by Glennie Vignarajah
Modified: 2006-03-12 19:25 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Glennie Vignarajah 2006-03-12 18:31:08 UTC
Version:           Konqueror (KHTML) 3.5.1 (using KDE KDE 3.5.1)
Installed from:    Debian testing/unstable Packages
OS:                Linux

Hi,
 Konqueror doesn't render AJAX pages from http://www.linkedfeed.com/ correctly (while this site works fine with Firefox).

 As AJAX sites tend to be more and more common, please make KHTML AJAX compatible.
 Thanks!
Comment 1 Maksim Orlovich 2006-03-12 18:37:24 UTC
We do support so-called AJAX. Problem here is this:
code expects for .. in .. on a NodeList to return indeces.
Comment 2 Glennie Vignarajah 2006-03-12 19:11:25 UTC
Hello,
 So is this because KHTML misinterprets javascript (then this should be fixed) or a programing error (in which case I can close the bug report) ?
Comment 3 Maksim Orlovich 2006-03-12 19:24:10 UTC
SVN commit 517975 by orlovich:

Enumerate indeces as collection/NodeList properties.
Makes www.linkedfeed.com show up
BUG:123507


 M  +27 -2     kjs_dom.cpp  
 M  +2 -0      kjs_dom.h  
 M  +24 -2     kjs_html.cpp  
 M  +1 -0      kjs_html.h  


--- branches/KDE/3.5/kdelibs/khtml/ecma/kjs_dom.cpp #517974:517975
@@ -589,8 +589,17 @@
 {
   if (p == lengthPropertyName)
     return true;
-  // ## missing: accept p if array index or item id...
-  return ObjectImp::hasProperty(exec, p);
+
+  if (ObjectImp::hasProperty(exec, p))
+    return true;
+
+  bool ok;
+  unsigned long pos = p.toULong(&ok);
+  if (ok && pos < list.length())
+    return true;
+
+  // ## missing: accept p if item id...
+  return false;
 }
 
 Value DOMNodeList::tryGet(ExecState *exec, const Identifier &p) const
@@ -633,6 +642,22 @@
   return result;
 }
 
+ReferenceList DOMNodeList::propList(ExecState *exec, bool recursive)
+{
+  ReferenceList properties = ObjectImp::propList(exec,recursive);
+
+  for (unsigned i = 0; i < list.length(); ++i) {
+    if (!ObjectImp::hasProperty(exec,Identifier::from(i))) {
+      properties.append(Reference(this, i));
+    }
+  }
+
+  if (!ObjectImp::hasProperty(exec, lengthPropertyName))
+    properties.append(Reference(this, lengthPropertyName));
+
+  return properties;
+}
+
 // Need to support both get and call, so that list[0] and list(0) work.
 Value DOMNodeList::call(ExecState *exec, Object &thisObj, const List &args)
 {
--- branches/KDE/3.5/kdelibs/khtml/ecma/kjs_dom.h #517974:517975
@@ -81,6 +81,8 @@
     virtual Value call(ExecState *exec, Object &thisObj, const List&args);
     virtual Value tryCall(ExecState *exec, Object &thisObj, const List&args);
     virtual bool implementsCall() const { return true; }
+    virtual ReferenceList propList(ExecState *exec, bool recursive);
+
     // no put - all read-only
     virtual const ClassInfo* classInfo() const { return &info; }
     virtual bool toBoolean(ExecState *) const { return true; }
--- branches/KDE/3.5/kdelibs/khtml/ecma/kjs_html.cpp #517974:517975
@@ -3133,8 +3133,8 @@
     return !hidden;
 }
 
-// We have to implement hasProperty since we don't use a hashtable for 'selectedIndex' and 'length'
-// ## this breaks "for (..in..)" though.
+// We have to implement hasProperty since we don't use a hashtable for 'selectedIndex' and 'length',
+// and for indices in "for (..in..)"
 bool KJS::HTMLCollection::hasProperty(ExecState *exec, const Identifier &p) const
 {
   if (p == lengthPropertyName)
@@ -3142,9 +3142,31 @@
   if ( collection.handle()->getType() == HTMLCollectionImpl::SELECT_OPTIONS &&
        ( p == "selectedIndex" || p == "value" ) )
     return true;
+
+  bool ok;
+  unsigned long pos = p.toULong(&ok);
+  if (ok && pos < collection.length())
+    return true;
+
   return DOMObject::hasProperty(exec, p);
 }
 
+ReferenceList KJS::HTMLCollection::propList(ExecState *exec, bool recursive)
+{
+  ReferenceList properties = ObjectImp::propList(exec,recursive);
+
+  for (unsigned i = 0; i < collection.length(); ++i) {
+    if (!ObjectImp::hasProperty(exec,Identifier::from(i))) {
+      properties.append(Reference(this, i));
+    }
+  }
+
+  if (!ObjectImp::hasProperty(exec, lengthPropertyName))
+    properties.append(Reference(this, lengthPropertyName));
+
+  return properties;
+}
+
 Value KJS::HTMLCollection::tryGet(ExecState *exec, const Identifier &propertyName) const
 {
 #ifdef KJS_VERBOSE
--- branches/KDE/3.5/kdelibs/khtml/ecma/kjs_html.h #517974:517975
@@ -178,6 +178,7 @@
     virtual bool implementsCall() const { return true; }
     virtual bool toBoolean(ExecState *) const;
     virtual bool hasProperty(ExecState *exec, const Identifier &p) const;
+    virtual ReferenceList propList(ExecState *exec, bool recursive);
     enum { Item, NamedItem, Tags };
     Value getNamedItems(ExecState *exec, const Identifier &propertyName) const;
     virtual const ClassInfo* classInfo() const { return &info; }
Comment 4 Maksim Orlovich 2006-03-12 19:25:53 UTC
It's actually sort of both: khtml behaved differently from other browsers, but that bit of code is also quite poor, and it's skimming right on the edge of erroring out...