diff options
Diffstat (limited to 'chrome')
33 files changed, 72 insertions, 127 deletions
diff --git a/chrome/browser/background/background_application_list_model_unittest.cc b/chrome/browser/background/background_application_list_model_unittest.cc index 982badf..65bdcac 100644 --- a/chrome/browser/background/background_application_list_model_unittest.cc +++ b/chrome/browser/background/background_application_list_model_unittest.cc @@ -72,7 +72,7 @@ static scoped_refptr<Extension> CreateExtension(const std::string& name, bogus_file_path().AppendASCII(name), Extension::INVALID, manifest, - Extension::STRICT_ERROR_CHECKS, + Extension::NO_FLAGS, &error); // Cannot ASSERT_* here because that attempts an illegitimate return. // Cannot EXPECT_NE here because that assumes non-pointers unlike EXPECT_EQ diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 9a02b63..595b001 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc @@ -145,11 +145,10 @@ void ComponentLoader::Reload(const std::string& extension_id) { } const Extension* ComponentLoader::Load(const ComponentExtensionInfo& info) { - int flags = Extension::REQUIRE_KEY; // TODO(abarth): We should REQUIRE_MODERN_MANIFEST_VERSION once we've updated // our component extensions to the new manifest version. - if (Extension::ShouldDoStrictErrorChecking(Extension::COMPONENT)) - flags |= Extension::STRICT_ERROR_CHECKS; + int flags = Extension::REQUIRE_KEY; + std::string error; // Get the absolute path to the extension. diff --git a/chrome/browser/extensions/convert_web_app.cc b/chrome/browser/extensions/convert_web_app.cc index bd36cb5..0f8bc53 100644 --- a/chrome/browser/extensions/convert_web_app.cc +++ b/chrome/browser/extensions/convert_web_app.cc @@ -174,7 +174,7 @@ scoped_refptr<Extension> ConvertWebAppToExtension( // Finally, create the extension object to represent the unpacked directory. std::string error; - int extension_flags = Extension::STRICT_ERROR_CHECKS; + int extension_flags = Extension::NO_FLAGS; if (web_app.is_bookmark_app) extension_flags |= Extension::FROM_BOOKMARK; scoped_refptr<Extension> extension = Extension::Create( diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index 0aaa77f..ea03d3a 100644 --- a/chrome/browser/extensions/extension_creator.cc +++ b/chrome/browser/extensions/extension_creator.cc @@ -107,7 +107,7 @@ bool ExtensionCreator::ValidateManifest(const FilePath& extension_dir, extension_dir, extension_id, Extension::INTERNAL, - Extension::STRICT_ERROR_CHECKS | Extension::FOLLOW_SYMLINKS_ANYWHERE, + Extension::FOLLOW_SYMLINKS_ANYWHERE, &error_message_)); return !!extension.get(); } diff --git a/chrome/browser/extensions/extension_icon_manager_unittest.cc b/chrome/browser/extensions/extension_icon_manager_unittest.cc index 615ae8d..3e3485b 100644 --- a/chrome/browser/extensions/extension_icon_manager_unittest.cc +++ b/chrome/browser/extensions/extension_icon_manager_unittest.cc @@ -116,7 +116,7 @@ TEST_F(ExtensionIconManagerTest, LoadRemoveLoad) { std::string error; scoped_refptr<Extension> extension(Extension::Create( manifest_path.DirName(), Extension::INVALID, *manifest.get(), - Extension::STRICT_ERROR_CHECKS, &error)); + Extension::NO_FLAGS, &error)); ASSERT_TRUE(extension.get()); TestIconManager icon_manager(this); @@ -157,7 +157,7 @@ TEST_F(ExtensionIconManagerTest, LoadComponentExtensionResource) { std::string error; scoped_refptr<Extension> extension(Extension::Create( manifest_path.DirName(), Extension::COMPONENT, *manifest.get(), - Extension::STRICT_ERROR_CHECKS, &error)); + Extension::NO_FLAGS, &error)); ASSERT_TRUE(extension.get()); TestIconManager icon_manager(this); diff --git a/chrome/browser/extensions/extension_info_map_unittest.cc b/chrome/browser/extensions/extension_info_map_unittest.cc index 1317c9e..659d52d 100644 --- a/chrome/browser/extensions/extension_info_map_unittest.cc +++ b/chrome/browser/extensions/extension_info_map_unittest.cc @@ -51,7 +51,7 @@ static scoped_refptr<Extension> CreateExtension(const std::string& name) { std::string error; scoped_refptr<Extension> extension = Extension::Create( path.AppendASCII(name), Extension::INVALID, manifest, - Extension::STRICT_ERROR_CHECKS, &error); + Extension::NO_FLAGS, &error); EXPECT_TRUE(extension) << error; return extension; @@ -73,7 +73,7 @@ static scoped_refptr<Extension> LoadManifest(const std::string& dir, std::string error; scoped_refptr<Extension> extension = Extension::Create( path, Extension::INVALID, *static_cast<DictionaryValue*>(result.get()), - Extension::STRICT_ERROR_CHECKS, &error); + Extension::NO_FLAGS, &error); EXPECT_TRUE(extension) << error; return extension; diff --git a/chrome/browser/extensions/extension_management_api.cc b/chrome/browser/extensions/extension_management_api.cc index 8f3da298..61edc4a 100644 --- a/chrome/browser/extensions/extension_management_api.cc +++ b/chrome/browser/extensions/extension_management_api.cc @@ -291,8 +291,8 @@ void GetPermissionWarningsByManifestFunction::OnParseSuccess( CHECK(parsed_manifest); scoped_refptr<Extension> extension = Extension::Create( - FilePath(), Extension::INVALID, *parsed_manifest, - Extension::STRICT_ERROR_CHECKS, &error_); + FilePath(), Extension::INVALID, *parsed_manifest, Extension::NO_FLAGS, + &error_); if (!extension.get()) { OnParseFailure(keys::kExtensionCreateError); return; diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index 378dfbf..b614f240 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -718,8 +718,7 @@ class ExtensionPrefsFlags : public ExtensionPrefsTest { dictionary.SetString(extension_manifest_keys::kName, "from_webstore"); dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); webstore_extension_ = prefs_.AddExtensionWithManifestAndFlags( - dictionary, Extension::INTERNAL, - Extension::STRICT_ERROR_CHECKS | Extension::FROM_WEBSTORE); + dictionary, Extension::INTERNAL, Extension::FROM_WEBSTORE); } { @@ -727,8 +726,7 @@ class ExtensionPrefsFlags : public ExtensionPrefsTest { dictionary.SetString(extension_manifest_keys::kName, "from_bookmark"); dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); bookmark_extension_ = prefs_.AddExtensionWithManifestAndFlags( - dictionary, Extension::INTERNAL, - Extension::STRICT_ERROR_CHECKS | Extension::FROM_BOOKMARK); + dictionary, Extension::INTERNAL, Extension::FROM_BOOKMARK); } } @@ -763,16 +761,16 @@ ExtensionPrefsPrepopulatedTest::ExtensionPrefsPrepopulatedTest() ext1_scoped_ = Extension::Create( prefs_.temp_dir().AppendASCII("ext1_"), Extension::EXTERNAL_PREF, - simple_dict, Extension::STRICT_ERROR_CHECKS, &error); + simple_dict, Extension::NO_FLAGS, &error); ext2_scoped_ = Extension::Create( prefs_.temp_dir().AppendASCII("ext2_"), Extension::EXTERNAL_PREF, - simple_dict, Extension::STRICT_ERROR_CHECKS, &error); + simple_dict, Extension::NO_FLAGS, &error); ext3_scoped_ = Extension::Create( prefs_.temp_dir().AppendASCII("ext3_"), Extension::EXTERNAL_PREF, - simple_dict, Extension::STRICT_ERROR_CHECKS, &error); + simple_dict, Extension::NO_FLAGS, &error); ext4_scoped_ = Extension::Create( prefs_.temp_dir().AppendASCII("ext4_"), Extension::EXTERNAL_PREF, - simple_dict, Extension::STRICT_ERROR_CHECKS, &error); + simple_dict, Extension::NO_FLAGS, &error); ext1_ = ext1_scoped_.get(); ext2_ = ext2_scoped_.get(); diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc index 6c0f96b..12d5d87 100644 --- a/chrome/browser/extensions/extension_protocols_unittest.cc +++ b/chrome/browser/extensions/extension_protocols_unittest.cc @@ -35,7 +35,7 @@ scoped_refptr<Extension> CreateTestExtension(const std::string& name, std::string error; scoped_refptr<Extension> extension( Extension::Create(path, Extension::INTERNAL, manifest, - Extension::STRICT_ERROR_CHECKS, &error)); + Extension::NO_FLAGS, &error)); EXPECT_TRUE(extension.get()) << error; return extension; } diff --git a/chrome/browser/extensions/extension_sorting_unittest.cc b/chrome/browser/extensions/extension_sorting_unittest.cc index 1cd8316..4d4cae5 100644 --- a/chrome/browser/extensions/extension_sorting_unittest.cc +++ b/chrome/browser/extensions/extension_sorting_unittest.cc @@ -618,7 +618,7 @@ class ExtensionSortingPreinstalledAppsBase : std::string error; app1_scoped_ = Extension::Create( prefs_.temp_dir().AppendASCII("app1_"), Extension::EXTERNAL_PREF, - simple_dict, Extension::STRICT_ERROR_CHECKS, &error); + simple_dict, Extension::NO_FLAGS, &error); prefs()->OnExtensionInstalled(app1_scoped_.get(), Extension::ENABLED, false, @@ -626,7 +626,7 @@ class ExtensionSortingPreinstalledAppsBase : app2_scoped_ = Extension::Create( prefs_.temp_dir().AppendASCII("app2_"), Extension::EXTERNAL_PREF, - simple_dict, Extension::STRICT_ERROR_CHECKS, &error); + simple_dict, Extension::NO_FLAGS, &error); prefs()->OnExtensionInstalled(app2_scoped_.get(), Extension::ENABLED, false, diff --git a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc index cb81acf..f81aa3b 100644 --- a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc +++ b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc @@ -37,8 +37,7 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { manifest.Set(keys::kWebURLs, list); std::string error; scoped_refptr<Extension> protected_app = Extension::Create( - path, Extension::INVALID, manifest, Extension::STRICT_ERROR_CHECKS, - &error); + path, Extension::INVALID, manifest, Extension::NO_FLAGS, &error); EXPECT_TRUE(protected_app.get()) << error; return protected_app; } @@ -62,8 +61,7 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { manifest.Set(keys::kWebURLs, list); std::string error; scoped_refptr<Extension> unlimited_app = Extension::Create( - path, Extension::INVALID, manifest, Extension::STRICT_ERROR_CHECKS, - &error); + path, Extension::INVALID, manifest, Extension::NO_FLAGS, &error); EXPECT_TRUE(unlimited_app.get()) << error; return unlimited_app; } @@ -89,8 +87,7 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { manifest.Set(keys::kPermissions, list); std::string error; scoped_refptr<Extension> component_app = Extension::Create( - path, Extension::COMPONENT, manifest, Extension::STRICT_ERROR_CHECKS, - &error); + path, Extension::COMPONENT, manifest, Extension::NO_FLAGS, &error); EXPECT_TRUE(component_app.get()) << error; return component_app; } @@ -115,8 +112,7 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { manifest.Set(keys::kPermissions, list); std::string error; scoped_refptr<Extension> handler_app = Extension::Create( - path, Extension::INVALID, manifest, Extension::STRICT_ERROR_CHECKS, - &error); + path, Extension::INVALID, manifest, Extension::NO_FLAGS, &error); EXPECT_TRUE(handler_app.get()) << error; return handler_app; } diff --git a/chrome/browser/extensions/extension_ui_unittest.cc b/chrome/browser/extensions/extension_ui_unittest.cc index e55c0ad..1c2eaa2 100644 --- a/chrome/browser/extensions/extension_ui_unittest.cc +++ b/chrome/browser/extensions/extension_ui_unittest.cc @@ -37,8 +37,8 @@ class ExtensionUITest : public testing::Test { EXPECT_EQ("", error); scoped_refptr<Extension> extension(Extension::Create( - extension_path, location, *extension_data, - Extension::REQUIRE_KEY | Extension::STRICT_ERROR_CHECKS, &error)); + extension_path, location, *extension_data, Extension::REQUIRE_KEY, + &error)); EXPECT_TRUE(extension.get()); EXPECT_EQ("", error); @@ -232,4 +232,3 @@ TEST_F(ExtensionUITest, PathPropagation) { EXPECT_TRUE(extension_details->GetString("path", &ui_path)); EXPECT_EQ(extension_path, FilePath(ui_path)); } - diff --git a/chrome/browser/extensions/image_loading_tracker_unittest.cc b/chrome/browser/extensions/image_loading_tracker_unittest.cc index 9fd69f3..2dce687 100644 --- a/chrome/browser/extensions/image_loading_tracker_unittest.cc +++ b/chrome/browser/extensions/image_loading_tracker_unittest.cc @@ -80,7 +80,7 @@ class ImageLoadingTrackerTest : public testing::Test, return NULL; return Extension::Create(test_file, location, *valid_value, - Extension::STRICT_ERROR_CHECKS, &error); + Extension::NO_FLAGS, &error); } gfx::Image image_; diff --git a/chrome/browser/extensions/installed_loader.cc b/chrome/browser/extensions/installed_loader.cc index 26fe121..62384c2 100644 --- a/chrome/browser/extensions/installed_loader.cc +++ b/chrome/browser/extensions/installed_loader.cc @@ -292,8 +292,6 @@ int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { int flags = Extension::NO_FLAGS; if (info->extension_location != Extension::LOAD) flags |= Extension::REQUIRE_KEY; - if (Extension::ShouldDoStrictErrorChecking(info->extension_location)) - flags |= Extension::STRICT_ERROR_CHECKS; if (extension_prefs_->AllowFileAccess(info->extension_id)) flags |= Extension::ALLOW_FILE_ACCESS; if (extension_prefs_->IsFromWebStore(info->extension_id)) diff --git a/chrome/browser/extensions/test_extension_prefs.cc b/chrome/browser/extensions/test_extension_prefs.cc index 6ef8bf0..40e3b7d 100644 --- a/chrome/browser/extensions/test_extension_prefs.cc +++ b/chrome/browser/extensions/test_extension_prefs.cc @@ -125,7 +125,7 @@ scoped_refptr<Extension> TestExtensionPrefs::AddApp(std::string name) { scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifest( const DictionaryValue& manifest, Extension::Location location) { return AddExtensionWithManifestAndFlags(manifest, location, - Extension::STRICT_ERROR_CHECKS); + Extension::NO_FLAGS); } scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifestAndFlags( diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc index 3bfb522..22b0714 100644 --- a/chrome/browser/extensions/unpacked_installer.cc +++ b/chrome/browser/extensions/unpacked_installer.cc @@ -125,8 +125,6 @@ void UnpackedInstaller::LoadFromCommandLine(const FilePath& path_in) { int flags = Extension::REQUIRE_MODERN_MANIFEST_VERSION; if (allow_file_access) flags |= Extension::ALLOW_FILE_ACCESS; - if (Extension::ShouldDoStrictErrorChecking(Extension::LOAD)) - flags |= Extension::STRICT_ERROR_CHECKS; std::string error; scoped_refptr<const Extension> extension(extension_file_util::LoadExtension( @@ -189,8 +187,6 @@ void UnpackedInstaller::LoadWithFileAccess(bool allow_file_access) { int flags = Extension::REQUIRE_MODERN_MANIFEST_VERSION; if (allow_file_access) flags |= Extension::ALLOW_FILE_ACCESS; - if (Extension::ShouldDoStrictErrorChecking(Extension::LOAD)) - flags |= Extension::STRICT_ERROR_CHECKS; std::string error; scoped_refptr<const Extension> extension(extension_file_util::LoadExtension( extension_path_, diff --git a/chrome/browser/intents/web_intents_registry_unittest.cc b/chrome/browser/intents/web_intents_registry_unittest.cc index 82673af..600d0cf 100644 --- a/chrome/browser/intents/web_intents_registry_unittest.cc +++ b/chrome/browser/intents/web_intents_registry_unittest.cc @@ -45,7 +45,6 @@ DictionaryValue* LoadManifestFile(const FilePath& path, scoped_refptr<Extension> LoadExtensionWithLocation( const std::string& name, Extension::Location location, - bool strict_error_checks, std::string* error) { FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); @@ -55,20 +54,17 @@ scoped_refptr<Extension> LoadExtensionWithLocation( scoped_ptr<DictionaryValue> value(LoadManifestFile(path, error)); if (!value.get()) return NULL; - int flags = Extension::NO_FLAGS; - if (strict_error_checks) - flags |= Extension::STRICT_ERROR_CHECKS; return Extension::Create(path.DirName(), location, *value, - flags, + Extension::NO_FLAGS, Extension::GenerateIdForPath(path), error); } scoped_refptr<Extension> LoadExtension(const std::string& name, std::string* error) { - return LoadExtensionWithLocation(name, Extension::INTERNAL, false, error); + return LoadExtensionWithLocation(name, Extension::INTERNAL, error); } scoped_refptr<Extension> LoadAndExpectSuccess(const std::string& name) { diff --git a/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc b/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc index 66253e5..c309083 100644 --- a/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc +++ b/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc @@ -37,8 +37,7 @@ scoped_refptr<Extension> MakeExtension(const std::string& name) { value.SetString(keys::kName, name); std::string error; scoped_refptr<Extension> extension(Extension::Create( - path, Extension::INVALID, value, Extension::STRICT_ERROR_CHECKS, - &error)); + path, Extension::INVALID, value, Extension::NO_FLAGS, &error)); EXPECT_TRUE(error.empty()); return extension; } diff --git a/chrome/browser/sync/glue/theme_util_unittest.cc b/chrome/browser/sync/glue/theme_util_unittest.cc index 7aede1e..76b8d3d 100644 --- a/chrome/browser/sync/glue/theme_util_unittest.cc +++ b/chrome/browser/sync/glue/theme_util_unittest.cc @@ -55,8 +55,7 @@ scoped_refptr<Extension> MakeThemeExtension(const FilePath& extension_path, source.SetString(extension_manifest_keys::kVersion, "0.0.0.0"); std::string error; scoped_refptr<Extension> extension = Extension::Create( - extension_path, Extension::INTERNAL, source, - Extension::STRICT_ERROR_CHECKS, &error); + extension_path, Extension::INTERNAL, source, Extension::NO_FLAGS, &error); EXPECT_TRUE(extension); EXPECT_EQ("", error); return extension; diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.cc b/chrome/browser/sync/test/integration/sync_extension_helper.cc index f32989a..20d1587 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.cc +++ b/chrome/browser/sync/test/integration/sync_extension_helper.cc @@ -296,8 +296,8 @@ scoped_refptr<Extension> CreateExtension( } std::string error; scoped_refptr<Extension> extension = - Extension::Create(extension_dir, Extension::INTERNAL, - source, Extension::STRICT_ERROR_CHECKS, &error); + Extension::Create(extension_dir, Extension::INTERNAL, source, + Extension::NO_FLAGS, &error); if (!error.empty()) { ADD_FAILURE() << error; return NULL; diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc index 008e5c2..8499a0b 100644 --- a/chrome/browser/themes/browser_theme_pack_unittest.cc +++ b/chrome/browser/themes/browser_theme_pack_unittest.cc @@ -411,7 +411,7 @@ TEST_F(BrowserThemePackTest, CanBuildAndReadPack) { ASSERT_TRUE(valid_value.get()); scoped_refptr<Extension> extension(Extension::Create( star_gazing_path, Extension::INVALID, *valid_value, - Extension::REQUIRE_KEY | Extension::STRICT_ERROR_CHECKS, &error)); + Extension::REQUIRE_KEY, &error)); ASSERT_TRUE(extension.get()); ASSERT_EQ("", error); diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm index 2e9b7d6..167eff5 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm @@ -65,7 +65,7 @@ public: } extension_ = Extension::Create(path.DirName(), Extension::INVALID, *value, - Extension::STRICT_ERROR_CHECKS, &error); + Extension::NO_FLAGS, &error); if (!extension_.get()) { LOG(ERROR) << error; return; diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm index a26eaa0..c49fad9 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm @@ -100,7 +100,7 @@ class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { std::string error; return Extension::Create(path, Extension::INVALID, extension_input_value, - Extension::STRICT_ERROR_CHECKS, &error); + Extension::NO_FLAGS, &error); } // Required to initialize the extension installed bubble. diff --git a/chrome/browser/ui/panels/base_panel_browser_test.cc b/chrome/browser/ui/panels/base_panel_browser_test.cc index 0dd7bfe..39f803d 100644 --- a/chrome/browser/ui/panels/base_panel_browser_test.cc +++ b/chrome/browser/ui/panels/base_panel_browser_test.cc @@ -451,8 +451,7 @@ scoped_refptr<Extension> BasePanelBrowserTest::CreateExtension( std::string error; scoped_refptr<Extension> extension = Extension::Create( - full_path, location, *input_value, - Extension::STRICT_ERROR_CHECKS, &error); + full_path, location, *input_value, Extension::NO_FLAGS, &error); EXPECT_TRUE(extension.get()); EXPECT_STREQ("", error.c_str()); browser()->profile()->GetExtensionService()-> diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index dd94c5a..40311440 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -196,35 +196,23 @@ class Extension : public base::RefCountedThreadSafe<Extension> { // manifest version that Chrome understands. REQUIRE_MODERN_MANIFEST_VERSION = 1 << 1, - // |STRICT_ERROR_CHECKS| enables extra error checking, such as - // checks that URL patterns do not contain ports. This error - // checking may find an error that a previous version of - // Chrome did not flag. To avoid errors in installed extensions - // when Chrome is upgraded, strict error checking is only enabled - // when loading extensions as a developer would (such as loading - // an unpacked extension), or when loading an extension that is - // tied to a specific version of Chrome (such as a component - // extension). Most callers will set the |STRICT_ERROR_CHECKS| bit when - // Extension::ShouldDoStrictErrorChecking(location) returns true. - STRICT_ERROR_CHECKS = 1 << 2, - // |ALLOW_FILE_ACCESS| indicates that the user is allowing this extension // to have file access. If it's not present, then permissions and content // scripts that match file:/// URLs will be filtered out. - ALLOW_FILE_ACCESS = 1 << 3, + ALLOW_FILE_ACCESS = 1 << 2, // |FROM_WEBSTORE| indicates that the extension was installed from the // Chrome Web Store. - FROM_WEBSTORE = 1 << 4, + FROM_WEBSTORE = 1 << 3, // |FROM_BOOKMARK| indicates the extension was created using a mock App // created from a bookmark. - FROM_BOOKMARK = 1 << 5, + FROM_BOOKMARK = 1 << 4, // |FOLLOW_SYMLINKS_ANYWHERE| means that resources can be symlinks to // anywhere in the filesystem, rather than being restricted to the // extension directory. - FOLLOW_SYMLINKS_ANYWHERE = 1 << 6, + FOLLOW_SYMLINKS_ANYWHERE = 1 << 5, }; static scoped_refptr<Extension> Create(const FilePath& path, @@ -309,17 +297,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> { location != Extension::COMPONENT; } - // Whether extensions with |location| should be loaded with strict - // error checking. Strict error checks may flag errors older versions - // of chrome did not detect. To avoid breaking installed extensions, - // strict checks are disabled unless the location indicates that the - // developer is loading the extension, or the extension is a component - // of chrome. - static inline bool ShouldDoStrictErrorChecking(Location location) { - return location == Extension::LOAD || - location == Extension::COMPONENT; - } - // Unpacked extensions start off with file access since they are a developer // feature. static inline bool ShouldAlwaysAllowFileAccess(Location location) { diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc index 04d8b91..e713b58 100644 --- a/chrome/common/extensions/extension_file_util_unittest.cc +++ b/chrome/common/extensions/extension_file_util_unittest.cc @@ -89,7 +89,7 @@ TEST(ExtensionFileUtil, LoadExtensionWithValidLocales) { std::string error; scoped_refptr<Extension> extension(extension_file_util::LoadExtension( - install_dir, Extension::LOAD, Extension::STRICT_ERROR_CHECKS, &error)); + install_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); ASSERT_TRUE(extension != NULL); EXPECT_EQ("The first extension that I made.", extension->description()); } @@ -105,7 +105,7 @@ TEST(ExtensionFileUtil, LoadExtensionWithoutLocalesFolder) { std::string error; scoped_refptr<Extension> extension(extension_file_util::LoadExtension( - install_dir, Extension::LOAD, Extension::STRICT_ERROR_CHECKS, &error)); + install_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); ASSERT_FALSE(extension == NULL); EXPECT_TRUE(error.empty()); } @@ -178,7 +178,7 @@ TEST(ExtensionFileUtil, LoadExtensionGivesHelpfullErrorOnMissingManifest) { std::string error; scoped_refptr<Extension> extension(extension_file_util::LoadExtension( - install_dir, Extension::LOAD, Extension::STRICT_ERROR_CHECKS, &error)); + install_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); ASSERT_TRUE(extension == NULL); ASSERT_FALSE(error.empty()); ASSERT_STREQ("Manifest file is missing or unreadable.", error.c_str()); @@ -195,7 +195,7 @@ TEST(ExtensionFileUtil, LoadExtensionGivesHelpfullErrorOnBadManifest) { std::string error; scoped_refptr<Extension> extension(extension_file_util::LoadExtension( - install_dir, Extension::LOAD, Extension::STRICT_ERROR_CHECKS, &error)); + install_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); ASSERT_TRUE(extension == NULL); ASSERT_FALSE(error.empty()); ASSERT_STREQ("Manifest is not valid JSON. " @@ -211,7 +211,7 @@ TEST(ExtensionFileUtil, FailLoadingNonUTF8Scripts) { std::string error; scoped_refptr<Extension> extension(extension_file_util::LoadExtension( - install_dir, Extension::LOAD, Extension::STRICT_ERROR_CHECKS, &error)); + install_dir, Extension::LOAD, Extension::NO_FLAGS, &error)); ASSERT_TRUE(extension == NULL); ASSERT_STREQ("Could not load file 'bad_encoding.js' for content script. " "It isn't UTF-8 encoded.", error.c_str()); diff --git a/chrome/common/extensions/extension_permission_set_unittest.cc b/chrome/common/extensions/extension_permission_set_unittest.cc index 139213c..4f8783f 100644 --- a/chrome/common/extensions/extension_permission_set_unittest.cc +++ b/chrome/common/extensions/extension_permission_set_unittest.cc @@ -43,8 +43,7 @@ static scoped_refptr<Extension> LoadManifest(const std::string& dir, scoped_refptr<Extension> extension = Extension::Create( path.DirName(), Extension::INVALID, - *static_cast<DictionaryValue*>(result.get()), - Extension::STRICT_ERROR_CHECKS | extra_flags, &error); + *static_cast<DictionaryValue*>(result.get()), extra_flags, &error); EXPECT_TRUE(extension) << error; return extension; } diff --git a/chrome/common/extensions/extension_set_unittest.cc b/chrome/common/extensions/extension_set_unittest.cc index 5d73d305..0bc8e92 100644 --- a/chrome/common/extensions/extension_set_unittest.cc +++ b/chrome/common/extensions/extension_set_unittest.cc @@ -41,7 +41,7 @@ scoped_refptr<Extension> CreateTestExtension(const std::string& name, std::string error; scoped_refptr<Extension> extension( Extension::Create(path, Extension::INTERNAL, manifest, - Extension::STRICT_ERROR_CHECKS, &error)); + Extension::NO_FLAGS, &error)); EXPECT_TRUE(extension.get()) << error; return extension; } diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index 9094670..5255c00 100644 --- a/chrome/common/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -93,7 +93,7 @@ static scoped_refptr<Extension> LoadManifest(const std::string& dir, static scoped_refptr<Extension> LoadManifestStrict( const std::string& dir, const std::string& test_file) { - return LoadManifest(dir, test_file, Extension::STRICT_ERROR_CHECKS); + return LoadManifest(dir, test_file, Extension::NO_FLAGS); } static ExtensionAction* LoadAction(const std::string& manifest) { @@ -459,8 +459,7 @@ TEST(ExtensionTest, ImageCaching) { values.SetString(keys::kName, "test"); values.SetString(keys::kVersion, "0.1"); scoped_refptr<Extension> extension(Extension::Create( - path, Extension::INVALID, values, Extension::STRICT_ERROR_CHECKS, - &errors)); + path, Extension::INVALID, values, Extension::NO_FLAGS, &errors)); ASSERT_TRUE(extension.get()); // Create an ExtensionResource pointing at an icon. @@ -763,8 +762,9 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, Permissions) { // for favicon access, we require the explicit pattern chrome://favicon/*. std::string error; extension = LoadManifestUnchecked("script_and_capture", - "extension_wildcard_chrome.json", Extension::INTERNAL, - Extension::NO_FLAGS, &error); + "extension_wildcard_chrome.json", + Extension::INTERNAL, Extension::NO_FLAGS, + &error); EXPECT_TRUE(extension == NULL); EXPECT_EQ(ExtensionErrorUtils::FormatErrorMessage( errors::kInvalidPermissionScheme, base::IntToString(1)), error); @@ -785,7 +785,7 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, Permissions) { // Component extensions with <all_urls> should get everything. extension = LoadManifest("script_and_capture", "extension_component_all.json", - Extension::COMPONENT, Extension::STRICT_ERROR_CHECKS); + Extension::COMPONENT, Extension::NO_FLAGS); EXPECT_TRUE(Allowed(extension, http_url)); EXPECT_TRUE(Allowed(extension, https_url)); EXPECT_TRUE(Allowed(extension, settings_url)); @@ -796,7 +796,7 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, Permissions) { // Component extensions should only get access to what they ask for. extension = LoadManifest("script_and_capture", "extension_component_google.json", Extension::COMPONENT, - Extension::STRICT_ERROR_CHECKS); + Extension::NO_FLAGS); EXPECT_TRUE(Allowed(extension, http_url)); EXPECT_TRUE(Blocked(extension, https_url)); EXPECT_TRUE(Blocked(extension, file_url)); @@ -867,7 +867,7 @@ static scoped_refptr<Extension> MakeSyncTestExtension( std::string error; scoped_refptr<Extension> extension = Extension::Create( - extension_path, location, source, Extension::STRICT_ERROR_CHECKS, &error); + extension_path, location, source, Extension::NO_FLAGS, &error); EXPECT_TRUE(extension); EXPECT_EQ("", error); return extension; diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc index 691c477..d3ba8b2 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc @@ -20,8 +20,7 @@ TEST_F(ExtensionManifestTest, ChromeResourcesPermissionValidOnlyForComponents) { errors::kInvalidPermissionScheme); std::string error; LoadExtension(Manifest("permission_chrome_resources_url.json"), - &error, - extensions::Extension::COMPONENT, - extensions::Extension::STRICT_ERROR_CHECKS); + &error, extensions::Extension::COMPONENT, + extensions::Extension::NO_FLAGS); EXPECT_EQ("", error); } diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_filebrowser_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_filebrowser_unittest.cc index 3668d35..72f2291 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_filebrowser_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_filebrowser_unittest.cc @@ -80,9 +80,7 @@ TEST_F(ExtensionManifestTest, FileManagerURLOverride) { // A component extention can override chrome://files/ URL. std::string error; LoadExtension(Manifest("filebrowser_url_override.json"), - &error, - Extension::COMPONENT, - Extension::STRICT_ERROR_CHECKS); + &error, Extension::COMPONENT, Extension::NO_FLAGS); #if defined(FILE_MANAGER_EXTENSION) EXPECT_EQ("", error); #else diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc index bd590c5..d80aa97 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc @@ -11,9 +11,8 @@ // backwards compatibility (we renamed it to "unlimitedStorage"). TEST_F(ExtensionManifestTest, OldUnlimitedStoragePermission) { scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess( - "old_unlimited_storage.json", - extensions::Extension::INTERNAL, - extensions::Extension::STRICT_ERROR_CHECKS); + "old_unlimited_storage.json", extensions::Extension::INTERNAL, + extensions::Extension::NO_FLAGS); EXPECT_TRUE(extension->HasAPIPermission( ExtensionAPIPermission::kUnlimitedStorage)); } diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc index 6d44698..6d396fe 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc @@ -15,31 +15,25 @@ TEST_F(ExtensionManifestTest, UpdateUrls) { // Test several valid update urls Testcase testcases[] = { Testcase("update_url_valid_1.json", Extension::INTERNAL, - Extension::STRICT_ERROR_CHECKS), + Extension::NO_FLAGS), Testcase("update_url_valid_2.json", Extension::INTERNAL, - Extension::STRICT_ERROR_CHECKS), + Extension::NO_FLAGS), Testcase("update_url_valid_3.json", Extension::INTERNAL, - Extension::STRICT_ERROR_CHECKS), + Extension::NO_FLAGS), Testcase("update_url_valid_4.json", Extension::INTERNAL, - Extension::STRICT_ERROR_CHECKS) + Extension::NO_FLAGS) }; RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_SUCCESS); // Test some invalid update urls Testcase testcases2[] = { - Testcase("update_url_invalid_1.json", - errors::kInvalidUpdateURL, - Extension::INTERNAL, - Extension::STRICT_ERROR_CHECKS), - Testcase("update_url_invalid_2.json", - errors::kInvalidUpdateURL, - Extension::INTERNAL, - Extension::STRICT_ERROR_CHECKS), - Testcase("update_url_invalid_3.json", - errors::kInvalidUpdateURL, - Extension::INTERNAL, - Extension::STRICT_ERROR_CHECKS) + Testcase("update_url_invalid_1.json", errors::kInvalidUpdateURL, + Extension::INTERNAL, Extension::NO_FLAGS), + Testcase("update_url_invalid_2.json", errors::kInvalidUpdateURL, + Extension::INTERNAL, Extension::NO_FLAGS), + Testcase("update_url_invalid_3.json", errors::kInvalidUpdateURL, + Extension::INTERNAL, Extension::NO_FLAGS) }; RunTestcases(testcases2, arraysize(testcases2), EXPECT_TYPE_ERROR); |