Move GetSiteURL to SecurityPrincipal interface [chromium/src : main]

0 views
Skip to first unread message

Viktoriya Bryhider (Gerrit)

unread,
Apr 1, 2026, 1:22:24 PM (2 days ago) Apr 1
to Alex Moshchuk, Liang Zhao, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org, Kevin McNee, Hiroki Nakagawa, Peter Beverloo, James Maclean, ajwong...@chromium.org, alexmo...@chromium.org, blink-work...@chromium.org, bmcquad...@chromium.org, chromium-a...@chromium.org, creis...@chromium.org, csharris...@chromium.org, dmurph+wat...@chromium.org, eme-r...@chromium.org, extension...@chromium.org, feature-me...@chromium.org, horo+...@chromium.org, kinuko+ser...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, navigation...@chromium.org, servicewor...@chromium.org, shimazu+se...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org, webap...@microsoft.com
Attention needed from Alex Moshchuk

Viktoriya Bryhider added 17 comments

Patchset-level comments
File-level comment, Patchset 5 (Latest):
Viktoriya Bryhider . resolved

Publishing removing GetSiteURL from SiteInstance.

I have moved all calls as is to `GetSecurityPrincipal().GetDeprecatedSiteURL()`. It should be green now. Checked all callsites from outside of /content and left unresolved comments where we can get rid of GetSecurityPrincipal().GetDeprecatedSiteURL() - can create separate Cls if you could confirm that those are acceptable replacements.

Please let me know how to proceed or if there a way to make it easier...
Thanks!

File chrome/browser/chrome_browser_interface_binders.cc
Line 371, Patchset 2: ->GetSecurityPrincipal()
Viktoriya Bryhider . unresolved

`net::SchemefulSite(frame_host->GetLastCommittedURL()).GetURL()` should work here.

File chrome/browser/extensions/chrome_extensions_browser_client_non_android.cc
Line 103, Patchset 2: owner_site_instance->GetSecurityPrincipal().GetDeprecatedSiteURL());
Viktoriya Bryhider . unresolved

Can pass `owner_rfh` instead and use `owner_rfh->GetLastCommittedOrigin().GetURL()` in place of `owner_site_instance->GetSecurityPrincipal().GetDeprecatedSiteURL()`. I have tried this locally - and tests seems to pass... Can create CL

File chrome/browser/media/cdm_document_service_impl.cc
File chrome/browser/site_protection/site_familiarity_utils.cc
Line 155, Patchset 2: const GURL& site_url = web_contents->GetSiteInstance()
Viktoriya Bryhider . resolved

Intentionally using SiteInstance::GetSiteURL - https://chromium-review.googlesource.com/c/chromium/src/+/7426181

File chrome/browser/task_manager/providers/web_contents/back_forward_cache_task.cc
Line 31, Patchset 2: const GURL& site_url =
Viktoriya Bryhider . resolved

In theory can try to replace with `net::SchemefulSite(render_frame_host->GetLastCommittedURL())` to keep eTLD+1, but it will not work for hosted apps(?).
Another option is to keep it and wait for crbug.com/40775860 mentioned above to replace URL with title.

File chrome/browser/task_manager/providers/web_contents/fenced_frame_task.cc
Line 48, Patchset 2: site_instance_->GetSecurityPrincipal().GetDeprecatedSiteURL().spec());
Viktoriya Bryhider . unresolved

I have tried to replace this with `net::SchemefulSite(rfh_->GetLastCommittedURL());` and run tests `browser_tests --gtest_filter="*FencedFrameTaskBrowserTest*" ` - the only difference is in last slash: `https://b.test/` vs `https://b.test` - looks like safe to replace to me.

File chrome/browser/task_manager/providers/web_contents/subframe_task.cc
Line 78, Patchset 2: site_instance_->GetSecurityPrincipal().GetDeprecatedSiteURL();
Viktoriya Bryhider . resolved

Need effective URL for hosted apps - otherwise can use SchemefulSite(GetLastCommittedURL())

File chrome/browser/ui/browser_instant_controller.cc
Line 59, Patchset 2: GURL site_url = contents->GetPrimaryMainFrame()
Viktoriya Bryhider . unresolved

Can potentially use `contents->GetLastCommittedURL()` here. BrowserInstantControllerTest.DefaultSearchProviderChanged passes with that change - not sure if there any corner cases.

File chrome/browser/ui/webui/top_chrome/webui_contents_preload_manager.cc
Line 468, Patchset 2: webui::LogWebUIShown(web_contents_ret->GetSiteInstance()
Viktoriya Bryhider . unresolved

Test `LogWebUIUrlTest.ShownWebUIForPreloadedPage` is hitting this codepath: I have checked:
1. web_contents_ret->GetVisibleURL();
2. webui_url;
3. web_contents_ret->GetURL(); all of them are the same - can try to substitute `GetDeprecatedSiteURL()` with one of them.

File components/guest_view/browser/guest_view_base.cc
Line 601, Patchset 2:const GURL& GuestViewBase::GetOwnerSiteURL() const {
Viktoriya Bryhider . unresolved

Tried to use `owner_rfh()->GetLastCommittedOrigin().GetURL()` here - tests which are hitting that codepath (*WebViewContentScript*) are passing, not sure about corner cases if any - can put CL.

File components/guest_view/browser/slim_web_view/slim_web_view_guest.cc
Line 415, Patchset 3: owner_rfh()
Viktoriya Bryhider . unresolved

owner_rfh should have committed navigation from what I'm reading. Can try to use `owner_rfh()->GetLastCommittedOrigin().host()`. Have not tested.

File content/browser/media/media_interface_proxy.cc
Line 501, Patchset 4: render_frame_host()
Viktoriya Bryhider . resolved

Have WIP to replace SiteURL with SecurityPrincipal in Services - https://chromium-review.googlesource.com/c/chromium/src/+/7712794

File extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
Line 110, Patchset 2: ->GetSecurityPrincipal()
Viktoriya Bryhider . unresolved

Considering replacing it with `embedder_rfh->GetMainFrame()->GetLastCommittedOrigin()` similar to line 119 in this file. Have not found cases when it will not work.

Line 629, Patchset 2: ->GetSiteInstance()
Viktoriya Bryhider . unresolved

Considering replacing it with `render_frame_host()->GetLastCommittedURL().withEmptyPath()`

File extensions/browser/extension_function_dispatcher.cc
Line 180, Patchset 2: .GetDeprecatedSiteURL()
Viktoriya Bryhider . unresolved

Seems safe to use frame.GetLastCommittedURL() or frame.GetLastCommittedOrigin() here.

File extensions/browser/extensions_browser_client.cc
Line 230, Patchset 2: const GURL& owner_site_url =
Viktoriya Bryhider . unresolved
Open in Gerrit

Related details

Attention is currently required from:
  • Alex Moshchuk
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I15e60f7d005865428ea5b50f85bbe1606ec04768
Gerrit-Change-Number: 7614138
Gerrit-PatchSet: 5
Gerrit-Owner: Viktoriya Bryhider <vbry...@microsoft.com>
Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
Gerrit-Reviewer: Viktoriya Bryhider <vbry...@microsoft.com>
Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
Gerrit-CC: James Maclean <wjma...@chromium.org>
Gerrit-CC: Kevin McNee <mc...@chromium.org>
Gerrit-CC: Liang Zhao <lz...@microsoft.com>
Gerrit-CC: Peter Beverloo <pe...@chromium.org>
Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
Gerrit-Comment-Date: Wed, 01 Apr 2026 17:22:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages