FYI: Small changes to localStorage/sessionStorage methods in M63

41 views
Skip to first unread message

Kubo Da Costa, Raphael

unread,
Oct 5, 2017, 7:09:52 AM10/5/17
to blin...@chromium.org
Hi all,

I've recently landed a few changes to Storage.idl (used by localStorage
and sessionStorage) to make it more compatible with the spec. Some of
the changes are user-visible, but not big enough to require an Intent
email, so jsbell and I agreed a small FYI email should be fine.

In a nutshell:

* All methods (e.g. getItem(), removeItem(), key() etc) in the Storage
interface used to have the [NotEnumerable] extended attribute, so they
wouldn't show up in for-in loops and Object.getOwnPropertyDescriptor()
would return a dictionary with 'enumerable' set to false. This is no
longer the case, and it aligns us with the spec as well as Firefox
(since version 34) and WebKit (since Safari 10.1).

* We had anonymous getter, setter and deleter operations in addition to
getItem(), setItem() and removeItem(), respectively. The anonymous
getter and getItem() in particular behaved a bit differently: getItem()
returned null if a key wasn't found, whereas the anonymous getter
returned undefined. The anonymous operations have now been merged into
the named ones.

The CL implementing this behavior change is http://crrev.com/c/691974
and the corresponding bug report is http://crbug.com/651774.

PhistucK

unread,
Oct 5, 2017, 11:03:58 AM10/5/17
to Kubo Da Costa, Raphael, blin...@chromium.org
I am not concerned about the second change (though it does result in a weird JavaScript object where undefined members return null instead of undefined, oh, well).

I am concerned about the first change, though.
for (x in localStorage) {...}
Now iterates methods as well, which can make an empty sessionStorage/localStorage seem like a non-empty one, or can make code that expect strings or undefined handle functions as strings.


PhistucK


--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/1507201783.9254.13.camel%40intel.com.


Dimitri Glazkov

unread,
Oct 5, 2017, 11:26:18 AM10/5/17
to PhistucK, Kubo Da Costa, Raphael, blin...@chromium.org
These seem like fairly small changes, but in the future, it might be good to use the intent-to-ship process for more explicit visibility.

:DG<

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

Kubo Da Costa, Raphael

unread,
Oct 5, 2017, 11:28:57 AM10/5/17
to blin...@chromium.org
Oh, one thing I forgot to mention in my original message is that I've created a couple of entries in chromestatus.com to hopefully make it easier for people to find out about these changes:
- https://www.chromestatus.com/feature/5120599789666304 (Web Storage: Methods are now enumerable) - https://www.chromestatus.com/feature/5700418495578112 (Web Storage: Anonymous getter may return null)
Reply all
Reply to author
Forward
0 new messages