diff options
-rw-r--r-- | chrome/common/extensions/extension.cc | 7 | ||||
-rw-r--r-- | chrome/common/extensions/extension_manifests_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/test/data/extensions/manifest_tests/web_urls_invalid_4.json | 12 |
3 files changed, 22 insertions, 0 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index a9a8fc9..30a67c6 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -764,6 +764,13 @@ bool Extension::LoadExtent(const DictionaryValue* manifest, return false; } + // Do not allow authors to claim "<all_urls>". That would make no sense. + if (pattern.match_all_urls()) { + *error = ExtensionErrorUtils::FormatErrorMessage(value_error, + base::UintToString(i)); + return false; + } + // We do not allow authors to put wildcards in their paths. Instead, we // imply one at the end. if (pattern.path().find('*') != std::string::npos) { diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc index a4c3a3d..5cdd909 100644 --- a/chrome/common/extensions/extension_manifests_unittest.cc +++ b/chrome/common/extensions/extension_manifests_unittest.cc @@ -153,6 +153,9 @@ TEST_F(ExtensionManifestTest, AppWebUrls) { LoadAndExpectError("web_urls_invalid_3.json", ExtensionErrorUtils::FormatErrorMessage( errors::kInvalidWebURL, "0")); + LoadAndExpectError("web_urls_invalid_4.json", + ExtensionErrorUtils::FormatErrorMessage( + errors::kInvalidWebURL, "0")); scoped_ptr<Extension> extension( LoadAndExpectSuccess("web_urls_default.json")); diff --git a/chrome/test/data/extensions/manifest_tests/web_urls_invalid_4.json b/chrome/test/data/extensions/manifest_tests/web_urls_invalid_4.json new file mode 100644 index 0000000..58634e3 --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/web_urls_invalid_4.json @@ -0,0 +1,12 @@ +{ + "name": "test", + "version": "1", + "app": { + "urls": [ + "<all_urls>" + ], + "launch": { + "web_url": "http://www.google.com/foo.html" + } + } +} |