| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../resources/js-test.js"></script> |
| </head> |
| <body> |
| <script> |
| |
| description("Test OffscreenCanvas transferable with exception cases."); |
| |
| var worker = new Worker('./resources/OffscreenCanvas-transferable.js'); |
| |
| var width = 50; |
| var height = 50; |
| var offscreenCanvas1 = new OffscreenCanvas(width, height); |
| |
| var ctx; |
| shouldNotThrow("ctx = offscreenCanvas1.getContext('2d')"); |
| shouldBeType("ctx", "OffscreenCanvasRenderingContext2D"); |
| shouldThrow("worker.postMessage({data: offscreenCanvas1}, [offscreenCanvas1])"); |
| |
| var offscreenCanvas2 = new OffscreenCanvas(width, height); |
| worker.postMessage({data: offscreenCanvas2}, [offscreenCanvas2]); |
| shouldThrow("offscreenCanvas2.transferToImageBitmap()"); |
| |
| shouldThrow("worker.postMessage({data: offscreenCanvas2}, [offscreenCanvas2])"); |
| shouldThrow("offscreenCanvas2.getContext('2d')"); |
| |
| finishJSTest(); |
| </script> |
| </body> |
| </html> |