[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
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 220.127.116.11.in-addr.arpa on
2007-01-11 19:12:09 PST
Summary: Refined event deferral
LPP-?: 'Legals branch and Broken Components'
Technical Reviewer: max (pending)
QA Reviewer: platform-team (pending)
Doc Reviewer: jsundman (pending)
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.
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.
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
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
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
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
LaszloEvents: Improve debug printing, move global deferral queue
into LzDelegate to avoid global nameespace pollution.
These components all work now:
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" >
You will observe that the hander on width, which was the
source of the bug, is properly deferred.
More information about the Laszlo-dev