[Laszlo-checkins] r11783 - in openlaszlo/trunk/WEB-INF/lps/lfc: compiler debugger

ptw@openlaszlo.org ptw at openlaszlo.org
Fri Nov 14 15:40:43 PST 2008


Author: ptw
Date: 2008-11-14 15:40:40 -0800 (Fri, 14 Nov 2008)
New Revision: 11783

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzMessage.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMessage.lzs
Log:
Change 20081114-ptw-I by ptw at dueling-banjos.home on 2008-11-14 18:34:31 EST
    in /Users/ptw/OpenLaszlo/trunk/WEB-INF/lps/lfc
    for http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc

Summary: Simplify LzBootstrapMessage.toString/valueOf

Bugs Fixed:
TRAC-727 LZX: New LPS hangs harpoon browser but not firefox

Technical Reviewer: akitsik at nexb.com (pending)
QA Reviewer: hminsky (pending)

Details:
    In some JS runtimes, toString and valueOf seem to be called on
    LzBootstrapMessage before it is fully initialized.  So, I
    simplified their implementation to protect against that.

Tests:
    Ahti will verify against his runtime



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzMessage.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzMessage.lzs	2008-11-14 20:54:33 UTC (rev 11782)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzMessage.lzs	2008-11-14 23:40:40 UTC (rev 11783)
@@ -7,8 +7,9 @@
 
 
 /**
- * This will be replaced by a more complete definition if the debugger
- * is included
+ * This will be replaced by a more functional definition if the debugger
+ * is included (one that maintains a correspondence between objects
+ * and their representation in the message)
  *
  * @access private
  */
@@ -16,17 +17,20 @@
   var message = '';
   public var length = 0;
 
+  /** @access private */
   function LzBootstrapMessage (message = null) {
     if (message != null) {
       this.appendInternal('' + message, message);
     }
   }
 
+  /** @access private */
   function appendInternal (str:String, obj = null) {
     this.message += str;
     this.length = this.message.length;
   }
 
+  /** @access private */
   function append (...str) {
     var len = str.length;
     for (var i = 0; i < len; i++) {
@@ -39,8 +43,12 @@
 
   // TODO: [2006-04-17 ptw] When javascript has getters and setters:
   // function get length () { return this.message.length; };
-  // function set length (length) { this.message.length = length; return this.length; };
+  // function set length (length) { this.message.length = length;
+  // return this.length; };
+  // For now, we just have to be careful to kepp the length field
+  // accurate
 
+
   /** @access private */
   public function charAt (index) { return this.message.charAt(index); }
   /** @access private */
@@ -57,11 +65,27 @@
   public function toUpperCase ():LzMessage {
     return new LzMessage(this.message.toUpperCase());
   };
+  /**
+   * @devnote NOTE: [2008-11-24 ptw] You might think we should
+   * trampoline to this.message.toString(), but in at least one JS
+   * engine, toString may be called before message has been
+   * initialized. By the standard String.toString and String.valueOf
+   * return the same value.
+   *
+   * @access private
+   */
+  public function toString () { return this.message || ''; };
+  /**
+   *  @devnote NOTE: [2008-11-24 ptw] You might think we should
+   * trampoline to this.message.valueOf(), but in at least one JS
+   * engine, valueOf may be called before message has been
+   * initialized. By the standard String.toString and String.valueOf
+   * return the same value.
+   *
+   * @access private
+   */
+  public function valueOf () { return this.message || ''; };
   /** @access private */
-  public function toString () { return this.message; };
-  /** @access private */
-  public function valueOf () { return this.message.valueOf(); };
-  /** @access private */
   public function concat (...args):LzMessage {
     return new LzMessage(this.message.concat.apply(this.message, args));
   }

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMessage.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMessage.lzs	2008-11-14 20:54:33 UTC (rev 11782)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMessage.lzs	2008-11-14 23:40:40 UTC (rev 11783)
@@ -33,10 +33,10 @@
    * @param * message: initial message (either a String or an LzMessage)
    */
   function LzDebugMessage (message=null) {
+    super(message);
     // can't be in prototype as it would be shared
     // could be a getter to defer allocation
     this.objects = [];
-    super(message);
   }
 
   /// These methods implement the String interface (since we are not



More information about the Laszlo-checkins mailing list