[Sugar-devel] [sugar-web] do webkit frames run on different	threads?
    Code Raguet 
    iraguet at activitycentral.com
       
    Thu Dec 19 11:14:22 EST 2013
    
    
  
On Thu, Dec 19, 2013 at 12:28 PM, Daniel Narvaez <dwnarvaez at gmail.com>wrote:
> Can you explain where multi thread would be an issue in our code? Why I'm
> thinking perhaps simplistically is that we are already dealing with the
> window.sugar stuff being available asyncronously.
Yes, we dealt with this, already. But I didn't know that some browser may
run frames simultaneously.
Suppose the following scenario:
* order of execution is not guaranteed
* javascript from python runs on top frame
* env.js runs on an iframe
* different frames may run simultneously
js from python:
> var environment = %s;              <--- phase 1
if (window.sugar === undefined) {
>   window.sugar = {};
> }
> window.sugar.environment = environment;  <--- phase 2
from getEnvironment:
> if (window.top.sugar) {
  sugar = window.top.sugar;
> } else {
>   sugar = {};                      <--- phase 1
>   window.top.sugar = sugar;              <--- phase 2
> }
In this case, they would be running for window.top.sugar and it may result
with {}
Our scenario is running "js from python" far earlier than getEnvironment
(but not guaranteed), therefore, even with multithreading, this is unlikely
to happen.
I just a thought, but I would like to hear what do you think
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20131219/5faa86d9/attachment-0001.html>
    
    
More information about the Sugar-devel
mailing list