Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / serviceworker / resources / fetch-request-fallback-iframe.html
blob37c7c62ffaf38b0a906da928a56c054e04d9a873
1 <script>
2 function xhr(url) {
3 return new Promise(function(resolve, reject) {
4 var request = new XMLHttpRequest();
5 request.addEventListener(
6 'error',
7 function(event) { reject(event); });
8 request.addEventListener(
9 'load',
10 function(event) { resolve(request.response); });
11 request.open('GET', url);
12 request.send();
13 });
16 function load_image(url, cross_origin) {
17 return new Promise(function(resolve, reject) {
18 var img = document.createElement('img');
19 document.body.appendChild(img);
20 img.onload = function() {
21 resolve();
23 img.onerror = function() {
24 reject();
26 if (cross_origin != '') {
27 img.crossOrigin = cross_origin;
29 img.src = url;
30 });
32 </script>