-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/796/
-----------------------------------------------------------
Review request for shindig.
Summary
-------
The motivation for this change is an odd out-of-order execution issue in Opera.
Caja ES53 initialization requires coordination between three frames: the Parent
container frame, a Taming child frame, and a Guest child frame. In particular,
we have to wait for both child frames to be ready before we can start the
cajoled gadget and run onload handlers.
This is a simplified explanation of how it currently works:
Parent writes this to Taming:
<script src="caja-taming-frame.js"></script>
<script>parent.tamingReady();</script>
Parent writes this to Guest:
<script src="caja-guest-frame.js"></script>
Taming finishes loading caja-taming-frame.js
Taming calls parent.tamingReady, which writes this to Guest:
<script>parent.guestReady();</script>
So at this point, the Guest document has the following:
<script src="caja-guest-frame.js"></script>
<script>parent.guestReady();</script>
And I expect what the Guest does is:
(1) Guest finishes loading caja-guest-frame.js
(2) Guest calls parent.guestReady, which starts the gadget
That works fine on Firefox and Chrome.
On Opera, for some reason (2) happens before (1). This is pretty weird. I'm
guessing it's a bug triggered by the unusual sequence of cross-frame
document.write calls. I tried to reproduce the problem with simpler cases, but
it looks like I need three frames to trigger the weird behavior.
So.. This patch avoids that weirdness by changing the logic so that each child
frame sets a flag in Parent when they're done, and then we start the gadget
when both flags are set.
Diffs
-----
/trunk/features/src/main/javascript/features/caja/taming.js 1128387
Diff: https://reviews.apache.org/r/796/diff
Testing
-------
"mvn test" passes.
SampleHelloWorld works in Firefox 4, Chrome 11, Opera 11
Thanks,
Felix