зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1122161 - Redirected channels should respect skip service worker flag. r=nsm
--HG-- extra : rebase_source : 959228846310fa8b44a74e8378f24c14a4f278c0
This commit is contained in:
Родитель
fc69cd94d8
Коммит
49e020876b
|
@ -27,11 +27,11 @@ skip-if = buildapp == 'b2g' # Bug 1137683
|
|||
skip-if = buildapp == 'b2g' # Bug 1137683
|
||||
[test_fetch_basic_http.html]
|
||||
[test_fetch_basic_http_sw_reroute.html]
|
||||
skip-if = true # Bug 1122161, need proper support for redirects
|
||||
skip-if = true # Bug 1170937, need fully support for redirects
|
||||
#skip-if = buildapp == 'b2g' # Bug 1137683
|
||||
[test_fetch_cors.html]
|
||||
[test_fetch_cors_sw_reroute.html]
|
||||
skip-if = true # Bug 1122161, need proper support for redirects
|
||||
skip-if = true # Bug 1170937, need fully support for redirects
|
||||
#skip-if = buildapp == 'b2g' # Bug 1137683
|
||||
[test_formdataparsing.html]
|
||||
[test_formdataparsing_sw_reroute.html]
|
||||
|
|
|
@ -140,6 +140,25 @@ fetchXHR('http://example.com/tests/dom/base/test/file_CrossSiteXHR_server.sjs?st
|
|||
finish();
|
||||
});
|
||||
|
||||
// Test that when the page fetches a url the controlling SW forces a redirect to
|
||||
// another location. This other location fetch should also be intercepted by
|
||||
// the SW.
|
||||
fetchXHR('something.txt', function(xhr) {
|
||||
my_ok(xhr.status == 200, "load should be successful");
|
||||
my_ok(xhr.responseText == "something else response body", "load should have something else");
|
||||
finish();
|
||||
});
|
||||
|
||||
// Test fetch will internally get it's SkipServiceWorker flag set. The request is
|
||||
// made from the SW through fetch(). fetch() fetches a server-side JavaScript
|
||||
// file that force a redirect. The redirect location fetch does not go through
|
||||
// the SW.
|
||||
fetchXHR('redirect_serviceworker.sjs', function(xhr) {
|
||||
my_ok(xhr.status == 200, "load should be successful");
|
||||
my_ok(xhr.responseText == "// empty worker, always succeed!\n", "load should have redirection content");
|
||||
finish();
|
||||
});
|
||||
|
||||
expectAsyncResult();
|
||||
fetch('http://example.com/tests/dom/base/test/file_CrossSiteXHR_server.sjs?status=200&allowOrigin=*')
|
||||
.then(function(res) {
|
||||
|
|
|
@ -190,4 +190,20 @@ onfetch = function(ev) {
|
|||
return new Response(body + body);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
else if (ev.request.url.includes('something.txt')) {
|
||||
ev.respondWith(Response.redirect('fetch/somethingelse.txt'));
|
||||
}
|
||||
|
||||
else if (ev.request.url.includes('somethingelse.txt')) {
|
||||
ev.respondWith(new Response('something else response body', {}));
|
||||
}
|
||||
|
||||
else if (ev.request.url.includes('redirect_serviceworker.sjs')) {
|
||||
// The redirect_serviceworker.sjs server-side JavaScript file redirects to
|
||||
// 'http://mochi.test:8888/tests/dom/workers/test/serviceworkers/worker.js'
|
||||
// The redirected fetch should not go through the SW since the original
|
||||
// fetch was initiated from a SW.
|
||||
ev.respondWith(fetch('redirect_serviceworker.sjs'));
|
||||
}
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче