[Laszlo-dev] For Review: Change 20071105-ptw-V Summary: Ensure deferred events do not recurse
André Bargull
a.bargull at intensis.de
Tue Dec 4 12:06:07 PST 2007
I've got another "super" testcase for you, which shows again differences
between queued and non-queued delegates...I guess you're starting to
hate me...
testcase:
[code]
<canvas debug="true" >
<class name="test" extends="node" >
<attribute name="foo" value="000" type="string"
setter="setFoo(foo)" />
<attribute name="bar" value="aaa" type="string"
setter="setBar(bar)" />
<event name="onfoo" />
<event name="onbar" />
<handler name="onfoo" args="foo" >
Debug.write("onfoo with %s", foo);
this.setBar(this.bar + foo);
</handler>
<handler name="onbar" args="bar" >
Debug.write("onbar with %s", bar);
this.setFoo(this.foo + bar);
</handler>
<method name="setFoo" args="foo" ><![CDATA[
Debug.write("setFoo with %s", foo);
this.foo = foo;
this.onfoo.sendEvent(foo);
]]></method>
<method name="setBar" args="bar" ><![CDATA[
Debug.write("setBar with %s", bar);
this.bar = bar;
this.onbar.sendEvent(bar);
]]></method>
</class>
<test id="foobar" >
<!-- later -->
<handler name="oninit" reference="canvas" >
Debug.write("-----");
this.foo = "";
this.bar = "";
this.setBar("aaa");
this.setFoo("000");
</handler>
</test>
</canvas>
[/code]
i) current output (without your changeset applied):
setBar with aaa
setFoo with 000
onbar with aaa
setFoo with 000aaa
onfoo with 000aaa
setBar with aaa000aaa
onbar with aaa000aaa
setFoo with 000aaaaaa000aaa
onfoo with 000
setBar with aaa000aaa000
onbar with aaa000aaa000
setFoo with 000aaaaaa000aaaaaa000aaa000
onfoo with 000aaaaaa000aaaaaa000aaa000
setBar with aaa000aaa000000aaaaaa000aaaaaa000aaa000
-----
setBar with aaa
onbar with aaa
setFoo with aaa
onfoo with aaa
setBar with aaaaaa
setFoo with 000
onfoo with 000
setBar with aaaaaa000
onbar with aaaaaa000
setFoo with 000aaaaaa000
ii) output with your changeset:
setBar with aaa
setFoo with 000
onbar with aaa
setFoo with 000aaa
onfoo with 000aaa
setBar with aaa000aaa
onfoo with 000
setBar with aaa000aaa000
-----
setBar with aaa
onbar with aaa
setFoo with aaa
onfoo with aaa
setBar with aaaaaa
setFoo with 000
onfoo with 000
setBar with aaaaaa000
onbar with aaaaaa000
setFoo with 000aaaaaa000
iii) output of a prototype of mine (see attachment)
setBar with aaa
setFoo with 000
onbar with aaa
setFoo with 000aaa
onfoo with 000aaa
setBar with aaa000aaa
onfoo with 000
setBar with aaa000aaa000
onbar with aaa000aaa000
setFoo with 000aaaaaa000aaa000
-----
setBar with aaa
onbar with aaa
setFoo with aaa
onfoo with aaa
setBar with aaaaaa
setFoo with 000
onfoo with 000
setBar with aaaaaa000
onbar with aaaaaa000
setFoo with 000aaaaaa000
Summary:
i) => too much function calls (+4)
ii) => function calls are missing (-2)
iii) => function calls match
BUT, what do we actually expect for queued delegates?
On 11/30/2007 6:41 PM, P T Withington wrote:
> I updated the change to correctly handle your new test case. Would
> you like to re-review it
> (http://svn.openlaszlo.org/openlaszlo/patches/20071105-ptw-V.tar)
>
> I 'improved' your test case just a bit to make more sense to me:
>
> <canvas debug="true" >
> <class name="foo" extends="node" >
> <attribute name="bar" value="123" setter="setBar(bar)" />
> <method name="setBar" args="bar" >
> this.bar = bar;
> if (this["onbar"]) {
> this.onbar.sendEvent(bar);
> }
> </method>
> <method name="provokeError" >
> this.setBar("789");
> </method>
> <method name="provokeError2" >
> this.setBar("xxx");
> </method>
> </class>
> <foo bar="456" >
> <handler name="onbar" args="bar">
> Debug.write("onbar - 1 - begin with %s", bar);
> this.provokeError();
> Debug.write("onbar - 1 - end with %s", this.bar);
> </handler>
> <handler name="onbar" args="bar">
> Debug.write("onbar - 2 - begin with %s", bar);
> this.provokeError2();
> Debug.write("onbar - 2 - end with %s", this.bar);
> </handler>
> <!-- later -->
> <handler name="oninit" reference="canvas" >
> Debug.write("-----");
> this.setBar("abc");
> </handler>
> </foo>
> </canvas>
>
> On 2007-11-06, at 19:28 EST, André Bargull wrote:
>
>> Approved.
>>
>> I've got another testcase which shows a different event-handling
>> (comparing queued and non-queued delegates),
>> even after applying this fix, but I don't know whether it is a bit
>> too much constructed:
>>
>> <canvas debug="true" >
>> <class name="foo" extends="node" >
>> <attribute name="bar" value="123" setter="setBar(bar)" />
>> <method name="setBar" args="bar" >
>> this.bar = bar;
>> if (this["onbar"]) {
>> this.onbar.sendEvent(bar);
>> }
>> </method>
>> <method name="provokeError" >
>> this.setBar("789");
>> </method>
>> <method name="provokeError2" >
>> this.setBar("xxx");
>> </method>
>> </class>
>> <foo bar="456" >
>> <handler name="onbar" args="bar">
>> Debug.write("onbar - 1 - begin with %s", bar);
>> this.provokeError();
>> Debug.write("onbar - 1 - end with %s", bar);
>> </handler>
>> <handler name="onbar" args="bar">
>> Debug.write("onbar - 2 - begin with %s", bar);
>> this.provokeError2();
>> Debug.write("onbar - 2 - end with %s", bar);
>> </handler>
>> <!-- later -->
>> <handler name="oninit" reference="canvas" >
>> Debug.write("-----");
>> this.setBar("abc");
>> </handler>
>> </foo>
>> </canvas>
>>
>> On 11/7/2007 12:23 AM, P T Withington wrote:
>>> Change 20071105-ptw-V by ptw at dueling-banjos.local on 2007-11-05
>>> 15:10:35 EST
>>> in /Users/ptw/OpenLaszlo/ringding-2
>>> for http://svn.openlaszlo.org/openlaszlo/trunk
>>>
>>> Summary: Ensure deferred events do not recurse
>>>
>>> Bugs Fixed:
>>> LPP-4950 'LzDelegate single-execution mechanism does not work for
>>> queued delegates'
>>>
>>> Technical Reviewer: hminksy (pending)
>>> QA Reviewer: a.bargull at intensis.de (pending)
>>>
>>> Tests:
>>> Test case from bug no longer shows the event recursing.
>>>
>>> Files:
>>> M WEB-INF/lps/lfc/events/LaszloEvents.lzs
>>>
>>>
>>> Changeset:
>>> http://svn.openlaszlo.org/openlaszlo/patches/20071105-ptw-V.tar
>>>
>
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: anba_LaszloEvents.lzs
Url: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20071204/5a6fc071/anba_LaszloEvents.pl
More information about the Laszlo-dev
mailing list