зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1170795
- Ignore redirect errors for synthesized cache entries. r=mayhemer
This commit is contained in:
Родитель
2e1a40399a
Коммит
3bd0da1770
|
@ -39,6 +39,12 @@ fetchXHR('synthesized-404.txt', function(xhr) {
|
|||
finish();
|
||||
});
|
||||
|
||||
fetchXHR('synthesized-308.txt', function(xhr) {
|
||||
my_ok(xhr.status == 308, "load should return 308");
|
||||
my_ok(xhr.responseText == "synthesized response body", "308 load should have synthesized response");
|
||||
finish();
|
||||
});
|
||||
|
||||
fetchXHR('synthesized-headers.txt', function(xhr) {
|
||||
my_ok(xhr.status == 200, "load should be successful");
|
||||
my_ok(xhr.getResponseHeader("X-Custom-Greeting") === "Hello", "custom header should be set");
|
||||
|
|
|
@ -13,6 +13,12 @@ onfetch = function(ev) {
|
|||
));
|
||||
}
|
||||
|
||||
else if (ev.request.url.includes("synthesized-308.txt")) {
|
||||
ev.respondWith(Promise.resolve(
|
||||
new Response("synthesized response body", { status: 308 })
|
||||
));
|
||||
}
|
||||
|
||||
else if (ev.request.url.includes("synthesized-headers.txt")) {
|
||||
ev.respondWith(Promise.resolve(
|
||||
new Response("synthesized response body", {
|
||||
|
|
|
@ -2951,8 +2951,11 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
|
|||
|
||||
// Do not return 304 responses from the cache, and also do not return
|
||||
// any other non-redirect 3xx responses from the cache (see bug 759043).
|
||||
// However, if this is a synthesized cache entry we don't care what the
|
||||
// content is and will return it regardless.
|
||||
NS_ENSURE_TRUE((mCachedResponseHead->Status() / 100 != 3) ||
|
||||
isCachedRedirect, NS_ERROR_ABORT);
|
||||
isCachedRedirect ||
|
||||
mInterceptCache == INTERCEPTED, NS_ERROR_ABORT);
|
||||
|
||||
// Don't bother to validate items that are read-only,
|
||||
// unless they are read-only because of INHIBIT_CACHING or because
|
||||
|
|
Загрузка…
Ссылка в новой задаче