| Index: extensions/browser/extension_navigation_throttle.cc
|
| diff --git a/extensions/browser/extension_navigation_throttle.cc b/extensions/browser/extension_navigation_throttle.cc
|
| index 1d4a17d4954c92964c5e494edf747e706c114139..033de4326a22ca89e5f0ccf2243282654068d789 100644
|
| --- a/extensions/browser/extension_navigation_throttle.cc
|
| +++ b/extensions/browser/extension_navigation_throttle.cc
|
| @@ -56,15 +56,12 @@ ExtensionNavigationThrottle::WillStartOrRedirectRequest() {
|
| } else {
|
| // If the navigation is not to a chrome-extension resource, no need to
|
| // perform any more checks; it's outside of the purview of this throttle.
|
| - return content::NavigationThrottle::PROCEED;
|
| + return {PROCEED};
|
| }
|
|
|
| // If the navigation is to an unknown or disabled extension, block it.
|
| - if (!target_extension) {
|
| - // TODO(nick): This yields an unsatisfying error page; use a different error
|
| - // code once that's supported. https://crbug.com/649869
|
| - return content::NavigationThrottle::BLOCK_REQUEST;
|
| - }
|
| + if (!target_extension)
|
| + return {BLOCK_REQUEST, net::ERR_FILE_NOT_FOUND};
|
|
|
| if (navigation_handle()->IsInMainFrame()) {
|
| // Block top-level navigations to blob: or filesystem: URLs with extension
|
| @@ -80,7 +77,7 @@ ExtensionNavigationThrottle::WillStartOrRedirectRequest() {
|
| target_extension->permissions_data()->HasAPIPermission(
|
| APIPermission::kWebView);
|
| if (!has_webview_permission)
|
| - return content::NavigationThrottle::CANCEL;
|
| + return {CANCEL};
|
| }
|
|
|
| guest_view::GuestViewBase* guest =
|
| @@ -106,7 +103,7 @@ ExtensionNavigationThrottle::WillStartOrRedirectRequest() {
|
| is_guest, target_extension, owner_extension, partition_id, url.path(),
|
| navigation_handle()->GetPageTransition(), &allowed);
|
| if (!allowed)
|
| - return content::NavigationThrottle::BLOCK_REQUEST;
|
| + return {BLOCK_REQUEST, net::ERR_ACCESS_DENIED};
|
| }
|
|
|
| // Platform apps should only load in app windows, or guest views; never in
|
| @@ -119,11 +116,11 @@ ExtensionNavigationThrottle::WillStartOrRedirectRequest() {
|
| case VIEW_TYPE_PANEL:
|
| break;
|
| default:
|
| - return content::NavigationThrottle::CANCEL;
|
| + return {CANCEL};
|
| }
|
| }
|
|
|
| - return content::NavigationThrottle::PROCEED;
|
| + return {PROCEED};
|
| }
|
|
|
| // This is a subframe navigation to a |target_extension| resource.
|
| @@ -158,12 +155,12 @@ ExtensionNavigationThrottle::WillStartOrRedirectRequest() {
|
| if (external_ancestor) {
|
| // Cancel navigations to nested URLs, to match the main frame behavior.
|
| if (!url_has_extension_scheme)
|
| - return content::NavigationThrottle::CANCEL;
|
| + return {CANCEL};
|
|
|
| // |url| must be in the manifest's "web_accessible_resources" section.
|
| if (!WebAccessibleResourcesInfo::IsResourceWebAccessible(target_extension,
|
| url.path()))
|
| - return content::NavigationThrottle::BLOCK_REQUEST;
|
| + return {BLOCK_REQUEST, net::ERR_ACCESS_DENIED};
|
|
|
| // A platform app may not be loaded in an <iframe> by another origin.
|
| //
|
| @@ -172,17 +169,17 @@ ExtensionNavigationThrottle::WillStartOrRedirectRequest() {
|
| // Security Policy. But CSP is incapable of blocking the chrome-extension
|
| // scheme. Thus, this case must be handled specially here.
|
| if (target_extension->is_platform_app())
|
| - return content::NavigationThrottle::CANCEL;
|
| + return {CANCEL};
|
|
|
| // A platform app may not load another extension in an <iframe>.
|
| const Extension* parent_extension =
|
| registry->enabled_extensions().GetExtensionOrAppByURL(
|
| parent->GetSiteInstance()->GetSiteURL());
|
| if (parent_extension && parent_extension->is_platform_app())
|
| - return content::NavigationThrottle::BLOCK_REQUEST;
|
| + return {BLOCK_REQUEST, net::ERR_BLOCKED_BY_CLIENT};
|
| }
|
|
|
| - return content::NavigationThrottle::PROCEED;
|
| + return {PROCEED};
|
| }
|
|
|
| content::NavigationThrottle::ThrottleCheckResult
|
| @@ -196,7 +193,7 @@ ExtensionNavigationThrottle::WillRedirectRequest() {
|
| if (result.action() == BLOCK_REQUEST) {
|
| // BLOCK_REQUEST is on redirect does not work without PlzNavigate, so
|
| // translate these errors into CANCEL.
|
| - return CANCEL;
|
| + return {CANCEL};
|
| }
|
| return result;
|
| }
|
|
|