History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-5012
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: P0 P0
Assignee: Unassigned
Reporter: Jes Lefcourt
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

Multiple calls to callJS fails in Firefox

Created: 31/Oct/07 02:43 PM   Updated: 09/Nov/07 02:51 PM
Component/s: Browser Integration
Affects Version/s: 4.0.6/Jujube
Fix Version/s: Cranberry

Time Tracking:
Not Specified

Severity: Major
Runtime: N/A
Flags: Products
Fix in hand: False


 Description  « Hide
Try compiling the following program into a SWF, embedding it in an HTML page and running it in Firefox:

<canvas width="100%" height="100%">
 <button text="Click">
   <handler name="onclick">
     LzBrowser.callJS('alert', null, 'something');
   </handler>
 </button>
</canvas>

You'll find that the alert dialog will only ever open once...

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Max Carlson - 31/Oct/07 03:38 PM
Upgrading to a p0

André Bargull - 01/Nov/07 04:32 AM
If you don't want/need to have a callback, the "callback" argument must be "false", instead of "null"!

A patch for this is quite easy:

--- C:/Dokumente und Einstellungen/Admin/Lokale Einstellungen/Temp/LzBrowser-HEAD.2.as Thu Nov 01 13:22:36 2007
+++ e:/Entwicklung/OpenLaszlo/cygwin/home/Admin/src/svn/openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzBrowser.as Thu Nov 01 13:20:47 2007
@@ -85,7 +85,8 @@
         return;
     }
 
- if (typeof callback == 'function') {
+ var hasCallback = typeof(callback) == 'function';
+ if (hasCallback) {
         this.__jscallback = callback;
     } else {
         this.__jscallback = null;
@@ -97,7 +98,7 @@
     //Debug.write('calling with args real', arguments);
     DojoExternalInterface.call.apply(this, args);
 
- if (callback == false) {
+ if (!hasCallback) {
         this._dequeueJS();
     }
 }

Jes Lefcourt - 01/Nov/07 05:30 AM
Thanks for your response, Andre!

It turns out that my issue is that I was compiling to swf7 instead of swf8. In swf8, everything works fine. However, in IE I also get two Javascript errors (although it works):

1. On load of the app, I get the error "Object doesn't support this property or method." on line 735. I did a bit of debugging, and this error is actually being thrown on line 734, which is "$3.startExec()". In case it helps, $3 is defined as "var $3=dojo.flash.obj.get()".

2. On unload of the page, I get the error "Syntax error" on line 1. I'm not sure where this comes from, but I'm guessing that perhaps the idle loop which checks the browser URL is still running while other things are being unloaded? Something like that?

Thanks!

André Bargull - 01/Nov/07 05:48 AM
Concerning the first JavaScript-error: this sounds just like LPP-4695.

Jes Lefcourt - 01/Nov/07 06:13 AM
Indeed, the workaround suggested in LPP 4695 (lzt=html) does get rid of the first one. Any thoughts on the second?

André Bargull - 01/Nov/07 06:59 AM
May you file a separate bug-report for the second issue (with a small reproducible testcase), so it's easier to track this bug. Thanks!

Mamye Kratt - 09/Nov/07 02:50 PM
Confirmed with Jes that this bug is fixed.


Mamye Kratt - 09/Nov/07 02:51 PM
(wafflecone build r7137 - cranberry RC)
Fixed.