gecko/dom/tests/mochitest/storageevent/frameGlobalStorageMaster.html

54 lines
1.0 KiB
HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>master frame for event storage propagation</title>
<script type="text/javascript" src="interOriginFrame.js"></script>
<script type="text/javascript">
var currentStep = 1;
var gotEvent = false;
function bind()
{
document.body.addEventListener("storage", function(event)
{
gotEvent = true;
}, false);
}
function doStep()
{
switch (currentStep)
{
case 1:
var storage = globalStorage[location.host];
storage.setItem("X", "1");
storage.setItem("X", "2");
storage.setItem("X", "2");
storage.removeItem("X");
storage.removeItem("X");
storage.removeItem("Y");
storage.setItem("X", "2");
break;
case 3:
todo(gotEvent, false, "Expected no events");
return finishTest();
}
// Increase by two to distinguish each test step order
// in both master doStep and slave doStep functions.
++currentStep;
++currentStep;
return true;
}
</script>
</head>
<body onload="bind(); postMsg('frame loaded');">
</body>
</html>