зеркало из https://github.com/mozilla/pjs.git
r=me From mvl - fix phoenix bustage on popup blocking
This commit is contained in:
Родитель
925955c81d
Коммит
b647e99aa7
|
@ -2808,7 +2808,6 @@ function focusSearchBar()
|
|||
}
|
||||
}
|
||||
|
||||
const IMAGEPERMISSION = 1;
|
||||
function nsContextMenu( xulMenu ) {
|
||||
this.target = null;
|
||||
this.menu = null;
|
||||
|
@ -3313,16 +3312,26 @@ nsContextMenu.prototype = {
|
|||
saveURL( this.imageURL, null, "SaveImageTitle", false );
|
||||
},
|
||||
toggleImageBlocking : function (aBlock) {
|
||||
var nsIPermissionManager = Components.interfaces.nsIPermissionManager;
|
||||
var permissionmanager =
|
||||
Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(nsIPermissionManager);
|
||||
var uri = Components.classes["@mozilla.org/network/standard-url;1"]
|
||||
.createInstance(Components.interfaces.nsIURI);
|
||||
uri.spec = this.imageURL;
|
||||
permissionmanager.add(uri,
|
||||
nsIPermissionManager.IMAGE_TYPE,
|
||||
aBlock ? nsIPermissionManager.DENY_ACTION : nsIPermissionManager.ALLOW_ACTION);
|
||||
},
|
||||
isImageBlocked : function() {
|
||||
var nsIPermissionManager = Components.interfaces.nsIPermissionManager;
|
||||
var permissionmanager =
|
||||
Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager);
|
||||
permissionmanager.add(this.imageURL, !aBlock, IMAGEPERMISSION);
|
||||
},
|
||||
isImageBlocked : function() {
|
||||
var permissionmanager =
|
||||
Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager);
|
||||
return permissionmanager.testForBlocking(this.imageURL, IMAGEPERMISSION);
|
||||
var uri = Components.classes["@mozilla.org/network/standard-url;1"]
|
||||
.createInstance(Components.interfaces.nsIURI);
|
||||
uri.spec = this.imageURL;
|
||||
return permissionmanager.testPermission(uri, nsIPermissionManager.IMAGE_TYPE);
|
||||
},
|
||||
// Generate email address and put it on clipboard.
|
||||
copyEmail : function () {
|
||||
|
|
|
@ -42,6 +42,8 @@ var gImagesPref, gImagesEnabled, gImagesRestricted;
|
|||
var policyButton = null;
|
||||
var manageTree = null;
|
||||
|
||||
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
|
||||
|
||||
function Startup()
|
||||
{
|
||||
policyButton = document.getElementById("popupPolicy");
|
||||
|
@ -299,7 +301,7 @@ function AddPermission() {
|
|||
var nameToURI = name.value.replace(" ", "");
|
||||
var uri = Components.classes['@mozilla.org/network/standard-url;1'].createInstance(Components.interfaces.nsIURI);
|
||||
uri.spec = nameToURI;
|
||||
popupmanager.add(uri, true);
|
||||
permissionmanager.add(uri, nsIPermissionManager.POPUP_TYPE, nsIPermissionManager.ALLOW_ACTION);
|
||||
loadPermissions();
|
||||
}
|
||||
|
||||
|
@ -322,13 +324,7 @@ function FinalizePermissionDeletions() {
|
|||
.getService(Components.interfaces.nsIIOService);
|
||||
|
||||
for (var p=0; p<deletedPermissions.length; p++) {
|
||||
if (deletedPermissions[p].type == 2) {
|
||||
// we lost the URI's original scheme, but this will do because the scheme
|
||||
// is stripped later anyway.
|
||||
var uri = ioService.newURI("http://"+deletedPermissions[p].host, null, null);
|
||||
popupmanager.remove(uri);
|
||||
} else
|
||||
permissionmanager.remove(deletedPermissions[p].host, deletedPermissions[p].type);
|
||||
permissionmanager.remove(deletedPermissions[p].host, deletedPermissions[p].type);
|
||||
}
|
||||
deletedPermissions.length = 0;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче