зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1169296 - Intercepting top-level document loads is not working with JAR channels. Tests. r=jdm
This commit is contained in:
Родитель
6060f671d6
Коммит
bf20132dbb
|
@ -1,2 +1,11 @@
|
|||
application.zip contains foo.txt, index.html, sw.js and manifest.webapp.
|
||||
application.zip contains:
|
||||
|
||||
- controlled.html
|
||||
- foo.txt
|
||||
- index.html
|
||||
- manifest.webapp
|
||||
- sw.js
|
||||
- test.js
|
||||
- test_doc_load_interception.js
|
||||
|
||||
Any change to one of these three files should be added to application.zip as well.
|
||||
|
|
Двоичные данные
dom/workers/test/serviceworkers/app-protocol/application.zip
Двоичные данные
dom/workers/test/serviceworkers/app-protocol/application.zip
Двоичный файл не отображается.
|
@ -3,6 +3,7 @@
|
|||
<head>
|
||||
<title>Test app for bug 1161684</title>
|
||||
<script src='test.js'></script>
|
||||
<script src='test_doc_load_interception.js'></script>
|
||||
<script type='application/javascript;version=1.7'>
|
||||
|
||||
function runTests() {
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
self.addEventListener('fetch', (event) => {
|
||||
if (event.request.url.indexOf('foo.txt') >= 0) {
|
||||
var body = 'swresponse';
|
||||
event.respondWith(new Response(body, {
|
||||
event.respondWith(new Response('swresponse', {
|
||||
headers: {'Content-Type': 'text/plain'}
|
||||
}));
|
||||
}
|
||||
|
||||
if (event.request.url.indexOf('test_doc_load_interception.js') >=0 ) {
|
||||
var scriptContent = 'alert("OK: Script modified by service worker")';
|
||||
event.respondWith(new Response(scriptContent, {
|
||||
headers: {'Content-Type': 'application/javascript'}
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
alert('KO: Should not load this file, but the sw modified version instead');
|
Загрузка…
Ссылка в новой задаче