[Laszlo-checkins] r12661 - openlaszlo/trunk/WEB-INF/lps/lfc/services

bargull@openlaszlo.org bargull at openlaszlo.org
Mon Jan 26 16:18:42 PST 2009


Author: bargull
Date: 2009-01-26 16:18:38 -0800 (Mon, 26 Jan 2009)
New Revision: 12661

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/services/LzModeManager.lzs
Log:
Change 20090127-bargull-V3h by bargull at dell--p4--2-53 on 2009-01-27 00:46:40
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix runtime exception from lz.ModeManager

New Features:

Bugs Fixed: LPP-7681

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

Documentation:

Release Notes:

Details:
handleMouseEvent(..) throw a "A term is undefined and has no properties." error in swf9 under certain conditions:
- the call to passModeEvent may change the modalviews-array ("modeArray")
 -> so in the next iteration it is possible that an invalid entry is used
Exactly that happened in the components example when submenus were opened and user clicked somewhere else (see bugreport).
To fix that bug, a simple if-condition needs to be added. 
I also changed all equality tests to identity tests (whenever views are compared to each other).
    

Tests:
see bugreport



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/LzModeManager.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/LzModeManager.lzs	2009-01-26 23:57:15 UTC (rev 12660)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/LzModeManager.lzs	2009-01-27 00:18:38 UTC (rev 12661)
@@ -1,6 +1,6 @@
 /**
   *
-  * @copyright Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2001-2009 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @affects lzmodemanager
@@ -121,7 +121,7 @@
         //releases all views past this one in the modelist as well
         var marr:Array = this.modeArray;
         for (var i:int = marr.length - 1; i >= 0; i--) {
-            if (marr[ i ] == view) {
+            if (marr[ i ] === view) {
                 marr.splice( i, marr.length - i );
                 var newmode:LzView = marr[ i - 1 ];
                 if (this.onmode.ready) this.onmode.sendEvent( newmode || null );
@@ -166,7 +166,12 @@
 
         var dosend:Boolean = true;
         for (var i:int = this.modeArray.length - 1; dosend && i >= 0; --i) {
-            var mView = this.modeArray[ i ];
+            var mView:LzView = this.modeArray[ i ];
+            if (! mView) {
+                // invalid entries are possible because the call to passModeEvent
+                // can have side-effects, e.g. modeArray may change (LPP-7681)
+                continue;
+            }
             // exclude the debugger from the mode
             if ($debug) {
                 if ($as2 || $as3) {
@@ -195,7 +200,7 @@
         if (dosend) {
             //check for double-click
             if (eventStr == "onclick") {
-                if (this.__LZlastclick == view && view.ondblclick.ready &&
+                if (this.__LZlastclick === view && view.ondblclick.ready &&
                         (LzTimeKernel.getTimer() - this.__LZlastClickTime) < view.DOUBLE_CLICK_TIME) {
                     //this is a double-click
                     eventStr = "ondblclick";
@@ -272,7 +277,7 @@
     function hasMode (view:LzView) :Boolean {
         var marr:Array = this.modeArray;
         for (var i:int = marr.length - 1; i >= 0; i--) {
-            if (view == marr[ i ]) {
+            if (view === marr[ i ]) {
                 return true;
             }
         }



More information about the Laszlo-checkins mailing list