Status: Unconfirmed
Owner: ----
Labels: Type-Bug Pri-2
New issue 357625 by
bradley....@gmail.com: localStorage Security Issue
Cannot Use Polyfill
http://code.google.com/p/chromium/issues/detail?id=357625
Chrome Version : 33.0.1750.152 (Official Build 256984)
What steps will reproduce the problem?
1. Enable "Block third-party cookies and site data" on
chrome://settings/content
2. Put a page in an iframe (for example, an ad or Facebook Canvas
application)
3. Add a polyfill for localStorage
window.localStorage = {
_data : {},
setItem : function(id, val) { return this._data[id] = String(val); },
getItem : function(id) { return this._data.hasOwnProperty(id) ?
this._data[id] : undefined; },
removeItem : function(id) { return delete this._data[id]; },
clear : function() { return this._data = {}; }
};
4. Attempt to write to localStorage
What is the expected result?
That the polyfill will have over-ridden the blocked localStorage object and
will work correctly (as a local cache that is not persistent between page
loads).
What happens instead?
An exception is thrown: "Uncaught SecurityError: Failed to read
the 'localStorage' property from 'Window': Access is denied for this
document."
Please provide any additional information below. Attach a screenshot if
possible.
We run a Facebook application that uses localStorage to cache data between
page loads. We have discovered that some users (who have the "Block
third-party cookies and site data" setting enabled) are unable to load our
app.
Rather than having to wrap each individual call to localStorage with a
try/catch we would like to simply override the entire object and simply
have a non-persistent datastore so that our code can function the same way.
Unfortunately, Chrome throws an exception even after the localStorage
variable has been overwritten.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings