W3C home > Mailing lists > Public > public-html@w3.org > March 2009

RE: localStorage and IE8

From: Adrian Bateman <adrianba@microsoft.com>
Date: Tue, 24 Mar 2009 11:44:36 -0700
To: Ian Hickson <ian@hixie.ch>, HTML WG <public-html@w3.org>, "public-webapps@w3.org" <public-webapps@w3.org>
CC: Jonas Sicking <jonas@sicking.cc>, Anne van Kesteren <annevk@opera.com>, Cameron McCormack <cam@mcc.id.au>, Drew Wilson <atwilson@google.com>, Jeremy Orlow <jorlow@google.com>, Michael Nordman <michaeln@google.com>, Oliver Hunt <oliver@apple.com>, Aaron Boodman <aa@google.com>, Robert O'Callahan <robert@ocallahan.org>, Dmitry Titov <dimich@google.com>, Adam Barth <whatwg@adambarth.com>
Message-ID: <749F45FA745A3244A87A63316D4E26B1842A215A7E@NA-EXMSG-C108.redmond.corp.microsoft.com>
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.



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:


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:


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;

...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:46:58 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:45 UTC