Closed Bug 510849 Opened 15 years ago Closed 12 years ago

web storage (localStorage/sessionStorage) empty string as key not supported

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: andrea.giammarchi, Assigned: Ms2ger)

References

Details

(Keywords: dev-doc-needed, html5)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2

Accordingly with W3 draft:
Each Storage object provides access to a list of key/value pairs, which are sometimes called items. Keys are strings. Any string (including the empty string) is a valid key.
but this is not true in Firefox

Reproducible: Always

Steps to Reproduce:
1.sessionStorage.setItem("", "test");
2.alert(sessionStorage.getItem(""));
Actual Results:  
null

Expected Results:  
the string "test"

associate the empty string with the data "string" as other browsers do
I can confirm this on 3.5.2 (Mac OS X). Dupes not found, marking as new.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Assignee: general → nobody
Component: JavaScript Engine → DOM: Other
QA Contact: general → general
Assignee: nobody → honzab.moz
Flags: wanted1.9.2?
Keywords: html5
Summary: web storage empty string as key not supported → web storage (localStorage/sessionStorage) empty string as key not supported
I can confirm this with Firefox 3.6.3 on Mac OS X 10.6.3.
Not time to work on this right now.
Assignee: honzab.moz → nobody
Blocks: 740357
Attached patch Patch v1Splinter Review
AFAICT, this works.
Assignee: nobody → Ms2ger
Status: NEW → ASSIGNED
Attachment #623404 - Flags: review?(honzab.moz)
Flags: wanted1.9.2?
OS: Windows XP → All
Hardware: x86 → All
Version: unspecified → Trunk
Keywords: dev-doc-needed
Comment on attachment 623404 [details] [diff] [review]
Patch v1

Review of attachment 623404 [details] [diff] [review]:
-----------------------------------------------------------------

Can you please add a test for this to test_localStorageBase.html, test_sessionStorageBase.html and all storageevent/ tests?

::: dom/imptests/webapps.json
@@ -23,5 @@
> -    "All 3 items should be added.": true,
> -    "array access should be correct": true,
> -    "getItem should be correct": true
> -  },
> -

Not sure why you are removing these tests...
Attachment #623404 - Flags: review?(honzab.moz) → review+
I'm not removing the tests, just the annotations that they failed.
https://hg.mozilla.org/mozilla-central/rev/6d219f7754f0
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla15
Component: DOM: Other → DOM
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: