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/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 | 8 |
9 description("Test OffscreenCanvas transferable with exception cases."); | 9 description("Test OffscreenCanvas transferable with exception cases."); |
10 | 10 |
11 var worker = new Worker('./resources/OffscreenCanvas-transferable.js'); | 11 var worker = new Worker('./resources/OffscreenCanvas-transferable.js'); |
12 | 12 |
13 var width = 50; | 13 var width = 50; |
14 var height = 50; | 14 var height = 50; |
15 var offscreenCanvas1 = new OffscreenCanvas(width, height); | 15 var offscreenCanvas1 = new OffscreenCanvas(width, height); |
16 | 16 |
17 var ctx; | 17 var ctx; |
18 shouldNotThrow("ctx = offscreenCanvas1.getContext('2d')"); | 18 shouldNotThrow("ctx = offscreenCanvas1.getContext('2d')"); |
19 shouldBeType("ctx", "OffscreenCanvasRenderingContext2D"); | 19 shouldBeType("ctx", "OffscreenCanvasRenderingContext2D"); |
20 shouldThrow("worker.postMessage({data: offscreenCanvas1}, [offscreenCanvas1])"); | 20 shouldThrow("worker.postMessage({data: offscreenCanvas1}, [offscreenCanvas1])"); |
21 | 21 |
22 var offscreenCanvas2 = new OffscreenCanvas(width, height); | 22 var offscreenCanvas2 = new OffscreenCanvas(width, height); |
23 worker.postMessage({data: offscreenCanvas2}, [offscreenCanvas2]); | 23 worker.postMessage({data: offscreenCanvas2}, [offscreenCanvas2]); |
24 shouldThrow("offscreenCanvas2.transferToImageBitmap()"); | 24 shouldThrow("offscreenCanvas2.transferToImageBitmap()"); |
25 | 25 |
26 shouldThrow("worker.postMessage({data: offscreenCanvas2}, [offscreenCanvas2])"); | 26 shouldThrow("worker.postMessage({data: offscreenCanvas2}, [offscreenCanvas2])"); |
27 shouldThrow("offscreenCanvas2.getContext('2d')"); | 27 shouldThrow("offscreenCanvas2.getContext('2d')"); |
28 | 28 |
| 29 // using a transferred OffscreenCanvas as a source image throws. |
| 30 shouldThrow("ctx.drawImage(offscreenCanvas2, 0, 0)"); |
| 31 |
29 finishJSTest(); | 32 finishJSTest(); |
30 </script> | 33 </script> |
31 </body> | 34 </body> |
32 </html> | 35 </html> |
OLD | NEW |