Prevent origin updates in same-document navigations and reclassify MHTML navigations [chromium/src : main]

0 views
Skip to first unread message

Diana Qu (Gerrit)

unread,
Jun 10, 2025, 1:52:37 AMJun 10
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng, Takashi Toyoshima and Łukasz Anforowicz

Diana Qu added 6 comments

Patchset-level comments
File-level comment, Patchset 18:
Diana Qu . resolved

FYI I update the title to affect more closely to the change in this CL

File content/browser/renderer_host/navigator.cc
Line 632, Patchset 16: if (!was_within_same_document) {
Charlie Reis . resolved

Since there's a risk we could end up with issues from either the MHTML change or the new renderer kills, I would suggest including a base::Feature killswitch that allows us to turn the changes off if needed (e.g., on Stable if that's when we notice it). That could guard each of the 3 functional changes. (I'm not opposed to using separate features for the content/ and blink/ changes if that's easier.)

Diana Qu

Updated.

Line 642, Patchset 3: }
Charlie Reis . resolved

In Alex's https://chromium-review.googlesource.com/c/chromium/src/+/1081937/3/content/browser/frame_host/navigator_impl.cc, he tried out an else block with CHECKs to verify that same-document navigations weren't changing these values in practice. Apparently that failed a lot of tests at the time (2018), as listed on https://crbug.com/40580002.

Can you run try jobs with similar CHECKs in this CL, to see if those issues have been resolved already or still happen? We may want to get to the bottom of it if they're still failing.

Diana Qu

ALL passing for this case.

Diana Qu

Do we want to end up keeping both two places that CHECK on origins? Seems like its good to keep to catch bugs.

Charlie Reis

I like the idea of keeping some kind of validation. We don't want to let the renderer kill the browser process by sending bad parameters, but there's ways to handle that. For example, we could do a renderer kill when validating the parameters if the insecure_request_policy or insecure_navigations_set differ on a same document navigation. That would need to happen earlier, such as with some of the other renderer kills in RenderFrameHostImpl::DidCommitNavigationInternal (which calls this function). After that, it should be impossible for the renderer to make us fail the CHECK with a bad parameter, so we could keep the CHECK here as documentation and a backstop, or remove it as redundant.

(In all of these cases, we may want to use the NotFatalUntil or killswitch approach to be able to react in case there are unexpected failures in the wild, which we might not notice until stable channel.)

Diana Qu

Let me think on what to do here. I feel like we shouldn't crash browser in same document mismatch case in real life, but want to keep some kind of signal to help catch bugs

Charlie Reis

In the short term, DumpWithoutCrashing gives a signal without actually crashing the browser. I think a renderer kill isn't a bad option, since that also creates a crash report without taking down the browser process, and only prevents further corruption from a misbehaving (either buggy or compromised) renderer. This will matter more as RenderDocument makes the origin of a RenderFrameHost const, and hopefully things like these values as well.

Diana Qu

Sure. I will do just a renderer crash in DidCommitNavigationInternal instead.

Diana Qu

Updated. with renderer kill and validated that without mhtml change the test will fail.

Charlie Reis

Thanks! Which test failure are you referring to? Maybe we can mention the test name in the CL description.

Diana Qu

Sure. Let me add that to the description.

File content/browser/renderer_host/render_frame_host_impl.cc
Line 15166, Patchset 16: GetProcess(), bad_message::RFH_INVALID_ORIGIN_ON_COMMIT);
Charlie Reis . resolved

Ah, it's best not to reuse existing renderer kill codes, because that makes it harder to tell which one is occurring when we look at histograms. Let's use a new unique value here.

It's probably also worth referencing same-document in all of these codes, along the lines of:

RFH_SAME_DOC_ORIGIN_CHANGE
RFH_SAME_DOC_INSECURE_REQUEST_POLICY_CHANGE
RFH_SAME_DOC_INSECURE_NAV_SET_CHANGE

Diana Qu

Updated.

Line 15311, Patchset 15: was_discarded_ = navigation_request->commit_params().was_discarded;
Takashi Toyoshima . resolved

I think this is a ClangTidy's false alert, but anyway you need a following line in the CL description to skip the check.
```
Skip-Clang-Tidy-Checks: bugprone-use-after-move
```

Diana Qu

I see. I run the git cl format tools and end up with these change. I can revert this style change.

Diana Qu

Ah nvm. I will add to CL description. Thanks!

Diana Qu

Done

File third_party/blink/renderer/core/loader/frame_loader.cc
Line 731, Patchset 16: same_document_navigation = false;
Charlie Reis . unresolved

I realized there's a problem with this approach, though I'm curious for dcheng@'s or lukasza@'s take on whether/how to fix it.

Here, we're unconditionally classifying all navigations within MHTML pages be cross-document, to handle the case where about:blank#foo in MHTML is actually cross-document (and thus changes origins).

Unfortunately, it is possible to have actual same-document navigations in MHTML, though apparently another bug makes that a little tricky. Imagine saving a page with a #foo link to MHTML (such as https://csreis.github.io/tests/same-document-navigations.html), loading the archive, and then clicking on the link. That should be same-document, but then this code would force it to be cross-document (and worse, it would result in an empty document because that #foo URL is not saved in the archive).

I've tried this in practice (including within a subframe) and there's a separate bug where the #foo link gets rewritten to include the full URL (https://csreis.github.io/tests/same-document-navigations.html#foo), and thus it doesn't look like a same-document URL from the MHTML's version of the URL. This means the #foo link is already basically broken today.

Using DevTools, I found it was technically still possible to navigate to "#foo" and get a same-document navigation, and I confirmed that this new code made it cross-document (and thus broken again). Without DevTools, I'm not sure if we can run into this problem, since MHTML can't run scripts (e.g., pushState), and all same-document links appear to be rewritten to leave the archive.

I'm not quite sure how we should approach this. Long term, it seems like we should fix the MHTML bug and allow same-document navigations, which would mean finding a different way to handle this case (e.g., only treating that first about:blank#foo navigation during archive loading as cross-document, but not all navigations within MHTML documents?). For now, it appears really hard to get a same-document navigation in MHTML to begin with (without opening DevTools), so maybe a TODO in this block isn't out of the question?

Diana Qu

Doesn't sounds like classify MTHML scope to only #framgent to cross-document is doable right now. I added some todos here just in case we decided to ship first and fix the #foo case later. (https://issues.chromium.org/issues/423663315). But I'm open with discussions.

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Takashi Toyoshima
  • Łukasz Anforowicz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: Ia086793fda05d4b0b280a5e1b62165c4f1bfc566
Gerrit-Change-Number: 6461342
Gerrit-PatchSet: 18
Gerrit-Owner: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Charlie Reis <cr...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Reviewer: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-CC: Alex Moshchuk <ale...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Jonathan Ross <jon...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Charlie Reis <cr...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Tue, 10 Jun 2025 05:52:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Charlie Reis <cr...@chromium.org>
Comment-In-Reply-To: Diana Qu <xi...@microsoft.com>
Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Łukasz Anforowicz (Gerrit)

