Enforce policy host restrictions in regard to the same-origin policy.
Bug: 774731
Cq-Include-Trybots: luci.chromium.try:linux_mojo
Change-Id: I811af3256766f6cd7b4466b6b894067e74f652fd
Reviewed-on: https://chromium-review.googlesource.com/c/1050806
Commit-Queue: Nick Peterson <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Reviewed-by: Mike West <[email protected]>
Reviewed-by: Matt Menke <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Takashi Toyoshima <[email protected]>
Reviewed-by: Devlin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#599859}
diff --git a/chrome/browser/extensions/extension_management_test_util.cc b/chrome/browser/extensions/extension_management_test_util.cc
index 21b667b..3eaab625 100644
--- a/chrome/browser/extensions/extension_management_test_util.cc
+++ b/chrome/browser/extensions/extension_management_test_util.cc
@@ -198,6 +198,34 @@
RemoveStringFromList(make_path(prefix, schema::kPolicyBlockedHosts), host);
}
+// Helper functions for 'runtime_allowed_hosts' manipulation ------------------
+
+void ExtensionManagementPrefUpdaterBase::UnsetPolicyAllowedHosts(
+ const std::string& prefix) {
+ DCHECK(prefix == schema::kWildcard || crx_file::id_util::IdIsValid(prefix));
+ pref_->Remove(make_path(prefix, schema::kPolicyAllowedHosts), nullptr);
+}
+
+void ExtensionManagementPrefUpdaterBase::ClearPolicyAllowedHosts(
+ const std::string& prefix) {
+ DCHECK(prefix == schema::kWildcard || crx_file::id_util::IdIsValid(prefix));
+ ClearList(make_path(prefix, schema::kPolicyAllowedHosts));
+}
+
+void ExtensionManagementPrefUpdaterBase::AddPolicyAllowedHost(
+ const std::string& prefix,
+ const std::string& host) {
+ DCHECK(prefix == schema::kWildcard || crx_file::id_util::IdIsValid(prefix));
+ AddStringToList(make_path(prefix, schema::kPolicyAllowedHosts), host);
+}
+
+void ExtensionManagementPrefUpdaterBase::RemovePolicyAllowedHost(
+ const std::string& prefix,
+ const std::string& host) {
+ DCHECK(prefix == schema::kWildcard || crx_file::id_util::IdIsValid(prefix));
+ RemoveStringFromList(make_path(prefix, schema::kPolicyAllowedHosts), host);
+}
+
// Helper functions for 'allowed_permissions' manipulation ---------------------
void ExtensionManagementPrefUpdaterBase::UnsetAllowedPermissions(