зеркало из https://github.com/mozilla/pjs.git
bug 742935: fix landing problem with 717350 r=honzab
--HG-- rename : netwerk/test/unit/test_mismatch_lm.js => netwerk/test/unit/test_mismatch_last-modified.js
This commit is contained in:
Родитель
41b96f7d7f
Коммит
5987c46a63
|
@ -1986,17 +1986,20 @@ nsHttpChannel::ProcessNotModified()
|
||||||
// that cache entry so there is a fighting chance of getting things on the
|
// that cache entry so there is a fighting chance of getting things on the
|
||||||
// right track as well as disabling pipelining for that host.
|
// right track as well as disabling pipelining for that host.
|
||||||
|
|
||||||
nsCAutoString lastModified;
|
nsCAutoString lastModifiedCached;
|
||||||
nsCAutoString lastModified304;
|
nsCAutoString lastModified304;
|
||||||
|
|
||||||
rv = mCachedResponseHead->GetHeader(nsHttp::Last_Modified,
|
rv = mCachedResponseHead->GetHeader(nsHttp::Last_Modified,
|
||||||
lastModified);
|
lastModifiedCached);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv)) {
|
||||||
rv = mResponseHead->GetHeader(nsHttp::Last_Modified,
|
rv = mResponseHead->GetHeader(nsHttp::Last_Modified,
|
||||||
lastModified304);
|
lastModified304);
|
||||||
if (NS_SUCCEEDED(rv) && !lastModified304.Equals(lastModified)) {
|
}
|
||||||
|
|
||||||
|
if (NS_SUCCEEDED(rv) && !lastModified304.Equals(lastModifiedCached)) {
|
||||||
LOG(("Cache Entry and 304 Last-Modified Headers Do Not Match "
|
LOG(("Cache Entry and 304 Last-Modified Headers Do Not Match "
|
||||||
"%s and %s\n", lastModified.get(), lastModified304.get()));
|
"[%s] and [%s]\n",
|
||||||
|
lastModifiedCached.get(), lastModified304.get()));
|
||||||
|
|
||||||
mCacheEntry->Doom();
|
mCacheEntry->Doom();
|
||||||
if (mConnectionInfo)
|
if (mConnectionInfo)
|
||||||
|
@ -2004,6 +2007,7 @@ nsHttpChannel::ProcessNotModified()
|
||||||
PipelineFeedbackInfo(mConnectionInfo,
|
PipelineFeedbackInfo(mConnectionInfo,
|
||||||
nsHttpConnectionMgr::RedCorruptedContent,
|
nsHttpConnectionMgr::RedCorruptedContent,
|
||||||
nsnull, 0);
|
nsnull, 0);
|
||||||
|
Telemetry::Accumulate(Telemetry::CACHE_LM_INCONSISTENT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge any new headers with the cached response headers
|
// merge any new headers with the cached response headers
|
||||||
|
|
|
@ -19,14 +19,21 @@ var listener_3 = {
|
||||||
// this listener is used to process the the request made after
|
// this listener is used to process the the request made after
|
||||||
// the cache invalidation. it expects to see the 'right data'
|
// the cache invalidation. it expects to see the 'right data'
|
||||||
|
|
||||||
|
QueryInterface: function(iid) {
|
||||||
|
if (iid.equals(Components.interfaces.nsIStreamListener) ||
|
||||||
|
iid.equals(Components.interfaces.nsIRequestObserver) ||
|
||||||
|
iid.equals(Components.interfaces.nsISupports))
|
||||||
|
return this;
|
||||||
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||||
|
},
|
||||||
|
|
||||||
onStartRequest: function test_onStartR(request, ctx) {},
|
onStartRequest: function test_onStartR(request, ctx) {},
|
||||||
|
|
||||||
onDataAvailable: function test_ODA(request, cx, inputStream,
|
onDataAvailable: function test_ODA(request, cx, inputStream,
|
||||||
offset, count) {
|
offset, count) {
|
||||||
var data = new BinaryInputStream(inputStream).readByteArray(count);
|
var data = new BinaryInputStream(inputStream).readByteArray(count);
|
||||||
|
|
||||||
// This is 'B'
|
do_check_eq(data[0], "B".charCodeAt(0));
|
||||||
do_check_eq(data, 66);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onStopRequest: function test_onStopR(request, ctx, status) {
|
onStopRequest: function test_onStopR(request, ctx, status) {
|
||||||
|
@ -38,6 +45,14 @@ var listener_2 = {
|
||||||
// this listener is used to process the revalidation of the
|
// this listener is used to process the revalidation of the
|
||||||
// corrupted cache entry. its revalidation prompts it to be cleaned
|
// corrupted cache entry. its revalidation prompts it to be cleaned
|
||||||
|
|
||||||
|
QueryInterface: function(iid) {
|
||||||
|
if (iid.equals(Components.interfaces.nsIStreamListener) ||
|
||||||
|
iid.equals(Components.interfaces.nsIRequestObserver) ||
|
||||||
|
iid.equals(Components.interfaces.nsISupports))
|
||||||
|
return this;
|
||||||
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||||
|
},
|
||||||
|
|
||||||
onStartRequest: function test_onStartR(request, ctx) {},
|
onStartRequest: function test_onStartR(request, ctx) {},
|
||||||
|
|
||||||
onDataAvailable: function test_ODA(request, cx, inputStream,
|
onDataAvailable: function test_ODA(request, cx, inputStream,
|
||||||
|
@ -47,16 +62,14 @@ var listener_2 = {
|
||||||
// This is 'A' from a cache revalidation, but that reval will clean the cache
|
// This is 'A' from a cache revalidation, but that reval will clean the cache
|
||||||
// because of mismatched last-modified response headers
|
// because of mismatched last-modified response headers
|
||||||
|
|
||||||
do_check_eq(data, 65);
|
do_check_eq(data[0], "A".charCodeAt(0));
|
||||||
},
|
},
|
||||||
|
|
||||||
onStopRequest: function test_onStopR(request, ctx, status) {
|
onStopRequest: function test_onStopR(request, ctx, status) {
|
||||||
var channel = request.QueryInterface(Ci.nsIHttpChannel);
|
var channel = request.QueryInterface(Ci.nsIHttpChannel);
|
||||||
|
|
||||||
var chan = ios.newChannel("http://localhost:4444/test1", "", null);
|
var chan = ios.newChannel("http://localhost:4444/test1", "", null);
|
||||||
var httpChan = chan.QueryInterface(Ci.nsIHttpChannel);
|
chan.asyncOpen(listener_3, null);
|
||||||
httpChan.requestMethod = "GET";
|
|
||||||
httpChan.asyncOpen(listener_3, null);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,21 +77,27 @@ var listener_1 = {
|
||||||
// this listener processes the initial request from a empty cache.
|
// this listener processes the initial request from a empty cache.
|
||||||
// the server responds with the wrong data ('A')
|
// the server responds with the wrong data ('A')
|
||||||
|
|
||||||
|
QueryInterface: function(iid) {
|
||||||
|
if (iid.equals(Components.interfaces.nsIStreamListener) ||
|
||||||
|
iid.equals(Components.interfaces.nsIRequestObserver) ||
|
||||||
|
iid.equals(Components.interfaces.nsISupports))
|
||||||
|
return this;
|
||||||
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||||
|
},
|
||||||
|
|
||||||
onStartRequest: function test_onStartR(request, ctx) {},
|
onStartRequest: function test_onStartR(request, ctx) {},
|
||||||
|
|
||||||
onDataAvailable: function test_ODA(request, cx, inputStream,
|
onDataAvailable: function test_ODA(request, cx, inputStream,
|
||||||
offset, count) {
|
offset, count) {
|
||||||
var data = new BinaryInputStream(inputStream).readByteArray(count);
|
var data = new BinaryInputStream(inputStream).readByteArray(count);
|
||||||
do_check_eq(data, 65);
|
do_check_eq(data[0], "A".charCodeAt(0));
|
||||||
},
|
},
|
||||||
|
|
||||||
onStopRequest: function test_onStopR(request, ctx, status) {
|
onStopRequest: function test_onStopR(request, ctx, status) {
|
||||||
var channel = request.QueryInterface(Ci.nsIHttpChannel);
|
var channel = request.QueryInterface(Ci.nsIHttpChannel);
|
||||||
|
|
||||||
var chan = ios.newChannel("http://localhost:4444/test1", "", null);
|
var chan = ios.newChannel("http://localhost:4444/test1", "", null);
|
||||||
var httpChan = chan.QueryInterface(Ci.nsIHttpChannel);
|
chan.asyncOpen(listener_2, null);
|
||||||
httpChan.requestMethod = "GET";
|
|
||||||
httpChan.asyncOpen(listener_2, null);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,9 +114,7 @@ function run_test() {
|
||||||
httpserver.start(4444);
|
httpserver.start(4444);
|
||||||
|
|
||||||
var chan = ios.newChannel("http://localhost:4444/test1", "", null);
|
var chan = ios.newChannel("http://localhost:4444/test1", "", null);
|
||||||
var httpChan = chan.QueryInterface(Ci.nsIHttpChannel);
|
chan.asyncOpen(listener_1, null);
|
||||||
httpChan.requestMethod = "GET";
|
|
||||||
httpChan.asyncOpen(listener_1, null);
|
|
||||||
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
}
|
}
|
|
@ -134,7 +134,7 @@ skip-if = os == "android"
|
||||||
[test_httpsuspend.js]
|
[test_httpsuspend.js]
|
||||||
[test_idnservice.js]
|
[test_idnservice.js]
|
||||||
[test_localstreams.js]
|
[test_localstreams.js]
|
||||||
[test_mismatch_lm.js]
|
[test_mismatch_last-modified.js]
|
||||||
[test_MIME_params.js]
|
[test_MIME_params.js]
|
||||||
[test_multipart_streamconv.js]
|
[test_multipart_streamconv.js]
|
||||||
[test_multipart_streamconv_missing_lead_boundary.js]
|
[test_multipart_streamconv_missing_lead_boundary.js]
|
||||||
|
|
|
@ -235,6 +235,7 @@ HISTOGRAM(CACHE_MEMORY_SEARCH, 1, 100, 100, LINEAR, "Time to search memory cache
|
||||||
HISTOGRAM(CACHE_DISK_SEARCH, 1, 100, 100, LINEAR, "Time to search disk cache (ms)")
|
HISTOGRAM(CACHE_DISK_SEARCH, 1, 100, 100, LINEAR, "Time to search disk cache (ms)")
|
||||||
HISTOGRAM(CACHE_OFFLINE_SEARCH, 1, 100, 100, LINEAR, "Time to search offline cache (ms)")
|
HISTOGRAM(CACHE_OFFLINE_SEARCH, 1, 100, 100, LINEAR, "Time to search offline cache (ms)")
|
||||||
HISTOGRAM(HTTP_DISK_CACHE_OVERHEAD, 1, 32000000, 100, EXPONENTIAL, "HTTP Disk cache memory overhead (bytes)")
|
HISTOGRAM(HTTP_DISK_CACHE_OVERHEAD, 1, 32000000, 100, EXPONENTIAL, "HTTP Disk cache memory overhead (bytes)")
|
||||||
|
HISTOGRAM(CACHE_LM_INCONSISTENT, 0, 1, 2, BOOLEAN, "Cache discovered inconsistent last-modified entry")
|
||||||
HISTOGRAM(CACHE_SERVICE_LOCK_WAIT, 1, 10000, 10000, LINEAR, "Time spent waiting on the cache service lock (ms)")
|
HISTOGRAM(CACHE_SERVICE_LOCK_WAIT, 1, 10000, 10000, LINEAR, "Time spent waiting on the cache service lock (ms)")
|
||||||
HISTOGRAM(CACHE_SERVICE_LOCK_WAIT_MAINTHREAD, 1, 10000, 10000, LINEAR, "Time spent waiting on the cache service lock on the main thread (ms)")
|
HISTOGRAM(CACHE_SERVICE_LOCK_WAIT_MAINTHREAD, 1, 10000, 10000, LINEAR, "Time spent waiting on the cache service lock on the main thread (ms)")
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче