Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <body> | |
| 4 <script src="/js-test-resources/js-test.js"></script> | |
| 5 <script> | |
| 6 description("WebGL's tex(Sub)Image2D should throw a SecurityError exception when the ImageBitmap is not origin clean."); | |
| 7 | |
| 8 window.jsTestIsAsync = true; | |
| 9 var gl; | |
| 10 var bitmap; | |
| 11 | |
| 12 var image = document.createElement('img'); | |
| 13 image.src = 'http://localhost:8080/security/resources/abe.png'; | |
| 14 | |
| 15 image.addEventListener('load', function() { | |
| 16 var canvas = document.createElement("canvas"); | |
| 17 canvas.width = 10; | |
| 18 canvas.height = 10; | |
| 19 | |
| 20 // ImageBitmap created from a clean canvas should be origin clean | |
| 21 createImageBitmap(canvas, 0, 0, 10, 10).then(imageBitmap => { | |
| 22 bitmap = imageBitmap; | |
| 23 shouldNotThrow("gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNS IGNED_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.
| |
| 24 shouldNotThrow("gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNS IGNED_BYTE, bitmap)"); | |
|
Ken Russell (switch to Gerrit)
2016/01/12 05:03:22
Same here.
xidachen
2016/01/12 13:58:37
Acknowledged.
| |
| 25 }, () => { | |
| 26 testFailed("Unexpected failure"); | |
| 27 finishJSTest(); | |
| 28 }); | |
| 29 | |
| 30 // Testing tainted ImageBitmap | |
| 31 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.
| |
| 32 createImageBitmap(image, 0, 0, 10, 10).then(imageBitmap => { | |
| 33 bitmap = imageBitmap; | |
| 34 shouldThrow("gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGN ED_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.
| |
| 35 shouldThrow("gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGN ED_BYTE, bitmap)"); | |
|
Ken Russell (switch to Gerrit)
2016/01/12 05:03:22
Same here.
xidachen
2016/01/12 13:58:37
Acknowledged.
| |
| 36 finishJSTest(); | |
| 37 }, () => { | |
| 38 testFailed("Unexpected failure"); | |
| 39 finishJSTest(); | |
| 40 }); | |
|
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.
| |
| 41 }); | |
| 42 </script> | |
| 43 </body> | |
| 44 </html> | |
| OLD | NEW |