summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/fetch/imagecache-maxage/index.html
blob: 0d4c52eeddb5af980664f5e29b105aade61ee0f0 (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
29
<!DOCTYPE html>
<script>
var width, url, width2, url2;
function maybeReport() {
  if (width !== undefined && url !== undefined &&
      width2 !== undefined && url2 !== undefined) {
    window.parent.postMessage({status: "result",
                               width,
                               width2,
                               url,
                               url2}, "*");
  }
}
onload = function() {
  width = document.querySelector("img").width;
  width2 = document.querySelector("img").width;
  maybeReport();
};
navigator.serviceWorker.onmessage = function(event) {
  if (event.data.suffix == "2") {
    url2 = event.data.url;
  } else {
    url = event.data.url;
  }
  maybeReport();
};
</script>
<img src="image.png">
<img src="image2.png">