You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Jasvir Nagra <ja...@gmail.com> on 2011/06/06 22:47:37 UTC

Re: Review Request: Fix timing problem in Caja intialization on Opera

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/796/#review765
-----------------------------------------------------------

Ship it!


LGTM

- Jasvir


On 2011-05-27 23:28:08, Felix Lee wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/796/
> -----------------------------------------------------------
> 
> (Updated 2011-05-27 23:28:08)
> 
> 
> 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
> 
>