Closed
Bug 662511
Opened 14 years ago
Closed 13 years ago
localStorage.key() gets out-of-sync when localStorage is updated in a separate window
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla8
People
(Reporter: scott.gonzalez, Assigned: mayhemer)
References
()
Details
(Whiteboard: [inbound])
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
jst
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.10 Safari/535.1
Build Identifier: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
If there are two windows open with pages on the same domain, localStorage.keys() won't include data written from the other page.
Reproducible: Always
Steps to Reproduce:
1. Open a window and call localStorage.clear()
2. Open another window and call localStorage.setItem( "a", "a" )
3. Go back to the first page and call localStorage.key( 0 );
Actual Results:
An error is thrown because the index is out of range.
Expected Results:
The key "a" should be returned.
Accessing localStorage.length causes the keys to update.
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
Assignee | ||
Comment 1•14 years ago
|
||
I'll write a test for this to confirm.
Assignee: nobody → honzab.moz
Assignee | ||
Comment 2•14 years ago
|
||
Confirming with this failing test.
Assignee | ||
Updated•14 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee | ||
Comment 3•14 years ago
|
||
Attachment #538356 -
Flags: review?(jst)
Assignee | ||
Updated•14 years ago
|
Attachment #538354 -
Attachment is obsolete: true
Updated•14 years ago
|
Attachment #538356 -
Flags: review?(jst) → review+
Assignee | ||
Comment 4•13 years ago
|
||
Whiteboard: [inbound]
Comment 5•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Assignee | ||
Comment 6•13 years ago
|
||
The patch for this bug has been backed out from Aurora by https://hg.mozilla.org/releases/mozilla-aurora/rev/de96bbe87419 because of bug 683316. Fix for this bug and for bug 683316 too has been landed on mozilla-central. It will be merged to Aurora in some 5 days.
Comment 7•13 years ago
|
||
I'm still saying this same basic behaviour in 11.0a1. Has this landed yet?
What I see is:
1. Open two different windows at http://trippingthebits.com/webstorage/test.html
2. Enter a local storage item in the 1st window.
3. Press dump button in the 1st window, item is shown.
3. Press dump button in the 2nd window, nothing.
4. Enter an item in the second window.
5. Press button in 2nd window, both items are shown.
Comment 8•13 years ago
|
||
I'm seeing something similar in Firefox 9.0.1.
Turn on Private Mode and then create two tabs both in http://trippingthebits.com/webstorage/test.html
Perform the following in the "local" section of the test page:
In tab 1 save test1/1 and then dump. Test1 can be seen.
In tab 2 hit dump. test1 is missing.
In tab 2 save test2/2 and then dump. Test2 is seen, but test1 is still missing.
In tab 1 hit dump. Test2 can be seen but test1 has gone!!
In tab 1 save test3/3 and hit dump. Now all three are seen.
In tab 2 hit dump. Only test 3 is seen.
Slightly different, but still incorrect, behavior is seen with non-Private Mode.
Comment 9•13 years ago
|
||
This is a similar test in non-Private mode. Create two tabs, enable Firebug in those tabs, and then load the test page in both tabs.
In tab 1 save test1/1 and then dump. Test1 can be seen.
In tab 2, hit dump. Nothing is displayed.
At Firebug command line prompt, enter localStorage.length. It's 1 !!!
At Firebug command line prompt, enter localStorage.key(0). It shows test1
Hit DUMP again, still nothing.
Why can Firebug commands see the contents of the localStorage but the JS code on the page can't?
Comment 10•13 years ago
|
||
Please ignore comment #8 and comment #9. While the problems I describe do occur when using the test page http://trippingthebits.com/webstorage/test.html, that page is not using localStorage directly (it's using a jQuery webStorage plugin). If I try the same tests on similar page which uses localStorage directly then everything behaves as expected.
Comment 11•13 years ago
|
||
Bug 715700 describes what appears to be a similar bug. However with 715700 the problem can only be seen in Private Mode and appears to have been introduced in Firefox 9.
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•