[Laszlo-dev] [UPDATED^2] For Review: Change 20070111-ptw-j Summary: Refined event deferral
P T Withington
ptw at pobox.com
Sat Jan 13 08:11:12 PST 2007
[Executive Summary:
I believe this is the final version of this change. Lots of debugger
changes have crept in here to make the debugger output prettier and
easier to compare -- I can split that out if it is too confusing, but
it was very helpful in initially diagnosing the problem; and, I think
it is much prettier (;)).
The final design is that only _delegates_ on the node under
initialization are deferred, not events. This prevents methods from
being called on the node while it is being initialized. These
delegates are un-deferred after the initial attributes and styles are
applied (right before onconstruct is sent).
I left in the Debug.debug statement that prints out each delegate
that is deferred by this new implementation so we can be on the
lookout for issues in cases where the new behavior applies.
All the formerly broken components now work (as well as they do in b1
-- note that menu_example is broken in swf in b1). The original test
case works correctly in both swf and dhtml, and you will see that the
handler that was the source of the bug is deferred in both runtimes.]
Change 20070111-ptw-j by ptw at 191.154.150.10.in-addr.arpa on
2007-01-11 19:12:09 PST
in /Users/ptw/OpenLaszlo/legals-2
Summary: Refined event deferral
Bugs Fixed:
LPP-?: 'Legals branch and Broken Components'
Technical Reviewer: max (pending)
QA Reviewer: platform-team (pending)
Doc Reviewer: jsundman (pending)
Documentation:
Methods that would be executed on a node in response to an event
when the node is being initialized (typically events that would be
triggered by initializing the attributes of the node) are deferred
until the node's attributes are fully initialized.
Release Notes:
This is a change from previous behavior, where the initialization
of a node attribute could cause (through a setter or event) a
method to be executed on the node when the node was partially
initialized. This was an underspecified area of the LZX language
which lead to hazards in some runtimes. This change should not
affect the behavior of existing programs.
Details:
LzMessage: Fix append to not escape strings, so that %w can print
strings escaped by default (so you can tell the difference
between `true` and `"true"`).
LzDebug.*: Changed the behavior of __String so that if 'pretty'
output is requested 'unique' information is not printed, even for
objects that have ambiguous representations. This makes it easier
to compare debugger traces, which might otherwise differ only in
the UID's assigned. By default '%w' requests pretty output. You
can use '%#w' to force unique information to be printed.
Inspecting an object will always print it uniquely. Also removed
some stale code that does not work or is not needed in the new
class regime. Fixed code that was trying to detect when you were
inspecting a class prototype object to work in the new class
regime.
LzFormat: Removed backward compatibility kludge for Debug.write
now that LzMessage.append works correctly. Removed hazards where
format tried to interpret the value to be displayed as a Number or
String prematurely.
LaszloCanvas, LzNode: For the purposes of testing this change, you
can set the canvas attibute __LZhenryWasRight to true or false to
enable or disable the deferral of events during node
initialization.
LzNode, LaszloEvents: Event deferral is refined in this change to
_only_ defer _delegates_ that would be executed on a node during
initialization. Previously, all events sent during a node's
initialization would be deferred. This meant that even nodes that
were already initialized or standalone events were deferred, which
appears to have been the cause of the lossage in components.
LzNode: Also over-rode LzNode._dbg_name and
LzNode.prototype._dbg_typename so that node's will print in the
debugger with their 'lz' package tagname, further hiding the
obsolete global Lz name.
UserClass: Fix usage warning now that nodes print properly.
Class: Make `Instance` a more well-behaved class for debugging.
Defer the computation of method typenames so classes can override
their default name (supports LzNode defining class name as package
tagname).
LaszloEvents: Improve debug printing, move global deferral queue
into LzDelegate to avoid global nameespace pollution.
Tests:
These components all work now:
examples/components/combobox_example.lzx?lzr=dhtml
examples/components/form_example.lzx?lzr=dhtml
examples/components/list_example.lzx?lzr=dhtml
examples/components/menu_example.lzx?lzr=dhtml
NOTE: menu_example is broken in swf, but exhibits the same broken
behavior in b1 swf.
This test (the original bug that sent us down this path) also
works the same in swf and dhtml:
<canvas width="600" height="600">
<view id="vw" bgcolor="blue" width="100" height="100" >
<handler name="onwidth" >
this.setBGColor(0xFF0000)
</handler>
</view>
</canvas>
You will observe that the hander on width, which was the
source of the bug, is properly deferred.
Files:
M WEB-INF/lps/lfc/debugger/LzMessage.lzs
M WEB-INF/lps/lfc/debugger/platform/swf/LzDebug.as
M WEB-INF/lps/lfc/debugger/platform/dhtml/LzDebug.js
M WEB-INF/lps/lfc/debugger/LzFormat.lzs
M WEB-INF/lps/lfc/core/LzNode.lzs
M WEB-INF/lps/lfc/core/UserClass.lzs
M WEB-INF/lps/lfc/core/Class.lzs
M WEB-INF/lps/lfc/views/LaszloCanvas.lzs
M WEB-INF/lps/lfc/events/LaszloEvents.lzs
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20070111-ptw-
j.tar
More information about the Laszlo-dev
mailing list