| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 <script> | 8 <script> |
| 9 function createCanvas(width, height) { | 9 function createCanvas(width, height) { |
| 10 var canvas = document.createElement("canvas"); | 10 var canvas = document.createElement("canvas"); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 test(function() { | 40 test(function() { |
| 41 var canvas3 = createCanvas(10, 10); | 41 var canvas3 = createCanvas(10, 10); |
| 42 var offscreenCanvas3 = canvas3.transferControlToOffscreen(); | 42 var offscreenCanvas3 = canvas3.transferControlToOffscreen(); |
| 43 assert_equals(offscreenCanvas3.width, 10); | 43 assert_equals(offscreenCanvas3.width, 10); |
| 44 assert_equals(offscreenCanvas3.height, 10); | 44 assert_equals(offscreenCanvas3.height, 10); |
| 45 assert_throws("InvalidStateError", function() { offscreenCanvas3.width = 20;
}); | 45 assert_throws("InvalidStateError", function() { offscreenCanvas3.width = 20;
}); |
| 46 assert_throws("InvalidStateError", function() { offscreenCanvas3.height = 20
; }); | 46 assert_throws("InvalidStateError", function() { offscreenCanvas3.height = 20
; }); |
| 47 }, "Test if resizing on offscreencanvas transferred from html canvas has thrown
exceptions."); | 47 }, "Test if resizing on offscreencanvas transferred from html canvas has thrown
exceptions."); |
| 48 | 48 |
| 49 test(function() { | |
| 50 var canvas4 = createCanvas(10, 10); | |
| 51 var offscreenCanvas4 = canvas4.transferControlToOffscreen(); | |
| 52 assert_throws("InvalidStateError", function() { | |
| 53 canvas4.getContext("2d"); | |
| 54 }, "canvas.getContext() is not allowed after transferring control to offscre
en."); | |
| 55 assert_throws("InvalidStateError", function() { | |
| 56 canvas4.height = 20; | |
| 57 }, "canvas resizing height is not allowed after transferring control to offs
creen."); | |
| 58 assert_throws("InvalidStateError", function() { | |
| 59 canvas4.width = 20; | |
| 60 }, "canvas resizing width is not allowed after transferring control to offsc
reen."); | |
| 61 assert_throws("InvalidStateError", function() { | |
| 62 canvas4.toBlob(function() {}); | |
| 63 }, "canvas.toBlob is not allowed after transferring control to offscreen."); | |
| 64 assert_throws("InvalidStateError", function() { | |
| 65 canvas4.toDataURL(); | |
| 66 }, "canvas.toDataURL is not allowed after transferring control to offscreen.
"); | |
| 67 }, "Test if modifying canvas after it transfers controls to offscreen throw exce
ptions"); | |
| 68 | |
| 69 </script> | 49 </script> |
| 70 </body> | 50 </body> |
| 71 </html> | 51 </html> |
| OLD | NEW |