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

Key: LPP-4999
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: P0 P0
Assignee: Unassigned
Reporter: Max Carlson
Votes: 0
Watchers: 1
Operations

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

IE resets history to #0 after visiting another site and pressing the back button

Created: 30/Oct/07 02:45 PM   Updated: 01/Feb/08 04:25 PM
Component/s: Browser Integration
Affects Version/s: 4.0.6/Jujube
Fix Version/s: Cranberry

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive test.zip (10 kb)


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


 Description  « Hide
There are some other issues with Firefox not resetting the history in this situation.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jes Lefcourt - 30/Oct/07 02:53 PM
Attached is a zip of a few files that demonstrate this issue. It also contains a modified embed script, embed-mod.js, that differs from embed-compressed.js in two ways:

1) In embed-compressed.js, Lz.history.init was being called before Lz._loaded. As a result, the parse function was not setting the canvas attribute to the value that was in the URL when the page was loaded. To solve this, I removed the onload event at the end of the page and added the following to line 53:
dojo.flash.addLoadedListener(Lz.history.init)

2) Even after #1, something (not sure what) still depends on onload. However, in Firefox, if you use the back button to get back to a page, onload does not get fired (see my previous email for details). To solve this, I defined an onunload event. If this is present, then Firefox does not do its Javascript caching and onload will get fired when coming back to the page. So, at the end of the file, I added:
window.onunload=function donothing() {}

These two modifications allow the desired functionality to work properly in Firefox. The use case that needs to be supported in each browser is as follows:
1) Go to test.html
=> App is shown, 0 is displayed in the app. Nothing is in the URL.

2) Click 'Next' twice
=> 2 is displayed in the app. URL has the anchor #_lzstateValue=2

3) Click on "Go to Google" link
=> Google.com is shown

4) Click on back button
=> App is shown again. URL has the anchor #_lzstateValue=2. 2 is displayed in the app.

Currently, with the aforementioned modifications to the JS script, this works perfectly in Firefox. The results for IE are:

1) BROKEN: The URL shows #0 (I'm not sure if this is really a big deal, although it's probably caused by the same problem as step #4)
2) Works
3) Works
4) BROKEN: The URL shows #0, 0 is displayed in the app

The results for Safari are:

1) Works
2) Works
3) Works
4) Works. In a more complicated application, however, the initial value is never set on the canvas... Could this be a timing issue?

Max Carlson - 02/Nov/07 10:36 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 04:14 PM
(wafflecone branch r7102 - cranberry RC)
FF works as described
IE 6 returns a blank screen when the next button is clicked the second time


Mamye Kratt - 05/Nov/07 04:21 PM
I tried the code in the bug (not the zip). The behavior is the same in IE 6, returns a blank screen when the next button is clicked the second time.The URL for IE6 is http://127.0.0.1:8080/lps-4.0.7/my-apps/4999.lzx#

Mamye Kratt - 09/Nov/07 10:38 AM
(wafflecone build r7137 - cranberry RC)
Seeing the same behavior as r7102. Note the IE6 test results do not match the results of the reporters.

Max Carlson - 09/Nov/07 10:49 AM
There is a known issue with this not working in IE 6. Fortunately, there is a workaround, described in LPP-5056.

Mamye Kratt - 09/Nov/07 10:56 AM
(wafflecone build r7137 - cranberry RC)
LPP-5056 covers the problems in IE6. Also, it is being deployed for FNAC with the workaround. There is quite a bit of implicit testing at FNAC.