Commit b8de8c26 authored by Samuel Huang's avatar Samuel Huang Committed by Commit Bot

Revert "Clear inapplicable disable reasons for component extensions"

This reverts commit 07619eb1.

Reason for revert: Speculative revert for "Linux Chromium OS ASan LSan Tests (1)" failures in unit_tests related to extensions.

Original change's description:
> Clear inapplicable disable reasons for component extensions
> 
> This change ensures that all component extensions are allowed to be activated  despite having some inapplicable disable reasons set.
> 
> In particular, this fixes any specific observed on-device instances where ChromeVox or tts had a disable reason of blocked by policy which prevented it from being activated.
> 
> Bug: 946839,947305
> Test: manually. With a device enterprise enrolled, push down kiosk apps to the device from an admin console. Ensure that ChromeVox still works on all screens.
> Change-Id: I2cedafeb16d4420702188f1516825ce1bad52802
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1553017
> Commit-Queue: David Tseng <dtseng@chromium.org>
> Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#648464}

TBR=dtseng@chromium.org,rdevlin.cronin@chromium.org,devlin@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 946839, 947305
Change-Id: Icf19fe7e45c41ed559a732703844c0874c6cfdd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1557734Reviewed-by: default avatarSamuel Huang <huangs@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#648573}
parent 48a29708
...@@ -1208,8 +1208,6 @@ void ExtensionService::AddExtension(const Extension* extension) { ...@@ -1208,8 +1208,6 @@ void ExtensionService::AddExtension(const Extension* extension) {
} }
void ExtensionService::AddComponentExtension(const Extension* extension) { void ExtensionService::AddComponentExtension(const Extension* extension) {
extension_prefs_->ClearInapplicableDisableReasonsForComponentExtension(
extension->id());
const std::string old_version_string( const std::string old_version_string(
extension_prefs_->GetVersionString(extension->id())); extension_prefs_->GetVersionString(extension->id()));
const base::Version old_version(old_version_string); const base::Version old_version(old_version_string);
......
...@@ -17,9 +17,6 @@ namespace disable_reason { ...@@ -17,9 +17,6 @@ namespace disable_reason {
// Also carefully consider if your reason should sync to other devices, and if // Also carefully consider if your reason should sync to other devices, and if
// so, add it to kKnownSyncableDisableReasons in // so, add it to kKnownSyncableDisableReasons in
// chrome/browser/extensions/extension_sync_service.cc. // chrome/browser/extensions/extension_sync_service.cc.
// Finally, consider whether your disable reason applies to component
// extensions. Reference/update the existing list of applicable reasons in
// ExtensionsPrefs::ClearInapplicableDisableReasonsForComponentExtension.
enum DisableReason { enum DisableReason {
DISABLE_NONE = 0, DISABLE_NONE = 0,
DISABLE_USER_ACTION = 1 << 0, DISABLE_USER_ACTION = 1 << 0,
......
...@@ -783,22 +783,6 @@ void ExtensionPrefs::ClearDisableReasons(const std::string& extension_id) { ...@@ -783,22 +783,6 @@ void ExtensionPrefs::ClearDisableReasons(const std::string& extension_id) {
DISABLE_REASON_CLEAR); DISABLE_REASON_CLEAR);
} }
void ExtensionPrefs::ClearInapplicableDisableReasonsForComponentExtension(
const std::string& component_extension_id) {
static constexpr int kAllowDisableReasons =
disable_reason::DISABLE_RELOAD |
disable_reason::DISABLE_UNSUPPORTED_REQUIREMENT |
disable_reason::DISABLE_CORRUPTED;
// Some disable reasons incorrectly cause component extensions to never
// activate on load. See https://crbug.com/946839 for more details on why we
// do this.
ModifyDisableReasons(
component_extension_id,
kAllowDisableReasons & GetDisableReasons(component_extension_id),
DISABLE_REASON_REPLACE);
}
void ExtensionPrefs::ModifyDisableReasons(const std::string& extension_id, void ExtensionPrefs::ModifyDisableReasons(const std::string& extension_id,
int reasons, int reasons,
DisableReasonChange change) { DisableReasonChange change) {
......
...@@ -281,10 +281,6 @@ class ExtensionPrefs : public KeyedService { ...@@ -281,10 +281,6 @@ class ExtensionPrefs : public KeyedService {
int disable_reasons); int disable_reasons);
void ClearDisableReasons(const std::string& extension_id); void ClearDisableReasons(const std::string& extension_id);
// Clears disable reasons that do not apply to component extensions.
void ClearInapplicableDisableReasonsForComponentExtension(
const std::string& component_extension_id);
// Gets the set of extensions that have been blacklisted in prefs. This will // Gets the set of extensions that have been blacklisted in prefs. This will
// return only the blocked extensions, not the "greylist" extensions. // return only the blocked extensions, not the "greylist" extensions.
// TODO(oleg): Make method names consistent here, in extension service and in // TODO(oleg): Make method names consistent here, in extension service and in
......
...@@ -111,7 +111,6 @@ void ExtensionRegistrar::AddExtension( ...@@ -111,7 +111,6 @@ void ExtensionRegistrar::AddExtension(
void ExtensionRegistrar::AddNewExtension( void ExtensionRegistrar::AddNewExtension(
scoped_refptr<const Extension> extension) { scoped_refptr<const Extension> extension) {
if (extension_prefs_->IsExtensionBlacklisted(extension->id())) { if (extension_prefs_->IsExtensionBlacklisted(extension->id())) {
DCHECK(!Manifest::IsComponentLocation(extension->location()));
// Only prefs is checked for the blacklist. We rely on callers to check the // Only prefs is checked for the blacklist. We rely on callers to check the
// blacklist before calling into here, e.g. CrxInstaller checks before // blacklist before calling into here, e.g. CrxInstaller checks before
// installation then threads through the install and pending install flow // installation then threads through the install and pending install flow
...@@ -119,7 +118,6 @@ void ExtensionRegistrar::AddNewExtension( ...@@ -119,7 +118,6 @@ void ExtensionRegistrar::AddNewExtension(
// extensions. // extensions.
registry_->AddBlacklisted(extension); registry_->AddBlacklisted(extension);
} else if (delegate_->ShouldBlockExtension(extension.get())) { } else if (delegate_->ShouldBlockExtension(extension.get())) {
DCHECK(!Manifest::IsComponentLocation(extension->location()));
registry_->AddBlocked(extension); registry_->AddBlocked(extension);
} else if (extension_prefs_->IsExtensionDisabled(extension->id())) { } else if (extension_prefs_->IsExtensionDisabled(extension->id())) {
registry_->AddDisabled(extension); registry_->AddDisabled(extension);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment