← Back to team overview

lightspark-users team mailing list archive

Re: Global object/s

 

Hi,

so each script init is run with a distinct (global) object as 'this'.

1. How do we resolve names which are defined in multiple global objects?
GlobalObject::getVariableAndTargetByMultiname searches through all
until it finds the first one, but
there is no well defined order.

2. The spec says that if I use Function.call and pass 'null' as the
first parameter,
then _the_ global object should be used as 'this' of the called function.
But which one?
Not all function calls originate from some script init, so I don't see
a good way
to determine the global object that we should use.
See for example testcase tamarin-SWF/ecma3/Function/e15_3_4_4_1_rt_.swf

Unfortunatelly none of our testcases generate an DoABC tag with
multiple scripts,
and I don't know how to write one. I only encountered them with YT.

Matthias

2011/10/4 Alessandro Pignotti <a.pignotti@xxxxxxxx>:
> Hi,
>
> it's needed to have multiple global objects as each script expects to
> work on a clean context. For example each script may use initSlot.
>
> Alessandro
>
> Il giorno mar, 04/10/2011 alle 11.25 +0200, Matthias Gehre ha scritto:
>> Hey,
>>
>> while looking through the code, I saw that in ABCContext::exec
>> we create a global object for each script by
>> global=Class<ASObject>::getInstanceS();
>> and then do
>> getGlobal()->registerGlobalScope(global);
>> which adds the 'global' to the globalScopes member of GlobalObject.
>>
>> Why do we have multiple global scopes? It seems that
>> GlobalObject::getVariableAndTargetByMultiname searches through all
>> global objects,
>> so it should be the same if we have just one instead of multiple?
>>
>> Then, I would derive GlobalObject from ASObject, as toString() on the
>> global object should return "[object Global]".
>> (we return [object Object] currently).
>>
>> Cheers,
>> Matthias
>>
>
>
>
> --
> Mailing list: https://launchpad.net/~lightspark-users
> Post to     : lightspark-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~lightspark-users
> More help   : https://help.launchpad.net/ListHelp
>


Follow ups

References