зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to autoland on a CLOSED TREE
This commit is contained in:
Коммит
c6409d2d11
|
@ -10781,13 +10781,6 @@
|
|||
value: false
|
||||
mirror: always
|
||||
|
||||
# When this pref is true, we will use the HTTPS acceptable content encoding
|
||||
# list for trustworthy domains such as http://localhost
|
||||
- name: network.http.encoding.trustworthy_is_https
|
||||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Support http3 version1
|
||||
- name: network.http.http3.support_version1
|
||||
type: RelaxedAtomicBool
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "mozilla/dom/CanonicalBrowsingContext.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/nsHTTPSOnlyUtils.h"
|
||||
#include "mozilla/dom/nsMixedContentBlocker.h"
|
||||
#include "mozilla/dom/Performance.h"
|
||||
#include "mozilla/dom/PerformanceStorage.h"
|
||||
#include "mozilla/dom/ProcessIsolation.h"
|
||||
|
@ -340,10 +339,7 @@ nsresult HttpBaseChannel::Init(nsIURI* aURI, uint32_t aCaps,
|
|||
// Construct connection info object
|
||||
nsAutoCString host;
|
||||
int32_t port = -1;
|
||||
bool isHTTPS =
|
||||
StaticPrefs::network_http_encoding_trustworthy_is_https()
|
||||
? nsMixedContentBlocker::IsPotentiallyTrustworthyLoopbackURL(mURI)
|
||||
: mURI->SchemeIs("https");
|
||||
bool isHTTPS = mURI->SchemeIs("https");
|
||||
|
||||
nsresult rv = mURI->GetAsciiHost(host);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1258,12 +1254,7 @@ HttpBaseChannel::DoApplyContentConversions(nsIStreamListener* aNextListener,
|
|||
break;
|
||||
}
|
||||
|
||||
bool isHTTPS =
|
||||
StaticPrefs::network_http_encoding_trustworthy_is_https()
|
||||
? nsMixedContentBlocker::IsPotentiallyTrustworthyLoopbackURL(mURI)
|
||||
: mURI->SchemeIs("https");
|
||||
|
||||
if (gHttpHandler->IsAcceptableEncoding(val, isHTTPS)) {
|
||||
if (gHttpHandler->IsAcceptableEncoding(val, mURI->SchemeIs("https"))) {
|
||||
RefPtr<nsHTTPCompressConv> converter = new nsHTTPCompressConv();
|
||||
nsAutoCString from(val);
|
||||
ToLowerCase(from);
|
||||
|
|
|
@ -17,12 +17,15 @@ XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
|||
|
||||
var httpServer = null;
|
||||
|
||||
add_task(async function check_brotli() {
|
||||
add_task(async function test() {
|
||||
httpServer = new HttpServer();
|
||||
httpServer.registerPathHandler("/content", contentHandler);
|
||||
httpServer.start(-1);
|
||||
Services.prefs.setCharPref(
|
||||
"network.http.accept-encoding",
|
||||
"gzip, deflate, br"
|
||||
);
|
||||
|
||||
async function test() {
|
||||
let chan = NetUtil.newChannel({ uri: URL, loadUsingSystemPrincipal: true });
|
||||
let [, buff] = await new Promise(resolve => {
|
||||
chan.asyncOpen(
|
||||
|
@ -35,37 +38,7 @@ add_task(async function check_brotli() {
|
|||
)
|
||||
);
|
||||
});
|
||||
return buff;
|
||||
}
|
||||
|
||||
Services.prefs.setBoolPref(
|
||||
"network.http.encoding.trustworthy_is_https",
|
||||
true
|
||||
);
|
||||
equal(
|
||||
await test(),
|
||||
"hello",
|
||||
"Should decode brotli when trustworthy_is_https=true"
|
||||
);
|
||||
Services.prefs.setBoolPref(
|
||||
"network.http.encoding.trustworthy_is_https",
|
||||
false
|
||||
);
|
||||
equal(
|
||||
await test(),
|
||||
"\x0b\x02\x80hello\x03",
|
||||
"Should not decode brotli when trustworthy_is_https=false"
|
||||
);
|
||||
Services.prefs.setCharPref(
|
||||
"network.http.accept-encoding",
|
||||
"gzip, deflate, br"
|
||||
);
|
||||
equal(
|
||||
await test(),
|
||||
"hello",
|
||||
"Should decode brotli if we set the HTTP accept encoding to include brotli"
|
||||
);
|
||||
equal(buff, "hello");
|
||||
Services.prefs.clearUserPref("network.http.accept-encoding");
|
||||
Services.prefs.clearUserPref("network.http.encoding.trustworthy_is_https");
|
||||
await httpServer.stop();
|
||||
});
|
||||
|
|
|
@ -181,7 +181,6 @@ function run_test() {
|
|||
prefs = Services.prefs;
|
||||
cePref = prefs.getCharPref("network.http.accept-encoding");
|
||||
prefs.setCharPref("network.http.accept-encoding", "gzip, deflate, br");
|
||||
prefs.setBoolPref("network.http.encoding.trustworthy_is_https", false);
|
||||
|
||||
httpserver.registerPathHandler("/test/cegzip1", handler);
|
||||
httpserver.registerPathHandler("/test/cegzip2", handler);
|
||||
|
|
Загрузка…
Ссылка в новой задаче