Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/webgl-cross-origin-ImageBitmap-blocked.html

Issue 1573173002: Make WebGL's texImage2D and texSubImage2D handle cross-origin ImageBitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layout tests includes both origin-clean and tainted-origin imagebitmap Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/webgl-cross-origin-ImageBitmap-blocked-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..caae9e4b2896f689714e8aa6ca649da6167c77ed
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/webgl-cross-origin-ImageBitmap-blocked.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="/js-test-resources/js-test.js"></script>
+<script>
+description("WebGL's tex(Sub)Image2D should throw a SecurityError exception when the ImageBitmap is not origin clean.");
+
+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;
+
+ // ImageBitmap created from a clean canvas should be origin clean
+ createImageBitmap(canvas, 0, 0, 10, 10).then(imageBitmap => {
+ bitmap = imageBitmap;
+ shouldNotThrow("gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, bitmap)");
Ken Russell (switch to Gerrit) 2016/01/12 05:03:22 Follow this up with shouldBe("gl.getError()", "gl.
xidachen 2016/01/12 13:58:37 Acknowledged.
+ shouldNotThrow("gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, bitmap)");
Ken Russell (switch to Gerrit) 2016/01/12 05:03:22 Same here.
xidachen 2016/01/12 13:58:37 Acknowledged.
+ }, () => {
+ testFailed("Unexpected failure");
+ finishJSTest();
+ });
+
+ // Testing tainted ImageBitmap
+ gl = canvas.getContext("webgl");
Ken Russell (switch to Gerrit) 2016/01/12 05:03:22 You should create a texture object and bind it to
xidachen 2016/01/12 13:58:37 Acknowledged.
+ 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)");
Ken Russell (switch to Gerrit) 2016/01/12 05:03:22 Follow this up with shouldBe("gl.getError()", "gl.
xidachen 2016/01/12 13:58:37 Acknowledged.
+ shouldThrow("gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, bitmap)");
Ken Russell (switch to Gerrit) 2016/01/12 05:03:22 Same here.
xidachen 2016/01/12 13:58:37 Acknowledged.
+ finishJSTest();
+ }, () => {
+ testFailed("Unexpected failure");
+ finishJSTest();
+ });
Ken Russell (switch to Gerrit) 2016/01/12 05:03:22 Shouldn't this entire second createImageBitmap cal
xidachen 2016/01/12 13:58:37 Acknowledged.
+});
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/webgl-cross-origin-ImageBitmap-blocked-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698