diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 18:58:19 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 18:58:19 +0000 |
commit | 35506359934707a1dc47e0b26684a145835dd9c3 (patch) | |
tree | a4c148fec23792743e3f5f024c852f6d668f173d /chrome/test | |
parent | d4d9025c103adaa1b89b130ed229e61947ec40cc (diff) | |
download | chromium_src-35506359934707a1dc47e0b26684a145835dd9c3.zip chromium_src-35506359934707a1dc47e0b26684a145835dd9c3.tar.gz chromium_src-35506359934707a1dc47e0b26684a145835dd9c3.tar.bz2 |
Add module-level permissions to extensions.
This first pass is fairly simple. If a permission is not specified in the
manifest, the corresponding module will not be exposed to script. For example,
without specifying the "tabs" permission, chrome.tabs and chrome.windows will
not be available.
BUG=12140
TEST=no
Review URL: http://codereview.chromium.org/164039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22745 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
6 files changed, 14 insertions, 4 deletions
diff --git a/chrome/test/data/extensions/good/Extensions/behllobkkfkfnphdnhnkndlbkcpglgmj/1.0.0.0/manifest.json b/chrome/test/data/extensions/good/Extensions/behllobkkfkfnphdnhnkndlbkcpglgmj/1.0.0.0/manifest.json index c1cf5b3..03acc6b 100644 --- a/chrome/test/data/extensions/good/Extensions/behllobkkfkfnphdnhnkndlbkcpglgmj/1.0.0.0/manifest.json +++ b/chrome/test/data/extensions/good/Extensions/behllobkkfkfnphdnhnkndlbkcpglgmj/1.0.0.0/manifest.json @@ -14,7 +14,7 @@ }, "toolstrip2.html" ], - "permissions": ["http://*.google.com/*", "https://*.google.com/*"], + "permissions": ["tabs", "http://*.google.com/*", "https://*.google.com/*"], "content_scripts": [ { "matches": ["file://*", "http://*.google.com/*", "https://*.google.com/*"], diff --git a/chrome/test/data/extensions/good/Extensions/bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0/manifest.json b/chrome/test/data/extensions/good/Extensions/bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0/manifest.json index 6cb06ff..08721e8 100644 --- a/chrome/test/data/extensions/good/Extensions/bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0/manifest.json +++ b/chrome/test/data/extensions/good/Extensions/bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0/manifest.json @@ -3,6 +3,7 @@ "version": "1.0", "name": "My extension 3", "toolstrips": ["toolstrip.html"], + "permissions": ["tabs"], "content_scripts": [ { "matches": ["file://*"], diff --git a/chrome/test/data/extensions/uitest/event_sink/manifest.json b/chrome/test/data/extensions/uitest/event_sink/manifest.json index 830243d..859aa8f 100644 --- a/chrome/test/data/extensions/uitest/event_sink/manifest.json +++ b/chrome/test/data/extensions/uitest/event_sink/manifest.json @@ -1,5 +1,6 @@ { "version": "1.0.0.0", "name": "Browser Event Sink Test Extension", - "description": "An extension UITest for testing the sending of browser events." + "description": "An extension UITest for testing the sending of browser events.", + "permissions": ["tabs", "bookmarks"] } diff --git a/chrome/test/data/extensions/uitest/roundtrip_api_call/manifest.json b/chrome/test/data/extensions/uitest/roundtrip_api_call/manifest.json index 5acde49..67f9e13 100644 --- a/chrome/test/data/extensions/uitest/roundtrip_api_call/manifest.json +++ b/chrome/test/data/extensions/uitest/roundtrip_api_call/manifest.json @@ -2,5 +2,6 @@ "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4RIIi/YbLZ6dRpdQnWfrQuo2vunkuPJpD9HNvZQ3J5aylSw7Y8ghzom793CbTJK1ZI254yZtkaWZJWOBhPKCaaRac+qfpRN1spl42vpyMn1OrGQm1pwZT6rDpCyIVIx/k2o4puMsQHNUIqxXPu3Oj+KSVdCIGOmabMhz765UjhwIDAQAB", "version": "1.0.0.0", "name": "Roundtrip ApiCall Test Extension", - "description": "An extension for an extension UITest." + "description": "An extension for an extension UITest.", + "permissions": ["tabs"] } diff --git a/chrome/test/data/extensions/uitest/simple_api_call/manifest.json b/chrome/test/data/extensions/uitest/simple_api_call/manifest.json index b302c0e..1918c59 100644 --- a/chrome/test/data/extensions/uitest/simple_api_call/manifest.json +++ b/chrome/test/data/extensions/uitest/simple_api_call/manifest.json @@ -2,5 +2,6 @@ "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCsaVmPYFjlYABY7y8sEVB5i3/stDIXU8i3bBeQYeaXOg+Jr1vEhaSgKTy3zMY4m3+cnKI7Z/bMpYohS4pQTcwIXS1kEB6taCUUWgm2315zxSH+gUFRyfzBDlS8LZ9tRirFGj8o0R2YQobHgSPyf04Phq4AeMmGSygEJkfGO+Wt8wIDAQAB", "version": "1.0.0.0", "name": "ApiCall Test Extension", - "description": "An extension for an extension UITest." + "description": "An extension for an extension UITest.", + "permissions": ["tabs"] } diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc index b223f88..dbc61a7 100644 --- a/chrome/test/render_view_test.cc +++ b/chrome/test/render_view_test.cc @@ -5,6 +5,7 @@ #include "chrome/test/render_view_test.h" #include "chrome/browser/extensions/extension_function_dispatcher.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/render_messages.h" #include "chrome/common/renderer_preferences.h" @@ -80,6 +81,11 @@ void RenderViewTest::SetUp() { ExtensionFunctionDispatcher::GetAllFunctionNames(&names); ExtensionProcessBindings::SetFunctionNames(names); + std::vector<std::string> permissions( + Extension::kPermissionNames, + Extension::kPermissionNames + Extension::kNumPermissions); + ExtensionProcessBindings::SetPermissions("", permissions); + mock_process_.reset(new MockProcess()); render_thread_.set_routing_id(kRouteId); |