mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 662511 - localStorage.key() gets out-of-sync when localStorage is updated in a separate window, r=jst
This commit is contained in:
parent
a5507482fc
commit
333edf60a8
@ -1169,8 +1169,10 @@ DOMStorageImpl::GetKey(bool aCallerSecure, PRUint32 aIndex, nsAString& aKey)
|
||||
// maybe we need to have a lazily populated key array here or
|
||||
// something?
|
||||
|
||||
if (UseDB())
|
||||
if (UseDB()) {
|
||||
mItemsCached = PR_FALSE;
|
||||
CacheKeysFromDB();
|
||||
}
|
||||
|
||||
IndexFinderData data(aCallerSecure, aIndex);
|
||||
mItems.EnumerateEntries(IndexFinder, &data);
|
||||
|
@ -49,6 +49,7 @@ include $(topsrcdir)/config/rules.mk
|
||||
_TEST_FILES = \
|
||||
frameBug624047.html \
|
||||
frameChromeSlave.html \
|
||||
frameKeySync.html \
|
||||
frameMasterEqual.html \
|
||||
frameMasterNotEqual.html \
|
||||
frameSlaveEqual.html \
|
||||
@ -67,6 +68,7 @@ _TEST_FILES = \
|
||||
test_cookieSession-phase1.html \
|
||||
test_cookieSession-phase2.html \
|
||||
test_embededNulls.html \
|
||||
test_keySync.html \
|
||||
test_localStorageBase.html \
|
||||
test_localStorageBasePrivateBrowsing.html \
|
||||
test_localStorageBaseSessionOnly.html \
|
||||
|
51
dom/tests/mochitest/localstorage/frameKeySync.html
Normal file
51
dom/tests/mochitest/localstorage/frameKeySync.html
Normal file
@ -0,0 +1,51 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>frame for localStorage test</title>
|
||||
|
||||
<script type="text/javascript" src="interOriginFrame.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var currentStep = parseInt(location.search.substring(1));
|
||||
|
||||
function doStep()
|
||||
{
|
||||
switch (currentStep)
|
||||
{
|
||||
case 1:
|
||||
localStorage.clear();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
localStorage.setItem("a", "1");
|
||||
is(localStorage["a"], "1", "Value a=1 set");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
try {
|
||||
is(localStorage.key(0), "a", "Key 'a' present in 'key' array")
|
||||
}
|
||||
catch (exc) {
|
||||
ok(false, "Shouldn't throw when accessing key(0) " + exc);
|
||||
}
|
||||
is(localStorage["a"], "1", "Value a=1 set");
|
||||
break;
|
||||
|
||||
default:
|
||||
return finishTest();
|
||||
}
|
||||
|
||||
// Increase by two to as odd number are executed in a window separate from
|
||||
// where even step are.
|
||||
++currentStep;
|
||||
++currentStep;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="postMsg('frame loaded');">
|
||||
</body>
|
||||
</html>
|
36
dom/tests/mochitest/localstorage/test_keySync.html
Normal file
36
dom/tests/mochitest/localstorage/test_keySync.html
Normal file
@ -0,0 +1,36 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>localStorage equal origins</title>
|
||||
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="interOriginTest2.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
|
||||
<!--
|
||||
This test loads two frames from the same origin, clears in one frame,
|
||||
sets a single key in another and then checks key(0) in the first frame.
|
||||
-->
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function startTest()
|
||||
{
|
||||
masterFrameOrigin = "http://example.org:80";
|
||||
slaveFrameOrigin = "http://example.org:80";
|
||||
|
||||
masterFrame.location = masterFrameOrigin + framePath + "frameKeySync.html?1";
|
||||
slaveFrame.location = slaveFrameOrigin + framePath + "frameKeySync.html?2";
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="startTest();">
|
||||
<iframe src="" name="masterFrame"></iframe>
|
||||
<iframe src="" name="slaveFrame"></iframe>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user