blob: 3ca1c4d5a0a98919612f45d6caeb648e6573ef10 [file] [log] [blame]
<html>
<head/>
<body>
<div id="description"/>
<div id="console"/>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var console = document.getElementById("console");
var maxCount = 30;
function recieveMessage(evt) {
try {
var data = evt.data;
if (data.i == 0) {
console.innerHTML += "Done."
if (window.testRunner)
testRunner.notifyDone();
}
else {
if (data.i < maxCount) {
var success = true;
for (var j = data.i; j < maxCount; j++) {
success = success && data.a[j] == j;
if (data.a[j] != j) {
console.innerHTML += "Failure: data.i = " + data.i + " j = " + j + " data.a[j] = " + data.a[j] + "<br>";
break;
}
}
if (data.a.foobar != "FooBar")
success = false;
if (data.a.length != maxCount) {
success = false;
console.innerHTML += "FAIL: i = " + data.i + " length = " + data.a.length;
}
if (success)
console.innerHTML += "PASS: i = " + data.i + "<br>";
else
console.innerHTML += "FAIL: i = " + data.i + " array: " + JSON.stringify(data.a) + "<br>";
}
var a = [];
for (var j = data.i - 1; j < maxCount; j++) {
a[j] = j;
};
a.foobar = "FooBar";
window.postMessage({i:data.i - 1, a:a}, '*');
}
} catch (e) {
console.innerHTML += "Exception " + e + "<br>";
if (window.testRunner)
testRunner.notifyDone();
}
}
window.addEventListener('message', recieveMessage, false);
window.postMessage({i:maxCount}, '*');
</script>
</body>
</html>