mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Backed out changeset 020ac30e270a (bug 1141415) for windows mochitest bustage
--HG-- extra : source : ad064f98011b5618332389792c913247d9ebaad0
This commit is contained in:
parent
1fd9c8167b
commit
c4c70c89c7
@ -17,11 +17,6 @@ const ACCESS_SESSION = SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION;
|
||||
const ACCESS_ALLOW_FIRST_PARTY_ONLY = SpecialPowers.Ci.nsICookiePermission.ACCESS_ALLOW_FIRST_PARTY_ONLY;
|
||||
const ACCESS_LIMIT_THIRD_PARTY = SpecialPowers.Ci.nsICookiePermission.ACCESS_LIMIT_THIRD_PARTY;
|
||||
|
||||
const EXPIRE_TIME = SpecialPowers.Ci.nsIPermissionManager.EXPIRE_TIME;
|
||||
var start;
|
||||
const DELAY = 1000;
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
|
||||
function starttest(){
|
||||
SpecialPowers.addPermission("pPROMPT", PROMPT_ACTION, document);
|
||||
SpecialPowers.addPermission("pALLOW", ALLOW_ACTION, document);
|
||||
@ -141,42 +136,9 @@ function test6() {
|
||||
dump('/**** pTHIRDPARTY still set ****/\n');
|
||||
setTimeout(test6, 0);
|
||||
} else {
|
||||
test7();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function test7() {
|
||||
start = Number(Date.now());
|
||||
SpecialPowers.addPermission('pEXPIRE', true, document, EXPIRE_TIME, start + DELAY);
|
||||
testExpiredPermission(test8);
|
||||
}
|
||||
|
||||
function test8() {
|
||||
start = Number(Date.now());
|
||||
SpecialPowers.pushPermissions([
|
||||
{ 'type': 'pEXPIRE',
|
||||
'allow': true,
|
||||
'expireType': EXPIRE_TIME,
|
||||
'expireTime': start + DELAY,
|
||||
'context': document
|
||||
}], function() {
|
||||
testExpiredPermission(SimpleTest.finish);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function testExpiredPermission(callback) {
|
||||
var now = Number(Date.now());
|
||||
if (now < start + DELAY) {
|
||||
ok(SpecialPowers.testPermission('pEXPIRE', ALLOW_ACTION, document), 'unexpired permission is still there');
|
||||
setTimeout(function() {testExpiredPermission(callback)}, DELAY);
|
||||
return;
|
||||
}
|
||||
|
||||
ok(!SpecialPowers.testPermission('pEXPIRE', ALLOW_ACTION, document), 'expired permission is cleared');
|
||||
|
||||
callback();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -318,7 +318,7 @@ SpecialPowersObserverAPI.prototype = {
|
||||
|
||||
switch (msg.op) {
|
||||
case "add":
|
||||
Services.perms.addFromPrincipal(principal, msg.type, msg.permission, msg.expireType, msg.expireTime);
|
||||
Services.perms.addFromPrincipal(principal, msg.type, msg.permission);
|
||||
break;
|
||||
case "remove":
|
||||
Services.perms.removeFromPrincipal(principal, msg.type);
|
||||
|
@ -806,26 +806,14 @@ SpecialPowersAPI.prototype = {
|
||||
continue;
|
||||
}
|
||||
|
||||
var todo = {'op': 'add',
|
||||
'type': permission.type,
|
||||
'permission': perm,
|
||||
'value': perm,
|
||||
'url': url,
|
||||
'appId': appId,
|
||||
'isInBrowserElement': isInBrowserElement,
|
||||
'expireType': (typeof permission.expireType === "number") ?
|
||||
permission.expireType : 0, // default: EXPIRE_NEVER
|
||||
'expireTime': (typeof permission.expireTime === "number") ?
|
||||
permission.expireTime : 0};
|
||||
|
||||
var cleanupTodo = Object.assign({}, todo);
|
||||
|
||||
var todo = {'op': 'add', 'type': permission.type, 'permission': perm, 'value': perm, 'url': url, 'appId': appId, 'isInBrowserElement': isInBrowserElement};
|
||||
if (permission.remove == true)
|
||||
todo.op = 'remove';
|
||||
|
||||
pendingPermissions.push(todo);
|
||||
|
||||
/* Push original permissions value or clear into cleanup array */
|
||||
var cleanupTodo = {'op': 'add', 'type': permission.type, 'permission': perm, 'value': perm, 'url': url, 'appId': appId, 'isInBrowserElement': isInBrowserElement};
|
||||
if (originalValue == Ci.nsIPermissionManager.UNKNOWN_ACTION) {
|
||||
cleanupTodo.op = 'remove';
|
||||
} else {
|
||||
@ -1878,7 +1866,7 @@ SpecialPowersAPI.prototype = {
|
||||
return [ url, appId, isInBrowserElement, isSystem ];
|
||||
},
|
||||
|
||||
addPermission: function(type, allow, arg, expireType, expireTime) {
|
||||
addPermission: function(type, allow, arg) {
|
||||
let [url, appId, isInBrowserElement, isSystem] = this._getInfoFromPermissionArg(arg);
|
||||
if (isSystem) {
|
||||
return; // nothing to do
|
||||
@ -1898,9 +1886,7 @@ SpecialPowersAPI.prototype = {
|
||||
'permission': permission,
|
||||
'url': url,
|
||||
'appId': appId,
|
||||
'isInBrowserElement': isInBrowserElement,
|
||||
'expireType': (typeof expireType === "number") ? expireType : 0,
|
||||
'expireTime': (typeof expireTime === "number") ? expireTime : 0
|
||||
'isInBrowserElement': isInBrowserElement
|
||||
};
|
||||
|
||||
this._sendSyncMessage('SPPermissionManager', msg);
|
||||
|
Loading…
Reference in New Issue
Block a user