History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-5185
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: -- --
Assignee: Max Carlson
Reporter: Max Carlson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

Several null dereferences for replication of LzDataElement.makeNodeList() nodes in dhtml

Created: 03/Dec/07 11:33 AM   Updated: 03/Dec/07 03:08 PM
Component/s: LFC - Data
Affects Version/s: RingDing (4.1)
Fix Version/s: RingDing (4.1)

Time Tracking:
Not Specified

Severity: Minor
Fixed in Change#: 7,437
Runtime: N/A
Fix in hand: False


 Description  « Hide
I ran across several null dereferencing errors when replicating LzDataElement.makeNodeList() nodes in DHTML.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Max Carlson - 03/Dec/07 03:08 PM
Author: max
Date: 2007-12-03 15:04:35 -0800 (Mon, 03 Dec 2007)
New Revision: 7437

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapointer.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzLazyReplicationManager.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzResizeReplicationManager.lzs
Log:
Change 20071203-maxcarlson-l by maxcarlson@Roboto on 2007-12-03 11:30:32 PST
    in /Users/maxcarlson/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix null dereferences for LzDataElement.makeNodeList() nodes

New Features:

Bugs Fixed: LPP-5185 - Several null dereferences for replication of LzDataElement.makeNodeList() nodes in dhtml

Technical Reviewer: promanik
QA Reviewer: hminsky
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: I ran across several null dereferencing errors when replicating LzDataElement.makeNodeList() nodes in DHTML.
    
LzLazyReplicationManager.lzs - Fix null dereferencing.

LzDatapointer.lzs - LzDataElement.makeNodeList() nodes don't have childNodes.

LzDataElement.lzs - Fix null dereferencing.

LzResizeReplicationManager.lzs - Fix null dereferencing.

Tests: See svn.laszloinaction.com/trunk/chap17 (you'll need the rails app installed) for the testcase.



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs 2007-12-03 22:16:21 UTC (rev 7436)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs 2007-12-03 23:04:35 UTC (rev 7437)
@@ -316,12 +316,14 @@
     this.childNodes = children;
     for ( var i = 0; i < children.length; i++ ){
         var c = children[ i ];
- c.setOwnerDocument( this.ownerDocument );
- c.parentNode = this;
- if (c.onparentNode) {
- if (c.onparentNode.ready) c.onparentNode.sendEvent( this );
+ if (c) {
+ c.setOwnerDocument( this.ownerDocument );
+ c.parentNode = this;
+ if (c.onparentNode) {
+ if (c.onparentNode.ready) c.onparentNode.sendEvent( this );
+ }
+ c.__LZo = i;
         }
- c.__LZo = i;
     }
     this.__LZcoDirty = false;
     if (this.onchildNodes) {

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapointer.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapointer.lzs 2007-12-03 22:16:21 UTC (rev 7436)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapointer.lzs 2007-12-03 23:04:35 UTC (rev 7437)
@@ -767,11 +767,12 @@
     
     if (p.childNodes) {
         for ( var i = 0; i < p.childNodes.length; i++ ){
- if ( p.childNodes[ i ].nodeName == name ){
+ var cn = p.childNodes[i];
+ if ( cn && cn.nodeName == name ){
                 //match
                 cnt++;
                 if ( !range || cnt >= range[ 0 ] ){
- o.push( p.childNodes[ i ] );
+ o.push( cn );
                 }
                 if ( range && cnt == range[ 1 ] ){
                     break;

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzLazyReplicationManager.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzLazyReplicationManager.lzs 2007-12-03 22:16:21 UTC (rev 7436)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzLazyReplicationManager.lzs 2007-12-03 23:04:35 UTC (rev 7437)
@@ -89,11 +89,13 @@
     }
 
     var firstcl = this.clones[ 0 ];
- firstcl.setOption( 'ignorelayout', true );
- var layo = firstcl.immediateparent.layouts;
- if (layo != null) {
- for ( var i = 0; i < layo.length; i++ ){
- layo[ i ].removeSubview( firstcl );
+ if (firstcl) {
+ firstcl.setOption( 'ignorelayout', true );
+ var layo = firstcl.immediateparent.layouts;
+ if (layo != null) {
+ for ( var i = 0; i < layo.length; i++ ){
+ layo[ i ].removeSubview( firstcl );
+ }
         }
     }
 

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzResizeReplicationManager.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzResizeReplicationManager.lzs 2007-12-03 22:16:21 UTC (rev 7436)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzResizeReplicationManager.lzs 2007-12-03 23:04:35 UTC (rev 7437)
@@ -273,6 +273,7 @@
   * @access private
   */
 function __LZHandleCloneResize ( cl , s){
+ if (! cl.datapath.p) return;
     var osize = cl.datapath.p[ this.datasizevar ] || this.viewsize;
     if ( s != osize ){
         cl.datapath.p[ this.datasizevar ] = s;


_______________________________________________
Laszlo-checkins mailing list
Laszlo-checkins@openlaszlo.org
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins