Closed Bug 687054 Opened 13 years ago Closed 13 years ago

StorageEvent is not always fired

Categories

(Core :: DOM: Core & HTML, defect)

5 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: alexander.kovaleff, Unassigned)

Details

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
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
Have you tried to see if the issue is reproducing on the latest firefox?
http://www.mozilla.org/en-US/firefox/new/
no, I didn't.
Please do so.
Confirmed in trunk.
Status: UNCONFIRMED → NEW
Ever confirmed: true
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.
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.
I can no longer reproduce the behaviour described in comment 0 (when once I could), so WFM.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.