Bug 958865 - extensions/cookie/test should use standard Services.perms. r=jdm

This commit is contained in:
Magnus Melin 2014-01-12 13:06:20 +02:00
Родитель ab969604d3
Коммит 93cec0dbc6
7 изменённых файлов: 13 добавлений и 17 удалений

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

@ -21,10 +21,6 @@ XPCOMUtils.defineLazyServiceGetter(Services, "etld",
"@mozilla.org/network/effective-tld-service;1",
"nsIEffectiveTLDService");
XPCOMUtils.defineLazyServiceGetter(Services, "permissions",
"@mozilla.org/permissionmanager;1",
"nsIPermissionManager");
function do_check_throws(f, result, stack)
{
if (!stack)

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

@ -65,7 +65,7 @@ function run_test() {
var kPermissionType = "cookie";
var ALLOW_FIRST_PARTY_ONLY = 9;
// ALLOW_FIRST_PARTY_ONLY overrides
Services.permissions.add(uri1, kPermissionType, ALLOW_FIRST_PARTY_ONLY);
Services.perms.add(uri1, kPermissionType, ALLOW_FIRST_PARTY_ONLY);
do_set_cookies(uri1, channel1, true, [0, 1, 1, 2]);
Services.cookies.removeAll();
do_set_cookies(uri1, channel2, true, [0, 0, 0, 0]);
@ -104,7 +104,7 @@ function run_test() {
var kPermissionType = "cookie";
var LIMIT_THIRD_PARTY = 10;
// LIMIT_THIRD_PARTY overrides
Services.permissions.add(uri1, kPermissionType, LIMIT_THIRD_PARTY);
Services.perms.add(uri1, kPermissionType, LIMIT_THIRD_PARTY);
do_set_cookies(uri1, channel1, true, [0, 1, 2, 3]);
Services.cookies.removeAll();
do_set_cookies(uri1, channel2, true, [0, 0, 0, 0]);

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

@ -19,7 +19,7 @@ function do_run_test() {
// Set up a profile.
let profile = do_get_profile();
let pm = Services.permissions;
let pm = Services.perms;
let permURI = NetUtil.newURI("http://example.com");
let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(permURI);

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

@ -9,7 +9,7 @@ function getPrincipalFromDomain(aDomain) {
function run_test() {
let profile = do_get_profile();
let pm = Services.permissions;
let pm = Services.perms;
let perm = 'test-idn';
// We create three principal linked to IDN.

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

@ -9,7 +9,7 @@ function getPrincipalFromURIString(uriStr)
}
function run_test() {
let pm = Services.permissions;
let pm = Services.perms;
// If we add a permission to a file:// URI, the test should return true.
let principal = getPrincipalFromURIString("file:///foo/bar");

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

@ -12,20 +12,20 @@ function run_test() {
null);
// add a permission entry for that URI
Services.permissions.add(uri, kType, kCapability);
Services.perms.add(uri, kType, kCapability);
do_check_true(permission_exists(kTestAddr, kType, kCapability));
Services.permissions.removeAll();
Services.perms.removeAll();
uri = Services.io.newURI("mailto:" + kTestAddr, null, null);
Services.permissions.add(uri, kType, kCapability);
Services.perms.add(uri, kType, kCapability);
do_check_true(permission_exists(kTestAddr, kType, kCapability));
Services.permissions.removeAll();
Services.perms.removeAll();
}
function permission_exists(aHost, aType, aCapability) {
let e = Services.permissions.enumerator;
let e = Services.perms.enumerator;
while (e.hasMoreElements()) {
let perm = e.getNext().QueryInterface(Ci.nsIPermission);
if (perm.host == aHost &&

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

@ -20,7 +20,7 @@ function do_run_test() {
// Set up a profile.
let profile = do_get_profile();
let pm = Services.permissions;
let pm = Services.perms;
let now = Number(Date.now());
let permType = "test/expiration-perm";
let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
@ -68,7 +68,7 @@ function do_run_test() {
function permission_observer(generator, now, type) {
// Set up our observer object.
this.generator = generator;
this.pm = Services.permissions;
this.pm = Services.perms;
this.now = now;
this.type = type;
this.adds = 0;
@ -125,7 +125,7 @@ permission_observer.prototype = {
} else if (data == "cleared") {
// only clear once: at the end
do_check_false(this.cleared);
do_check_eq(do_count_enumerator(Services.permissions.enumerator), 0);
do_check_eq(do_count_enumerator(Services.perms.enumerator), 0);
this.cleared = true;
} else {