Backed out changeset ddd4b7cfd119 (bug 968273) for causing high frequency mochitest failures on browser_bug968273.js CLOSED TREE

This commit is contained in:
Aron Cseh 2024-05-17 02:52:49 +03:00
parent 385f6deeda
commit fdfa4bc02c
9 changed files with 1 additions and 142 deletions

View file

@ -13366,11 +13366,6 @@
value: 10
mirror: always
- name: network.cache.persist_permanent_redirects_http
type: bool
value: false
mirror: always
# This is used for a temporary workaround for a web-compat issue. If pref is
# true CORS preflight requests are allowed to send client certificates.
- name: network.cors_preflight.allow_client_cert

View file

@ -5091,17 +5091,7 @@ nsresult nsHttpChannel::InitCacheEntry() {
void nsHttpChannel::UpdateInhibitPersistentCachingFlag() {
// The no-store directive within the 'Cache-Control:' header indicates
// that we must not store the response in a persistent cache.
if (mResponseHead->NoStore()) {
mLoadFlags |= INHIBIT_PERSISTENT_CACHING;
return;
}
if (!StaticPrefs::network_cache_persist_permanent_redirects_http() &&
mURI->SchemeIs("http") &&
nsHttp::IsPermanentRedirect(mResponseHead->Status())) {
mLoadFlags |= INHIBIT_PERSISTENT_CACHING;
return;
}
if (mResponseHead->NoStore()) mLoadFlags |= INHIBIT_PERSISTENT_CACHING;
// Only cache SSL content on disk if the pref is set
if (!gHttpHandler->IsPersistentHttpsCachingEnabled() &&

View file

@ -73,11 +73,6 @@ support-files = [
"test_1629307.html",
"file_link_header.sjs",
"file_link_dns_prefetch.sjs",
"bug968273_new.html",
"bug968273_redirect.html",
"bug968273_redirect.html^headers^",
"file_bug968273.html",
"test_bug968273.html",
]
prefs = [
@ -198,5 +193,3 @@ support-files = [
skip-if = ["socketprocess_networking"]
["browser_test_offline_tab.js"]
["browser_bug968273.js"]

View file

@ -1,70 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function OpenCacheEntry(key, flags, lci) {
return new Promise(resolve => {
key = Services.io.newURI(key);
function CacheListener() {}
CacheListener.prototype = {
QueryInterface: ChromeUtils.generateQI(["nsICacheEntryOpenCallback"]),
onCacheEntryCheck() {
return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED;
},
onCacheEntryAvailable(entry) {
resolve(entry);
},
run() {
let storage = Services.cache2.diskCacheStorage(lci);
storage.asyncOpenURI(key, "", flags, this);
},
};
new CacheListener().run();
});
}
async function do_test_cache_persistent(https) {
let scheme = https ? "https" : "http";
let url =
scheme + "://example.com/browser/netwerk/test/browser/test_bug968273.html";
let redirectUrl =
scheme +
"://example.com/browser/netwerk/test/browser/bug968273_redirect.html";
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
let loadContextInfo = Services.loadContextInfo.custom(false, {
partitionKey: `(${scheme},example.com)`,
});
let entry = await OpenCacheEntry(
redirectUrl,
Ci.nsICacheStorage.OPEN_NORMALLY,
loadContextInfo
);
Assert.ok(
entry.persistent == https,
https
? "Permanent redirects over HTTPS can be persistent"
: "Permanent redirects over HTTP cannot be persistent"
);
BrowserTestUtils.removeTab(tab);
gBrowser.removeCurrentTab();
Services.cache2.clear();
}
add_task(async function setupTestingPref() {
await SpecialPowers.pushPrefEnv({
set: [["network.cache.persist_permanent_redirects_http", false]],
});
});
add_task(async function test_cache_persistent() {
await do_test_cache_persistent(true);
await do_test_cache_persistent(false);
});

View file

@ -1 +0,0 @@
<html><body>This is bug968273_new.html.</body></html>

View file

@ -1 +0,0 @@
<html><body>This document is redirected to bug968273_new.html.</body></html>

View file

@ -1,3 +0,0 @@
HTTP 301 Moved Permanently
Location: bug968273_new.html
Cache-Control: max-age=3600

View file

@ -1,19 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=968273
If a load has redirects, reloading the page will load the page starting with the original
URI and do the redirects again.
-->
<head>
<title>Test for Bug 968273</title>
<script>
</script>
</head>
<body>
<div id="frames">
<iframe name="child0" id="myIframe" src="bug968273_redirect.html"></iframe>
</div>
</body>
</html>

View file

@ -1,25 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=968273
If a load has redirects, reloading the page will load the page starting with the original
URI and do the redirects again.
-->
<head>
<title>Test for Bug 968273</title>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=968273">Mozilla Bug 968273</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type='application/javascript'>
window.open("file_bug968273.html");
</script>
</pre>
</body>
</html>