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

Key: LPP-5108
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: -- --
Assignee: Max Carlson
Reporter: Max Carlson
Votes: 0
Watchers: 0
Operations

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

History broken in DHTML

Created: 14/Nov/07 01:50 PM   Updated: 14/Nov/07 10:09 PM
Component/s: Browser Integration
Affects Version/s: Cranberry
Fix Version/s: RingDing (4.1)

Time Tracking:
Not Specified

File Attachments: 1. File test.lzx (0.6 kb)


Severity: Minor
Fixed in Change#: 7,282
Runtime: N/A
Fix in hand: True


 Description  « Hide
History broke in dhtml as of r7133.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Max Carlson - 14/Nov/07 01:50 PM
Attaching test case for hash mark setting

Max Carlson - 14/Nov/07 10:09 PM
Author: max
Date: 2007-11-14 22:08:29 -0800 (Wed, 14 Nov 2007)
New Revision: 7282

Modified:
   openlaszlo/trunk/lps/includes/source/embednew.js
Log:
Change 20071114-maxcarlson-n by maxcarlson@Roboto on 2007-11-14 14:20:59 PST
    in /Users/maxcarlson/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix history initialization in dhtml

New Features:

Bugs Fixed: LPP-5108 - History broken in DHTML

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

Documentation:

Release Notes:

Details: Add _onload array to store methods called onload. Attach history.init method if properties.history != false. Call all methods in _onload inside _ready().

r7133 removed a call to Lz.history.init that was attached ot the window.onload event handler - which runs too early in some cases.

Tests: http://localhost:8080/trunk/test/history/history.lzx?lzt=html and http://localhost:8080/trunk/test/history/history.lzx?lzr=dhtml&lzt=html work, as does the testcase attached to LPP-5108. Tested in Safari 3 and Firefox 2 OS X.



Modified: openlaszlo/trunk/lps/includes/source/embednew.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/embednew.js 2007-11-15 05:08:14 UTC (rev 7281)
+++ openlaszlo/trunk/lps/includes/source/embednew.js 2007-11-15 06:08:29 UTC (rev 7282)
@@ -104,31 +104,36 @@
         };
 
         // Add entry for this application
- Lz[properties.id] = {
+ var app = Lz[properties.id] = {
             runtime: 'swf'
             ,_id: properties.id
             ,setCanvasAttribute: Lz._setCanvasAttributeSWF
             ,getCanvasAttribute: Lz._getCanvasAttributeSWF
             ,callMethod: Lz._callMethodSWF
             ,_ready: Lz._ready
+ // List of functions to call when the app is loaded
+ ,_onload: []
             ,loaded: false
             ,_sendMouseWheel: Lz._sendMouseWheel
             ,_setCanvasAttributeDequeue: Lz._setCanvasAttributeDequeue
         }
+ // listen for history unless properties.history == false
+ if (properties.history != false) {
+ app._onload.push(Lz.history.init);
+ }
         // 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;
+ Lz.setCanvasAttribute = app.setCanvasAttribute;
         }
- if (! Lz['getCanvasAttribute']) Lz.getCanvasAttribute = Lz[properties.id].getCanvasAttribute;
- if (! Lz['callMethod']) Lz.callMethod = Lz[properties.id].callMethod;
+ if (! Lz['getCanvasAttribute']) Lz.getCanvasAttribute = app.getCanvasAttribute;
+ if (! Lz['callMethod']) Lz.callMethod = app.callMethod;
 
         dojo.flash.setSwf(swfargs, minimumVersion);
         Lz.__BrowserDetect.init();
         if (Lz.__BrowserDetect.OS == 'Mac') {
- LzMousewheelKernel.setCallback(Lz[properties.id], '_sendMouseWheel');
+ LzMousewheelKernel.setCallback(app, '_sendMouseWheel');
         }
     }
 
@@ -205,16 +210,21 @@
         };
 
         // Add entry for this application
- Lz[properties.id] = {
+ var app = Lz[properties.id] = {
             runtime: 'dhtml'
             ,_id: properties.id
             ,_ready: Lz._ready
+ ,_onload: []
             ,loaded: false
             ,setCanvasAttribute: Lz._setCanvasAttributeDHTML
             ,getCanvasAttribute: Lz._getCanvasAttributeDHTML
         }
- if (! Lz['setCanvasAttribute']) Lz.setCanvasAttribute = Lz[properties.id].setCanvasAttribute;
- if (! Lz['getCanvasAttribute']) Lz.getCanvasAttribute = Lz[properties.id].getCanvasAttribute;
+ // listen for history unless properties.history == false
+ if (properties.history != false) {
+ app._onload.push(Lz.history.init);
+ }
+ if (! Lz['setCanvasAttribute']) Lz.setCanvasAttribute = app.setCanvasAttribute;
+ if (! Lz['getCanvasAttribute']) Lz.getCanvasAttribute = app.getCanvasAttribute;
 
         this.__dhtmlLoadScript(url)
     }
@@ -396,7 +406,7 @@
             this.setCanvasAttribute(a[0], a[1], a[2]);
         }
     }
- ,/** @access private */
+ ,/** @access private called on canvas init */
     _ready: function (cref) {
         this.loaded = true;
         Lz.loaded = true;
@@ -404,6 +414,12 @@
             this._setCanvasAttributeDequeue();
         }
         if (cref) this.canvas = cref;
+ // call list of functions in _onload array
+ for (var i = 0; i < this._onload.length; i++) {
+ var f = this._onload[i];
+ if (typeof f == 'function') f(this);
+ }
+ // for backward compatibility and simplicity
         if (this.onload && typeof this.onload == 'function') {
             this.onload();
         }


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