From kfm-devel Wed Feb 28 22:50:37 2001 From: David Faure Date: Wed, 28 Feb 2001 22:50:37 +0000 To: kfm-devel Subject: Re: JS return values X-MARC-Message: https://marc.info/?l=kfm-devel&m=98340516229516 On Wednesday 28 February 2001 21:10, Harri Porten wrote: > David Faure wrote: > > > > ecma/kjs_window.cpp : > > 655 return Completion(Normal, result); > > > > kjs/function.cpp : > > 128 else if (comp.complType() == ReturnValue) > > 129 return comp.value(); > > 130 else > > 131 return Undefined(); > > > > This obviously makes any window function return Undefined :( > > That's what I wrote about in that ununderstandable answer to your bug > report recently :} Right - I couldn't understand it because I hadn't looked into the code yet, so it was all Chinese to me (no offense intended to Chinese people :-) > Yes. And I'm very sorry if you wasted any time debugging this. Actually, I found that one fast. I usually put kdDebug everywhere and get lost, whereas this time I used gdb and "next", and I immediately saw what was wrong :-) > I had the fix on my disk and must have forgotten to commit it :( I even fixed the > kpac code .... It's checked in now. Thanks. > > or should we simply fix line 655 to s/Normal/ReturnValue/, given that if the value > > is undefined, kjs/function is going to return Undefined anyway ? > > There are other parts in the code that differentiate between the two so > I would prefer to keep it this way. Hmm, you did what I suggested anyway :) > > There has to be a reason for Normal vs ReturnValue but I'm probably missing it :-) > > "Normal" would be like "void" and no exception thrown. "ReturnValue" is > used when the JS code said "return xyz;" or we want to emulate that like > above. Thought so, but the code in kjs/function.cpp line 130 doesn't care - ok that's where "other parts of the code care" comes in :) > Sorry for the mess. I had done local checks before I checked in my > recent libkjs fix. Now I understand why I couldn't explain the posting > (from Malte?) about getElementById() I read today. Good that I resisted > touching that part of the code until after the 2.1 release. Yes ;-) /me happy that his JS-enabled website works again :) -- David FAURE, david@mandrakesoft.com, faure@kde.org http://perso.mandrakesoft.com/~david/, http://www.konqueror.org/ KDE, Making The Future of Computing Available Today