Change maxcarlson-20100825-5k4 by maxcarl...@friendly on 2010-08-25 15:58:50 PDT
in /Users/maxcarlson/openlaszlo/trunk2
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Add pmrpc cross-domain support for calling JS in loaded iframes/html
Bugs Fixed: LPP-9324 - Add pmrpc to the html component
Technical Reviewer: promanik
QA Reviewer: hminsky
Details: This change makes it possible to call javascript inside and send
events from within iframes loaded from different domains. The technology to do
this (pmrpc) is completely callback based, which forced some changes with the
way callbacks work. html.callJavascript() now requires a callback argument if
you need the return value for a given call.
credits - Add license from pmrpc.js
html - Include JSON library to serialize callJavascript retrun values. Modify
SWF __iframecallback() and callJavascript() to store callbacks locally now that
return values come back asynchonously.
rte.lzx - Use callbacks where callJavascript() return values are required.
Reorient towards updating the rte.text attribute whenever text changes. Rework
destroy() to finish only after rte.text is updated one last time.
pmrpc - Include library
build - Add dependencies, build target for pmrpc
rtemanager - Rename destroy() -> __destroy(). addButton() expects a second
buttonid arg, which is echoed back. This allows the asynchronous return value
to associate the button ID with the correct callback in rte.lzx.
iframemanager-library - Include pmrpc.js.
iframemanager - Shorten lookups, remove unneeded getIDFromWindow() call, owner
-> __owner. Rework asyncCallback() to pass through the callback ID when
needed, see html.lzx __iframecallback() in swf. callJavascript() now uses
pmrpc to call into the iframe. Leave older direct iframe calling code intact.
Register as a pmrpc server for asyncCallback().
iframestub - Include pmrpc, register as a client for callJavascript() calls and
use iframemanager.asyncCallback(). Replace
parent.lz.embed.iframemanager.getIDFromWindow with window.name.
examples/extensions/html - Add test showing JS script injection failing.
examples/extensions/html-test - Include iframestub to ensure callJavascript()
calls work properly.
examples/extensions/rte - Use this.text instead of getText().
Tests: examples/extensions/html.lzx and examples/extensions/rte.lzx run as
before.
Files:
A credits/pmrpc.txt
M lps/components/extensions/html.lzx
M lps/components/extensions/rte.lzx
A lps/includes/source/pmrpc.js
M lps/includes/source/build.xml
M lps/includes/source/rtemanager.js
M lps/includes/source/iframemanager-library.lzs
M lps/includes/source/iframemanager.js
M lps/includes/source/iframestub.js
M examples/extensions/html.lzx
M examples/extensions/html-test.html
M examples/extensions/rte.lzx
Changeset:
http://svn.openlaszlo.org/openlaszlo/patches/maxcarlson-20100825-5k4.tar