summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/chrome/printpreview_images_sw.html
blob: 78b8a0dd88fd11f0b4e17f31264887cb6533e117 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!doctype html>
<style>
  img, object, svg, input { display: block }
  div {
    content: url(nonexistent.png?1);
    width: 32px;
    height: 32px;
  }
</style>
<script>
const WORKER = "printpreview_images_sw.js";
if (location.href.includes("registered")) {
  console.log("REGISTERED");
  onload = function() {
    postMessage("ready", "*");
  }
  onbeforeunload = function() {
    navigator.serviceWorker.getRegistrations().then(function(registrations) {
      for(let registration of registrations) {
        registration.unregister()
      }
    })
    navigator.serviceWorker.unregister(WORKER);
  }
} else {
  navigator.serviceWorker.oncontrollerchange = function() {
    location.href = location.href + "?registered";
  };
  navigator.serviceWorker.register(WORKER);
}
</script>
<div></div>
<picture>
  <source srcset="nonexistent.png?2">
  <img width=32 height=32>
</picture>
<picture>
  <source srcset="nonexistent.png?3" media="print">
  <source srcset="animated.gif" media="not print">
  <img width=32 height=32>
</picture>
<img src="nonexistent.png?4" width=32 height=32>
<svg width="32" height="32">
  <image x=0 y=0 href="nonexistent.png?7" width=32 height=32></image>
</svg>
<input type="image" src="nonexistent.png?6" width=32 height=32>