[Laszlo-checkins] r10631 - openlaszlo/trunk/WEB-INF/lps/lfc/data

bargull@openlaszlo.org bargull at openlaszlo.org
Thu Aug 7 08:10:27 PDT 2008


Author: bargull
Date: 2008-08-07 08:10:21 -0700 (Thu, 07 Aug 2008)
New Revision: 10631

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/LzParsedPath.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
Log:
Change 20080807-bargull-xYc by bargull at dell--p4--2-53 on 2008-08-07 11:16:15
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: lfc fixes for dguide

New Features:

Bugs Fixed: LPP-6795, LPP-6797, LPP-6798, LPP-6807

Technical Reviewer: ptw, hminsky
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
LzReplicationManager: check "this.nodes" to avoid possible null-pointer dereferences (LPP-6797)
LzParsedPath: AnonDatasetGenerator need to subclass LzEventable to be able to participate in our event-system (LPP-6798)
LzDatapointer: check node-type before executing arbitrary code (LPP-6795)
---
LzParsedPath: removed operatorArgs, no longer needed (LPP-6807)
LzDatapointer: rewritten __LZprocessOperator (LPP-6795, LPP-6807)
LzDataElement: removed optional argument from __LZgetText (LPP-6807)
    

Tests:



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs	2008-08-07 14:12:45 UTC (rev 10630)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs	2008-08-07 15:10:21 UTC (rev 10631)
@@ -457,11 +457,10 @@
 /**
   * @access private
   */
-// dummyarg needed for calls from LzDatapointer.__LZprocessOperator
-function __LZgetText ( dummyarg:* = null ) :String {
+function __LZgetText () :String {
     var s:String = "";
     for ( var i:int = 0; i < this.childNodes.length; i++ ){
-        var c = this.childNodes[ i ]
+        var c = this.childNodes[ i ];
         if ( c.nodeType == LzDataElement.TEXT_NODE ){
             s += c.data;
         }

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapointer.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapointer.lzs	2008-08-07 14:12:45 UTC (rev 10630)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapointer.lzs	2008-08-07 15:10:21 UTC (rev 10631)
@@ -1208,7 +1208,7 @@
 
 
 /** @access private */
-function __LZprocessOperator (p, pp, depends = null) :* {
+function __LZprocessOperator (p /*:LzDataNodeMixin*/, pp:LzParsedPath) :* {
     if (p == null) {
         if ( $debug ) {
             Debug.info("%s: p is null in %s", arguments.callee, this);
@@ -1216,23 +1216,35 @@
         return;
     }
 
-    if (pp.operatorArgs != null) {
-        //"text()" [__LZgetText()] or "serialize()" 
-        return p[ pp.operator ] ( pp.operatorArgs );
+    var op:String = pp.operator;
+    switch (op) {
+        case "serialize": 
+            //operator: "serialize()"
+            return p.serialize();
+        case "__LZgetText": 
+            //operator: "text()" [__LZgetText()]
+            return p.nodeType != LzDataElement.TEXT_NODE ? p.__LZgetText() : void(0);
+        case "nodeName":
+            //operator: "name()" [nodeName]
+            return p.nodeName;
+        default:
+            if (pp.hasAttrOper) {
+                //operator: "attributes" or "attributes.xxx"
+                if (p.nodeType != LzDataElement.TEXT_NODE && p['attributes']) {
+                    if (op == "attributes") {
+                        return p.attributes;
+                    } else {
+                        //@dev-note: 11 == length of 'attributes.'
+                        return p.attributes[op.substr(11)];
+                    }
+                } else {
+                    // TODO: [2007-3-16 hqm] I'll do what Ben did, return undefined
+                    return;
+                }
+            } else if ($debug) {
+                Debug.error ("Unknown operator '%s' in '%s'", op, arguments.callee);
+            }
     }
-
-    // LzParsedPath.initialize() created pp.operator
-    if (pp.operator.indexOf("attributes.") == 0) {
-        //operator: "attributes.xxx"
-        if (p['attributes']) {
-            return p.attributes[pp.operator.substr(11)];
-        }
-        // TODO: [2007-3-16 hqm] I'll do what Ben did, return undefined
-        return;
-    } else {
-        //operator: "attributes", "nodeName"
-        return p[pp.operator];
-    }
 }
 
 ////////////////////////////////////////////////////////////////

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzParsedPath.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzParsedPath.lzs	2008-08-07 14:12:45 UTC (rev 10630)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzParsedPath.lzs	2008-08-07 15:10:21 UTC (rev 10631)
@@ -75,13 +75,6 @@
   var aggOperator:String = null;
   
   /** 
-    * null or 0
-    * 
-    * @access private
-    */
-  var operatorArgs:* = null;
-  
-  /** 
     * true if terminal operator is a attribute-selector, otherwise false
     * 
     * @access private
@@ -234,10 +227,8 @@
                         this.operator = "nodeName";
                     } else if ( cnode.indexOf( "text" ) > -1 ){
                         this.operator = "__LZgetText";
-                        this.operatorArgs = 0;
                     } else if ( cnode.indexOf( "serialize" ) > -1 ){
                         this.operator = "serialize";
-                        this.operatorArgs = 0;
                     } else if ($debug) {
                         Debug.warn( "Unknown operator: '%s'", cnode);
                     }
@@ -361,7 +352,7 @@
 /**
   * @access private
   */
-class AnonDatasetGenerator {
+class AnonDatasetGenerator extends LzEventable {
 
     /**
       * @access private

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs	2008-08-07 14:12:45 UTC (rev 10630)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs	2008-08-07 15:10:21 UTC (rev 10631)
@@ -459,7 +459,7 @@
 
     if ( this.__LZspecialDotDot ) this.__LZsetupDotDot( n[ 0 ] );
 
-    if ( this.orderpath != null ){
+    if ( this.orderpath != null && this.nodes ){
         this.nodes = this.mergesort( this.nodes , 0 , this.nodes.length - 1 );
     }
 
@@ -621,7 +621,7 @@
 
     this.orderpath = xpath;
 
-    if ( this.nodes.length ){
+    if ( this.nodes && this.nodes.length ){
         //reset nodes in order now
         this.__LZHandleMultiNodes( this.nodes );
     }
@@ -649,7 +649,7 @@
     }
     
     this.comparator = comparator;
-    if ( this.orderpath != null && this.nodes.length ){
+    if ( this.orderpath != null && this.nodes && this.nodes.length ){
         //reset nodes in order now
         this.__LZHandleMultiNodes( this.nodes );
     }



More information about the Laszlo-checkins mailing list