[Laszlo-checkins] r13789 - in openlaszlo/trunk: lps/components/extensions lps/includes/source test/extensions

max@openlaszlo.org max at openlaszlo.org
Fri May 1 14:02:01 PDT 2009


Author: max
Date: 2009-05-01 14:01:57 -0700 (Fri, 01 May 2009)
New Revision: 13789

Modified:
   openlaszlo/trunk/lps/components/extensions/html.lzx
   openlaszlo/trunk/lps/includes/source/iframemanager.js
   openlaszlo/trunk/test/extensions/html.lzx
Log:
Change 20090430-maxcarlson-m by maxcarlson at Bank on 2009-04-30 16:29:03 PDT
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: HTML component should have a minimum size

Bugs Fixed: LPP-8108 - Enforce minimum size of html component

Technical Reviewer: hminsky
QA Reviewer: mdemmon

Details: test/extensions/html - Add buttons for testing invalid method calls and sizes

lps/components/extensions/html - Avoid registering for onx/ony in the target for dhtml - unused.  __updatepos() passes null x/y to iframemanager to skip positioning.  Width/height values are limited to >= 0.

iframemanager - Add try/catch around method call to prevent bad calls from affecting subsequent calls to callJavascript.

Tests: test/extensions/html.lzx?lzr=dhtml runs as before, clicking 'bad method' no longer breaks the other buttons or causes an exception.  Clicking 'invalid size' no longer breaks IE.



Modified: openlaszlo/trunk/lps/components/extensions/html.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/html.lzx	2009-05-01 02:37:31 UTC (rev 13788)
+++ openlaszlo/trunk/lps/components/extensions/html.lzx	2009-05-01 21:01:57 UTC (rev 13789)
@@ -127,8 +127,12 @@
         }
         this._posdel.register(this.target, 'onwidth');
         this._posdel.register(this.target, 'onheight');
-        this._posdel.register(this.target, 'onx');
-        this._posdel.register(this.target, 'ony');
+        if ($dhtml) {
+            // x and y are implicit
+        } else {
+            this._posdel.register(this.target, 'onx');
+            this._posdel.register(this.target, 'ony');
+        }
         //Debug.write(t);
         this.__updatepos(null);
         if (this['ontarget']) this.ontarget.sendEvent(t);
@@ -180,16 +184,17 @@
         if (! this['iframeid']) return;
 
         if ($dhtml) {
-            var x = 0;
-            var y = 0;
+            // pass in null x/y to skip positioning
+            var x = null;
+            var y = null;
             var z = this.sprite.getZ();
         } else {
             var x = this.getAttributeRelative("x", canvas);
             var y = this.getAttributeRelative("y", canvas);
             var z = this.target.sprite.getZ();
         }
-        var width = this.width;
-        var height = this.height;
+        var width = Math.max(this.width, 0);
+        var height = Math.max(this.height, 0);
         lz.embed.iframemanager.setPosition(this.iframeid, x, y, width, height, this.visible, z);
     </method>
     <!--- @access private -->

Modified: openlaszlo/trunk/lps/includes/source/iframemanager.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/iframemanager.js	2009-05-01 02:37:31 UTC (rev 13788)
+++ openlaszlo/trunk/lps/includes/source/iframemanager.js	2009-05-01 21:01:57 UTC (rev 13789)
@@ -295,12 +295,15 @@
         }
         var iframe = lz.embed.iframemanager.getFrameWindow(id);
         if (!args) args = [];
-        var method = iframe.eval(methodName);
-        if (method) {
-            var retVal = method.apply(iframe, args);
-            //console.log('callJavascript', methodName, args, 'in', iframe, 'result', retVal);
-            if (callbackDel) callbackDel.execute(retVal);
-            return retVal;
+        try {
+            var method = iframe.eval(methodName);
+            if (method) {
+                var retVal = method.apply(iframe, args);
+                //console.log('callJavascript', methodName, args, 'in', iframe, 'result', retVal);
+                if (callbackDel) callbackDel.execute(retVal);
+                return retVal;
+            }
+        } catch (e) {
         }
     }
 }

Modified: openlaszlo/trunk/test/extensions/html.lzx
===================================================================
--- openlaszlo/trunk/test/extensions/html.lzx	2009-05-01 02:37:31 UTC (rev 13788)
+++ openlaszlo/trunk/test/extensions/html.lzx	2009-05-01 21:01:57 UTC (rev 13789)
@@ -47,6 +47,21 @@
                     }
                 </handler>
             </button> 
+            <button>Invalid size
+                <handler name="onclick">
+                    if (classroot.main) {
+                        classroot.main.setWidth(-100);
+                    }
+                </handler>
+            </button> 
+            <button>Bad method
+                <handler name="onclick">
+                    if (classroot.main) {
+                        classroot.main.setAttribute('src', ''); 
+                        classroot.main.callJavascript('nomethodwiththisname', null, '#ff0000'); 
+                    }
+                </handler>
+            </button> 
             <text name="status" y="3" fontstyle="bold" visible="${classroot.main.loading}">Loading...</text>
         </hbox>    
         <html name="main" history="false" width="100%" height="${classroot.height - this.y - 44}">



More information about the Laszlo-checkins mailing list