summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webmessaging/support/cross-domain-image-receive.htm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/web-platform/tests/webmessaging/support/cross-domain-image-receive.htm25
1 files changed, 25 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webmessaging/support/cross-domain-image-receive.htm b/testing/web-platform/tests/webmessaging/support/cross-domain-image-receive.htm
new file mode 100644
index 0000000000..253b34bd76
--- /dev/null
+++ b/testing/web-platform/tests/webmessaging/support/cross-domain-image-receive.htm
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+
+<html lang="en">
+<head>
+ <title>Cross-Domain image transfer test</title>
+</head>
+<script type="text/javascript" charset="utf-8">
+
+function receiver(e) {
+ var dstCanvas = document.createElement('canvas');
+ dstCanvas.width = e.data.image.width
+ dstCanvas.height = e.data.image.height
+ var dstCtx = dstCanvas.getContext('2d');
+ dstCtx.drawImage(e.data.image, 0, 0)
+ var imgData = dstCtx.getImageData(0, 0, dstCanvas.height, dstCanvas.width);
+
+ result = JSON.stringify(imgData.data);
+ e.source.postMessage(result, "*");
+}
+
+addEventListener('message', receiver, false);
+</script>
+<body>
+</body>
+</html>