RE: localStorage and IE8

Hi Ian,

Thanks for bringing the whatwg thread to our attention. We are aware of the situation related to possible contention from different tabs or windows (which may well be running in different processes in IE8) and our desire not to allow one to block execution of another.

I will read through the mails and respond with our comments.

Cheers,

Ade.

-- 
Adrian Bateman
Program Manager - Internet Explorer - Microsoft Corporation
Phone: +1 (425) 538 5111
E-mail: mailto:adrianba@microsoft.com



-----Original Message-----
From: public-html-request@w3.org [mailto:public-html-request@w3.org] On Behalf Of Ian Hickson
Sent: Monday, March 23, 2009 4:25 PM
To: HTML WG; public-webapps@w3.org
Cc: Jonas Sicking; Anne van Kesteren; Cameron McCormack; Drew Wilson; Jeremy Orlow; Michael Nordman; Oliver Hunt; Aaron Boodman; Robert O'Callahan; Dmitry Titov; Adam Barth
Subject: localStorage and IE8


IE8 implements the localStorage feature of the Web Storage specification:

   http://dev.w3.org/html5/webstorage/#storage

However, in a recent thread on the whatwg mailing list [1], it was noticed 
that IE8 fails to implement the following requirement from the section 
entitled "3.6 Threads":

# Multiple browsing contexts must be able to access the local storage 
# areas simultaneously in such a manner that scripts cannot detect any 
# concurrent script execution.
 -- http://dev.w3.org/html5/webstorage/#threads

This can be demonstrated by opening two separate IE8 windows, navigating 
both to the following URL:

   http://software.hixie.ch/utilities/js/js-eval-window/

Typing the following into the first window:

   localStorage.foo = 0;
   while (true)
      localStorage.foo = parseInt(localStorage.foo) + 1;

Typing the following into the second window:

   var x = 0;
   while (localStorage.foo == localStorage.foo)
     x += 1;
   x

...and then pressing the "Evaluate..." button in both windows.

In a compliant implementation, both would spin until the browser trips the 
"hung script" limit. (Both scripts are effectively infinite loops; the 
condition in the second script is guaranteed to be true by the condition 
quoted above.)

In IE8, the second script will return in finite time, indicating that the 
condition is not always true.

This leads to the possibility of race conditions, where scripts like this:

   localStorage.pendingName = "Fred";
   // ...
   if (localStorage.pendingName != "n/a") {
     output("Hello " + localStorage.pendingName + "!");
     localStorage.pendingName == "n/a";
   }

...if run in two windows side by side, would sometimes lead to two 
different calls to the output() method, one with "Hello Fred!" as 
expected, and one with "Hello n/a!", despite the check.

This is likely to be extremely hard for authors to debug.


This problem is exacerbated with Web Workers. It would be useful if 
someone from the IE team could contribute to the aforementioned thread [1] 
so that whatever solution is found is one that Microsoft would be willing 
to implement.


[1] http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-March/thread.html#18907

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 24 March 2009 18:47:08 UTC