Bug 1213151 - Part 2: Use SpecialPowers.cleanUpSTSData() in a few tests; r=jdm

This commit is contained in:
Ehsan Akhgari 2015-10-05 00:32:54 -04:00
Родитель 2aca052b56
Коммит e6a62c4d9d
6 изменённых файлов: 8 добавлений и 23 удалений

Просмотреть файл

@ -1225,11 +1225,7 @@ function test41()
ok(true, "test 41c close");
// clean up the STS state
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var thehost = ios.newURI("http://example.com", null, null);
var sss = Cc["@mozilla.org/ssservice;1"].getService(Ci.nsISiteSecurityService);
var loadContext = SpecialPowers.wrap(window)
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
@ -1237,7 +1233,7 @@ function test41()
var flags = 0;
if (loadContext.usePrivateBrowsing)
flags |= Ci.nsISocketProvider.NO_PERMANENT_STORAGE;
sss.removeState(Ci.nsISiteSecurityService.HEADER_HSTS, thehost, flags);
SpecialPowers.cleanUpSTSData("http://example.com", flags);
doTest(42);
}
}

Просмотреть файл

@ -1,6 +1,6 @@
[DEFAULT]
tags = psm
skip-if = buildapp == 'b2g' || e10s
skip-if = buildapp == 'b2g'
support-files =
nosts_bootstrap.html
nosts_bootstrap.html^headers^

Просмотреть файл

@ -47,13 +47,7 @@
document.body.removeChild(document.getElementById('ifr_' + test));
// clean up the STS state
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var thehost = ios.newURI("http://example.com", null, null);
var sss = Cc["@mozilla.org/ssservice;1"].getService(Ci.nsISiteSecurityService);
sss.removeState(Ci.nsISiteSecurityService.HEADER_HSTS, thehost, 0);
SpecialPowers.cleanUpSTSData("http://example.com");
}
function loadVerifyFrames(round) {

Просмотреть файл

@ -192,14 +192,8 @@
function clean_up_sts_state(isPrivate) {
// erase all signs that this test ran.
SimpleTest.info("Cleaning up STS data");
var ios =
Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var thehost = ios.newURI("http://example.com", null, null);
var sss =
Cc["@mozilla.org/ssservice;1"].
getService(Ci.nsISiteSecurityService);
var flags = isPrivate ? Ci.nsISocketProvider.NO_PERMANENT_STORAGE : 0
sss.removeState(Ci.nsISiteSecurityService.HEADER_HSTS, thehost, flags);
SpecialPowers.cleanUpSTSData("http://example.com", flags);
dump_STSState(isPrivate);
}

Просмотреть файл

@ -558,10 +558,11 @@ SpecialPowersObserverAPI.prototype = {
case "SPCleanUpSTSData": {
let origin = aMessage.data.origin;
let flags = aMessage.data.flags;
let uri = Services.io.newURI(origin, null, null);
let sss = Cc["@mozilla.org/ssservice;1"].
getService(Ci.nsISiteSecurityService);
sss.removeState(Ci.nsISiteSecurityService.HEADER_HSTS, uri, 0);
sss.removeState(Ci.nsISiteSecurityService.HEADER_HSTS, uri, flags);
}
case "SPLoadExtension": {

Просмотреть файл

@ -2044,8 +2044,8 @@ SpecialPowersAPI.prototype = {
this.notifyObserversInParentProcess(null, "browser:purge-domain-data", "example.com");
},
cleanUpSTSData: function(origin) {
return this._sendSyncMessage('SPCleanUpSTSData', {origin: origin});
cleanUpSTSData: function(origin, flags) {
return this._sendSyncMessage('SPCleanUpSTSData', {origin: origin, flags: flags || 0});
},
loadExtension: function(ext, handler) {