Closed Bug 1451991 Opened 6 years ago Closed 6 years ago

Devtools: Localstorage didn't list item whose key names "key"

Categories

(DevTools :: Storage Inspector, defect)

defect
Not set
normal

Tracking

(firefox61 fixed)

RESOLVED FIXED
Firefox 61
Tracking Status
firefox61 --- fixed

People

(Reporter: im, Assigned: miker)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
Build ID: 20100101

Steps to reproduce:

Run 
localStorage.setItem("key", "value")
localStorage.setItem("key2", "value")
in devtools' console and switch to storage tab and inspect localStoage list.
Same to sessionStorage


Actual results:

Only item "key2" is listed.


Expected results:

Both items "key" and "key2" are listed.
Component: Untriaged → Developer Tools: Storage Inspector
So the issue is that we use Object.keys to iterate through these storage types and "key" is a method on the prototype.

localStorage.setItem("setItem", "value3") would cause a similar issue.

So we need to find a way to get all keys.
for ( var i = 0, len = localStorage.length; i < len; ++i ) {
  console.log( localStorage.key( i ) );
}

Dirty but works.
Assignee: nobody → mratcliffe
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment on attachment 8968136 [details]
Bug 1451991 - Devtools: Localstorage didn't list item whose key names "key"

https://reviewboard.mozilla.org/r/236812/#review242562

Looks good to me, thanks Mike
Attachment #8968136 - Flags: review?(nchevobbe) → review+
Pushed by mratcliffe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/865e7a04728a
Devtools: Localstorage didn't list item whose key names "key" r=nchevobbe
Pushed by mratcliffe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8218cd8d6ec1
Devtools: Localstorage didn't list item whose key names "key" r=nchevobbe
https://hg.mozilla.org/mozilla-central/rev/8218cd8d6ec1
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 61
Flags: needinfo?(mratcliffe)
Depends on: 1462912
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.