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 [EMAIL PROTECTED] 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
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to