Closed Bug 1295761 Opened 6 years ago Closed 4 years ago

After rapidly adding and removing a localStorage item, it's still shown in Storage Inspector

Categories

(DevTools :: Storage Inspector, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: shobson, Assigned: miker)

References

Details

Attachments

(1 obsolete file)

Okay, this is a weird one but I don't *think* it's my code...

1) visit https://developer.mozilla.org/en-US/
2) open storage inspector in dev tools and select local storage and then https://developer.mozilla.org/en-US/
3) select "CSS" out of "Web Platform" menu
4) watch two keys appear in LocalStorage, one is 'test' and the other is the current date and time
 
Reasons I don't think this is my code:
- my code does not include the string 'test' in it anywhere
- it only happens in FireFox, not Chrome
- closing and reopening the dev tools makes them disappear (which is not true of keys with empty values when I set them myself)

Reasons why it's probably my code:
- can't reproduce anywhere else
- there are more people QAing Firefox than there are MDN ;)
- Chrome doesn't let you keep their dev tools open and observe the keys when refreshing pages, it's possible it's being written and removed in Chrome because I can observe it

Tried it in Dev Edition which I assume is a clean profile, same result.
I should add: 

- no plug-ins in Dev Edition, it dumps everything when I logout
- turned my adblocker paranoia settings up to high and it still happened so I don't think it's a 3rd party script.
Hi Stephanie,

I've managed to reproduce this issue on the latest Nightly.
The following pushlog introduced the issue: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=e847cfcb315f511f4928b03fd47dcf57aad05e1e&tochange=1801b99994e4f29cd49fa34d840f0c40ba8be304

Jarda, could you take a look at this?
Component: Untriaged → Developer Tools: Storage Inspector
Flags: needinfo?(jsnajdr)
I can reproduce it, too. I'll let you know when I figure out something.
"test" is written here:
https://login.persona.org/include.js:8:11074

a.localStorage.setItem("test","true"),a.localStorage.removeItem("test")

It should be immediately removed though. It's strange that Storage Inspector keeps showing it. Looks like a bug.

The date value is written here:
https://developer.cdn.mozilla.net/static/build/js/main.a7b27a25fb9c.js:5:18125

localStorage.setItem(uid,uid);result=localStorage.getItem(uid)==uid;localStorage.removeItem(uid)

Again, the storage item should have been immediately removed. Instead, it's still shown in the Storage Inspector, although the value is empty.

It would be nice if devtools enabled developers to find these code locations, wouldn't it? I had to add some C++ tweaks in the DOM storage code to get them.
Flags: needinfo?(jsnajdr)
Ah, it's Persona! That makes sense. It wouldn't have been blocked by my very paranoid ad blockers.

We can close this if you like, or move it over to the Storage Inspector component.
The localStorage item fails to be removed from the Storage Inspector when removed too quickly. Renaming the bug.
Priority: -- → P3
Summary: 'test' and date being written and removed from localStorage → After adding and removing a localStorage item, it's still shown in Storage Inspector
STR:
localStorage.setItem("test","true")
localStorage.removeItem("test")
Summary: After adding and removing a localStorage item, it's still shown in Storage Inspector → After rapidly adding and removing a localStorage item, it's still shown in Storage Inspector
Whiteboard: [todo-mr]
Filter on HOTFROG.
Whiteboard: [todo-mr] → [todo-mr][t1]
Assignee: nobody → mratcliffe
Priority: P3 → P2
Has STR: --- → yes
Status: NEW → ASSIGNED
Comment on attachment 8879945 [details]
Bug 1295761 - Stop storage inspector showing items that have been quickly added & removed

https://reviewboard.mozilla.org/r/151320/#review157048

This change feels good. Thanks!
Attachment #8879945 - Flags: review?(pbrosset) → review+
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again.

hg error in cmd: hg rebase -s 7b75948abbfb -d 895701cff94e: rebasing 403625:7b75948abbfb "Bug 1295761 - Stop storage inspector showing items that have been quickly added & removed r=pbro" (tip)
merging devtools/client/storage/ui.js
warning: conflicts while merging devtools/client/storage/ui.js! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
Pushed by mratcliffe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7d0c5443a348
Stop storage inspector showing items that have been quickly added & removed r=pbro
https://hg.mozilla.org/mozilla-central/rev/7d0c5443a348
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 56
Backed out in https://hg.mozilla.org/mozilla-central/rev/a584b41ad399 for... being the thing I could find to back out to stop the permaorange of bug 1376281. Since this was green when it merged to mozilla-central, by rights whatever thing in https://hg.mozilla.org/mozilla-central/pushloghtml?changeset=af9a8cebd43fb23822be25c5d4d065d5e9e195b8 it was that disagreed with it should have been backed out instead, but I couldn't spot anything in there that seemed enough like a likely candidate to be worth pushing a backout to try.
Status: RESOLVED → REOPENED
Flags: needinfo?(mratcliffe)
Resolution: FIXED → ---
Target Milestone: Firefox 56 → ---
Duplicate of this bug: 1376281
See Also: → 1362747
Duplicate of this bug: 1439749
Attachment #8879945 - Attachment is obsolete: true
Flags: needinfo?(mratcliffe)
This was fixed by bug 1443461.
Status: REOPENED → RESOLVED
Has Regression Range: --- → irrelevant
Closed: 5 years ago4 years ago
Resolution: --- → WORKSFORME
Whiteboard: [todo-mr][t1]
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.