kjs: variables with/without var [PATCH]
Maciej Stachowiak
mjs at apple.com
Sun Jan 19 03:07:47 GMT 2003
On Saturday, January 18, 2003, at 04:06 PM, Harri Porten wrote:
> On Sat, 18 Jan 2003, Maciej Stachowiak wrote:
>
>>> Hmm, I'm afraid I don't see how putValue() could know the right
>>> globalobject to use..... or is that
>>> exec->context().imp()->variableObject() ?
>>
>> variableObject is not the nearest global object, it's the
>> pseudo-object
>> for the function's local scope. I'm pretty sure that without `var' you
>> should be setting a global variable.
>
> I agree. We just seem to have a problem chosing the right "global"
> space.
How about getting the last item in the scope chain of the current
context? I believe that will get the right (lexically scoped) global
object when in a function body.
>> The kjs in Safari (based on 3.0.x)
>> is putting things in the global object in this case, and the original
>> posted example works fine with the "var" removed, which makes me doubt
>> there is anything wrong with the globalObject() call.
>
> We had to change the "window" behaviour in order to fix
>
> http://bugs.kde.org/show_bug.cgi?id=51120
>
> With Window::hasProperty() always returning true you'll end up with
> variables being found (and probably also placed) differently.
OK, I see. We still have the bug in Safari since we are not merged to
the latest sources.
Regards,
Maciej
More information about the kfm-devel
mailing list