2 <title>Test ImageBitmap : Transfer
</title>
4 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
5 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css">
7 <script src=
"imagebitmap_structuredclone_utils.js"></script>
8 <script type=
"text/javascript">
10 var worker
= new Worker("imagebitmap_structuredclone.js");
11 worker
.onmessage = function(event
) {
13 if (event
.data
.type
== "status") {
14 ok(event
.data
.status
, event
.data
.msg
);
15 } else if (event
.data
.type
== "finish") {
17 } else if (event
.data
.type
== "bitmap1") {
18 compareImageBitmapWithImageElement(event
.data
.bitmap
, gImage1
);
19 } else if (event
.data
.type
== "bitmap2") {
20 compareImageBitmapWithImageElement(event
.data
.bitmap
, gImage2
);
21 } else if (event
.data
.type
== "bitmap3") {
22 compareImageBitmapWithImageData(event
.data
.bitmap
, gImageData
, "Check preserving alpha");
27 ok(worker
, "Worker created successfully.");
29 prepareImageBitmaps().then(function(){
30 worker
.postMessage({"bitmap1":gImageBitmap1
, "bitmap2":gImageBitmap2
, "bitmap3":gImageBitmap3
},
31 [gImageBitmap1
, gImageBitmap2
, gImageBitmap3
]);
33 ok(gImageBitmap1
.width
== 0 && gImageBitmap1
.height
== 0,
34 "After transfer, ImageBitmap become neutered");
35 ok(gImageBitmap2
.width
== 0 && gImageBitmap2
.height
== 0,
36 "After transfer, ImageBitmap become neutered");
37 ok(gImageBitmap3
.width
== 0 && gImageBitmap3
.height
== 0,
38 "After transfer, ImageBitmap become neutered");
42 SimpleTest
.waitForExplicitFinish();
43 addLoadEvent(runTests
);