blob: f3f9f4bb629bd464ceadfa1dc970a4750506de5e [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
description('Tests that serialized image buffers account for neutered state.');
window.jsTestIsAsync = true;
function checkState(state) {
var elementCount = state.width * state.height;
for (var i = 0; i < elementCount; ++i) {
if (state.data[i] != 0) {
testFailed("Found non-zero data.");
finishJSTest();
return;
}
}
testPassed("Found only zeros.");
finishJSTest();
}
function runTest() {
if (window.testRunner) {
testRunner.dumpAsText(true);
testRunner.waitUntilDone();
}
var id = new ImageData(1, 256);
// This will neuter the data buffer.
postMessage("", "*", [id.data.buffer]);
history.pushState(id, "");
setTimeout(function() {
checkState(history.state);
}, 0);
}
</script>
</head>
<body onload="runTest()">
</body>
</html>