2 <title>Test ImageBitmap : StructuredClone between main window and iframe
</title>
4 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
5 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css">
7 <div id=
"content"></div>
8 <script src=
"imagebitmap_structuredclone_utils.js"></script>
9 <script type=
"text/javascript">
12 window
.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");
26 var div
= document
.getElementById("content");
27 ok(div
, "Parent exists");
29 var ifr
= document
.createElement("iframe");
30 ifr
.addEventListener("load", iframeLoaded
);
31 ifr
.setAttribute('src', "imagebitmap_structuredclone_iframe.html");
34 function iframeLoaded() {
35 prepareImageBitmaps().then(function(){
36 ifr
.contentWindow
.postMessage({"bitmap1":gImageBitmap1
, "bitmap2":gImageBitmap2
, "bitmap3":gImageBitmap3
}, "*");
41 SimpleTest
.waitForExplicitFinish();
42 addLoadEvent(runTests
);