Index: LayoutTests/http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html |
diff --git a/LayoutTests/http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html b/LayoutTests/http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html |
index f34afd26a077deea88504614fadf6f16bbbed027..bd0e5874becdefb01d4a013e4caf16c5837a49ec 100644 |
--- a/LayoutTests/http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html |
+++ b/LayoutTests/http/tests/security/webgl-remote-read-remote-image-blocked-no-crossorigin.html |
@@ -1,3 +1,6 @@ |
+<!doctype html> |
+<html> |
+<body> |
<pre id="console"></pre> |
<script> |
if (window.testRunner) { |
@@ -51,8 +54,11 @@ test = function(canvas, description) |
testToDataURL(canvas, description); |
} |
-var image = new Image(); |
-image.onload = function() { |
+testResource = function (resource, resourceType, continuation) |
+{ |
+ log(""); |
+ log("Testing " + resourceType + "..."); |
+ |
var canvas = document.createElement("canvas"); |
canvas.width = 100; |
canvas.height = 100; |
@@ -74,14 +80,14 @@ image.onload = function() { |
log("FAIL: Calling toDataURL() on an untainted canvas was not allowed: Threw error: " + e + "."); |
} |
- log("\n"); |
+ log(""); |
log("Tainted canvas:"); |
// Test reading from a canvas after uploading a remote image as a texture |
var texture = gl.createTexture(); |
gl.bindTexture(gl.TEXTURE_2D, texture); |
- testTexImage2D(gl, image, "image"); |
+ testTexImage2D(gl, resource, resourceType); |
- test(canvas, "remote image"); |
+ test(canvas, "remote " + resourceType); |
var dirtyCanvas = canvas; |
@@ -90,14 +96,40 @@ image.onload = function() { |
dirtyCanvas.width = 100; |
dirtyCanvas.height = 100; |
var dirtyContext = dirtyCanvas.getContext("2d"); |
- dirtyContext.drawImage(image, 0, 0, 100, 100); |
+ dirtyContext.drawImage(resource, 0, 0, 100, 100); |
testTexImage2D(gl, dirtyCanvas, "canvas"); |
test(canvas, "tainted canvas"); |
+ continuation(); |
+} |
+ |
+testImage = function () |
+{ |
+ var image = new Image(); |
+ image.onload = testResource.bind(null, image, "image", testVideo); |
+ // Notice that we forget to set the image.crossOrigin property! |
+ image.src = "http://localhost:8000/security/resources/abe-allow-star.php"; |
+} |
+ |
+testVideo = function () |
+{ |
+ var video = document.createElement('video'); |
+ video.oncanplay = testResource.bind(null, video, "video", finishUp); |
+ // No crossOrigin set here either. |
+ var name = "../../media/resources/test.ogv"; |
+ var type = "video/ogg"; |
+ video.src = "http://localhost:8000/security/resources/video-cross-origin-allow.php?name=" + name + "&type=" + type; |
+} |
+ |
+finishUp = function () |
+{ |
+ log("DONE"); |
if (window.testRunner) |
testRunner.notifyDone(); |
} |
-// Notice that we forget to set the image.crossOrigin property! |
-image.src = "http://localhost:8000/security/resources/abe-allow-star.php"; |
+ |
+testImage(); |
</script> |
+</body> |
+</html> |