gecko/dom/tests/mochitest/globalstorage/iframe_bug614116-1.html

31 lines
881 B
HTML

<!DOCTYPE html>
<html>
<body onload="loaded()">
<script>
function loaded() {
parent.postMessage("loaded", "http://mochi.test:8888");
}
function onMessageReceived(e) {
switch (e.data) {
case "getdata":
parent.postMessage("data:" + globalStorage["example.com"].data, "http://mochi.test:8888");
break;
case "setdata":
var didSucceed = true;
try {
globalStorage["example.com"].data = "value2";
} catch(e) {
didSucceed = false;
}
parent.postMessage("success:" + didSucceed, "http://mochi.test:8888");
parent.postMessage("dataset2:" + globalStorage["example.com"].data, "http://mochi.test:8888");
break;
}
}
addEventListener("message", onMessageReceived, false);
</script>
</body>
</html>