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

RESOLVED FIXED in mozilla15

Status

()

Core
DOM
RESOLVED FIXED
8 years ago
4 years ago

People

(Reporter: Andrea Giammarchi, Assigned: Ms2ger)

Tracking

({dev-doc-needed, html5})

Trunk
mozilla15
dev-doc-needed, html5
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

8 years ago
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

Updated

8 years ago
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general

Updated

8 years ago
Assignee: general → nobody
Component: JavaScript Engine → DOM: Other
QA Contact: general → general
Assignee: nobody → honzab.moz
Flags: wanted1.9.2?

Updated

7 years ago
Keywords: html5
Summary: web storage empty string as key not supported → web storage (localStorage/sessionStorage) empty string as key not supported

Updated

7 years ago
Duplicate of this bug: 549113

Comment 3

7 years ago
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
(Assignee)

Updated

6 years ago
Blocks: 740357
(Assignee)

Comment 5

5 years ago
Created attachment 623404 [details] [diff] [review]
Patch v1

AFAICT, this works.
Assignee: nobody → Ms2ger
Status: NEW → ASSIGNED
Attachment #623404 - Flags: review?(honzab.moz)
(Assignee)

Updated

5 years ago
Flags: wanted1.9.2?
OS: Windows XP → All
Hardware: x86 → All
Version: unspecified → Trunk
(Assignee)

Updated

5 years ago
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+
(Assignee)

Comment 7

5 years ago
I'm not removing the tests, just the annotations that they failed.
(Assignee)

Comment 8

5 years ago
https://hg.mozilla.org/mozilla-central/rev/6d219f7754f0
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla15
Component: DOM: Other → DOM
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.