Author: ptw
Date: 2007-10-12 20:17:21 -0700 (Fri, 12 Oct 2007)
New Revision: 6835

Modified:
   
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
Log:
Change 20071012-ptw-d by [EMAIL PROTECTED] on 2007-10-12 18:31:24 EDT
    in /Users/ptw/OpenLaszlo/ringding-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Make backtrace work in <script> on DHTML

Bugs Fixed:
LPP-4850: 'Backtrace failing to run under DHTML'

Technical Reviewer: [EMAIL PROTECTED] (pending)
QA Reviewer: max (Message-ID: <[EMAIL PROTECTED]>)

Details:
    Fix JavascriptGenerator to not emit bactrace prefix until _after_
    var declarations are emitted.

Tests:
    <canvas>
      <script>
        var bar = "Hello";
        var foo = LzBrowser.getInitArg('bar');
        Debug.debug('foo', foo, 'bar', bar);
      </script>
    </canvas>

    yields:

    DEBUG @lpp-4850.lzx#5: foo Hello bar Hello

    lzx> Debug.inspect(DEBUG @lpp-4850.lzx#5: foo Hello bar Hello\n)
    ?\194?\171#LzDebug#1#0| DEBUG @lpp-4850.lzx#5: foo Hello bar 
Hello\n?\194?\187 {
    backtrace: lpp-4850.lzx#2/62 <- initialize <- lz.script <- makeChild <- 
makeSomeVie...
    file: 'lpp-4850.lzx'
    line: 5
    message: 'foo Hello bar Hello\n'
    }
    DEBUG @lpp-4850.lzx#5: foo Hello bar Hello\n
    lzx> 

    Also ran smokecheck in SWF and DHTML.



Modified: 
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
===================================================================
--- 
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
  2007-10-13 02:30:17 UTC (rev 6834)
+++ 
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
  2007-10-13 03:17:21 UTC (rev 6835)
@@ -1317,10 +1317,6 @@
 
 
     List newBody = new ArrayList();
-    // FIXME: (LPP-2075) [2006-05-19 ptw] Wrap body in try and make
-    // suffix be a finally clause, so suffix will not be skipped by
-    // inner returns.
-    newBody.addAll(prefix);
 
     int activationObjectSize = 0;
     if (scriptElement) {
@@ -1343,6 +1339,13 @@
         newBody.add(parseFragment(code));
       }
     }
+
+    // Cf. LPP-4850: Prefix has to come after declarations (above).
+    // FIXME: (LPP-2075) [2006-05-19 ptw] Wrap body in try and make
+    // suffix be a finally clause, so suffix will not be skipped by
+    // inner returns.
+    newBody.addAll(prefix);
+
     // Now emit functions in the activation context
     // Note: variable has already been declared so assignment does the
     // right thing (either assigns to global or local


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

Reply via email to