Last Comment Bug 510849 - web storage (localStorage/sessionStorage) empty string as key not supported
: web storage (localStorage/sessionStorage) empty string as key not supported
Status: RESOLVED FIXED
: dev-doc-needed, html5
Product: Core
Classification: Components
Component: DOM (show other bugs)
: Trunk
: All All
: -- normal with 1 vote (vote)
: mozilla15
Assigned To: :Ms2ger
:
Mentors:
: 549113 (view as bug list)
Depends on:
Blocks: 740357
  Show dependency treegraph
 
Reported: 2009-08-17 01:18 PDT by Andrea Giammarchi
Modified: 2013-04-04 13:52 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch v1 (3.27 KB, patch)
2012-05-12 02:31 PDT, :Ms2ger
honzab.moz: review+
Details | Diff | Splinter Review

Description Andrea Giammarchi 2009-08-17 01:18:00 PDT
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
Comment 1 Juriy "kangax" Zaytsev 2009-08-21 19:45:55 PDT
I can confirm this on 3.5.2 (Mac OS X). Dupes not found, marking as new.
Comment 2 Nickolay_Ponomarev 2010-04-19 00:35:07 PDT
*** Bug 549113 has been marked as a duplicate of this bug. ***
Comment 3 Ernst de Haan 2010-04-19 10:18:46 PDT
I can confirm this with Firefox 3.6.3 on Mac OS X 10.6.3.
Comment 4 Honza Bambas (:mayhemer) 2012-01-18 08:34:22 PST
Not time to work on this right now.
Comment 5 :Ms2ger 2012-05-12 02:31:22 PDT
Created attachment 623404 [details] [diff] [review]
Patch v1

AFAICT, this works.
Comment 6 Honza Bambas (:mayhemer) 2012-05-14 13:25:13 PDT
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...
Comment 7 :Ms2ger 2012-05-14 13:40:52 PDT
I'm not removing the tests, just the annotations that they failed.

Note You need to log in before you can comment on or make changes to this bug.