<pre id="console"></pre>
<script>
log = function(msg) {
    document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
}

var image = new Image();

image.onload = function() {
    var canvas = document.createElement("canvas");
    canvas.width = 100;
    canvas.height = 100;
    var context = canvas.getContext("2d");

    context.drawImage(image, 0, 0, 100, 100);

    try {
        var imageData = context.getImageData(0,0,100,100);
        log("PASS");
    } catch (e) {
        log("FAIL");
    }

    top.postMessage('done', '*');
}

image.crossOrigin = "anonymous";
image.src = "http://localhost:8000/security/resources/abe-allow-star.py";
</script>
