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

Key: LPP-5016
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: P0 P0
Assignee: Max Carlson
Reporter: Jes Lefcourt
Votes: 0
Watchers: 0
Operations

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

_parse gets called before canvas is initialized

Created: 01/Nov/07 09:56 AM   Updated: 05/Nov/07 03:43 PM
Component/s: Browser Integration
Affects Version/s: 4.0.6/Jujube
Fix Version/s: Cranberry

Time Tracking:
Not Specified

Severity: Major
Fixed in Change#: 7,097
Runtime: N/A
Fix in hand: False


 Description  « Hide
On load of the page, if the OL application is somewhat large, then it is possible that _parse gets called before the canvas is initialized. As a result, the initial value of any canvas attributes stored in the anchor part of the URL never get set to the canvas.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Max Carlson - 02/Nov/07 10:37 AM
Author: max
Date: 2007-11-02 11:33:04 -0700 (Fri, 02 Nov 2007)
New Revision: 7097

Modified:
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/LaszloLibrary.lzs
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
   openlaszlo/branches/wafflecone/lps/includes/source/embednew.js
   openlaszlo/branches/wafflecone/lps/includes/source/lzhistory.js
Log:
Change 20071101-maxcarlson-S by maxcarlson@Plastik on 2007-11-01 19:38:19 PDT
    in /Users/maxcarlson/openlaszlo/wafflecone
    for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone

Summary: Fix lzhistory behavior when another page is visited and the back-button is used.

New Features:

Bugs Fixed: LPP-4999 - IE resets history to #0 after visiting another site and pressing the back button, LPP-5016 - _parse gets called before canvas is initialized

Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: LzSprite.as - Delay DojoExternalInterface initialization 'til canvas init time.

LaszloLibrary.lzs - Delay DojoExternalInterface initialization 'til canvas init time.

embednew.js - Add dojo.flash.addLoadedListener(Lz.history.init) instead of using window.onload. Check for presence of dojo.flash.comm.callMethod() before calling.

lzhistory.js - _parse() only sets canvas attribute when Lz.loaded == true. Add
window.onunload=function () {} to fix back button behavior in Firefox.
    

Tests: Test a SOLO compile of this application:
<canvas width="100%" height="100%" debug="true" proxied="false">
  <attribute name="stateValue" type="string" value="null"/>
  
  <simplelayout axis="x"/>
  <button text="Next">
    <handler name="onclick">
      var cur = Number(canvas.stateValue);
      if(isNaN(cur)) { cur = 0; }
      cur++;
      LzBrowser.loadJS("Lz.setCanvasAttribute('stateValue', '" + escape(cur) + "', true)");
    </handler>
  </button>
  <button text="Google">
    <handler name="onclick">
      LzBrowser.loadURL('http://google.com/');
    </handler>
  </button>

  <text text="${canvas.stateValue}" resize="true" x="100" y="100"/>
</canvas>

