Backed out 2 changesets (bug 1814961) for causing xpcshell failures on test_rcwn_interrupted.js. CLOSED TREE

Backed out changeset dafb2e6890e1 (bug 1814961)
Backed out changeset 85190e2952da (bug 1814961)
This commit is contained in:
Cosmin Sabou 2023-02-13 19:03:45 +02:00
Родитель e610003ae1
Коммит d54d7ed518
3 изменённых файлов: 6 добавлений и 116 удалений

Просмотреть файл

@ -7768,11 +7768,6 @@ nsresult nsHttpChannel::ContinueOnStopRequest(nsresult aStatus, bool aIsFromNet,
mCachedContentIsValid = false;
StoreCachedContentIsPartial(1);
// We are about to perform a different network request.
// We must set mRaceCacheWithNetwork to false because otherwise
// we would ignore the network response thinking we didn't need it.
mRaceCacheWithNetwork = false;
// Perform the range request
rv = ContinueConnect();
if (NS_SUCCEEDED(rv)) {
@ -9369,11 +9364,7 @@ void nsHttpChannel::ReportNetVSCacheTelemetry() {
NS_IMETHODIMP
nsHttpChannel::Test_delayCacheEntryOpeningBy(int32_t aTimeout) {
MOZ_ASSERT(NS_IsMainThread(), "Must be called on the main thread");
mRaceCacheWithNetwork = true;
mCacheOpenDelay = aTimeout;
if (mCacheOpenTimer) {
mCacheOpenTimer->SetDelay(aTimeout);
}
return NS_OK;
}
@ -9478,11 +9469,13 @@ nsresult nsHttpChannel::TriggerNetwork() {
// If |mCacheOpenFunc| is assigned, we're delaying opening the entry to
// simulate racing. Although cache entry opening hasn't started yet, we're
// actually racing, so we must set mRaceCacheWithNetwork to true now.
mRaceCacheWithNetwork =
AwaitingCacheCallbacks() &&
(mCacheOpenFunc || StaticPrefs::network_http_rcwn_enabled());
if (mCacheOpenFunc) {
mRaceCacheWithNetwork = true;
} else if (AwaitingCacheCallbacks()) {
mRaceCacheWithNetwork = StaticPrefs::network_http_rcwn_enabled();
}
LOG((" triggering network rcwn=%d\n", bool(mRaceCacheWithNetwork)));
LOG((" triggering network\n"));
return ContinueConnect();
}

Просмотреть файл

@ -1,102 +0,0 @@
/*
Checkes if the concurrent cache read/write works when the write is interrupted because of max-entry-size limits.
This is enhancement of 29a test, this test checks that cocurrency is resumed when the first channel is interrupted
in the middle of reading and the second channel already consumed some content from the cache entry.
This test is using a resumable response.
- with a profile, set max-entry-size to 1 (=1024 bytes)
- first channel makes a request for a resumable response
- second channel makes a request for the same resource, concurrent read happens
- first channel sets predicted data size on the entry with every chunk, it's doomed on 1024
- second channel now must engage interrupted concurrent write algorithm and read the rest of the content from the network
- both channels must deliver full content w/o errors
*/
"use strict";
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
var httpProtocolHandler = Cc[
"@mozilla.org/network/protocol;1?name=http"
].getService(Ci.nsIHttpProtocolHandler);
XPCOMUtils.defineLazyGetter(this, "URL", function() {
return "http://localhost:" + httpServer.identity.primaryPort;
});
var httpServer = null;
function make_channel(url, callback, ctx) {
return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true });
}
// need something bigger than 1024 bytes
const responseBody =
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
function contentHandler(metadata, response) {
response.processAsync();
do_timeout(500, () => {
response.setHeader("Content-Type", "text/plain");
response.setHeader("ETag", "Just testing");
response.setHeader("Cache-Control", "max-age=99999");
response.setHeader("Accept-Ranges", "bytes");
response.setHeader("Content-Length", "" + responseBody.length);
if (metadata.hasHeader("If-Range")) {
response.setStatusLine(metadata.httpVersion, 206, "Partial Content");
let len = responseBody.length;
response.setHeader("Content-Range", "0-" + (len - 1) + "/" + len);
}
response.bodyOutputStream.write(responseBody, responseBody.length);
response.finish();
});
}
function run_test() {
// Static check
Assert.ok(responseBody.length > 1024);
do_get_profile();
Services.prefs.setIntPref("browser.cache.disk.max_entry_size", 1);
Services.prefs.setBoolPref("network.http.rcwn.enabled", false);
httpServer = new HttpServer();
httpServer.registerPathHandler("/content", contentHandler);
httpServer.start(-1);
httpProtocolHandler.EnsureHSTSDataReady().then(function() {
var chan1 = make_channel(URL + "/content");
chan1.asyncOpen(new ChannelListener(firstTimeThrough, null));
var chan2 = make_channel(URL + "/content");
chan2
.QueryInterface(Ci.nsIRaceCacheWithNetwork)
.test_delayCacheEntryOpeningBy(30);
chan2.asyncOpen(new ChannelListener(secondTimeThrough, null));
chan2.QueryInterface(Ci.nsIRaceCacheWithNetwork).test_triggerNetwork(20);
});
do_test_pending();
}
function firstTimeThrough(request, buffer) {
Assert.equal(buffer, responseBody);
}
function secondTimeThrough(request, buffer) {
Assert.equal(buffer, responseBody);
httpServer.stop(do_test_finished);
}

Просмотреть файл

@ -409,7 +409,6 @@ skip-if = os == "win" && os_version == "6.1" && bits == 32 # fails on Win7
skip-if = os == "win" && os_version == "6.1" && bits == 32 # fails on Win7
[test_race_cache_with_network.js]
[test_rcwn_always_cache_new_content.js]
[test_rcwn_interrupted.js]
[test_channel_priority.js]
[test_bug1312774_http1.js]
[test_bug1312782_http1.js]