bug 146048, image context menu is slow to appear, c=tomi.leppikangus@oulu.fi, r=morse, sr=waterson
git-svn-id: svn://10.0.0.236/trunk@122147 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
ac24fe5f24
commit
3ef731e4d2
@ -46,25 +46,9 @@
|
||||
Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager);
|
||||
|
||||
if(permissionmanager.testForBlocking(gContextMenu.imageURL,IMAGEPERMISSION))
|
||||
return false;
|
||||
|
||||
var enumerator = permissionmanager.enumerator;
|
||||
while (enumerator.hasMoreElements()) {
|
||||
var nextPermission = enumerator.getNext();
|
||||
nextPermission = nextPermission.QueryInterface(Components.interfaces.nsIPermission);
|
||||
var imageType = 1;
|
||||
if (nextPermission.type == imageType &&
|
||||
!nextPermission.capability) {
|
||||
/* some image host is being blocked, need to find out if it's our image's host */
|
||||
var host = nextPermission.host;
|
||||
if(host.charAt(0) == ".") { // get rid of the ugly dot on the start of some domains
|
||||
host = host.substring(1,host.length);
|
||||
}
|
||||
if (host && gContextMenu.imageURL.search(host) != -1) {
|
||||
/* it's our image's host that's being blocked */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* image is not already being blocked, so "Block Image" can appear on the menu */
|
||||
return true;
|
||||
},
|
||||
|
||||
@ -46,25 +46,9 @@
|
||||
Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager);
|
||||
|
||||
if(permissionmanager.testForBlocking(gContextMenu.imageURL,IMAGEPERMISSION))
|
||||
return false;
|
||||
|
||||
var enumerator = permissionmanager.enumerator;
|
||||
while (enumerator.hasMoreElements()) {
|
||||
var nextPermission = enumerator.getNext();
|
||||
nextPermission = nextPermission.QueryInterface(Components.interfaces.nsIPermission);
|
||||
var imageType = 1;
|
||||
if (nextPermission.type == imageType &&
|
||||
!nextPermission.capability) {
|
||||
/* some image host is being blocked, need to find out if it's our image's host */
|
||||
var host = nextPermission.host;
|
||||
if(host.charAt(0) == ".") { // get rid of the ugly dot on the start of some domains
|
||||
host = host.substring(1,host.length);
|
||||
}
|
||||
if (host && gContextMenu.imageURL.search(host) != -1) {
|
||||
/* it's our image's host that's being blocked */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* image is not already being blocked, so "Block Image" can appear on the menu */
|
||||
return true;
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user