Author: pbr
Date: 2007-11-21 11:16:02 -0800 (Wed, 21 Nov 2007)
New Revision: 7346

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
Log:
Change 20071120-Philip-2 by [EMAIL PROTECTED] on 2007-11-20 20:34:09 EST
     in /cygdrive/f/laszlo/svn/src/svn/openlaszlo/trunk
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Generate error if datapath is defined on the canvas

New Features:

Bugs Fixed: LPP-3767

Technical Reviewer: hqm
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
You can't define a datapath on the canvas. The current schema can't detect this 
condition so I added a runtime check for this case. The test is straight 
forward. In swf, you don't need anything else. 
However, in dhtml you will get some downstream errors which might mislead the 
user. I added initialization code and a few checks to eliminate the other dhtml 
errors.


Tests:
See LPP-3767 (the test is in LPP-2089 and shown below). In an unpatched 
environment, the system with hang. With the patch and error is generated in the 
debug window.

<canvas>
     <dataset name="test">
         <item>first</item>
         <item>second</item>
     </dataset>

     <datapath id="dp" xpath="test:/item"/>
     <handler name="oninit">
        Debug.write(dp);
     </handler>
</canvas>


Files:
M      WEB-INF/lps/lfc/data/LzReplicationManager.lzs

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20071120-Philip-2.tar



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs      
2007-11-21 19:05:29 UTC (rev 7345)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs      
2007-11-21 19:16:02 UTC (rev 7346)
@@ -124,7 +124,16 @@
 function construct ( odp , args ){
     //odp: original datapath
     var view = odp.immediateparent;
+    if (view == canvas) {
+        // Initialize vars to reduce dhtml errors
+        this.nodes = [];
+        this.clones = [];
+        this.clonePool = [];
+        Debug.error("LzReplicationManager constructed at canvas. A datapath 
cannot be defined on the canvas");
+        return;
+    }
 
+
     //this is so that when it looks like you're refering to the view in source
     //you can say view.datapath and you'll get what you want (which is this)
     this.datapath = this;
@@ -435,14 +444,17 @@
     //init in order
     LzInstantiator.enableDataReplicationQueuing( );
 
-    while ( this.nodes.length > this.clones.length ){
-        this.clones.push( this.getNewClone() );
+    while ( this.nodes && this.nodes.length > this.clones.length ){
+        var cl = this.getNewClone();
+        if (!cl)
+            break;
+        this.clones.push( cl );
     }
 
     LzInstantiator.clearDataReplicationQueue( );
 
 
-    while ( this.nodes.length < this.clones.length ){
+    while ( this.nodes && this.nodes.length < this.clones.length ){
         //this condition can only be reached if pooling is turned on
         this.poolClone();
     }
@@ -551,6 +563,9 @@
   * @access private
   */
 function getNewClone ( forceNew ){
+    if (!this.cloneParent) {
+        return null;
+    }
     if ( this.clonePool.length ){
         var v = this.reattachClone( this.clonePool.pop() );
     } else {


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to