Change 20070607-maxcarlson-B by [EMAIL PROTECTED] on 2007-06-07
15:15:46 PDT
in /Users/maxcarlson/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Allow history system to initialize history wrapper.
New Features:
Bugs Fixed: LPP-4108, LPP-4098
Technical Reviewer: mcarlson
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation: The history mechanism that traps backbutton events and
allows javascript to set attributes on the canvas, relies on the
h.html page loading in a particular order /wrt the laszlo
application, but this order is not enforced. The result is that when
the h.html file loads too soon, the initial load doesn't register
with the app, and when h.html loads too late the application may
attempt to read parameters using lzSetCanvasAttribute or push history
state before h.html is available. Both cases can cause unexpected
behavior.
The fix is to enforce the order in which h.html is loaded in the
browser and the application attempts to interact with the history
mechanism. The changes are:
- Load h.html from LzHistory.as to ensure that the application is
ready to recieve messages from it before it is loaded.
- When h.html has finished loading for the first time LzHistory
generates an onReady event, and sets it isReady attribute to true, to
let the application know that it is ok to push history states and
load attributes from Javascript
The files that are affected in this change are:
- embed.js: lzHistEmbed() no longer writes the h.html iframe to the
page, but instead writes a <div> that the h.html iframe can be
written to later
- embed.js: contains a new method called lzWriteHistoryIframe that is
called by LzHistory.as to load h.html into an iframe in the <div>
created in lzHistEmbed()
- LzHistory.as: calls lzWriteHistoryIframe() when it loads
- LzHistory.as: Generates a onReady event the first time h.html
loads, has an isReady flag that indicates if it is in a ready state
Release Notes: - The interfaces in embed.js remain the same, so the
wrapper html doesn't have to change.
- Applications that make use of the history mechanism will need to
wait for the onReady event and/or check the isReady state before
pushing history states
- Applications that read attributes using lzSetCanvasAttribute need
to wait for the onReady event and/or check the isReady before reading
the attributes
- The onReady event may be generated before the application
attaches a listener to it, so you should not rely on this event
firing to indicate readiness. You should check the isReady flag, and
if it returns false, then attach the event listener to the onReady event
Details:
Tests:
Files:
M WEB-INF/lps/lfc/services/LzHistory.as
M lps/includes/embed.js
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20070607-
maxcarlson-B.tar