Good catch. This is because SWF does not implement `in`, and the run-
time emulation will trip up on undefined properties.
I was trying to avoid .hasOwnProperty because it blows up in some
browsers on native objects (e.g., the DOM div behind a DHTML
sprite). I worked around it by putting the .hasOwnProperty test
inside ignoring Errors.
I assume you approve the rest of the change?
On 2007-10-22, at 17:33 EDT, André Bargull wrote:
not approved.
"Debug.objectOwnProperties(..)" [LzDebug.lzs]:
You should stay with "hasOwnProperty(..)" instead of testing "(key
in proto)", otherwise you'll get a different output in swf compared
to dhtml for "undefined" values.
testcase:
[code]
<script>
class test01 extends Instance {
var attr01 = void(0);
}
Debug.write(new test01());
</script>
[/code]
P T Withington wrote:
Hi André, didn't know if you might have missed this, or if you
don't have time, I can ask someone else to review. Thanks!
Begin forwarded message:
From: P T Withington <[EMAIL PROTECTED]>
Date: 18 October 2007 19:28:41 EDT
To: André Bargull <[EMAIL PROTECTED]>, Steve O'Sullivan
<[EMAIL PROTECTED]>
Cc: [email protected]
Subject: For Review: Change 20071018-ptw-X Summary: Be more
careful detecting DOM nodes
Change 20071018-ptw-X by [EMAIL PROTECTED] on 2007-10-18
18:34:57 EDT
in /Users/ptw/OpenLaszlo/ringding-2
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Be more careful detecting DOM nodes
Bugs Fixed:
LPP-4739 'Printing LzDataText in Debugger is erronous for "%w"'
Technical Reviewer: [EMAIL PROTECTED] (pending)
QA Reviewer: [EMAIL PROTECTED] (pending)
Details:
LzDebug.lzs: objectOwnProperties: Be more careful detecting
prototypes, simplify test for 'own' properties to be any
property
that is different from that same property in the prototype
(or all
properties, if there is no prototype). Take care poking at the
prototype, which may be a runtime native object.
LzDebug.js: Tighten up the test for DOM nodes so that we don't
mistake an LZ node for one.
LzRuntime: Eliminate old debugging output that was there
just to
verify source warnings were working. Add Debug.ignoringErrors
which can be used on any platform to evaluate a closure without
recursing into the debugger.
Tests:
1. Verified that LzDataText is printed as an LZX object (in SWF,
Firefox, Safari, Opera):
lzx> Debug.write("%#w\n", new LzDataText('test'))
«LzDataText(0)#71| test»
2. Verified that DOM nodes can still be inspected (does not
apply to SWF):
lzx> Debug.inspect(canvas.sprite.__LZdiv)
«HTMLDivElement#22| #document/html/body/div#lzappContainer/
div.lzcanvasdiv[1]» {
align: ''
attributes: [object NamedNodeMap]
...
tagName: 'DIV'
textContent: ''
title: ''
}
#document/html/body/div#lzappContainer/div.lzcanvasdiv[1]
3. Verified that movieclips can still be inspected (only
applies to
SWF):
lzx> Debug.inspect(_level0.spriteroot)
«MovieClip#160| _level0.spriteroot» {
_currentframe: 0
_opacity: «undefined»
...
_visible: true
_x: 0
_xscale: 100
_y: 0
_yscale: 100
}«MovieClip#160| _level0.spriteroot»
lzx>
4. Ran smokecheck in swf and dhtml on Firefox
Files:
M WEB-INF/lps/lfc/debugger/LzDebug.lzs
M WEB-INF/lps/lfc/debugger/platform/dhtml/LzDebug.js
M WEB-INF/lps/lfc/compiler/LzRuntime.lzs
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20071018-
ptw-X.tar