diff options
25 files changed, 6 insertions, 171 deletions
diff --git a/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/check.js b/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/check.js index 1a67bfd..6635d4e 100644 --- a/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/check.js +++ b/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/check.js @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -if (typeof fail_exported != 'undefined') - chrome.test.notifyFail('fail.js was unintentionally exported.'); - if (typeof pass_exported == 'undefined') chrome.test.notifyFail('pass.js was not exported correctly.'); diff --git a/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/main.html b/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/main.html index 1c412ad..f1516f5 100644 --- a/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/main.html +++ b/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/main.html @@ -1,5 +1,3 @@ <!DOCTYPE html> -<!-- fail.js is not exported, it would be an error to have it load. --> -<script src="_modules/gpcckkmippodnppallflahfabmeilgjg/fail.js"></script> <script src="_modules/gpcckkmippodnppallflahfabmeilgjg/pass.js"></script> <script src="check.js"></script> diff --git a/chrome/test/data/extensions/api_test/shared_module/import_pass/check.js b/chrome/test/data/extensions/api_test/shared_module/import_pass/check.js index b0f9c43..5091de1 100644 --- a/chrome/test/data/extensions/api_test/shared_module/import_pass/check.js +++ b/chrome/test/data/extensions/api_test/shared_module/import_pass/check.js @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -if (typeof fail_exported != 'undefined') - chrome.test.notifyFail('fail.js was unintentionally exported.'); - if (typeof pass_exported == 'undefined') chrome.test.notifyFail('pass.js was not exported correctly.'); diff --git a/chrome/test/data/extensions/api_test/shared_module/import_pass/main.html b/chrome/test/data/extensions/api_test/shared_module/import_pass/main.html index 1c412ad..f1516f5 100644 --- a/chrome/test/data/extensions/api_test/shared_module/import_pass/main.html +++ b/chrome/test/data/extensions/api_test/shared_module/import_pass/main.html @@ -1,5 +1,3 @@ <!DOCTYPE html> -<!-- fail.js is not exported, it would be an error to have it load. --> -<script src="_modules/gpcckkmippodnppallflahfabmeilgjg/fail.js"></script> <script src="_modules/gpcckkmippodnppallflahfabmeilgjg/pass.js"></script> <script src="check.js"></script> diff --git a/chrome/test/data/extensions/api_test/shared_module/shared/fail.js b/chrome/test/data/extensions/api_test/shared_module/shared/fail.js deleted file mode 100644 index dbe933d..0000000 --- a/chrome/test/data/extensions/api_test/shared_module/shared/fail.js +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var fail_exported = {}; diff --git a/chrome/test/data/extensions/api_test/shared_module/shared/manifest.json b/chrome/test/data/extensions/api_test/shared_module/shared/manifest.json index 6a90fa4..e4afafa 100644 --- a/chrome/test/data/extensions/api_test/shared_module/shared/manifest.json +++ b/chrome/test/data/extensions/api_test/shared_module/shared/manifest.json @@ -2,10 +2,6 @@ "name": "Shared Module Test", "manifest_version": 2, "version": "1.0", - "export": { - "resources": [ - "pass.js" - ] - }, + "export": {}, "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" } diff --git a/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/fail.js b/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/fail.js deleted file mode 100644 index 9073140..0000000 --- a/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/fail.js +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var fail_exported = {}; diff --git a/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/manifest.json b/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/manifest.json index 806603e..d273bbf 100644 --- a/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/manifest.json +++ b/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/manifest.json @@ -3,9 +3,6 @@ "manifest_version": 2, "version": "1.0", "export": { - "resources": [ - "pass.js" - ], "whitelist": [ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ] diff --git a/extensions/browser/extension_protocols.cc b/extensions/browser/extension_protocols.cc index 55c5dcb..351047e 100644 --- a/extensions/browser/extension_protocols.cc +++ b/extensions/browser/extension_protocols.cc @@ -482,26 +482,8 @@ ExtensionProtocolHandler::MaybeCreateJob( const Extension* new_extension = extension_info_map_->extensions().GetByID(new_extension_id); - bool first_party_in_import = false; - // NB: This first_party_for_cookies call is not for security, it is only - // used so an exported extension can limit the visible surface to the - // extension that imports it, more or less constituting its API. - const std::string& first_party_path = - request->first_party_for_cookies().path(); - if (SharedModuleInfo::IsImportedPath(first_party_path)) { - std::string first_party_id; - std::string dummy; - SharedModuleInfo::ParseImportedPath(first_party_path, &first_party_id, - &dummy); - if (first_party_id == new_extension_id) { - first_party_in_import = true; - } - } - if (SharedModuleInfo::ImportsExtensionById(extension, new_extension_id) && - new_extension && - (first_party_in_import || - SharedModuleInfo::IsExportAllowed(new_extension, new_relative_path))) { + new_extension) { directory_path = new_extension->path(); extension_id = new_extension_id; relative_path = base::FilePath::FromUTF8Unsafe(new_relative_path); diff --git a/extensions/browser/info_map.cc b/extensions/browser/info_map.cc index 101f35b..23587d5 100644 --- a/extensions/browser/info_map.cc +++ b/extensions/browser/info_map.cc @@ -204,10 +204,8 @@ bool InfoMap::MapUrlToLocalFilePath(const GURL& file_url, if (!new_extension) return false; - if (!SharedModuleInfo::ImportsExtensionById(extension, new_extension_id) || - !SharedModuleInfo::IsExportAllowed(new_extension, new_relative_path)) { + if (!SharedModuleInfo::ImportsExtensionById(extension, new_extension_id)) return false; - } resource = new_extension->GetResource(new_relative_path); } else { diff --git a/extensions/common/manifest_constants.cc b/extensions/common/manifest_constants.cc index f3791a5..4c5191c 100644 --- a/extensions/common/manifest_constants.cc +++ b/extensions/common/manifest_constants.cc @@ -121,7 +121,6 @@ const char kPluginsPath[] = "path"; const char kPluginsPublic[] = "public"; const char kPublicKey[] = "key"; const char kRemoveButton[] = "remove_button"; -const char kResources[] = "resources"; const char kRequirements[] = "requirements"; const char kRunAt[] = "run_at"; const char kSandboxedPages[] = "sandbox.pages"; @@ -337,10 +336,6 @@ const char kInvalidExport[] = "Invalid value for 'export'."; const char kInvalidExportPermissions[] = "Permissions are not allowed for extensions that export resources."; -const char kInvalidExportResources[] = - "Invalid value for 'export.resources'."; -const char kInvalidExportResourcesString[] = - "Invalid value for 'export.resources[*]'."; const char kInvalidExportWhitelist[] = "Invalid value for 'export.whitelist'."; const char kInvalidExportWhitelistString[] = diff --git a/extensions/common/manifest_constants.h b/extensions/common/manifest_constants.h index 3e9c501..bac9963 100644 --- a/extensions/common/manifest_constants.h +++ b/extensions/common/manifest_constants.h @@ -129,7 +129,6 @@ extern const char kPluginsPath[]; extern const char kPluginsPublic[]; extern const char kPublicKey[]; extern const char kRemoveButton[]; -extern const char kResources[]; extern const char kRequirements[]; extern const char kRunAt[]; extern const char kSandboxedPages[]; @@ -294,8 +293,6 @@ extern const char kInvalidExcludeMatch[]; extern const char kInvalidExcludeMatches[]; extern const char kInvalidExport[]; extern const char kInvalidExportPermissions[]; -extern const char kInvalidExportResources[]; -extern const char kInvalidExportResourcesString[]; extern const char kInvalidExportWhitelist[]; extern const char kInvalidExportWhitelistString[]; extern const char kInvalidFileAccessList[]; 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", diff --git a/extensions/test/data/manifest_tests/shared_module_export.json b/extensions/test/data/manifest_tests/shared_module_export.json index 49c0c11..932a4f1 100644 --- a/extensions/test/data/manifest_tests/shared_module_export.json +++ b/extensions/test/data/manifest_tests/shared_module_export.json @@ -3,9 +3,6 @@ "manifest_version": 2, "version": "1.0", "export": { - "resources": [ - "*" - ], "whitelist": [ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" diff --git a/extensions/test/data/manifest_tests/shared_module_export_and_import.json b/extensions/test/data/manifest_tests/shared_module_export_and_import.json index 3f59ac2..3119b2f 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_and_import.json +++ b/extensions/test/data/manifest_tests/shared_module_export_and_import.json @@ -2,11 +2,7 @@ "name": "shared_module_export unittest", "manifest_version": 2, "version": "1.0", - "export": { - "resources": [ - "*" - ] - }, + "export": {}, "import": [{ "id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }], diff --git a/extensions/test/data/manifest_tests/shared_module_export_foo.json b/extensions/test/data/manifest_tests/shared_module_export_foo.json deleted file mode 100644 index e0b583f..0000000 --- a/extensions/test/data/manifest_tests/shared_module_export_foo.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "shared_module_export unittest", - "manifest_version": 2, - "version": "1.0", - "export": { - "resources": [ - "foo" - ] - }, - "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" -} diff --git a/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json b/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json index aafb5f8..ea1946e 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json +++ b/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json @@ -2,10 +2,6 @@ "name": "shared_module_export unittest", "manifest_version": 2, "version": "1.0", - "export": { - "resources": [ - "*" - ] - }, + "export": {}, "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" } diff --git a/extensions/test/data/manifest_tests/shared_module_export_not_dict.json b/extensions/test/data/manifest_tests/shared_module_export_not_dict.json index 2500644..7db16fb 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_not_dict.json +++ b/extensions/test/data/manifest_tests/shared_module_export_not_dict.json @@ -2,8 +2,6 @@ "name": "shared_module_export unittest", "manifest_version": 2, "version": "1.0", - "export": [ - {"resources": "*"} - ], + "export": [], "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" } diff --git a/extensions/test/data/manifest_tests/shared_module_export_resource_not_string.json b/extensions/test/data/manifest_tests/shared_module_export_resource_not_string.json deleted file mode 100644 index 2021553..0000000 --- a/extensions/test/data/manifest_tests/shared_module_export_resource_not_string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "shared_module_export unittest", - "manifest_version": 2, - "version": "1.0", - "export": { - "resources": [ - "*", - {} - ] - }, - "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" -} diff --git a/extensions/test/data/manifest_tests/shared_module_export_resources_not_list.json b/extensions/test/data/manifest_tests/shared_module_export_resources_not_list.json deleted file mode 100644 index 76971072..0000000 --- a/extensions/test/data/manifest_tests/shared_module_export_resources_not_list.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "shared_module_export unittest", - "manifest_version": 2, - "version": "1.0", - "export": { - "resources": "*" - }, - "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" -} diff --git a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json index 6c1bb1b..6134311 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json +++ b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json @@ -3,9 +3,6 @@ "manifest_version": 2, "version": "1.0", "export": { - "resources": [ - "*" - ], "whitelist": [ "notavalidid" ] diff --git a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json index 2e75502..a56f336 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json +++ b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json @@ -3,9 +3,6 @@ "manifest_version": 2, "version": "1.0", "export": { - "resources": [ - "*" - ], "whitelist": [ { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": "", diff --git a/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json b/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json index 06d3e18..94bc3f8 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json +++ b/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json @@ -3,9 +3,6 @@ "manifest_version": 2, "version": "1.0", "export": { - "resources": [ - "*" - ], "whitelist": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" |