Run the SOLO compile, step forward a few times, then click the 'google' button. Pressing the back button after google loads should work in ie7, firefox and google.



Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/LaszloLibrary.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/LaszloLibrary.lzs 2007-11-02 18:16:25 UTC (rev 7096)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/LaszloLibrary.lzs 2007-11-02 18:33:04 UTC (rev 7097)
@@ -47,15 +47,6 @@
 if ($as2) {
     // Initialize the DojoExternalInterface class
     DojoExternalInterface = new DojoExternalInterfaceClass();
-
- // Expose your methods
- DojoExternalInterface.addCallback("getCanvasAttribute", LzHistory, LzHistory.getCanvasAttribute);
- DojoExternalInterface.addCallback("setCanvasAttribute", LzHistory, LzHistory.setCanvasAttribute);
- DojoExternalInterface.addCallback("callMethod", LzHistory, LzHistory.callMethod);
- DojoExternalInterface.addCallback("receiveHistory", LzHistory, LzHistory.receiveHistory);
-
- // Tell JavaScript that you are ready to have method calls
- DojoExternalInterface.loaded();
 }
 
 if ($debug) {

Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzSprite.as 2007-11-02 18:16:25 UTC (rev 7096)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzSprite.as 2007-11-02 18:33:04 UTC (rev 7097)
@@ -15,6 +15,7 @@
 
 
     if (isroot) {
+ this.isroot = true;
         var is = _root.spriteroot;
         if (! is) {
             var is = _root.attachMovie('empty', 'spriteroot', 1000);
@@ -221,6 +222,16 @@
 LzSprite.prototype.init = function( ) {
     this.__LZmovieClipRef._visible = this.visible;
     this.__LZbgRef._visible = this.visible;
+ if (this.isroot) {
+ // Expose your methods
+ DojoExternalInterface.addCallback("getCanvasAttribute", LzHistory, LzHistory.getCanvasAttribute);
+ DojoExternalInterface.addCallback("setCanvasAttribute", LzHistory, LzHistory.setCanvasAttribute);
+ DojoExternalInterface.addCallback("callMethod", LzHistory, LzHistory.callMethod);
+ DojoExternalInterface.addCallback("receiveHistory", LzHistory, LzHistory.receiveHistory);
+
+ // Tell JavaScript that you are ready to have method calls
+ DojoExternalInterface.loaded();
+ }
 }
 
 

Modified: openlaszlo/branches/wafflecone/lps/includes/source/embednew.js
===================================================================
--- openlaszlo/branches/wafflecone/lps/includes/source/embednew.js 2007-11-02 18:16:25 UTC (rev 7096)
+++ openlaszlo/branches/wafflecone/lps/includes/source/embednew.js 2007-11-02 18:33:04 UTC (rev 7097)
@@ -117,6 +117,7 @@
         // for callbacks onload
         Lz._swfid = properties.id;
         dojo.flash.addLoadedListener(Lz._loaded);
+ dojo.flash.addLoadedListener(Lz.history.init)
         if (! Lz['setCanvasAttribute']) {
             Lz.setCanvasAttribute = Lz[properties.id].setCanvasAttribute;
         }
@@ -335,7 +336,7 @@
      * @param hist:Boolean value - if true, add a history event.
      */
     _setCanvasAttributeSWF: function (name, value, hist) {
- if (this.loaded) {
+ if (this.loaded && dojo.flash.comm['callMethod']) {
             if (hist) {
                 Lz.history._store(name, value);
             } else {

Modified: openlaszlo/branches/wafflecone/lps/includes/source/lzhistory.js
===================================================================
--- openlaszlo/branches/wafflecone/lps/includes/source/lzhistory.js 2007-11-02 18:16:25 UTC (rev 7096)
+++ openlaszlo/branches/wafflecone/lps/includes/source/lzhistory.js 2007-11-02 18:33:04 UTC (rev 7097)
@@ -170,7 +170,7 @@
         var _this = Lz.history;
         // TODO: send events to all apps
         if (h.length == 0 || h == _this._lasthash) return;
- if (h.indexOf('_lz') != -1) {
+ if (Lz.loaded && h.indexOf('_lz') != -1) {
             // TODO: use rison
             _this._lasthash = h;
             h = h.substring(3);
@@ -229,4 +229,7 @@
         }
     }
 };
-window.onload = Lz.history.init;
+if (Lz.__BrowserDetect.isFirefox) {
+ // If this is present, then Firefox does not do its Javascript caching and onload will get fired when coming back to the page. Thanks Jes!
+ window.onunload = function() {};
+}


_______________________________________________
Laszlo-checkins mailing list
Laszlo-checkins@openlaszlo.org
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Max Carlson - 05/Nov/07 12:05 PM
Author: max
Date: 2007-11-05 12:03:56 -0800 (Mon, 05 Nov 2007)
New Revision: 7133

Modified:
   openlaszlo/trunk/
   openlaszlo/trunk/WEB-INF/lps/lfc/LaszloLibrary.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
   openlaszlo/trunk/lps/includes/source/embednew.js
   openlaszlo/trunk/lps/includes/source/lzhistory.js
Log:
Change 20071102-maxcarlson-v by maxcarlson@Plastik on 2007-11-02 17:35:12 PDT
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Merge wafflecone r7097 to trunk

New Features:

Bugs Fixed: LPP-4999 - IE resets history to #0 after visiting another site and pressing the back button, LPP-5016 - _parse gets called before canvas is initialized

Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:

Plastik:trunk-clean maxcarlson$ ~/openlaszlo/tools/svn/svnmerge.py merge -r 709
7 -S ../wafflecone
U WEB-INF/lps/lfc/kernel/swf/LzSprite.as
U WEB-INF/lps/lfc/LaszloLibrary.lzs
U lps/includes/source/embednew.js
U lps/includes/source/lzhistory.js

property 'svnmerge-integrated' set on '.'
    

Tests: Test a SOLO compile of this application:
<canvas width="100%" height="100%" debug="true" proxied="false">
  <attribute name="stateValue" type="string" value="null"/>
  
  <simplelayout axis="x"/>
  <button text="Next">
    <handler name="onclick">
      var cur = Number(canvas.stateValue);
      if(isNaN(cur)) { cur = 0; }
      cur++;
      LzBrowser.loadJS("Lz.setCanvasAttribute('stateValue', '" + escape(cur) + "', true)");
    </handler>
  </button>
  <button text="Google">
    <handler name="onclick">
      LzBrowser.loadURL('http://google.com/');
    </handler>
  </button>

  <text text="${canvas.stateValue}" resize="true" x="100" y="100"/>
</canvas>

Run the SOLO compile, step forward a few times, then click the 'google' button. Pressing the back button after google loads should work in ie7, firefox and google.




Property changes on: openlaszlo/trunk
___________________________________________________________________
Name: svnmerge-integrated
   - /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7013 /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661 /openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334
   + /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7013 /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661,7097 /openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/LaszloLibrary.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/LaszloLibrary.lzs 2007-11-05 20:00:28 UTC (rev 7132)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/LaszloLibrary.lzs 2007-11-05 20:03:56 UTC (rev 7133)
@@ -47,15 +47,6 @@
 if ($as2) {
     // Initialize the DojoExternalInterface class
     DojoExternalInterface = new DojoExternalInterfaceClass();
-
- // Expose your methods
- DojoExternalInterface.addCallback("getCanvasAttribute", LzHistory, LzHistory.getCanvasAttribute);
- DojoExternalInterface.addCallback("setCanvasAttribute", LzHistory, LzHistory.setCanvasAttribute);
- DojoExternalInterface.addCallback("callMethod", LzHistory, LzHistory.callMethod);
- DojoExternalInterface.addCallback("receiveHistory", LzHistory, LzHistory.receiveHistory);
-
- // Tell JavaScript that you are ready to have method calls
- DojoExternalInterface.loaded();
 }
 
 if ($debug) {

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as 2007-11-05 20:00:28 UTC (rev 7132)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as 2007-11-05 20:03:56 UTC (rev 7133)
@@ -15,6 +15,7 @@
 
 
     if (isroot) {
+ this.isroot = true;
         var is = _root.spriteroot;
         if (! is) {
             var is = _root.attachMovie('empty', 'spriteroot', 1000);
@@ -218,6 +219,16 @@
 LzSprite.prototype.init = function( ) {
     this.__LZmovieClipRef._visible = this.visible;
     this.__LZbgRef._visible = this.visible;
+ if (this.isroot) {
+ // Expose your methods
+ DojoExternalInterface.addCallback("getCanvasAttribute", LzHistory, LzHistory.getCanvasAttribute);
+ DojoExternalInterface.addCallback("setCanvasAttribute", LzHistory, LzHistory.setCanvasAttribute);
+ DojoExternalInterface.addCallback("callMethod", LzHistory, LzHistory.callMethod);
+ DojoExternalInterface.addCallback("receiveHistory", LzHistory, LzHistory.receiveHistory);
+
+ // Tell JavaScript that you are ready to have method calls
+ DojoExternalInterface.loaded();
+ }
 }
 
 

Modified: openlaszlo/trunk/lps/includes/source/embednew.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/embednew.js 2007-11-05 20:00:28 UTC (rev 7132)
+++ openlaszlo/trunk/lps/includes/source/embednew.js 2007-11-05 20:03:56 UTC (rev 7133)
@@ -118,6 +118,7 @@
         // for callbacks onload
         Lz._swfid = properties.id;
         dojo.flash.addLoadedListener(Lz._loaded);
+ dojo.flash.addLoadedListener(Lz.history.init)
         if (! Lz['setCanvasAttribute']) {
             Lz.setCanvasAttribute = Lz[properties.id].setCanvasAttribute;
         }
@@ -348,7 +349,7 @@
      * @param hist:Boolean value - if true, add a history event.
      */
     _setCanvasAttributeSWF: function (name, value, hist) {
- if (this.loaded) {
+ if (this.loaded && dojo.flash.comm['callMethod']) {
             if (hist) {
                 Lz.history._store(name, value);
             } else {

Modified: openlaszlo/trunk/lps/includes/source/lzhistory.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/lzhistory.js 2007-11-05 20:00:28 UTC (rev 7132)
+++ openlaszlo/trunk/lps/includes/source/lzhistory.js 2007-11-05 20:03:56 UTC (rev 7133)
@@ -170,7 +170,7 @@
         var _this = Lz.history;
         // TODO: send events to all apps
         if (h.length == 0 || h == _this._lasthash) return;
- if (h.indexOf('_lz') != -1) {
+ if (Lz.loaded && h.indexOf('_lz') != -1) {
             // TODO: use rison
             _this._lasthash = h;
             h = h.substring(3);
@@ -229,4 +229,7 @@
         }
     }
 };
-window.onload = Lz.history.init;
+if (Lz.__BrowserDetect.isFirefox) {
+ // If this is present, then Firefox does not do its Javascript caching and onload will get fired when coming back to the page. Thanks Jes!
+ window.onunload = function() {};
+}


_______________________________________________
Laszlo-checkins mailing list
Laszlo-checkins@openlaszlo.org
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Mamye Kratt - 05/Nov/07 03:43 PM
(wafflecone branch builld r7102 - cranberry RC)
XP/FF

I'm trying to test and I don't think the results are correct.
 
1. I put the test file in my-apps and compiled using the solo button on the debug console
2. Clicked Continue in Setup SOLO Application Deployment
3. Clicked on next button several times, observed the number incrementing in Preview SOLO Application in Browser
4. Clicked on Google button, observed Google site loads in Preview SOLO Application in Browser
5. Clicked back button in browser, nothing happens