Commit c95c2b44 authored by Aaron Colwell's avatar Aaron Colwell Committed by Commit Bot

Removing GetSiteForURL() call from ExtensionWebContentsObserver.

Replacing site URL comparison with a check that compares extension
pointers. This is similar to ProcessManager::GetExtensionForWebContents()
code which appears to be trying to accomplish the same goal. This change
is part of an effort to remove site URL usage across the code base.

Bug: 1085275
Change-Id: Ice16e145849786eabcfbe5fd05861528a2beb8a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212785
Commit-Queue: Aaron Colwell <acolwell@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Auto-Submit: Aaron Colwell <acolwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818027}
parent c38065a7
......@@ -292,12 +292,14 @@ const Extension* ExtensionWebContentsObserver::GetExtensionFromFrame(
if (verify_url) {
const url::Origin& origin(render_frame_host->GetLastCommittedOrigin());
// Without site isolation, this check is needed to eliminate non-extension
// schemes. With site isolation, this is still needed to exclude sandboxed
// extension frames with an opaque origin.
const GURL site_url(render_frame_host->GetSiteInstance()->GetSiteURL());
if (origin.opaque() || site_url != content::SiteInstance::GetSiteForURL(
browser_context, origin.GetURL()))
// This check is needed to eliminate origins that are not within a
// hosted-app's web extent, and sandboxed extension frames with an opaque
// origin.
// TODO(1139108) See if extension check is still needed after bug is fixed.
auto* extension_for_origin = ExtensionRegistry::Get(browser_context)
->enabled_extensions()
.GetExtensionOrAppByURL(origin.GetURL());
if (origin.opaque() || extension_for_origin != extension)
return nullptr;
}
......
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