chrome: Allow WebUI handling of DevTools scheme (fixes issue #3421)

This commit is contained in:
Marshall Greenblatt 2023-01-23 13:42:05 -05:00
parent 47d2651ea4
commit c3c5d6ff37
1 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include "base/values.h" #include "base/values.h"
#include "cef/grit/cef_resources.h" #include "cef/grit/cef_resources.h"
#include "chrome/browser/browser_about_handler.h" #include "chrome/browser/browser_about_handler.h"
#include "chrome/browser/devtools/devtools_ui_bindings.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_untrusted_web_ui_configs.h" #include "chrome/browser/ui/webui/chrome_untrusted_web_ui_configs.h"
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
@ -534,6 +535,11 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
// Returns true if WebUI is allowed to handle the specified |url|. // Returns true if WebUI is allowed to handle the specified |url|.
static bool AllowWebUIForURL(const GURL& url) { static bool AllowWebUIForURL(const GURL& url) {
if (cef::IsChromeRuntimeEnabled() &&
url.SchemeIs(content::kChromeDevToolsScheme)) {
return DevToolsUIBindings::IsValidFrontendURL(url);
}
if (!url.SchemeIs(content::kChromeUIScheme) && if (!url.SchemeIs(content::kChromeUIScheme) &&
!url.SchemeIs(content::kChromeUIUntrustedScheme)) { !url.SchemeIs(content::kChromeUIUntrustedScheme)) {
return false; return false;