User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:126.96.36.199) Gecko/20090729 Firefox/3.5.2 Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:188.8.131.52) Gecko/20090729 Firefox/3.5.2 `localStorage` supports short accessor notation (as an alternative to `getItem`/`setItem`): localStorage.foo = 'bar'; localStorage.foo; // 'bar' It also supports `clear()` method, which as per current "Web Storage" specs draft (http://www.w3.org/TR/webstorage/): "... must atomically cause the list associated with the object to be emptied of all key/value pairs, if there are any. If there are none, then the method must do nothing." What looks like a bug is that even after `clear()`, keys are still "present" in `localStorage`: localStorage.foo = 'bar'; localStorage.clear(); 'foo' in localStorage; // true Is this an expected behavior? Note that the last statement returns `false` in at least WebKit and IE8 (and allows to check for presence of a value without resorting to a more verbose - `getItem(key) !== null`). Thank you. Reproducible: Always
The spec also says "The names of the supported named properties on a Storage object are the keys of each key/value pair currently present in the list associated with the object.", so this looks like a bug. See the URL field for testcase. Confirmed in Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.3a1pre) Gecko/20090919 Minefield/3.7a1pre
From jst on IRC: "I think that'd be a matter of finding the XPConnect wrapper for the localStorage object when calling clear, and calling JS_ClearScope() on its JSObject"
I think we should block on this web compatibility bug for 1.9.2.
Flags: blocking1.9.2? → blocking1.9.2+
OS: Mac OS X → All
Priority: -- → P2
Hardware: x86 → All
Target Milestone: --- → mozilla1.9.2
Comment on attachment 409678 [details] [diff] [review] v1 [Checkin comment 6] r+sr=jst
Comment on attachment 409678 [details] [diff] [review] v1 [Checkin comment 6] http://hg.mozilla.org/mozilla-central/rev/5df9f71b9e98
Attachment #409678 - Attachment description: v1 → v1 [Checkin comment 6]
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Comment on attachment 409678 [details] [diff] [review] v1 [Checkin comment 6] (this is a blocker, doesn't need explicit approval, please land ASAP)
You need to log in before you can comment on or make changes to this bug.