StorageEvent is not always fired

RESOLVED WORKSFORME

Status

()

Core
DOM
RESOLVED WORKSFORME
7 years ago
7 years ago

People

(Reporter: Alexander Kovalev, Unassigned)

Tracking

5 Branch
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0.1) Gecko/20100101 Firefox/5.0.1
Build ID: 20110707182747

Steps to reproduce:

I have two separate browser windows. Each window listens to `storage` event. 
But `storage` event is not fired always. I expect `storage` event to be fired every time I change the value of `id` property in localStorage

   localStorage.setItem('id', uid);

Each window has its own uid. But the `storage` event is triggred only twice. When the first window updates localStorage, and when the second window updates it for the first time.

Firefox 5.0.1. Mac OS X.

PS
http://jsfiddle.net/alexanderk/sQXsu/show/
This is the demo page which illistrates this bug.
Open two firefox windows with firebug.
Start clicking on "Update local storage" in one window and another.
You will see that `storage` event is fired only twice

I have tested this page in Safari, Chrome, Opera -- everything works fine.




Actual results:

`storage` event was not triggered every time localStorage was modified


Expected results:

`storage` event is supposed to be triggered every time localStorage is modified
(Reporter)

Comment 1

7 years ago
I worked around this problem by clearing value of key I'm updating before setting new value.

  localStorage.removeItem('key');
  localStorage.setItem('key', uid);

It looks like previous values are cached
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general

Comment 2

7 years ago
Have you tried to see if the issue is reproducing on the latest firefox?
http://www.mozilla.org/en-US/firefox/new/
(Reporter)

Comment 3

7 years ago
no, I didn't.

Comment 4

7 years ago
Please do so.

Comment 5

7 years ago
Confirmed in trunk.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 6

7 years ago
I believe this has been fixed by bug 683316, because I could reproduce this on a build from Sept 22, but not on Sept 25.

Comment 7

7 years ago
Storage event is only fired if the value actually changes.  I don't know if this is correct or not according to the spec.  This is the behaviour I still see.

Comment 8

7 years ago
I can no longer reproduce the behaviour described in comment 0 (when once I could), so WFM.
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.