diff options
author | elijahtaylor <elijahtaylor@chromium.org> | 2014-10-08 21:51:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-09 04:52:03 +0000 |
commit | fb585bffff6976d3daa1a4608918f0bf01b318af (patch) | |
tree | a14b187e6194f3e4c2529d228ca21d92fb25d3f5 /extensions/common/manifest_handlers | |
parent | fad66c3012d0c95b447f5bc46da7602f57188dfe (diff) | |
download | chromium_src-fb585bffff6976d3daa1a4608918f0bf01b318af.zip chromium_src-fb585bffff6976d3daa1a4608918f0bf01b318af.tar.gz chromium_src-fb585bffff6976d3daa1a4608918f0bf01b318af.tar.bz2 |
Remove "resources" subkey and functionality for Shared Modules
BUG=419936
Review URL: https://codereview.chromium.org/625713002
Cr-Commit-Position: refs/heads/master@{#298790}
Diffstat (limited to 'extensions/common/manifest_handlers')
3 files changed, 0 insertions, 56 deletions
diff --git a/extensions/common/manifest_handlers/shared_module_info.cc b/extensions/common/manifest_handlers/shared_module_info.cc index 2f712fd..70f6ea9 100644 --- a/extensions/common/manifest_handlers/shared_module_info.cc +++ b/extensions/common/manifest_handlers/shared_module_info.cc @@ -79,13 +79,6 @@ bool SharedModuleInfo::IsSharedModule(const Extension* extension) { } // static -bool SharedModuleInfo::IsExportAllowed(const Extension* extension, - const std::string& relative_path) { - return GetSharedModuleInfo(extension). - exported_set_.MatchesURL(extension->url().Resolve(relative_path)); -} - -// static bool SharedModuleInfo::IsExportAllowedByWhitelist(const Extension* extension, const std::string& other_id) { // Sanity check. In case the caller did not check |extension| to make sure it @@ -141,11 +134,6 @@ bool SharedModuleInfo::Parse(const Extension* extension, *error = base::ASCIIToUTF16(errors::kInvalidExport); return false; } - const base::ListValue* resources_list = NULL; - if (!export_value->GetList(keys::kResources, &resources_list)) { - *error = base::ASCIIToUTF16(errors::kInvalidExportResources); - return false; - } if (export_value->HasKey(keys::kWhitelist)) { const base::ListValue* whitelist = NULL; if (!export_value->GetList(keys::kWhitelist, &whitelist)) { @@ -163,22 +151,6 @@ bool SharedModuleInfo::Parse(const Extension* extension, export_whitelist_.insert(extension_id); } } - for (size_t i = 0; i < resources_list->GetSize(); ++i) { - std::string resource_path; - if (!resources_list->GetString(i, &resource_path)) { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidExportResourcesString, base::IntToString(i)); - return false; - } - const GURL& resolved_path = extension->url().Resolve(resource_path); - if (!resolved_path.is_valid()) { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidExportResourcesString, base::IntToString(i)); - return false; - } - exported_set_.AddPattern( - URLPattern(URLPattern::SCHEME_EXTENSION, resolved_path.spec())); - } } if (has_import) { diff --git a/extensions/common/manifest_handlers/shared_module_info.h b/extensions/common/manifest_handlers/shared_module_info.h index ee8d6e5..5f67821d 100644 --- a/extensions/common/manifest_handlers/shared_module_info.h +++ b/extensions/common/manifest_handlers/shared_module_info.h @@ -34,8 +34,6 @@ class SharedModuleInfo : public Extension::ManifestData { // Functions relating to exporting resources. static bool IsSharedModule(const Extension* extension); - static bool IsExportAllowed(const Extension* extension, - const std::string& relative_path); // Check against the shared module's whitelist to see if |other_id| can import // its resources. If no whitelist is specified, all extensions can import this // extension. @@ -49,9 +47,6 @@ class SharedModuleInfo : public Extension::ManifestData { static const std::vector<ImportInfo>& GetImports(const Extension* extension); private: - // This extension exports the following resources to other extensions. - URLPatternSet exported_set_; - // Optional list of extensions from which importing is allowed. std::set<std::string> export_whitelist_; diff --git a/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc b/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc index ef90a1a..ecbabbd 100644 --- a/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc +++ b/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc @@ -35,10 +35,6 @@ TEST_F(SharedModuleManifestTest, ExportsAll) { << manifest.name(); EXPECT_FALSE(SharedModuleInfo::ImportsModules(extension.get())) << manifest.name(); - EXPECT_TRUE(SharedModuleInfo::IsExportAllowed(extension.get(), "foo")) - << manifest.name(); - EXPECT_TRUE(SharedModuleInfo::IsExportAllowed(extension.get(), "foo/bar")) - << manifest.name(); EXPECT_TRUE(SharedModuleInfo::IsExportAllowedByWhitelist(extension.get(), kImportId1)) << manifest.name(); @@ -61,31 +57,12 @@ TEST_F(SharedModuleManifestTest, ExportWhitelistAll) { kNoImport)) << manifest.name(); } -TEST_F(SharedModuleManifestTest, ExportFoo) { - ManifestData manifest("shared_module_export_foo.json"); - - scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); - - EXPECT_TRUE(SharedModuleInfo::IsSharedModule(extension.get())) - << manifest.name(); - EXPECT_FALSE(SharedModuleInfo::ImportsModules(extension.get())) - << manifest.name(); - EXPECT_TRUE(SharedModuleInfo::IsExportAllowed(extension.get(), "foo")) - << manifest.name(); - EXPECT_FALSE(SharedModuleInfo::IsExportAllowed(extension.get(), "foo/bar")) - << manifest.name(); -} - TEST_F(SharedModuleManifestTest, ExportParseErrors) { Testcase testcases[] = { Testcase("shared_module_export_and_import.json", "Simultaneous 'import' and 'export' are not allowed."), Testcase("shared_module_export_not_dict.json", "Invalid value for 'export'."), - Testcase("shared_module_export_resources_not_list.json", - "Invalid value for 'export.resources'."), - Testcase("shared_module_export_resource_not_string.json", - "Invalid value for 'export.resources[1]'."), Testcase("shared_module_export_whitelist_item_not_id.json", "Invalid value for 'export.whitelist[0]'."), Testcase("shared_module_export_whitelist_item_not_string.json", |