On 2010-05-23, at 10:10, André Bargull wrote:
>> It seems to me that debug mode should not change the behavior. You could
>> argue that either behavior is correct, but it seems important for the
>> behavior to be consistent. Unless you have a compelling argument to always
>> enforce the type (and return undefined when wrong), I think the current
>> implementation is better than the previous.
>>
>
> Neither behaviour is absolutely correct, here's a related test case.
> <canvas debug="true">
> <node>
> <handler name="oninit" reference="global">
> Debug.write("oninit")
> </handler>
> </node>
> </canvas>
>
> Old behaviour (debug mode, all runtimes):
> (1) debug error "ERROR: Invalid event sender: global => global (for event
> oninit)"
> (2) invalid sender is changed to 'this' (see lz.Node#__LZsetDelegates())
> (3) handler code is executed because of (2)
>
> New behaviour (debug mode)
> (1) debug error "ERROR: Invalid event sender: global => global (for event
> oninit)"
> (2 - swf8) delegate for handler registered to invalid sender (for swf8 kernel
> compatibility, see lz.Delegate and lz.Event)
> (2 - except swf8) debug error "ERROR: Not registering /anonymous/<handler
> method='handle global.oninit'>: invalid event sender: global.oninit"
>
>
> To change to sender is wrong, but to print a warning and still register the
> delegate resp. print another warning is wrong, too.
Perhaps the best we can do is to remove the check from the reference
computation altogether and rely on the (newly improved) error reporting in
register? Too bad for swf8 -- there is no way to distinguish legacy code from
an error here.