зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1267493 - Replace `isURIPotentiallyTrustworthy` usage in Push with a testing pref. r=dragana
MozReview-Commit-ID: LrjAyVeNMyI --HG-- extra : rebase_source : 7b2f821a80f853986bb196d8fc5e1eae9d77fd48
This commit is contained in:
Родитель
2e593175f4
Коммит
91fa002ac4
|
@ -31,10 +31,6 @@ const CONNECTION_PROTOCOLS = (function() {
|
|||
}
|
||||
})();
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gContentSecurityManager",
|
||||
"@mozilla.org/contentsecuritymanager;1",
|
||||
"nsIContentSecurityManager");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gPushNotifier",
|
||||
"@mozilla.org/push/Notifier;1",
|
||||
"nsIPushNotifier");
|
||||
|
@ -400,11 +396,6 @@ this.PushService = {
|
|||
return [];
|
||||
}
|
||||
|
||||
if (!gContentSecurityManager.isURIPotentiallyTrustworthy(uri)) {
|
||||
console.warn("findService: Untrusted server URI", uri.spec);
|
||||
return [];
|
||||
}
|
||||
|
||||
for (let connProtocol of CONNECTION_PROTOCOLS) {
|
||||
if (connProtocol.validServerURI(uri)) {
|
||||
service = connProtocol;
|
||||
|
|
|
@ -71,9 +71,9 @@ this.PushServiceAndroidGCM = {
|
|||
if (serverURI.scheme == "https") {
|
||||
return true;
|
||||
}
|
||||
if (prefs.get("debug") && serverURI.scheme == "http") {
|
||||
// Accept HTTP endpoints when debugging.
|
||||
return true;
|
||||
if (serverURI.scheme == "http") {
|
||||
// Allow insecure server URLs for development and testing.
|
||||
return !!prefs.get("testing.allowInsecureServerURL");
|
||||
}
|
||||
console.info("Unsupported Android GCM dom.push.serverURL scheme", serverURI.scheme);
|
||||
return false;
|
||||
|
|
|
@ -439,7 +439,10 @@ this.PushServiceHttp2 = {
|
|||
},
|
||||
|
||||
validServerURI: function(serverURI) {
|
||||
return serverURI.scheme == "http" || serverURI.scheme == "https";
|
||||
if (serverURI.scheme == "http") {
|
||||
return !!prefs.get("testing.allowInsecureServerURL");
|
||||
}
|
||||
return serverURI.scheme == "https";
|
||||
},
|
||||
|
||||
connect: function(subscriptions) {
|
||||
|
|
|
@ -257,7 +257,10 @@ this.PushServiceWebSocket = {
|
|||
},
|
||||
|
||||
validServerURI: function(serverURI) {
|
||||
return serverURI.scheme == "ws" || serverURI.scheme == "wss";
|
||||
if (serverURI.scheme == "ws") {
|
||||
return !!prefs.get("testing.allowInsecureServerURL");
|
||||
}
|
||||
return serverURI.scheme == "wss";
|
||||
},
|
||||
|
||||
get _UAID() {
|
||||
|
|
|
@ -9,8 +9,6 @@ const {PushDB, PushService, PushServiceHttp2} = serviceExports;
|
|||
|
||||
var prefs;
|
||||
var tlsProfile;
|
||||
var pushEnabled;
|
||||
var pushConnectionEnabled;
|
||||
|
||||
var serverPort = -1;
|
||||
|
||||
|
@ -21,12 +19,12 @@ function run_test() {
|
|||
dump("using port " + serverPort + "\n");
|
||||
|
||||
do_get_profile();
|
||||
setPrefs();
|
||||
setPrefs({
|
||||
'testing.allowInsecureServerURL': true,
|
||||
});
|
||||
prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
|
||||
tlsProfile = prefs.getBoolPref("network.http.spdy.enforce-tls-profile");
|
||||
pushEnabled = prefs.getBoolPref("dom.push.enabled");
|
||||
pushConnectionEnabled = prefs.getBoolPref("dom.push.connection.enabled");
|
||||
|
||||
// Set to allow the cert presented by our H2 server
|
||||
var oldPref = prefs.getIntPref("network.http.speculative-parallel-limit");
|
||||
|
@ -42,8 +40,6 @@ function run_test() {
|
|||
|
||||
prefs.setIntPref("network.http.speculative-parallel-limit", oldPref);
|
||||
|
||||
servicePrefs.set('testing.notifyWorkers', false);
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
|
@ -193,6 +189,4 @@ add_task(function* test_pushNotifications() {
|
|||
|
||||
add_task(function* test_complete() {
|
||||
prefs.setBoolPref("network.http.spdy.enforce-tls-profile", tlsProfile);
|
||||
prefs.setBoolPref("dom.push.enabled", pushEnabled);
|
||||
prefs.setBoolPref("dom.push.connection.enabled", pushConnectionEnabled);
|
||||
});
|
||||
|
|
|
@ -53,6 +53,7 @@ function run_test() {
|
|||
|
||||
do_get_profile();
|
||||
setPrefs({
|
||||
'testing.allowInsecureServerURL': true,
|
||||
'http2.retryInterval': 1000,
|
||||
'http2.maxRetries': 2
|
||||
});
|
||||
|
|
|
@ -51,8 +51,11 @@ function run_test() {
|
|||
|
||||
do_get_profile();
|
||||
|
||||
servicePrefs.set('testing.notifyWorkers', false);
|
||||
setPrefs();
|
||||
setPrefs({
|
||||
'testing.allowInsecureServerURL': true,
|
||||
'testing.notifyWorkers': false,
|
||||
'testing.notifyAllObservers': true,
|
||||
});
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ function run_test() {
|
|||
|
||||
do_get_profile();
|
||||
setPrefs({
|
||||
'testing.allowInsecureServerURL': true,
|
||||
'http2.retryInterval': 1000,
|
||||
'http2.maxRetries': 2
|
||||
});
|
||||
|
|
|
@ -44,6 +44,7 @@ function run_test() {
|
|||
|
||||
do_get_profile();
|
||||
setPrefs({
|
||||
'testing.allowInsecureServerURL': true,
|
||||
'http2.retryInterval': 1000,
|
||||
'http2.maxRetries': 2
|
||||
});
|
||||
|
|
|
@ -29,6 +29,7 @@ function run_test() {
|
|||
|
||||
do_get_profile();
|
||||
setPrefs({
|
||||
'testing.allowInsecureServerURL': true,
|
||||
'http2.retryInterval': 1000,
|
||||
'http2.maxRetries': 2
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче