[Sugar-devel] [sugar-web] do webkit frames run on different threads?

Code Raguet iraguet at activitycentral.com
Thu Dec 19 02:32:51 EST 2013


I've read the following, recently:
[...]

> In Opera, every window has its own JavaScript thread. This includes
> windows in iframes. The consequence is that event handlers initiated from
> different frames might execute at the same time. If these simultaneous
> scripts modify shared data (like properties in the top window), we have the
> possibility of race conditions.

[...]
source:
http://dev.opera.com/articles/view/timing-and-synchronization-in-javascript/

Because some pieces of sugar-web API ( for ex: env.js) relay on window.top
props (and karma loads a context.html iframe and runs the specs within), I
asked to myself if webkit frames may simultaneously run on different
threads...

I always think in a single-threaded model when programming javascript
(async, of course, but not multithreading). Therefore, It seems to me like
an Opera specific.
After a little research, I wasn't able to find an concrete answer, so asked
Roger to try out some tests.

We made a long running function with busy waiting loops that mutates a
shared porp at window.top and then we ran it twice (one per frame) in
Opera. As the doc says, we 've been able to make a (racy) non-deterministic
state of the shared prop.[?]

Same tests on Chrome showed single-thread behavior... [?]

So the thesis would be running those on webkit... but we haven't yet
We had some unrelated issues and before keep digging I want ask you what do
you think/know about...

Thanks,
Code
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20131219/437fbec3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 328.png
Type: image/png
Size: 569 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20131219/437fbec3/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 341.png
Type: image/png
Size: 610 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20131219/437fbec3/attachment-0003.png>


More information about the Sugar-devel mailing list