diff --git a/dom/workers/test/serviceworkers/mochitest.ini b/dom/workers/test/serviceworkers/mochitest.ini
index aaa955898c4..d0f642c2bb6 100644
--- a/dom/workers/test/serviceworkers/mochitest.ini
+++ b/dom/workers/test/serviceworkers/mochitest.ini
@@ -162,6 +162,8 @@ support-files =
eventsource/*
sw_clients/file_blob_upload_frame.html
redirect_post.sjs
+ xslt_worker.js
+ xslt/*
[test_app_protocol.html]
skip-if = release_build
@@ -250,6 +252,7 @@ skip-if = toolkit == "android" || toolkit == "gonk"
[test_workerupdatefoundevent.html]
[test_opaque_intercept.html]
[test_fetch_event_client_postmessage.html]
+[test_xslt.html]
[test_escapedSlashes.html]
[test_eventsource_intercept.html]
[test_not_intercept_plugin.html]
diff --git a/dom/workers/test/serviceworkers/test_xslt.html b/dom/workers/test/serviceworkers/test_xslt.html
new file mode 100644
index 00000000000..be56f50865a
--- /dev/null
+++ b/dom/workers/test/serviceworkers/test_xslt.html
@@ -0,0 +1,113 @@
+
+
+
+
+ Bug 1182113 - Test service worker XSLT interception
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/workers/test/serviceworkers/xslt/test.xml b/dom/workers/test/serviceworkers/xslt/test.xml
new file mode 100644
index 00000000000..83c7776339a
--- /dev/null
+++ b/dom/workers/test/serviceworkers/xslt/test.xml
@@ -0,0 +1,6 @@
+
+
+
+ Example
+ Error
+
diff --git a/dom/workers/test/serviceworkers/xslt/xslt.sjs b/dom/workers/test/serviceworkers/xslt/xslt.sjs
new file mode 100644
index 00000000000..db681ab5001
--- /dev/null
+++ b/dom/workers/test/serviceworkers/xslt/xslt.sjs
@@ -0,0 +1,12 @@
+function handleRequest(request, response) {
+ response.setHeader("Content-Type", "application/xslt+xml", false);
+ response.setHeader("Access-Control-Allow-Origin", "*");
+
+ var body = request.queryString;
+ if (!body) {
+ response.setStatusLine(null, 500, "Invalid querystring");
+ return;
+ }
+
+ response.write(unescape(body));
+}
diff --git a/dom/workers/test/serviceworkers/xslt_worker.js b/dom/workers/test/serviceworkers/xslt_worker.js
new file mode 100644
index 00000000000..bf9bdbc566b
--- /dev/null
+++ b/dom/workers/test/serviceworkers/xslt_worker.js
@@ -0,0 +1,52 @@
+var testType = 'synthetic';
+
+var xslt = " " +
+ "" +
+ " " +
+ " " +
+ " " +
+ " " +
+ " " +
+ " " +
+ "";
+
+onfetch = function(event) {
+ if (event.request.url.includes('test.xsl')) {
+ if (testType == 'synthetic') {
+ if (event.request.mode != 'cors') {
+ event.respondWith(Response.error());
+ return;
+ }
+
+ event.respondWith(Promise.resolve(
+ new Response(xslt, { headers: {'Content-Type': 'application/xslt+xml'}})
+ ));
+ }
+ else if (testType == 'cors') {
+ if (event.request.mode != 'cors') {
+ event.respondWith(Response.error());
+ return;
+ }
+
+ var url = "http://example.com/tests/dom/workers/test/serviceworkers/xslt/xslt.sjs?" + escape(xslt);
+ event.respondWith(fetch(url, { mode: 'cors' }));
+ }
+ else if (testType == 'opaque') {
+ if (event.request.mode != 'cors') {
+ event.respondWith(Response.error());
+ return;
+ }
+
+ var url = "http://example.com/tests/dom/workers/test/serviceworkers/xslt/xslt.sjs?" + escape(xslt);
+ event.respondWith(fetch(url, { mode: 'no-cors' }));
+ }
+ else {
+ event.respondWith(Response.error());
+ }
+ }
+};
+
+onmessage = function(event) {
+ testType = event.data;
+};