mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1564221 - Remove QueryInterface parameter from MockSecurityInfo in devtools tests r=ochameau,nchevobbe
The `MockSecurityInfo` instances in the patched devtools tests are not actually being used as `nsITransportSecurityInfo` instances; while `QueryInterface` methods were generated for the them, these were never called. Additionally, the methods they are being passed to are not XPCOM-defined and therefore do not strictly require `nsITransportSecurityInfo`. In addition `NetworkHelper#parseSecurityInfo` now requires its `securityInfo` to be `QueryInterface`d to a `nsITransportSecurityInfo` before calling the function (except in the case of `MockSecurityInfo`, which is structurally similar). Differential Revision: https://phabricator.services.mozilla.com/D40521 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
3f90c2f83f
commit
810526de71
@ -324,6 +324,9 @@ NetworkResponseListener.prototype = {
|
|||||||
// was a redirect from http to https, the request object seems to contain
|
// was a redirect from http to https, the request object seems to contain
|
||||||
// security info for the https request after redirect.
|
// security info for the https request after redirect.
|
||||||
const secinfo = this.httpActivity.channel.securityInfo;
|
const secinfo = this.httpActivity.channel.securityInfo;
|
||||||
|
if (secinfo) {
|
||||||
|
secinfo.QueryInterface(Ci.nsITransportSecurityInfo);
|
||||||
|
}
|
||||||
const info = NetworkHelper.parseSecurityInfo(secinfo, this.httpActivity);
|
const info = NetworkHelper.parseSecurityInfo(secinfo, this.httpActivity);
|
||||||
|
|
||||||
let isRacing = false;
|
let isRacing = false;
|
||||||
|
@ -594,8 +594,6 @@ var NetworkHelper = {
|
|||||||
* => state === "weak"
|
* => state === "weak"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
securityInfo.QueryInterface(Ci.nsITransportSecurityInfo);
|
|
||||||
|
|
||||||
const wpl = Ci.nsIWebProgressListener;
|
const wpl = Ci.nsIWebProgressListener;
|
||||||
const NSSErrorsService = Cc["@mozilla.org/nss_errors_service;1"].getService(
|
const NSSErrorsService = Cc["@mozilla.org/nss_errors_service;1"].getService(
|
||||||
Ci.nsINSSErrorsService
|
Ci.nsINSSErrorsService
|
||||||
|
@ -31,8 +31,10 @@ const MockCertificate = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This *cannot* be used as an nsITransportSecurityInfo (since that interface is
|
||||||
|
// builtinclass) but the methods being tested aren't defined by XPCOM and aren't
|
||||||
|
// calling QueryInterface, so this usage is fine.
|
||||||
const MockSecurityInfo = {
|
const MockSecurityInfo = {
|
||||||
QueryInterface: ChromeUtils.generateQI([Ci.nsITransportSecurityInfo]),
|
|
||||||
securityState: wpl.STATE_IS_SECURE,
|
securityState: wpl.STATE_IS_SECURE,
|
||||||
errorCode: 0,
|
errorCode: 0,
|
||||||
cipherName: "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
|
cipherName: "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
|
||||||
|
@ -17,8 +17,11 @@ Object.defineProperty(this, "NetworkHelper", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const wpl = Ci.nsIWebProgressListener;
|
const wpl = Ci.nsIWebProgressListener;
|
||||||
|
|
||||||
|
// This *cannot* be used as an nsITransportSecurityInfo (since that interface is
|
||||||
|
// builtinclass) but the methods being tested aren't defined by XPCOM and aren't
|
||||||
|
// calling QueryInterface, so this usage is fine.
|
||||||
const MockSecurityInfo = {
|
const MockSecurityInfo = {
|
||||||
QueryInterface: ChromeUtils.generateQI([Ci.nsITransportSecurityInfo]),
|
|
||||||
securityState: wpl.STATE_IS_BROKEN,
|
securityState: wpl.STATE_IS_BROKEN,
|
||||||
errorCode: 0,
|
errorCode: 0,
|
||||||
// nsISSLStatus.TLS_VERSION_1_2
|
// nsISSLStatus.TLS_VERSION_1_2
|
||||||
|
@ -18,8 +18,10 @@ Object.defineProperty(this, "NetworkHelper", {
|
|||||||
|
|
||||||
const wpl = Ci.nsIWebProgressListener;
|
const wpl = Ci.nsIWebProgressListener;
|
||||||
|
|
||||||
|
// This *cannot* be used as an nsITransportSecurityInfo (since that interface is
|
||||||
|
// builtinclass) but the methods being tested aren't defined by XPCOM and aren't
|
||||||
|
// calling QueryInterface, so this usage is fine.
|
||||||
const MockSecurityInfo = {
|
const MockSecurityInfo = {
|
||||||
QueryInterface: ChromeUtils.generateQI([Ci.nsITransportSecurityInfo]),
|
|
||||||
securityState: wpl.STATE_IS_SECURE,
|
securityState: wpl.STATE_IS_SECURE,
|
||||||
errorCode: 0,
|
errorCode: 0,
|
||||||
cipherName: "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
|
cipherName: "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
|
||||||
|
Loading…
Reference in New Issue
Block a user