| OLD | NEW |
| 1 self.addEventListener('fetch', function(event) { | 1 self.addEventListener('fetch', function(event) { |
| 2 var url = event.request.url; | 2 var url = event.request.url; |
| 3 if (url.indexOf('dummy-dir') == -1) { | 3 if (url.indexOf('dummy-dir') == -1) { |
| 4 return; | 4 return; |
| 5 } | 5 } |
| 6 var result = 'mode=' + event.request.mode + | 6 var result = 'mode=' + event.request.mode + |
| 7 ' credentials=' + event.request.credentials; | 7 ' credentials=' + event.request.credentials; |
| 8 if (url == 'http://127.0.0.1:8000/dummy-dir/same.html') { | 8 if (url == 'http://127.0.0.1:8000/dummy-dir/same.html') { |
| 9 event.respondWith(new Response( | 9 event.respondWith(new Response( |
| 10 result + | 10 result + |
| 11 '<link id="same-same" rel="import" ' + | 11 '<link id="same-same" rel="import" ' + |
| 12 'href="http://127.0.0.1:8000/dummy-dir/same-same.html">' + | 12 'href="http://127.0.0.1:8000/dummy-dir/same-same.html">' + |
| 13 '<link id="same-other" rel="import" ' + | 13 '<link id="same-other" rel="import" ' + |
| 14 ' href="http://localhost:8000/dummy-dir/same-other.html">')); | 14 ' href="http://localhost:8000/dummy-dir/same-other.html">')); |
| 15 } else if (url == 'http://localhost:8000/dummy-dir/other.html') { | 15 } else if (url == 'http://localhost:8000/dummy-dir/other.html') { |
| 16 event.respondWith(new Response( | 16 event.respondWith(new Response( |
| 17 result + | 17 result + |
| 18 '<link id="other-same" rel="import" ' + | 18 '<link id="other-same" rel="import" ' + |
| 19 ' href="http://127.0.0.1:8000/dummy-dir/other-same.html">' + | 19 ' href="http://127.0.0.1:8000/dummy-dir/other-same.html">' + |
| 20 '<link id="other-other" rel="import" ' + | 20 '<link id="other-other" rel="import" ' + |
| 21 ' href="http://localhost:8000/dummy-dir/other-other.html">')); | 21 ' href="http://localhost:8000/dummy-dir/other-other.html">')); |
| 22 } else { | 22 } else { |
| 23 event.respondWith(new Response(result)); | 23 event.respondWith(new Response(result)); |
| 24 } | 24 } |
| 25 }); | 25 }); |
| OLD | NEW |