Bug 1169296 - Intercepting top-level document loads is not working with JAR channels. Tests. r=jdm
authorFernando Jimenez <ferjmoreno@gmail.com>
Wed, 03 Jun 2015 10:41:45 +0200
changeset 246968 c9a430de302f89f5cfd25767790770de21210085
parent 246967 54684722f9e81e86f9966090933865a3e8abdab5
child 246969 8bcfd31f7d5e5e63aa6a105f13dfcc032ccaea76
push id28848
push userryanvm@gmail.com
push dateWed, 03 Jun 2015 20:00:13 +0000
treeherdermozilla-central@0920f2325a6d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1169296
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1169296 - Intercepting top-level document loads is not working with JAR channels. Tests. r=jdm
dom/workers/test/serviceworkers/app-protocol/README.txt
dom/workers/test/serviceworkers/app-protocol/application.zip
dom/workers/test/serviceworkers/app-protocol/controlled.html
dom/workers/test/serviceworkers/app-protocol/sw.js
dom/workers/test/serviceworkers/app-protocol/test_doc_load_interception.js
--- a/dom/workers/test/serviceworkers/app-protocol/README.txt
+++ b/dom/workers/test/serviceworkers/app-protocol/README.txt
@@ -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.
index 0e914a94cf6639d4f26e47a5a26e21c0422eb82e..8fd09d1ca5442387b4f5a30c48c1f21876d60eba
GIT binary patch
literal 2724
zc$|e+3pmsJAD+vY%UqV*LDFdpVQz7fqp&D<XPR3Po7ph7n1oyoCYRH)BqR1$?s632
z=v11_Wp2qN(G4f3I!Ybaayy&)YwP^~=lu5kp6|0g&)(<rdEfW*e!gywBBBZa5clI1
zdfN`b_ecWd07zTw1J1T^@<}qvOB%ol!lM?Q@TdhL1%U5aYni)-(xNjll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i8DLiwEMv`(qA`OTNYdqP*W9VWqdM;UFH
z<q}%Ojf6ugm!#L!Ij2*-8`c$C9+eF)jgRLfY&bWiAQx@OCH$noc;$x(I(O@5(vJla
zF~<nRfWTwH;bd$C21_Cb6T?4C!5cQ3<0nUhJL|wn+&#`@=(LDHcP7beYtuEmsAx6|
zInDe?dIEc)#A)89+mH5@cpw~-A!n=ZeO~#f<(lzIdl=N4{*Dw`Ct0OYh%fwQd?N++
z5ib7Z#4W^mW59%j6-B<>F8G(TBtZJVHCvVb$UFG&8lcU)20sRGjq`6FSpkeO?(w&!
z4%%Gm{6IXb@-G{40U#SL!<%ahv>8ob1MugaU^jH`FZ>(o|6}mSkzh9-qJY2W<o^cZ
zr5FE50tJAUxj>(@478bLU)RBJE<rM^!~kEW7_>RX`~W-;^2@$e0H9GE@NbR;Z93A;
S5h%v{9}m`;Tgy=p@7rIqWc1Sj
--- a/dom/workers/test/serviceworkers/app-protocol/controlled.html
+++ b/dom/workers/test/serviceworkers/app-protocol/controlled.html
@@ -1,13 +1,14 @@
 <!DOCTYPE html>
 <html>
   <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() {
   return Promise.resolve()
     .then(navigator.serviceWorker.ready)
     .then(() => { return testFetchAppResource('swresponse'); })
     .then(done);
 }
--- a/dom/workers/test/serviceworkers/app-protocol/sw.js
+++ b/dom/workers/test/serviceworkers/app-protocol/sw.js
@@ -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'}
+    }));
+  }
 });
new file mode 100644
--- /dev/null
+++ b/dom/workers/test/serviceworkers/app-protocol/test_doc_load_interception.js
@@ -0,0 +1,1 @@
+alert('KO: Should not load this file, but the sw modified version instead');