gecko/dom/tests/mochitest/localstorage/test_bug624047.html

66 lines
1.7 KiB
HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>bug 624047</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="interOriginTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript">
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
/*
This test does the folliwing:
- loads a page in an iframe that stores a value to localStorage
- sooner then in 5 seconds reloads the page
- now the page later then 5 seconds after load in the first step checks the
value is still present in localStorage (what is expected)
- if not, the bug is still present
*/
function flushTables()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var storageManager = Components.classes["@mozilla.org/dom/storagemanager;1"]
.getService(Components.interfaces.nsIObserver);
storageManager.observe(null, "profile-before-change", null);
}
function startTest()
{
slaveOrigin = "http://sub2.test2.example.org";
slave = document.getElementById("__test_frame").contentWindow;
flushTables();
slave.location = slaveOrigin + slavePath + "frameBug624047.html";
setTimeout(function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
slaveLoadsPending = 1;
slave.location.reload();
}, 2000);
}
function doNextTest()
{
SimpleTest.finish();
}
function doStep()
{
}
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body onload="startTest();">
This test takes about 15s to complete... Please wait...
<br/>
<iframe src="" id="__test_frame"></iframe>
</body>
</html>