Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/security/webgl-cross-origin-ImageBitmap-blocked.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/webgl-cross-origin-ImageBitmap-blocked.html b/third_party/WebKit/LayoutTests/http/tests/security/webgl-cross-origin-ImageBitmap-blocked.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1f64c6e97923fac5ef036babadfeea85d89f6223 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/webgl-cross-origin-ImageBitmap-blocked.html |
| @@ -0,0 +1,32 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<body> |
| +<script src="/js-test-resources/js-test.js"></script> |
| +<script> |
| +description("WebGL's texImage2D should throw security error when the ImageBitmap is not origin clean."); |
|
Justin Novosad
2016/01/11 21:08:53
Nit: "throw security error" -> "throw a SecurityEr
xidachen
2016/01/12 02:35:50
Acknowledged.
|
| + |
| +window.jsTestIsAsync = true; |
| +var gl; |
| +var bitmap; |
| + |
| +var image = document.createElement('img'); |
| +image.src = 'http://localhost:8080/security/resources/abe.png'; |
| + |
| +image.addEventListener('load', function() { |
| + var canvas = document.createElement("canvas"); |
| + canvas.width = 10; |
| + canvas.height = 10; |
| + |
| + gl = canvas.getContext("webgl"); |
| + createImageBitmap(image, 0, 0, 10, 10).then(imageBitmap => { |
| + bitmap = imageBitmap; |
| + shouldThrow("gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, bitmap)"); |
|
Justin Novosad
2016/01/11 21:08:53
I think you should make a call to texImage2D that
xidachen
2016/01/12 02:35:50
Acknowledged.
|
| + finishJSTest(); |
| + }, () => { |
| + testFailed("Unexpected failure"); |
| + finishJSTest(); |
| + }); |
| +}); |
| +</script> |
| +</body> |
| +</html> |