OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body> |
| 4 <script src="/resources/testharness.js"></script> |
| 5 <script src="/resources/testharnessreport.js"></script> |
| 6 <script> |
| 7 |
| 8 function startTest(imageSourceElement, imageSourceType) { |
| 9 var offscreenCanvas = new OffscreenCanvas(10, 10); |
| 10 var gl = offscreenCanvas.getContext("webgl"); |
| 11 var texture = gl.createTexture(); |
| 12 gl.bindTexture(gl.TEXTURE_2D, texture); |
| 13 |
| 14 assert_throws("SecurityError", function() { |
| 15 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, imageS
ourceElement); |
| 16 }, "cross-origin " + imageSourceType + " should be tainted"); |
| 17 } |
| 18 |
| 19 var t = async_test("cross-origin image/canvas passed to Offscreen webgl texImage
2D should be thrown"); |
| 20 var image = document.createElement('img'); |
| 21 image.addEventListener("load", function() { |
| 22 t.step(function() { |
| 23 startTest(image, "image"); |
| 24 }); |
| 25 |
| 26 var canvas = document.createElement("canvas"); |
| 27 canvas.width = 10; |
| 28 canvas.height = 10; |
| 29 var context = canvas.getContext("2d"); |
| 30 // taint the canvas |
| 31 context.drawImage(image, 0, 0, 10, 10); |
| 32 t.step(function() { |
| 33 startTest(canvas, "canvas"); |
| 34 t.done(); |
| 35 }); |
| 36 |
| 37 }); |
| 38 image.src = 'http://localhost:8080/security/resources/abe.png'; |
| 39 |
| 40 var t2 = async_test("cross-origin video passed to Offscreen webgl texImage2D sho
uld be thrown"); |
| 41 var video = document.createElement('video'); |
| 42 video.src = 'http://localhost:8080/media/resources/load-video.php?name=test.ogv&
amp;type=video/ogv'; |
| 43 document.body.appendChild(video); |
| 44 video.addEventListener("playing", function() { |
| 45 t2.step(function() { |
| 46 startTest(video, "video"); |
| 47 t2.done(); |
| 48 }); |
| 49 }); |
| 50 video.play(); |
| 51 |
| 52 </script> |
| 53 </body> |
| 54 </html> |
OLD | NEW |