зеркало из https://github.com/mozilla/pjs.git
57 строки
968 B
HTML
57 строки
968 B
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>slave for storage event propagation</title>
|
|
|
|
<script type="text/javascript" src="interOriginFrame.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
var currentStep = 2;
|
|
|
|
var events = [];
|
|
|
|
function bind()
|
|
{
|
|
document.body.addEventListener("storage", function(event)
|
|
{
|
|
events.push(event);
|
|
}, false);
|
|
}
|
|
|
|
function doStep()
|
|
{
|
|
function checkEvent()
|
|
{
|
|
var event = events.shift();
|
|
ok(event);
|
|
if (!event)
|
|
return;
|
|
is(event.domain, "example.com");
|
|
}
|
|
|
|
switch (currentStep)
|
|
{
|
|
case 2:
|
|
is(events.length, 4, "Expected 5 events");
|
|
checkEvent();
|
|
checkEvent();
|
|
checkEvent();
|
|
checkEvent();
|
|
break;
|
|
}
|
|
|
|
// 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>
|