summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/FileAPI/url/url_xmlhttprequest_img.html
blob: 7f26633d81eed126a2ca60e301054edbbd4d0f98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<title>FileAPI Test: Creating Blob URL via XMLHttpRequest as image source</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="author" title="JunChen Xia" href="mailto:xjconlyme@gmail.com">
<link rel="match" href="url_xmlhttprequest_img-ref.html">

<p>Test passes if there is a filled blue square.</p>

<p>
  <img id="fileDisplay">
</p>

<script src="/common/reftest-wait.js"></script>
<script>
  var http = new XMLHttpRequest();
  http.open("GET", "/images/blue96x96.png", true);
  http.responseType = "blob";
  http.onloadend = function() {
    var fileDisplay = document.querySelector("#fileDisplay");
    fileDisplay.src = window.URL.createObjectURL(http.response);
    takeScreenshot();
  };
  http.send();
</script>
</html>