Bug 1302488 - Alt-Svc Hard Refresh Race r=hurley

This commit is contained in:
Patrick McManus 2016-09-13 13:24:19 -04:00
parent abfa4e2d89
commit 14f8754356
2 changed files with 11 additions and 3 deletions

View File

@ -5737,6 +5737,7 @@ nsHttpChannel::BeginConnect()
RefPtr<AltSvcMapping> mapping;
if (!mConnectionInfo && mAllowAltSvc && // per channel
!(mLoadFlags & LOAD_FRESH_CONNECTION) &&
(scheme.Equals(NS_LITERAL_CSTRING("http")) ||
scheme.Equals(NS_LITERAL_CSTRING("https"))) &&
(!proxyInfo || proxyInfo->IsDirect()) &&

View File

@ -145,7 +145,7 @@ function makeChan(origin) {
var origin;
var xaltsvc;
var retryCounter = 0;
var loadWithoutAltSvc = false;
var loadWithoutClearingMappings = false;
var nextTest;
var expectPass = true;
var waitFor = 0;
@ -180,6 +180,7 @@ Listener.prototype = {
if (waitFor != 0) {
do_check_eq(routed, "");
do_test_pending();
loadWithoutClearingMappings = true;
do_timeout(waitFor, doTest);
waitFor = 0;
xaltsvc = "NA";
@ -192,6 +193,7 @@ Listener.prototype = {
} else {
dump ("poll later for alt svc mapping\n");
do_test_pending();
loadWithoutClearingMappings = true;
do_timeout(500, doTest);
}
@ -217,8 +219,13 @@ function doTest()
if (xaltsvc != "NA") {
chan.setRequestHeader("x-altsvc", xaltsvc, false);
}
chan.loadFlags = Ci.nsIRequest.LOAD_FRESH_CONNECTION |
Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI;
if (loadWithoutClearingMappings) {
chan.loadFlags = Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI;
} else {
chan.loadFlags = Ci.nsIRequest.LOAD_FRESH_CONNECTION |
Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI;
}
loadWithoutClearingMappings = false;
chan.asyncOpen2(listener);
}