← Back to team overview

lightspark-users team mailing list archive

Re: Global object/s

 

Hi,

Okey, I see. What I was encountering originally was an infinite loop
caused by accessing a T_DEFINABLE from a script init which would
call the same script init again and again.
This made me thinking about it.
Now I'll just stick with a check if a script init has already been executed
previously.

Thanks for enlighting me!

Matthias

2011/10/5 Jasper St. Pierre <jstpierre@xxxxxxxxxxx>:
> On Wed, Oct 5, 2011 at 8:03 AM, Matthias Gehre <M.Gehre@xxxxxx> wrote:
>> Hi,
>>
>> so each script init is run with a distinct (global) object as 'this'.
>
> Yes. You can verify this by using "getglobalscope" across two scripts
> and comparing the pointers in Tamarin.
>
>> 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.
>
> "The first one wins" or "Throw a verifier error in case two scripts
> have the same exports". It's one of the two.
>
>> 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
>
> The callee's global object. So, the same as "getglobalscope" inside
> the function call.
>
>> 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.
>
> For Flex, each class that you write will be in one DoABC tag.
>
>> 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
>>>
>>
>> --
>> 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
>>
>
>
>
> --
>   Jasper
>


References