[Laszlo-checkins] r16831 - openlaszlo/trunk/WEB-INF/lps/lfc/compiler

ptw@openlaszlo.org ptw at openlaszlo.org
Tue Jun 29 06:00:22 PDT 2010


Author: ptw
Date: 2010-06-29 06:00:21 -0700 (Tue, 29 Jun 2010)
New Revision: 16831

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzMessage.lzs
Log:
Change 20100621-ptw-F by ptw at padme.home on 2010-06-21 19:23:13 EDT
    in /Users/ptw/OpenLaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Correct LzMessage.xmlEscape

Bugs Fixed:  LPP-3172 xmlEscape uses invalid XML entities (partial)

Technical Reviewer: andre.bargull at udo.edu (pending)
QA Reviewer: max at openlaszlo.org (Message-ID: <4C28215D.4060406 at openlaszlo.org>)

Details:
    LzMessage/xmlEscape unecessarily escapes `>` and does not escape
    `&`.  Fix that.

Tests:
    Inspection



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzMessage.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzMessage.lzs	2010-06-29 10:54:16 UTC (rev 16830)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzMessage.lzs	2010-06-29 13:00:21 UTC (rev 16831)
@@ -1,7 +1,7 @@
 /**
  * support for debug messages
  *
- * @copyright Copyright 2001-2009 Laszlo Systems, Inc.  All Rights Reserved.
+ * @copyright Copyright 2001-2010 Laszlo Systems, Inc.  All Rights Reserved.
  *            Use is subject to license terms.
  */
 
@@ -118,6 +118,13 @@
    * newlines because the text kernel translates those on a platform
    * basis.  This function would be better called "markup escape"
    * perhaps.
+   *
+   * @devnote [2010-06-21 ptw] While XML defines 5 non-numeric
+   * entities
+   * (http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML)
+   * only `<` and `&` function as syntactic markers, so for the
+   * purposes of this method, only they need to be escaped to prevent
+   * them being interpreted as markup.
    */
   static function xmlEscape (input:*):* {
     if (input && ((typeof(input) == "string") || (input is String))) {
@@ -127,7 +134,7 @@
         var c:String = input.charAt(i);
         switch (c) {
           case '<': output += "&lt;"; break;
-          case '>': output += "&gt;"; break;
+          case '&': output += "&amp;"; break;
           default: output += c;
         }
       }
@@ -164,7 +171,7 @@
 
 /**
  * Convert a String to HTML for display in the Debugger by escaping
- * the HTML characters in the String.
+ * the HTML syntax marker characters in the String.
  * @access private
  */
 String.prototype.toHTML = function () {



More information about the Laszlo-checkins mailing list