unread,
Jun 10, 2025, 12:50:34 PMJun 10
to Diana Qu, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Diana Qu

Łukasz Anforowicz added 3 comments

Commit Message
Line 12, Patchset 19 (Latest):- As a result, NavigationMhtmlBrowserTest.IframeAboutBlankNotFound
now passes, since the navigation is no longer misclassified.
Łukasz Anforowicz . unresolved

Can you help me when/how the test becomes broken? It's not broken today, so I assume that the test will break after step 1 (enforcing invariants on same-document navigations)?

File content/browser/renderer_host/render_frame_host_impl.cc
Line 15314, Patchset 19 (Latest): was_discarded_ = navigation_request->commit_params().was_discarded;
Łukasz Anforowicz . unresolved

Please fix this WARNING reported by ClangTidy: check: bugprone-use-after-move

Analyzer Description: Runs clang-tidy checks against chromium
Owner: gb...@chromium.org

check: bugprone-use-after-move

'navigation_request' used after it was moved (https://clang.llvm.org/extra/clang-tidy/checks/bugprone/use-after-move.html)

(Note: You can add `Skip-Clang-Tidy-Checks: bugprone-use-after-move` footer to the CL description to skip the check)

(Lint observed on `android-clang-tidy-rel` and `linux-clang-tidy-rel`)

File third_party/blink/renderer/core/loader/frame_loader.cc
Line 731, Patchset 16: same_document_navigation = false;
Charlie Reis . unresolved

I realized there's a problem with this approach, though I'm curious for dcheng@'s or lukasza@'s take on whether/how to fix it.

Here, we're unconditionally classifying all navigations within MHTML pages be cross-document, to handle the case where about:blank#foo in MHTML is actually cross-document (and thus changes origins).

Unfortunately, it is possible to have actual same-document navigations in MHTML, though apparently another bug makes that a little tricky. Imagine saving a page with a #foo link to MHTML (such as https://csreis.github.io/tests/same-document-navigations.html), loading the archive, and then clicking on the link. That should be same-document, but then this code would force it to be cross-document (and worse, it would result in an empty document because that #foo URL is not saved in the archive).

I've tried this in practice (including within a subframe) and there's a separate bug where the #foo link gets rewritten to include the full URL (https://csreis.github.io/tests/same-document-navigations.html#foo), and thus it doesn't look like a same-document URL from the MHTML's version of the URL. This means the #foo link is already basically broken today.

Using DevTools, I found it was technically still possible to navigate to "#foo" and get a same-document navigation, and I confirmed that this new code made it cross-document (and thus broken again). Without DevTools, I'm not sure if we can run into this problem, since MHTML can't run scripts (e.g., pushState), and all same-document links appear to be rewritten to leave the archive.

I'm not quite sure how we should approach this. Long term, it seems like we should fix the MHTML bug and allow same-document navigations, which would mean finding a different way to handle this case (e.g., only treating that first about:blank#foo navigation during archive loading as cross-document, but not all navigations within MHTML documents?). For now, it appears really hard to get a same-document navigation in MHTML to begin with (without opening DevTools), so maybe a TODO in this block isn't out of the question?

Diana Qu

Doesn't sounds like classify MTHML scope to only #framgent to cross-document is doable right now. I added some todos here just in case we decided to ship first and fix the #foo case later. (https://issues.chromium.org/issues/423663315). But I'm open with discussions.

Łukasz Anforowicz

I've tried this in practice (including within a subframe) and there's a separate bug where the #foo link gets rewritten to include the full URL (https://csreis.github.io/tests/same-document-navigations.html#foo), and thus it doesn't look like a same-document URL from the MHTML's version of the URL. This means the #foo link is already basically broken today.

What kind of broken-ness are we talking about?

  • Classifying the navigation as same-document VS cross-document?
  • Navigation going to the network, instead of staying within the MHTML archive?

If we're talking about the latter, then maybe we should (in a follow-up CL?) change how URLs are looked up in MHTML archive (discarding `#foo` from URLs before using them as a key). That said, I haven't looked at how the code actually does MHTML archive entry lookup, so maybe what I said here is inaccurate / misleading / wrong...

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Diana Qu
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: Ia086793fda05d4b0b280a5e1b62165c4f1bfc566
Gerrit-Change-Number: 6461342
Gerrit-PatchSet: 19
Gerrit-Owner: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Charlie Reis <cr...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Reviewer: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-CC: Alex Moshchuk <ale...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Jonathan Ross <jon...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Charlie Reis <cr...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Diana Qu <xi...@microsoft.com>
Gerrit-Comment-Date: Tue, 10 Jun 2025 16:50:25 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 10, 2025, 5:49:28 PMJun 10
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Łukasz Anforowicz

Diana Qu added 2 comments

Commit Message
Line 12, Patchset 19 (Latest):- As a result, NavigationMhtmlBrowserTest.IframeAboutBlankNotFound
now passes, since the navigation is no longer misclassified.
Łukasz Anforowicz . unresolved

Can you help me when/how the test becomes broken? It's not broken today, so I assume that the test will break after step 1 (enforcing invariants on same-document navigations)?

Diana Qu

Yes, it will break after step 1. because MHTML is classifying as same document navigation but in fact new document is committed and new opaque origins are created. (I can update the description with more details if that helps)

File content/browser/renderer_host/render_frame_host_impl.cc
Line 15314, Patchset 19 (Latest): was_discarded_ = navigation_request->commit_params().was_discarded;
Łukasz Anforowicz . unresolved

Please fix this WARNING reported by ClangTidy: check: bugprone-use-after-move

Analyzer Description: Runs clang-tidy checks against chromium
Owner: gb...@chromium.org

check: bugprone-use-after-move

'navigation_request' used after it was moved (https://clang.llvm.org/extra/clang-tidy/checks/bugprone/use-after-move.html)

(Note: You can add `Skip-Clang-Tidy-Checks: bugprone-use-after-move` footer to the CL description to skip the check)

(Lint observed on `android-clang-tidy-rel` and `linux-clang-tidy-rel`)

Diana Qu

I can just revert this line locally. It got added after running `git cl format`

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Łukasz Anforowicz
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Tue, 10 Jun 2025 21:49:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Łukasz Anforowicz <luk...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 10, 2025, 9:51:31 PMJun 10
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Łukasz Anforowicz

Diana Qu added 1 comment

File content/browser/renderer_host/render_frame_host_impl.cc
Line 15166, Patchset 16: GetProcess(), bad_message::RFH_INVALID_ORIGIN_ON_COMMIT);
Charlie Reis . unresolved

Ah, it's best not to reuse existing renderer kill codes, because that makes it harder to tell which one is occurring when we look at histograms. Let's use a new unique value here.

It's probably also worth referencing same-document in all of these codes, along the lines of:

RFH_SAME_DOC_ORIGIN_CHANGE
RFH_SAME_DOC_INSECURE_REQUEST_POLICY_CHANGE
RFH_SAME_DOC_INSECURE_NAV_SET_CHANGE

Diana Qu

Updated.

Diana Qu

I noticed that `CrossOriginSameDocumentCommit` and `CrossOriginSameDocumentCommitFromAboutBlank` fail after I change the error message code. Both this test expect `RFH_INVALID_ORIGIN_ON_COMMIT`, but since we do the origin check early now, it will return `RFH_SAME_DOC_ORIGIN_CHANGE`.

I prefer to just remove the origin check in this mismatch case since we are verifying origins in `CanCommitOriginAndUrl` later down the line and have a error message corresponding to it already. (Since it seems like we don't want to reuse these code?)

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Łukasz Anforowicz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: Ia086793fda05d4b0b280a5e1b62165c4f1bfc566
Gerrit-Change-Number: 6461342
Gerrit-PatchSet: 24
Gerrit-Owner: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Charlie Reis <cr...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Reviewer: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-CC: Alex Moshchuk <ale...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Jonathan Ross <jon...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Charlie Reis <cr...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Wed, 11 Jun 2025 01:51:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 10, 2025, 10:00:08 PMJun 10
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Łukasz Anforowicz

Diana Qu added 1 comment

File content/browser/renderer_host/render_frame_host_impl.cc
Line 15314, Patchset 19: was_discarded_ = navigation_request->commit_params().was_discarded;
Łukasz Anforowicz . resolved

Please fix this WARNING reported by ClangTidy: check: bugprone-use-after-move

Analyzer Description: Runs clang-tidy checks against chromium
Owner: gb...@chromium.org

check: bugprone-use-after-move

'navigation_request' used after it was moved (https://clang.llvm.org/extra/clang-tidy/checks/bugprone/use-after-move.html)

(Note: You can add `Skip-Clang-Tidy-Checks: bugprone-use-after-move` footer to the CL description to skip the check)

(Lint observed on `android-clang-tidy-rel` and `linux-clang-tidy-rel`)

Diana Qu

I can just revert this line locally. It got added after running `git cl format`

Diana Qu

Reverted all untouched change related to format run.

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Łukasz Anforowicz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: Ia086793fda05d4b0b280a5e1b62165c4f1bfc566
Gerrit-Change-Number: 6461342
Gerrit-PatchSet: 26
Gerrit-Owner: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Charlie Reis <cr...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Reviewer: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-CC: Alex Moshchuk <ale...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Jonathan Ross <jon...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Charlie Reis <cr...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Wed, 11 Jun 2025 01:59:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Diana Qu <xi...@microsoft.com>
Comment-In-Reply-To: Łukasz Anforowicz <luk...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 16, 2025, 4:10:28 PMJun 16
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Łukasz Anforowicz

Diana Qu added 1 comment

Patchset-level comments
File-level comment, Patchset 26 (Latest):
Diana Qu . resolved

Bumping up this CL a bit for some pending questions and discussions. Kindly review when you get a chance. Thank you

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Łukasz Anforowicz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
Gerrit-Comment-Date: Mon, 16 Jun 2025 20:10:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Charlie Reis (Gerrit)

unread,
Jun 16, 2025, 6:35:37 PMJun 16
to Diana Qu, Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Daniel Cheng, Diana Qu and Łukasz Anforowicz

Charlie Reis added 6 comments

Patchset-level comments
Charlie Reis . resolved

Sorry for the delay-- two of these discussions needed a bit of investigation.

Commit Message
Line 14, Patchset 26 (Latest):now passes, since MHTML was classified as same_doucument navigation,
Charlie Reis . unresolved

minor nit: document

File content/browser/renderer_host/render_frame_host_impl.cc
Line 15124, Patchset 26 (Latest): // must remain exactly the same as the entry in session history.
Charlie Reis . unresolved

s/the entry in session history/before the commit/

(We aren't comparing to session history, but rather to the current state of the FrameTreeNode / RFH.)

Line 15166, Patchset 16: GetProcess(), bad_message::RFH_INVALID_ORIGIN_ON_COMMIT);
Charlie Reis . unresolved

Ah, it's best not to reuse existing renderer kill codes, because that makes it harder to tell which one is occurring when we look at histograms. Let's use a new unique value here.

It's probably also worth referencing same-document in all of these codes, along the lines of:

RFH_SAME_DOC_ORIGIN_CHANGE
RFH_SAME_DOC_INSECURE_REQUEST_POLICY_CHANGE
RFH_SAME_DOC_INSECURE_NAV_SET_CHANGE

Diana Qu

Updated.

Diana Qu

I noticed that `CrossOriginSameDocumentCommit` and `CrossOriginSameDocumentCommitFromAboutBlank` fail after I change the error message code. Both this test expect `RFH_INVALID_ORIGIN_ON_COMMIT`, but since we do the origin check early now, it will return `RFH_SAME_DOC_ORIGIN_CHANGE`.

I prefer to just remove the origin check in this mismatch case since we are verifying origins in `CanCommitOriginAndUrl` later down the line and have a error message corresponding to it already. (Since it seems like we don't want to reuse these code?)

Charlie Reis

Hmm. It looks like the relevant existing check is at https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.cc;drc=e1bf12cc67dde1f974d2aa300fcfa340b140f5c5;l=11434-11440:

```
// Same-document navigations cannot change origins, as long as these checks
// aren't being bypassed in unusual modes. This check must be after the MHTML
// check, as shown by NavigationMhtmlBrowserTest.IframeAboutBlankNotFound.
if (is_same_document_navigation && origin != GetLastCommittedOrigin()) {
LogCanCommitOriginAndUrlFailureReason("cross_origin_same_document");
return CanCommitStatus::CANNOT_COMMIT_ORIGIN;
}
```

That does have a broad MHTML exemption [here](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.cc;drc=e1bf12cc67dde1f974d2aa300fcfa340b140f5c5;l=11410-11419), and it even cites the test we're running into.

However, relying on that would mean we don't have a test that fails without the MHTML change, even though this CL would introduce a functional bug if we didn't have the MHTML change: MHTML about:blank#foo documents would have a new opaque origin in the renderer, but the browser process would ignore that origin on line 4931 because it claims to be same-document. That origin mismatch could lead to other types of renderer kills that are harder to diagnose, so I think we do want both test coverage and the MHTML change.

I agree with you that having overlapping renderer kills for this isn't ideal either, though. What if we removed the new RFH_SAME_DOC_ORIGIN_CHANGE and updated the existing check in RenderFrameHostImpl::CanCommitOriginAndUrl to catch the new bug? More specifically, we could move the `is_same_document_navigation` block above the `IsMhtmlSubframe` block, since we now need that particular invariant to apply to MHTML as well. The MHTML change should then prevent the `IframeAboutBlankNotFound` test from failing.

File third_party/blink/renderer/core/loader/frame_loader.cc
Line 731, Patchset 16: same_document_navigation = false;
Charlie Reis . unresolved

I realized there's a problem with this approach, though I'm curious for dcheng@'s or lukasza@'s take on whether/how to fix it.

Here, we're unconditionally classifying all navigations within MHTML pages be cross-document, to handle the case where about:blank#foo in MHTML is actually cross-document (and thus changes origins).

Unfortunately, it is possible to have actual same-document navigations in MHTML, though apparently another bug makes that a little tricky. Imagine saving a page with a #foo link to MHTML (such as https://csreis.github.io/tests/same-document-navigations.html), loading the archive, and then clicking on the link. That should be same-document, but then this code would force it to be cross-document (and worse, it would result in an empty document because that #foo URL is not saved in the archive).

I've tried this in practice (including within a subframe) and there's a separate bug where the #foo link gets rewritten to include the full URL (https://csreis.github.io/tests/same-document-navigations.html#foo), and thus it doesn't look like a same-document URL from the MHTML's version of the URL. This means the #foo link is already basically broken today.

Using DevTools, I found it was technically still possible to navigate to "#foo" and get a same-document navigation, and I confirmed that this new code made it cross-document (and thus broken again). Without DevTools, I'm not sure if we can run into this problem, since MHTML can't run scripts (e.g., pushState), and all same-document links appear to be rewritten to leave the archive.

I'm not quite sure how we should approach this. Long term, it seems like we should fix the MHTML bug and allow same-document navigations, which would mean finding a different way to handle this case (e.g., only treating that first about:blank#foo navigation during archive loading as cross-document, but not all navigations within MHTML documents?). For now, it appears really hard to get a same-document navigation in MHTML to begin with (without opening DevTools), so maybe a TODO in this block isn't out of the question?

Diana Qu

Doesn't sounds like classify MTHML scope to only #framgent to cross-document is doable right now. I added some todos here just in case we decided to ship first and fix the #foo case later. (https://issues.chromium.org/issues/423663315). But I'm open with discussions.

Łukasz Anforowicz

I've tried this in practice (including within a subframe) and there's a separate bug where the #foo link gets rewritten to include the full URL (https://csreis.github.io/tests/same-document-navigations.html#foo), and thus it doesn't look like a same-document URL from the MHTML's version of the URL. This means the #foo link is already basically broken today.

What kind of broken-ness are we talking about?

  • Classifying the navigation as same-document VS cross-document?
  • Navigation going to the network, instead of staying within the MHTML archive?

If we're talking about the latter, then maybe we should (in a follow-up CL?) change how URLs are looked up in MHTML archive (discarding `#foo` from URLs before using them as a key). That said, I haven't looked at how the code actually does MHTML archive entry lookup, so maybe what I said here is inaccurate / misleading / wrong...

Charlie Reis

Sorry for the delay. It appears the type of brokenness depends on whether it's in the main frame or a subframe.

In a subframe, when a #foo link gets rewritten to https://csreis.github.io/tests/same-document-navigations.html#foo, clicking that link attempts to look it up in the archive and doesn't find anything, so we end up with a new empty document, instead of scrolling to the #foo anchor as it should.

In a main frame, links in MHTML documents are apparently allowed to go to the network, so the rewritten #foo link does a cross-document navigation to the real https://csreis.github.io/tests/same-document-navigations.html#foo URL.

Neither behavior is correct, since #foo should have done a scroll to the fragment in the same document in both cases.

And yes, I think we should try to fix MHTML's behavior in a separate CL, possibly by not rewriting fragment links.

The trouble is that this CL (as it stands) will prevent us from fixing that bug, because it will force all navigations in an MHTML document to be cross-document. Maybe we can get by with that today (with a risk of regressing any same-document navigations that actually do work today), but we'll need a more accurate classification to get same-document navigations to work while still calling the initial about:blank#fragment load a cross-document navigation.

File third_party/blink/renderer/platform/runtime_enabled_features.json5
Line 5065, Patchset 26 (Latest): name: "TranslationAPIV1",
status: {
"Win": "experimental",
"Mac": "experimental",
"Linux": "experimental",
"default": "",
},
copied_from_base_feature_if: "overridden",
},
Charlie Reis . unresolved

Is this due to a merge conflict? It seems unrelated to this CL.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Diana Qu
  • Łukasz Anforowicz
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Diana Qu <xi...@microsoft.com>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Mon, 16 Jun 2025 22:35:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Charlie Reis <cr...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 16, 2025, 8:24:58 PMJun 16
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Łukasz Anforowicz

Diana Qu added 4 comments

Commit Message
Line 12, Patchset 19:- As a result, NavigationMhtmlBrowserTest.IframeAboutBlankNotFound

now passes, since the navigation is no longer misclassified.
Łukasz Anforowicz . resolved

Can you help me when/how the test becomes broken? It's not broken today, so I assume that the test will break after step 1 (enforcing invariants on same-document navigations)?

Diana Qu

Yes, it will break after step 1. because MHTML is classifying as same document navigation but in fact new document is committed and new opaque origins are created. (I can update the description with more details if that helps)

Diana Qu

Done

Line 14, Patchset 26:now passes, since MHTML was classified as same_doucument navigation,
Charlie Reis . resolved

minor nit: document

Diana Qu

Done

File third_party/blink/renderer/core/loader/frame_loader.cc
Line 731, Patchset 16: same_document_navigation = false;
Charlie Reis . unresolved

I realized there's a problem with this approach, though I'm curious for dcheng@'s or lukasza@'s take on whether/how to fix it.

Here, we're unconditionally classifying all navigations within MHTML pages be cross-document, to handle the case where about:blank#foo in MHTML is actually cross-document (and thus changes origins).

Unfortunately, it is possible to have actual same-document navigations in MHTML, though apparently another bug makes that a little tricky. Imagine saving a page with a #foo link to MHTML (such as https://csreis.github.io/tests/same-document-navigations.html), loading the archive, and then clicking on the link. That should be same-document, but then this code would force it to be cross-document (and worse, it would result in an empty document because that #foo URL is not saved in the archive).

I've tried this in practice (including within a subframe) and there's a separate bug where the #foo link gets rewritten to include the full URL (https://csreis.github.io/tests/same-document-navigations.html#foo), and thus it doesn't look like a same-document URL from the MHTML's version of the URL. This means the #foo link is already basically broken today.

Using DevTools, I found it was technically still possible to navigate to "#foo" and get a same-document navigation, and I confirmed that this new code made it cross-document (and thus broken again). Without DevTools, I'm not sure if we can run into this problem, since MHTML can't run scripts (e.g., pushState), and all same-document links appear to be rewritten to leave the archive.

I'm not quite sure how we should approach this. Long term, it seems like we should fix the MHTML bug and allow same-document navigations, which would mean finding a different way to handle this case (e.g., only treating that first about:blank#foo navigation during archive loading as cross-document, but not all navigations within MHTML documents?). For now, it appears really hard to get a same-document navigation in MHTML to begin with (without opening DevTools), so maybe a TODO in this block isn't out of the question?

Diana Qu

Doesn't sounds like classify MTHML scope to only #framgent to cross-document is doable right now. I added some todos here just in case we decided to ship first and fix the #foo case later. (https://issues.chromium.org/issues/423663315). But I'm open with discussions.

Łukasz Anforowicz

I've tried this in practice (including within a subframe) and there's a separate bug where the #foo link gets rewritten to include the full URL (https://csreis.github.io/tests/same-document-navigations.html#foo), and thus it doesn't look like a same-document URL from the MHTML's version of the URL. This means the #foo link is already basically broken today.

What kind of broken-ness are we talking about?

  • Classifying the navigation as same-document VS cross-document?
  • Navigation going to the network, instead of staying within the MHTML archive?

If we're talking about the latter, then maybe we should (in a follow-up CL?) change how URLs are looked up in MHTML archive (discarding `#foo` from URLs before using them as a key). That said, I haven't looked at how the code actually does MHTML archive entry lookup, so maybe what I said here is inaccurate / misleading / wrong...

Charlie Reis

Sorry for the delay. It appears the type of brokenness depends on whether it's in the main frame or a subframe.

In a subframe, when a #foo link gets rewritten to https://csreis.github.io/tests/same-document-navigations.html#foo, clicking that link attempts to look it up in the archive and doesn't find anything, so we end up with a new empty document, instead of scrolling to the #foo anchor as it should.

In a main frame, links in MHTML documents are apparently allowed to go to the network, so the rewritten #foo link does a cross-document navigation to the real https://csreis.github.io/tests/same-document-navigations.html#foo URL.

Neither behavior is correct, since #foo should have done a scroll to the fragment in the same document in both cases.

And yes, I think we should try to fix MHTML's behavior in a separate CL, possibly by not rewriting fragment links.

The trouble is that this CL (as it stands) will prevent us from fixing that bug, because it will force all navigations in an MHTML document to be cross-document. Maybe we can get by with that today (with a risk of regressing any same-document navigations that actually do work today), but we'll need a more accurate classification to get same-document navigations to work while still calling the initial about:blank#fragment load a cross-document navigation.

Diana Qu

So the desired behavior is that we want to only reclassify the initial about:blank#fragment loads as cross doc and left other mhtml related navigation same doc still?

File third_party/blink/renderer/platform/runtime_enabled_features.json5
Line 5065, Patchset 26: name: "TranslationAPIV1",

status: {
"Win": "experimental",
"Mac": "experimental",
"Linux": "experimental",
"default": "",
},
copied_from_base_feature_if: "overridden",
},
Charlie Reis . resolved

Is this due to a merge conflict? It seems unrelated to this CL.

Diana Qu

Yeah might be a bad merge. Will remove.

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Łukasz Anforowicz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: Ia086793fda05d4b0b280a5e1b62165c4f1bfc566
Gerrit-Change-Number: 6461342
Gerrit-PatchSet: 27
Gerrit-Owner: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Charlie Reis <cr...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Reviewer: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-CC: Alex Moshchuk <ale...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Jonathan Ross <jon...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Charlie Reis <cr...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Tue, 17 Jun 2025 00:24:34 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Charlie Reis (Gerrit)

unread,
Jun 17, 2025, 7:19:51 PMJun 17
to Diana Qu, Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Daniel Cheng, Diana Qu and Łukasz Anforowicz

Charlie Reis added 1 comment

File third_party/blink/renderer/core/loader/frame_loader.cc
Charlie Reis

That would be ideal, yes-- it would let us fix the existing MHTML bug so that same-document navigations would work, without this new code reclassifying them as cross-document.

At first glance, I'm not quite sure how to distinguish between that initial about:blank#fragment load (which may load from the archive and thus should be cross-document) and a later about:blank#fragment2 case which should be same-document. Maybe there's some way to distinguish them.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Diana Qu
  • Łukasz Anforowicz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: Ia086793fda05d4b0b280a5e1b62165c4f1bfc566
Gerrit-Change-Number: 6461342
Gerrit-PatchSet: 27
Gerrit-Owner: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Charlie Reis <cr...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Reviewer: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-CC: Alex Moshchuk <ale...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Jonathan Ross <jon...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Diana Qu <xi...@microsoft.com>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Tue, 17 Jun 2025 23:19:41 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 19, 2025, 3:28:46 AMJun 19
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Łukasz Anforowicz

Diana Qu added 2 comments

File content/browser/renderer_host/render_frame_host_impl.cc
Line 15124, Patchset 26: // must remain exactly the same as the entry in session history.
Charlie Reis . resolved

s/the entry in session history/before the commit/

(We aren't comparing to session history, but rather to the current state of the FrameTreeNode / RFH.)

Diana Qu

Updated. (Must be mixed up with the all the session history related invariant I was adding)

File third_party/blink/renderer/core/loader/frame_loader.cc
Diana Qu

I remember seeing `has_committed_any_navigation()` and `is_initial_empty_document()` in renderer code. I assume there are equivalent code in frame document? And I also see `HasFragmentIdentifier` in url. Can we use that and combine with checking if the url is about:blank as a check and only set same_document_navigation = false in that case?

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Łukasz Anforowicz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: Ia086793fda05d4b0b280a5e1b62165c4f1bfc566
Gerrit-Change-Number: 6461342
Gerrit-PatchSet: 28
Gerrit-Owner: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Charlie Reis <cr...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Reviewer: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-CC: Alex Moshchuk <ale...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Jonathan Ross <jon...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Charlie Reis <cr...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Thu, 19 Jun 2025 07:28:36 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 19, 2025, 4:46:29 PMJun 19
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Łukasz Anforowicz

Diana Qu added 1 comment

File content/browser/renderer_host/render_frame_host_impl.cc
Line 15166, Patchset 16: GetProcess(), bad_message::RFH_INVALID_ORIGIN_ON_COMMIT);
Charlie Reis . unresolved

Ah, it's best not to reuse existing renderer kill codes, because that makes it harder to tell which one is occurring when we look at histograms. Let's use a new unique value here.

It's probably also worth referencing same-document in all of these codes, along the lines of:

RFH_SAME_DOC_ORIGIN_CHANGE
RFH_SAME_DOC_INSECURE_REQUEST_POLICY_CHANGE
RFH_SAME_DOC_INSECURE_NAV_SET_CHANGE

Diana Qu

Updated.

Diana Qu

I noticed that `CrossOriginSameDocumentCommit` and `CrossOriginSameDocumentCommitFromAboutBlank` fail after I change the error message code. Both this test expect `RFH_INVALID_ORIGIN_ON_COMMIT`, but since we do the origin check early now, it will return `RFH_SAME_DOC_ORIGIN_CHANGE`.

I prefer to just remove the origin check in this mismatch case since we are verifying origins in `CanCommitOriginAndUrl` later down the line and have a error message corresponding to it already. (Since it seems like we don't want to reuse these code?)

Charlie Reis

Hmm. It looks like the relevant existing check is at https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.cc;drc=e1bf12cc67dde1f974d2aa300fcfa340b140f5c5;l=11434-11440:

```
// Same-document navigations cannot change origins, as long as these checks
// aren't being bypassed in unusual modes. This check must be after the MHTML
// check, as shown by NavigationMhtmlBrowserTest.IframeAboutBlankNotFound.
if (is_same_document_navigation && origin != GetLastCommittedOrigin()) {
LogCanCommitOriginAndUrlFailureReason("cross_origin_same_document");
return CanCommitStatus::CANNOT_COMMIT_ORIGIN;
}
```

That does have a broad MHTML exemption [here](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.cc;drc=e1bf12cc67dde1f974d2aa300fcfa340b140f5c5;l=11410-11419), and it even cites the test we're running into.

However, relying on that would mean we don't have a test that fails without the MHTML change, even though this CL would introduce a functional bug if we didn't have the MHTML change: MHTML about:blank#foo documents would have a new opaque origin in the renderer, but the browser process would ignore that origin on line 4931 because it claims to be same-document. That origin mismatch could lead to other types of renderer kills that are harder to diagnose, so I think we do want both test coverage and the MHTML change.

I agree with you that having overlapping renderer kills for this isn't ideal either, though. What if we removed the new RFH_SAME_DOC_ORIGIN_CHANGE and updated the existing check in RenderFrameHostImpl::CanCommitOriginAndUrl to catch the new bug? More specifically, we could move the `is_same_document_navigation` block above the `IsMhtmlSubframe` block, since we now need that particular invariant to apply to MHTML as well. The MHTML change should then prevent the `IframeAboutBlankNotFound` test from failing.

Diana Qu

Updated.

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Łukasz Anforowicz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: Ia086793fda05d4b0b280a5e1b62165c4f1bfc566
Gerrit-Change-Number: 6461342
Gerrit-PatchSet: 29
Gerrit-Owner: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Charlie Reis <cr...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Reviewer: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-CC: Alex Moshchuk <ale...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Jonathan Ross <jon...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Charlie Reis <cr...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Thu, 19 Jun 2025 20:46:18 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 19, 2025, 6:51:44 PMJun 19
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Łukasz Anforowicz

Diana Qu added 1 comment

File third_party/blink/renderer/core/loader/frame_loader.cc
Diana Qu
Something like the following? That way, `CANNOT_COMMIT_ORIGIN` check don't need to be moved.
```
if (parent->Loader().GetDocumentLoader()->HasBeenLoadedAsWebArchive()) {
const KURL& target = frame_->GetDocument()->Url();
if (target.ProtocolIs("about") && target.Host() == "blank" &&
target.HasFragmentIdentifier() &&
frame_->GetDocument()->IsInitialEmptyDocument()) {
same_document_navigation = false;
}
}
```
Gerrit-Comment-Date: Thu, 19 Jun 2025 22:51:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Charlie Reis <cr...@chromium.org>
Comment-In-Reply-To: Diana Qu <xi...@microsoft.com>
Comment-In-Reply-To: Łukasz Anforowicz <luk...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 19, 2025, 6:52:30 PMJun 19
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
File third_party/blink/renderer/core/loader/frame_loader.cc
Diana Qu

(If this works. I might move out the mhtml change to another CL for clarity)

Gerrit-Comment-Date: Thu, 19 Jun 2025 22:52:19 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Charlie Reis (Gerrit)

unread,
Jun 20, 2025, 5:02:39 PMJun 20
to Diana Qu, Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Daniel Cheng, Diana Qu and Łukasz Anforowicz

Charlie Reis added 8 comments

Patchset-level comments
File-level comment, Patchset 29 (Latest):
Charlie Reis . resolved

Thanks! This might get us close enough that we can proceed without much concern.

Commit Message
Line 12, Patchset 29 (Latest):2. Reclassify MHTML navigations as cross-document
Charlie Reis . unresolved

We can mention this is just in the initial empty document, based on the discussion below.

File content/browser/renderer_host/render_frame_host_impl.cc
Line 11385, Patchset 29 (Latest): // aren't being bypassed in unusual modes. This check must be after the MHTML

// check, as shown by NavigationMhtmlBrowserTest.IframeAboutBlankNotFound.
Charlie Reis . unresolved

We can remove this sentence now.

Line 11387, Patchset 29 (Latest): if (is_same_document_navigation && origin != GetLastCommittedOrigin()) {
Charlie Reis . unresolved

We should guard this with the new feature and keep the old one for when the feature is disabled, just in case we miss an MHTML case that matters.

Line 15166, Patchset 16: GetProcess(), bad_message::RFH_INVALID_ORIGIN_ON_COMMIT);
Charlie Reis . resolved

Ah, it's best not to reuse existing renderer kill codes, because that makes it harder to tell which one is occurring when we look at histograms. Let's use a new unique value here.

It's probably also worth referencing same-document in all of these codes, along the lines of:

RFH_SAME_DOC_ORIGIN_CHANGE
RFH_SAME_DOC_INSECURE_REQUEST_POLICY_CHANGE
RFH_SAME_DOC_INSECURE_NAV_SET_CHANGE

Diana Qu

Updated.

Diana Qu

I noticed that `CrossOriginSameDocumentCommit` and `CrossOriginSameDocumentCommitFromAboutBlank` fail after I change the error message code. Both this test expect `RFH_INVALID_ORIGIN_ON_COMMIT`, but since we do the origin check early now, it will return `RFH_SAME_DOC_ORIGIN_CHANGE`.

I prefer to just remove the origin check in this mismatch case since we are verifying origins in `CanCommitOriginAndUrl` later down the line and have a error message corresponding to it already. (Since it seems like we don't want to reuse these code?)

Charlie Reis

Hmm. It looks like the relevant existing check is at https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.cc;drc=e1bf12cc67dde1f974d2aa300fcfa340b140f5c5;l=11434-11440:

```
// Same-document navigations cannot change origins, as long as these checks
// aren't being bypassed in unusual modes. This check must be after the MHTML
// check, as shown by NavigationMhtmlBrowserTest.IframeAboutBlankNotFound.
if (is_same_document_navigation && origin != GetLastCommittedOrigin()) {
LogCanCommitOriginAndUrlFailureReason("cross_origin_same_document");
return CanCommitStatus::CANNOT_COMMIT_ORIGIN;
}
```

That does have a broad MHTML exemption [here](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/render_frame_host_impl.cc;drc=e1bf12cc67dde1f974d2aa300fcfa340b140f5c5;l=11410-11419), and it even cites the test we're running into.

However, relying on that would mean we don't have a test that fails without the MHTML change, even though this CL would introduce a functional bug if we didn't have the MHTML change: MHTML about:blank#foo documents would have a new opaque origin in the renderer, but the browser process would ignore that origin on line 4931 because it claims to be same-document. That origin mismatch could lead to other types of renderer kills that are harder to diagnose, so I think we do want both test coverage and the MHTML change.

I agree with you that having overlapping renderer kills for this isn't ideal either, though. What if we removed the new RFH_SAME_DOC_ORIGIN_CHANGE and updated the existing check in RenderFrameHostImpl::CanCommitOriginAndUrl to catch the new bug? More specifically, we could move the `is_same_document_navigation` block above the `IsMhtmlSubframe` block, since we now need that particular invariant to apply to MHTML as well. The MHTML change should then prevent the `IframeAboutBlankNotFound` test from failing.

Diana Qu

Updated.

Charlie Reis

Thanks, looks good!

File content/public/common/content_features.cc
Line 399, Patchset 29 (Latest):// This feature acts as a kill switch for https://crbug.com/40580002.
Charlie Reis . unresolved

Maybe also mention that this should not be enabled unless TreatMhtmlAsCrossDocument is also enabled in Blink, or else some MHTML navigations may cause renderer kills.

File third_party/blink/renderer/core/loader/frame_loader.cc
Line 725, Patchset 29 (Latest): // Treat MHTML navigations as cross-document navigations, since
Charlie Reis . unresolved

As noted above, let's limit this to cases within the initial empty document (and maybe rename the feature to TreatMhtmlInitialDocumentLoadsAsCrossDocument).

Charlie Reis

That's very close. I like the IsInitialEmptyDocument check, which might be the only time this reclassification to cross-document is needed. The checks for "about" and "blank" should be redundant with that, since I don't think any other protocol and host can be the initial empty document.

The only case that won't handle correctly is from my example above: about:blank#fragment should initially load as cross-document given how the MHTML code works, but then a later navigation to about:blank#fragment2 in theory should be allowed to be same-document, scrolling within the initial document.

Still, that case seems unlikely to matter in practice, and we would probably be in good shape if we just limited the re-classification to the IsInitialEmptyDocument cases. We can include a TODO just for that one corner case and not worry too much about it.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Diana Qu
  • Łukasz Anforowicz
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Diana Qu <xi...@microsoft.com>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Fri, 20 Jun 2025 21:02:27 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 20, 2025, 6:14:05 PMJun 20
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Łukasz Anforowicz

Diana Qu added 1 comment

File third_party/blink/renderer/core/loader/frame_loader.cc
Diana Qu

I thought `IsInitialEmptyDocument or maybe `has commited any navigation` can distingush between `about::blank#fragment` and `about:blank#fragment2`? Since we already navitgated to `about::blank#fragment`?

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Łukasz Anforowicz
Gerrit-Attention: Charlie Reis <cr...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Fri, 20 Jun 2025 22:13:56 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 20, 2025, 6:21:52 PMJun 20
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Łukasz Anforowicz

Diana Qu added 1 comment

File content/browser/renderer_host/render_frame_host_impl.cc
Line 11385, Patchset 29 (Latest): // aren't being bypassed in unusual modes. This check must be after the MHTML
// check, as shown by NavigationMhtmlBrowserTest.IframeAboutBlankNotFound.
Charlie Reis . unresolved

We can remove this sentence now.

Diana Qu

I believe if we do make the "only classify initial mhtml fragment cross document" change, this no long need to be moved before the mhtml check?

(Also do you mind me move the mhtml change to another CL and try land that first?)

Gerrit-Comment-Date: Fri, 20 Jun 2025 22:21:44 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Charlie Reis (Gerrit)

unread,
Jun 20, 2025, 6:31:52 PMJun 20
to Diana Qu, Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Daniel Cheng, Diana Qu and Łukasz Anforowicz

Charlie Reis added 2 comments

File content/browser/renderer_host/render_frame_host_impl.cc
Line 11385, Patchset 29 (Latest): // aren't being bypassed in unusual modes. This check must be after the MHTML
// check, as shown by NavigationMhtmlBrowserTest.IframeAboutBlankNotFound.
Charlie Reis . unresolved

We can remove this sentence now.

Diana Qu

I believe if we do make the "only classify initial mhtml fragment cross document" change, this no long need to be moved before the mhtml check?

(Also do you mind me move the mhtml change to another CL and try land that first?)

Charlie Reis

I believe if we do make the "only classify initial mhtml fragment cross document" change, this no long need to be moved before the mhtml check?

I think we do want to move this before the MHTML check, to make the enforcement stronger. We're fixing the MHTML code so that the exception to the same-document enforcement isn't needed.

(Also do you mind me move the mhtml change to another CL and try land that first?)

That's certainly fine! Smaller CLs tend to be easier to reason about. It's possible to make this CL dependent on that one so that the tests still pass, since this one should require the MHTML fix.

File third_party/blink/renderer/core/loader/frame_loader.cc
Charlie Reis

Oh, is it no longer considered the initial empty document after doing the about:blank#fragment navigation? That's great, and it may solve this problem in general.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Diana Qu
  • Łukasz Anforowicz
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Diana Qu <xi...@microsoft.com>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Fri, 20 Jun 2025 22:31:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Charlie Reis <cr...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 20, 2025, 6:36:55 PMJun 20
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng and Łukasz Anforowicz

Diana Qu added 2 comments

File content/browser/renderer_host/render_frame_host_impl.cc
Line 11385, Patchset 29 (Latest): // aren't being bypassed in unusual modes. This check must be after the MHTML
// check, as shown by NavigationMhtmlBrowserTest.IframeAboutBlankNotFound.
Charlie Reis . unresolved

We can remove this sentence now.

Diana Qu

I believe if we do make the "only classify initial mhtml fragment cross document" change, this no long need to be moved before the mhtml check?

(Also do you mind me move the mhtml change to another CL and try land that first?)

Charlie Reis

I believe if we do make the "only classify initial mhtml fragment cross document" change, this no long need to be moved before the mhtml check?

I think we do want to move this before the MHTML check, to make the enforcement stronger. We're fixing the MHTML code so that the exception to the same-document enforcement isn't needed.

(Also do you mind me move the mhtml change to another CL and try land that first?)

That's certainly fine! Smaller CLs tend to be easier to reason about. It's possible to make this CL dependent on that one so that the tests still pass, since this one should require the MHTML fix.

Diana Qu

I somehow remember seeing `ForwardRedirectWithNoCommittedEntry` fail after making the initial classification change and move the check to early spot. I can double check again.

I think it make more sense to land the MHTML classification change first before we make this same document change.

File third_party/blink/renderer/core/loader/frame_loader.cc
Diana Qu

Let me set a debugger and making sure. But that's how I understand the method. At least thats what it means for `is_initial_empty_document()` and `has_committed_any_navigation()` while I was looking into the renderer swap thing.

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Łukasz Anforowicz
Gerrit-Attention: Charlie Reis <cr...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Comment-Date: Fri, 20 Jun 2025 22:36:44 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 20, 2025, 8:42:16 PMJun 20
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis, Daniel Cheng, Rakina Zata Amni, Takashi Toyoshima and Łukasz Anforowicz

Diana Qu added 1 comment

File content/browser/renderer_host/render_frame_host_impl.cc
Line 11385, Patchset 29 (Latest): // aren't being bypassed in unusual modes. This check must be after the MHTML
// check, as shown by NavigationMhtmlBrowserTest.IframeAboutBlankNotFound.
Charlie Reis . unresolved

We can remove this sentence now.

Diana Qu

I believe if we do make the "only classify initial mhtml fragment cross document" change, this no long need to be moved before the mhtml check?

(Also do you mind me move the mhtml change to another CL and try land that first?)

Charlie Reis

I believe if we do make the "only classify initial mhtml fragment cross document" change, this no long need to be moved before the mhtml check?

I think we do want to move this before the MHTML check, to make the enforcement stronger. We're fixing the MHTML code so that the exception to the same-document enforcement isn't needed.

(Also do you mind me move the mhtml change to another CL and try land that first?)

That's certainly fine! Smaller CLs tend to be easier to reason about. It's possible to make this CL dependent on that one so that the tests still pass, since this one should require the MHTML fix.

Diana Qu

I somehow remember seeing `ForwardRedirectWithNoCommittedEntry` fail after making the initial classification change and move the check to early spot. I can double check again.

I think it make more sense to land the MHTML classification change first before we make this same document change.

Diana Qu

Yah. `NavigationMhtmlBrowserTest.IframeAboutBlankNotFound` fails if we move the origin check above the mhtml check. `CANNOT_COMMIT_ORIGIN url 'about:blank#fragment' origin 'null [internally: (ABFA9BC760B77038FDF36AAABBF938F5) derived from file://]' lock '{ file:/// sandboxed }'`

I can look into it later.

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
  • Daniel Cheng
  • Rakina Zata Amni
  • Takashi Toyoshima
  • Łukasz Anforowicz
Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Attention: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Sat, 21 Jun 2025 00:42:04 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Charlie Reis (Gerrit)

unread,
Jun 23, 2025, 5:07:03 PMJun 23
to Diana Qu, Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Diana Qu

Charlie Reis added 2 comments

Patchset-level comments
Charlie Reis . resolved

Just adjusting the attention set to avoid having this in reviewer's queues, since it sounds like you're still looking into the test failure.

File content/browser/renderer_host/render_frame_host_impl.cc
Line 11385, Patchset 29 (Latest): // aren't being bypassed in unusual modes. This check must be after the MHTML
// check, as shown by NavigationMhtmlBrowserTest.IframeAboutBlankNotFound.
Charlie Reis . unresolved

We can remove this sentence now.

Diana Qu

I believe if we do make the "only classify initial mhtml fragment cross document" change, this no long need to be moved before the mhtml check?

(Also do you mind me move the mhtml change to another CL and try land that first?)

Charlie Reis

I believe if we do make the "only classify initial mhtml fragment cross document" change, this no long need to be moved before the mhtml check?

I think we do want to move this before the MHTML check, to make the enforcement stronger. We're fixing the MHTML code so that the exception to the same-document enforcement isn't needed.

(Also do you mind me move the mhtml change to another CL and try land that first?)

That's certainly fine! Smaller CLs tend to be easier to reason about. It's possible to make this CL dependent on that one so that the tests still pass, since this one should require the MHTML fix.

Diana Qu

I somehow remember seeing `ForwardRedirectWithNoCommittedEntry` fail after making the initial classification change and move the check to early spot. I can double check again.

I think it make more sense to land the MHTML classification change first before we make this same document change.

Diana Qu

Yah. `NavigationMhtmlBrowserTest.IframeAboutBlankNotFound` fails if we move the origin check above the mhtml check. `CANNOT_COMMIT_ORIGIN url 'about:blank#fragment' origin 'null [internally: (ABFA9BC760B77038FDF36AAABBF938F5) derived from file://]' lock '{ file:/// sandboxed }'`

I can look into it later.

Charlie Reis

Interesting. I wonder if that means the about:blank#fragment case is still treated as same-document.

Open in Gerrit

Related details

Attention is currently required from:
  • Diana Qu
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
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: Ia086793fda05d4b0b280a5e1b62165c4f1bfc566
Gerrit-Change-Number: 6461342
Gerrit-PatchSet: 29
Gerrit-Owner: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Charlie Reis <cr...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Diana Qu <xi...@microsoft.com>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Reviewer: Łukasz Anforowicz <luk...@chromium.org>
Gerrit-CC: Alex Moshchuk <ale...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Jonathan Ross <jon...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Diana Qu <xi...@microsoft.com>
Gerrit-Comment-Date: Mon, 23 Jun 2025 21:06:52 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Diana Qu (Gerrit)

unread,
Jun 23, 2025, 5:11:24 PMJun 23
to Łukasz Anforowicz, Takashi Toyoshima, Chromium Metrics Reviews, Nate Chapin, AyeAye, Rakina Zata Amni, Alex Moshchuk, Jonathan Ross, Daniel Cheng, Charlie Reis, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, asvitkine...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, blink-...@chromium.org, alexmo...@chromium.org, creis...@chromium.org, navigation...@chromium.org
Attention needed from Charlie Reis

Diana Qu added 1 comment

File content/browser/renderer_host/render_frame_host_impl.cc
Line 11385, Patchset 29 (Latest): // aren't being bypassed in unusual modes. This check must be after the MHTML
// check, as shown by NavigationMhtmlBrowserTest.IframeAboutBlankNotFound.
Charlie Reis . unresolved

We can remove this sentence now.

Diana Qu

I believe if we do make the "only classify initial mhtml fragment cross document" change, this no long need to be moved before the mhtml check?

(Also do you mind me move the mhtml change to another CL and try land that first?)

Charlie Reis

I believe if we do make the "only classify initial mhtml fragment cross document" change, this no long need to be moved before the mhtml check?

I think we do want to move this before the MHTML check, to make the enforcement stronger. We're fixing the MHTML code so that the exception to the same-document enforcement isn't needed.

(Also do you mind me move the mhtml change to another CL and try land that first?)

That's certainly fine! Smaller CLs tend to be easier to reason about. It's possible to make this CL dependent on that one so that the tests still pass, since this one should require the MHTML fix.

Diana Qu

I somehow remember seeing `ForwardRedirectWithNoCommittedEntry` fail after making the initial classification change and move the check to early spot. I can double check again.

I think it make more sense to land the MHTML classification change first before we make this same document change.

Diana Qu

Yah. `NavigationMhtmlBrowserTest.IframeAboutBlankNotFound` fails if we move the origin check above the mhtml check. `CANNOT_COMMIT_ORIGIN url 'about:blank#fragment' origin 'null [internally: (ABFA9BC760B77038FDF36AAABBF938F5) derived from file://]' lock '{ file:/// sandboxed }'`

I can look into it later.

Charlie Reis

Interesting. I wonder if that means the about:blank#fragment case is still treated as same-document.

Diana Qu

I got it working. It was comparing the wrong value. Moving the mhtml change to another CL: https://chromium-review.googlesource.com/c/chromium/src/+/6653528. And I will clean up this one to be just same document restriction

Open in Gerrit

Related details

Attention is currently required from:
  • Charlie Reis
Gerrit-Attention: Charlie Reis <cr...@chromium.org>
Gerrit-Comment-Date: Mon, 23 Jun 2025 21:11:13 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages