From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sun, 6 Mar 2022 11:29:27 +0100 Subject: Revert Permit blocking of view-source This reverts commit e72fc9b64116bf259e516096fcc60b58ae8ae1b3. License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- .../policy_blocklist_navigation_throttle.cc | 19 ------------------- .../policy_blocklist_navigation_throttle.h | 4 ---- 2 files changed, 23 deletions(-) diff --git a/components/policy/content/policy_blocklist_navigation_throttle.cc b/components/policy/content/policy_blocklist_navigation_throttle.cc --- a/components/policy/content/policy_blocklist_navigation_throttle.cc +++ b/components/policy/content/policy_blocklist_navigation_throttle.cc @@ -15,7 +15,6 @@ #include "components/prefs/pref_service.h" #include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_context.h" -#include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_handle.h" #include "url/gurl.h" @@ -43,19 +42,6 @@ PolicyBlocklistNavigationThrottle::PolicyBlocklistNavigationThrottle( PolicyBlocklistNavigationThrottle::~PolicyBlocklistNavigationThrottle() = default; -bool PolicyBlocklistNavigationThrottle::IsBlockedViewSourceNavigation() { - content::NavigationEntry* nav_entry = - navigation_handle()->GetNavigationEntry(); - if (!nav_entry || !nav_entry->IsViewSourceMode()) - return false; - - GURL view_source_url = GURL(std::string("view-source:") + - navigation_handle()->GetURL().spec()); - - return (blocklist_service_->GetURLBlocklistState(view_source_url) == - URLBlocklistState::URL_IN_BLOCKLIST); -} - content::NavigationThrottle::ThrottleCheckResult PolicyBlocklistNavigationThrottle::WillStartRequest() { const GURL& url = navigation_handle()->GetURL(); @@ -72,11 +58,6 @@ PolicyBlocklistNavigationThrottle::WillStartRequest() { net::ERR_BLOCKED_BY_ADMINISTRATOR); } - if (IsBlockedViewSourceNavigation()) { - return ThrottleCheckResult(BLOCK_REQUEST, - net::ERR_BLOCKED_BY_ADMINISTRATOR); - } - if (blocklist_state == URLBlocklistState::URL_IN_ALLOWLIST) return PROCEED; diff --git a/components/policy/content/policy_blocklist_navigation_throttle.h b/components/policy/content/policy_blocklist_navigation_throttle.h --- a/components/policy/content/policy_blocklist_navigation_throttle.h +++ b/components/policy/content/policy_blocklist_navigation_throttle.h @@ -35,10 +35,6 @@ class PolicyBlocklistNavigationThrottle : public content::NavigationThrottle { const char* GetNameForLogging() override; private: - // Returns TRUE if this navigation is to view-source: and view-source is on - // the URLBlocklist. - bool IsBlockedViewSourceNavigation(); - // To ensure both allow and block policies override Safe Sites, // SafeSitesNavigationThrottle must be consulted as part of this throttle // rather than added separately to the list of throttles. -- 2.25.1