summaryrefslogtreecommitdiffstats
path: root/extensions/common/permissions
diff options
context:
space:
mode:
authorbattre <battre@chromium.org>2015-11-12 13:25:46 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-12 21:26:57 +0000
commitb807906072e191a10febe3f1e9b9fa46429abff9 (patch)
tree8cc2b40220582871b9014162cf4b1cbd9e370e2d /extensions/common/permissions
parentd913bfecb178a60b441cb41e4c52262278e61aa5 (diff)
downloadchromium_src-b807906072e191a10febe3f1e9b9fa46429abff9.zip
chromium_src-b807906072e191a10febe3f1e9b9fa46429abff9.tar.gz
chromium_src-b807906072e191a10febe3f1e9b9fa46429abff9.tar.bz2
Remove URLs from chrome.tabs.executeScript permission warning.
This CL removes the URL error messages triggered by chrome.tabs.executeScript when the extension lacks the permission to access the respective host. This is necessary to prevent that an extension can see the list of open URLs of all tabs without having asked for appropriate permission. BUG=551626 Review URL: https://codereview.chromium.org/1414223005 Cr-Commit-Position: refs/heads/master@{#359392}
Diffstat (limited to 'extensions/common/permissions')
-rw-r--r--extensions/common/permissions/permissions_data.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/extensions/common/permissions/permissions_data.cc b/extensions/common/permissions/permissions_data.cc
index c904af7..79271d7 100644
--- a/extensions/common/permissions/permissions_data.cc
+++ b/extensions/common/permissions/permissions_data.cc
@@ -13,6 +13,7 @@
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/permissions_parser.h"
+#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/permission_message_provider.h"
#include "extensions/common/switches.h"
#include "extensions/common/url_pattern_set.h"
@@ -89,9 +90,13 @@ bool PermissionsData::IsRestrictedUrl(const GURL& document_url,
if (!URLPattern::IsValidSchemeForExtensions(document_url.scheme()) &&
document_url.spec() != url::kAboutBlankURL) {
if (error) {
- *error = ErrorUtils::FormatErrorMessage(
- manifest_errors::kCannotAccessPage,
- document_url.spec());
+ if (extension->permissions_data()->active_permissions().HasAPIPermission(
+ APIPermission::kTab)) {
+ *error = ErrorUtils::FormatErrorMessage(
+ manifest_errors::kCannotAccessPageWithUrl, document_url.spec());
+ } else {
+ *error = manifest_errors::kCannotAccessPage;
+ }
}
return true;
}
@@ -349,9 +354,15 @@ PermissionsData::AccessType PermissionsData::CanRunOnPage(
return ACCESS_WITHHELD;
if (error) {
- *error = ErrorUtils::FormatErrorMessage(manifest_errors::kCannotAccessPage,
- document_url.spec());
+ if (extension->permissions_data()->active_permissions().HasAPIPermission(
+ APIPermission::kTab)) {
+ *error = ErrorUtils::FormatErrorMessage(
+ manifest_errors::kCannotAccessPageWithUrl, document_url.spec());
+ } else {
+ *error = manifest_errors::kCannotAccessPage;
+ }
}
+
return ACCESS_DENIED;
}