Commit 120ae96d authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Limit WebUI to just HTML Imports, instead of all of Web Components

The WebUI pages should only require HTML Imports at this point,
and not Shadow DOM v0 or Custom Elements v0. Limit to just that.

Bug: 1111843, 937746
Change-Id: Ib61e38475957e045fb5ecd38dc761f156f55aa53
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2512381Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824721}
parent 07e4c76d
......@@ -1589,7 +1589,7 @@ void ChromeContentRendererClient::DidSetUserAgent(
#endif
}
bool ChromeContentRendererClient::RequiresWebComponentsV0(const GURL& url) {
bool ChromeContentRendererClient::RequiresHtmlImports(const GURL& url) {
if (url.SchemeIs(content::kChromeUIScheme)) {
base::StringPiece host_piece = url.host_piece();
// TODO(crbug.com/1014322): Remove when migrated to Polymer3.
......
......@@ -193,7 +193,7 @@ class ChromeContentRendererClient
const std::string& name) override;
bool IsSafeRedirectTarget(const GURL& url) override;
void DidSetUserAgent(const std::string& user_agent) override;
bool RequiresWebComponentsV0(const GURL& url) override;
bool RequiresHtmlImports(const GURL& url) override;
#if BUILDFLAG(ENABLE_EXTENSIONS)
void MaybeProxyURLLoaderFactory(
content::RenderFrame* render_frame,
......
......@@ -246,7 +246,7 @@ bool ContentRendererClient::IsSafeRedirectTarget(const GURL& url) {
void ContentRendererClient::DidSetUserAgent(const std::string& user_agent) {}
bool ContentRendererClient::RequiresWebComponentsV0(const GURL& url) {
bool ContentRendererClient::RequiresHtmlImports(const GURL& url) {
return false;
}
......
......@@ -409,11 +409,11 @@ class CONTENT_EXPORT ContentRendererClient {
// most once.
virtual void DidSetUserAgent(const std::string& user_agent);
// Returns true if |url| still requires native Web Components v0 features.
// Returns true if |url| still requires the native HTML Imports feature.
// Used for Web UI pages.
// TODO(937747): Remove this function when all WebUIs can function without
// Web Components v0.
virtual bool RequiresWebComponentsV0(const GURL& url);
// HTML Imports.
virtual bool RequiresHtmlImports(const GURL& url);
// Optionally returns audio renderer algorithm parameters.
virtual base::Optional<::media::AudioRendererAlgorithmParameters>
......
......@@ -3224,13 +3224,9 @@ void RenderFrameImpl::CommitNavigationWithParams(
prefetch_loader_factory,
std::unique_ptr<DocumentState> document_state,
std::unique_ptr<WebNavigationParams> navigation_params) {
// TODO(738611): This is temporary switch to have chrome WebUI use the old web
// APIs. After completion of the migration, we should remove this.
if (GetContentClient()->renderer()->RequiresWebComponentsV0(
common_params->url)) {
blink::WebRuntimeFeatures::EnableShadowDOMV0(true);
blink::WebRuntimeFeatures::EnableCustomElementsV0(true);
// TODO(738611): This is temporary switch to have chrome WebUI use the old
// HTML Imports API. After completion of the migration, we should remove this.
if (GetContentClient()->renderer()->RequiresHtmlImports(common_params->url)) {
blink::WebRuntimeFeatures::EnableHTMLImports(true);
}
......
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