a testcase for a new khtml problem

Luciano Montanaro mikelima at cirulla.net
Mon May 2 10:20:02 BST 2005


El Viernes 29 Abril 2005 23:33, Harri Porten escribió:
> On Thu, 28 Apr 2005, Allan Sandfeld Jensen wrote:
> > > if (o.type() != ObjectType) test triggers.
> >
> > Hmm. Maybe overloading the type wasn't the best idea. The alternative
> > is some other way to make document.all==null return true.
>
> The only way to do that is to return null.

Yes, that's what I think too.

>
> I've looked at the beginning of the thread but I'm not sure where the
> problem lies. If I can be of help with any kjs type problems please let
> me know.

I don't think this problem can be solved without some help from the kjs 
side. I have done some experiments.

returning NullType instead of KJS::HTMLCollection::type

and applying this change to kjs

RCS file: /home/kde/kdelibs/kjs/reference.cpp,v
retrieving revision 1.7
diff -p -u -r1.7 reference.cpp
--- reference.cpp       22 Dec 2004 13:55:11 -0000      1.7
+++ reference.cpp       2 May 2005 09:14:03 -0000
@@ -123,14 +123,15 @@ Value Reference::getValue(ExecState *exe

   Value o = getBase(exec);

-  if (o.isNull() || o.type() == NullType) {
+//  if (o.isNull() || o.type() == NullType) {
+  if (o.isNull()) {
     UString m = I18N_NOOP("Can't find variable: ") + 
getPropertyName(exec).ustring();
     Object err = Error::create(exec, ReferenceError, m.ascii());
     exec->setException(err);
     return err;
   }

-  if (o.type() != ObjectType) {
+  if (o.type() != ObjectType && o.type() != NullType) {
     UString m = I18N_NOOP("Base is not an object");
     Object err = Error::create(exec, ReferenceError, m.ascii());
     exec->setException(err);

makes the test for (document.all == null) work, but it is an hack over an 
hack. 

As things are now, the code could as well have the IE compatible mode, and 
the strict netscape compatible mode. 

I tested also what firefox does in strict mode: in this case the document 
interface is completely removed.

Couldn't we have document.all removed in strict mode and allowed in 
quirks-non-netscape mode?

Luciano


>
> Harri.

-- 
Luciano Montanaro       //
                    \\ //
                     \x/Un euro, un voto!




More information about the kfm-devel mailing list