Bug 468313 - Add permissions to safe-browsing so warnings don't keep showing up on attack sites. r=sdwilsh ui-r=limi

This commit is contained in:
Mehdi Mulani 2011-05-03 13:39:28 -04:00
Родитель 1734a9f26e
Коммит 97d5535c14
2 изменённых файлов: 17 добавлений и 0 удалений

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

@ -2688,6 +2688,11 @@ function BrowserOnClick(event) {
gBrowser.loadURIWithFlags(content.location.href,
nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER,
null, null, null);
Services.perms.add(makeURI(content.location.href), "safe-browsing",
Ci.nsIPermissionManager.ALLOW_ACTION,
Ci.nsIPermissionManager.EXPIRE_SESSION);
let buttons = [{
label: gNavigatorBundle.getString("safebrowsing.getMeOutOfHereButton.label"),
accessKey: gNavigatorBundle.getString("safebrowsing.getMeOutOfHereButton.accessKey"),

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

@ -54,6 +54,7 @@
#include "nsIDirectoryService.h"
#include "nsIKeyModule.h"
#include "nsIObserverService.h"
#include "nsIPermissionManager.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefService.h"
@ -4025,6 +4026,17 @@ nsUrlClassifierDBService::LookupURI(nsIURI* uri,
rv = mWorker->CheckCleanHost(key, &clean);
NS_ENSURE_SUCCESS(rv, rv);
if (!clean) {
nsCOMPtr<nsIPermissionManager> permissionManager =
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
if (permissionManager) {
PRUint32 perm;
permissionManager->TestPermission(uri, "safe-browsing", &perm);
clean |= (perm == nsIPermissionManager::ALLOW_ACTION);
}
}
*didLookup = !clean;
if (clean) {
return NS_OK;