0
Commit Graph

50 Commits

Author SHA1 Message Date
Dan Harrington
ea4afa0c4e Add MHTML_Improvements to testing config
Bug: 363289333
Change-Id: I7ec8bbba28f965b2fd6564ad89eae0f445864909
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5977166
Reviewed-by: Jian Li <jianli@chromium.org>
Commit-Queue: Dan H <harringtond@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1379015}
2024-11-06 15:26:51 +00:00
Alison Gale
770f3fce37 Migrate TODOs referencing old crbug IDs to the new issue tracker IDs
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:

- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)

Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.

#crbug-todo-migration

Bug: b/321899722
Change-Id: Ibc66b8c440e4bcdef414e77fef4d9874d2ea9951
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5493800
Auto-Submit: Alison Gale <agale@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1293330}
2024-04-27 00:39:58 +00:00
Alison Gale
81f4f2c793 Migrate TODOs referencing old crbug IDs to the new issue tracker IDs
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:

- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)

Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.

#crbug-todo-migration

Bug: b/321899722
Change-Id: Iee14d10d544e9f0ec046117cc4ec8a55c427adc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5469947
Reviewed-by: Darryl James <dljames@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1290838}
2024-04-22 19:33:31 +00:00
Rakina Zata Amni
7b72d8f479 Always defer assigning RFH to navigation if a pending commit RFH exists
With navigation queueing, assigning a RFH for a navigation is deferred
if there is a pending commit RFH and the navigation cannot reuse the
pending commit RFH. However, this means it is not possible to enforce
invariants like "there can only be 1 pending commit navigation at a
time" (which is currently CHECKed in
RenderFrameHostImpl::RecordMetricsForBlockedGetFrameHostAttempt() but
fails in some tests when RenderDocument is enabled)).

This CL drops the exception for when the pending commit RFH could be
reused and just always defers assigning the RFH when a pending commit
RFH is present, to allow a consistent set of invariants to be
maintained during navigation.

Bug: 1220337
Change-Id: I2e819411896d749eeb0c8824fa833e388fb267c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4805448
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1187656}
2023-08-24 04:07:06 +00:00
Dominic Farolino
0b067632d4 Fenced frames: Remove fenced frames ShadowDOM implementation
This CL removes the fenced frames ShadowDOM implementation, which was a
temporary implementation that we intended to origin trial on while
MPArch was getting ready. The original implementation is outlined in the
original design doc [1], and this CL removes it now that MPArch-based
fenced-frames is in a place where we can move forward exclusively with
it.

[1]: https://docs.google.com/document/d/1ijTZJT3DHQ1ljp4QQe4E4XCCRaYAxmInNzN1SzeJM8s/edit

Low-Coverage-Reason: test and code removal
AX-Relnotes: n/a
Bug: 1262022, 1249865
Change-Id: Ic6c03e9bc459844476423a02c71183a979226503
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3918971
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Josh Karlin <jkarlin@chromium.org>
Commit-Queue: Dominic Farolino <dom@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Nektarios Paisios <nektar@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1070141}
2022-11-11 02:57:49 +00:00
Fergal Daly
7723f9d3fa Update uses of WebContentsConsoleObserver::Wait to check return value.
The return value is newly-added and will be marked [[nodiscard]] as
soon as all uses are updated.

BUG=1379192

This CL was uploaded by git cl split.

R=boliu@chromium.org

Change-Id: I0620db68d72086116fdf92c6e539210755c4180e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3990124
Commit-Queue: Fergal Daly <fergal@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Auto-Submit: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1065165}
2022-10-29 07:03:13 +00:00
Avi Drissman
4e1b7bc33d Update copyright headers in content/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: I8c0f009d16350271f07d8e5e561085822cc9dd27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3895935
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047456}
2022-09-15 14:03:50 +00:00
Daniel Cheng
982f2b2e68 Use base::FunctionRef for the various ForEachRenderFrameHost helpers.
Using base::FunctionRef as the callable param for a visitor function
can significantly reduce the boilerplate required to use the visitor
function. It also avoids the heap allocation required to support
base::RepeatingCallback's strong ownership semantics.

The most common transformation in this CL is converting something
like:

  rfh->ForEachRenderFrameHost(base::BindRepeating(
      &MyClass::HandleRFH, base::Unretained(this)));

to simply using a lambda that captures `this`:

  rfh->ForEachRenderFrameHost([this] (content::RenderFrameHost* rfh) {
      HandleRFH(rfh);
  });

An astute reader will note that the latter is one line longer; however,
many of these callbacks currently bind other arguments as additional
input parameters or as out parameters. Using lambda captures
significantly reduces the boilerplate, improving readability, and makes
it much easier to avoid unnecessary copies.

Bug: 1303103
Change-Id: I3aeb74a0988dbddb645faef2239e9541c9adac52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3767487
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1039508}
2022-08-25 23:46:16 +00:00
Dave Tapuska
327c06c9c7 Rename GetMainFrame to GetPrimaryMainFrame
Progressively rename some usages of GetMainFrame to GetPrimaryMainFrame.

This is an automated change via git grep & sed.

BUG=1250404

Change-Id: I5e8fda4f11104cf9fcde8a690a33dc6ab7c34f3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3696741
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013636}
2022-06-13 20:31:51 +00:00
Kevin McNee
48f87e799b Add test for MHTML documents being prevented from creating fenced frames
MHTML documents are restricted in such a way that fenced frames may not
be created. We codify this with a test.

Bug: 1123606
Change-Id: I742b89f0e203bea7522b11c87196c9b00ecc20be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3582552
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#997749}
2022-04-29 16:53:24 +00:00
David Sanders
7d4623df8d Remove unused includes in render_widget_host_impl.h
Also adds some includes to other files which were
getting them transitively, to fix the build.

Bug: 242216
Change-Id: I900810c90632553345d6d777c74520c85791b3a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3597547
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#994544}
2022-04-21 07:00:18 +00:00
Daniel Cheng
95a27e9f6a Replace url::Replacements<T> with GURL::Replacements in /content/browser.
When clearing URL components, the two interfaces are exactly identical.
When replacing a URL component, GURL::Replacements has a simpler
interface.

This CL was uploaded by git cl split.

R=boliu@chromium.org

Bug: 1271865
Change-Id: I0c97cfe9f8d30c94d9612c01c1ad665a88d41f21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3487156
Auto-Submit: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Bo Liu <boliu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#974620}
2022-02-24 14:02:13 +00:00
Peter Boström
1d6a095400 Remove unused "base/macros.h" in content/
Removes `#include "base/macros.h"` from files in content/ that do not
contain `ignore_result(`.

Bug: 1010217
No-Try: true
Change-Id: I887403408704241047e3bd66e953ff7df195368b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3274993
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#940781}
2021-11-11 16:07:03 +00:00
Carlos Caballero
15caeeb12d Rename WebContentsImpl::GetFrameTree to GetPrimaryFrameTree
Note that the old method is already returning the PrimaryFrameTree so
this patch is just about making that explicit.

Trivial change that renames all test files leaving the production code
for a later patch. That code will need a closer look to make sure that
call sites are really expecting the primary frame tree (note they are
already getting the primary frame tree, so this is just an extra check
for peace of mind).

Keeping the old method around for a while will also prevent this massive
patch from being reverted if an optional try-bot later fails.

Bug: 1251094
Change-Id: Ibc86aedf203013e41e61ede94e6af929f80ee477
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3231330
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Sreeja Kamishetty <sreejakshetty@chromium.org>
Commit-Queue: Carlos Caballero <carlscab@google.com>
Cr-Commit-Position: refs/heads/main@{#935359}
2021-10-27 09:57:55 +00:00
Miyoung Shin
a2dd6a4a07 Reland "[mparch] Expose IsErrorDocument in RenderFrameHost"
This is a reland of dd5f48e2f2

Reason for revert: fixed the flaky TC.

Original change's description:
> [mparch] Expose IsErrorDocument in RenderFrameHost
>
> This is a precursor CL of crrev.com/c/3189357 that will replace
> DidFinishNavigation with PrimaryPageChanged. To match
> NavigationHandle::IsErrorPage, this CL exposes IsErrorDocument in
> RenderFrameHost.
>
> Bug: 1218946
> Change-Id: I52332b9b3b7ec4fb4fcb5733b7a9ea0780a40a51
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3193931
> Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
> Reviewed-by: Alexander Timin <altimin@chromium.org>
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#926656}

Bug: 1218946, 1254825
Change-Id: I43136515238e7c2c2c6fbb68fdce96350d7ec86c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3198011
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/main@{#929145}
2021-10-07 12:19:21 +00:00
Owen Min
98aabca2f6 Revert "[mparch] Expose IsErrorDocument in RenderFrameHost"
This reverts commit dd5f48e2f2.

Reason for revert: RenderFrameHostImplBrowserTest.ErrorDocuments is failing, more details on crbug.com/1254825

Original change's description:
> [mparch] Expose IsErrorDocument in RenderFrameHost
>
> This is a precursor CL of crrev.com/c/3189357 that will replace
> DidFinishNavigation with PrimaryPageChanged. To match
> NavigationHandle::IsErrorPage, this CL exposes IsErrorDocument in
> RenderFrameHost.
>
> Bug: 1218946
> Change-Id: I52332b9b3b7ec4fb4fcb5733b7a9ea0780a40a51
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3193931
> Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
> Reviewed-by: Alexander Timin <altimin@chromium.org>
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#926656}

Bug: 1218946, 1254825
Change-Id: Ie4e814f41f88116f8a72fb528e2b95ac6f3d27cf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3197797
Auto-Submit: Owen Min <zmin@chromium.org>
Owners-Override: Owen Min <zmin@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#926858}
2021-09-30 18:46:26 +00:00
Miyoung Shin
dd5f48e2f2 [mparch] Expose IsErrorDocument in RenderFrameHost
This is a precursor CL of crrev.com/c/3189357 that will replace
DidFinishNavigation with PrimaryPageChanged. To match
NavigationHandle::IsErrorPage, this CL exposes IsErrorDocument in
RenderFrameHost.

Bug: 1218946
Change-Id: I52332b9b3b7ec4fb4fcb5733b7a9ea0780a40a51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3193931
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#926656}
2021-09-30 08:23:35 +00:00
Dave Tapuska
ed66163f55 Rewrite the final usages of GetAllFrames in tests.
Fix up remaining usages of GetAllFrames and use either ChildFrameAt
or CollectAllRenderFrameHosts test functions.

BUG=1208438

Change-Id: I2bdcc0574ddeda92a37fa4ccf49c9f8900218111
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3182021
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#925754}
2021-09-28 14:34:54 +00:00
Peter Boström
828b902994 Replace DISALLOW_COPY_AND_ASSIGN in content/
This replaces DISALLOW_COPY_AND_ASSIGN with explicit constructor deletes
where a local script is able to detect its insertion place (~Foo() is
public => insert before this line).

This is incomplete as not all classes have a public ~Foo() declared, so
not all DISALLOW_COPY_AND_ASSIGN occurrences are replaced.

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: Iea478401b7580682c7b9f195f7af9cbbdb6ce315
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3167292
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#923194}
2021-09-21 02:28:43 +00:00
Lei Zhang
e02299a9f0 Do IWYU for base/strings/stringprintf.h.
Files that use base::StringPrintf() and StringPrintV() should include
stringprintf.h. Find the files that do not using this command:

git grep -l 'base::StringPrint[fV]' | \
    xargs grep -L '^#include "base/strings/stringprintf.h"$' | \
    grep -E '(cc|mm)$'

and add the include to those files.

Then do a similar check for base::StringAppend.

Change-Id: Ia736e7d64eeb13dc7aff72944ebe00f6931ed584
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2849391
Reviewed-by: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#876342}
2021-04-26 23:12:24 +00:00
Rakina Zata Amni
039c7fcb2d Remove base_url check for error pages
We used to need to account for pages with the base_url set to
kUnreachableWebDataURL when checking if a page is an error page or not
due to auto-reload. This is no longer needed after we moved error page
auto reloading to the browser, and this check also caused us to wrongly
believe that normal pages with base_url == kUnreachableWebDataURL as
error pages (e.g. an MHTML document).

This CL removes the check for base_url when determining if a page is an
error page or not. Since this is the last usage of DidCommitParams'
base_url, we can also just remove the param completely.

See: https://groups.google.com/a/google.com/g/chrome-navigation/c/x4qaF1dmszI/m/66DUFhoQCgAJ

Bug: 1131832
Change-Id: I3a51b458eda52cbe999e5b2b4226e0cee1c27a7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2796782
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/master@{#871401}
2021-04-12 07:52:52 +00:00
Robert Sesek
3bce5dd0e6 mojo: Remove deprecated CreateDataPipe overload that takes pointer out-args
Bug: 944990
Change-Id: I407992469e63ff241a2295d4029a5f36d1d5304d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2698090
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#855820}
2021-02-19 19:27:58 +00:00
Lukasz Anforowicz
8ad9106715 Return false from ResourceNeedsLoad in presence of an MHTML archive.
After this CL, blink::ResourceFetcher should not start HTTP requests if
an MHTML archive is present. Additionally tweak GetCacheIdentifier to
make sure that globally cached requests (e.g. fulfilled via HTTP) are
not reused for requests within MHTML archive.

Change-Id: I3b7253c22bc42b941d9abd8dec82e58f730dd815
Bug: 1168249
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2638219
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#846266}
2021-01-22 19:52:39 +00:00
arthursonzogni
898dcda58c Move CSPEE to the NavigationRequest.
Move CSPEE code from the AncestorThrottle toward the NavigationRequest.
Why?

1) AncestorThrottle is a NavigationThrottle. NavigationThrottle doesn't
   run for several URLs like about:blank. This fixes two two test case
   introduced recently for bug 1163174

2) CSPEE can add a 'sandbox' directive. This might modify the origin.
   The origin needs to be computed before running the
   NavigationThrottle. So this isn't possible to check CSPEE in the
   NavigationThrottle. Taking CSPEE into accounts for sandbox will be
   fixed in a follow-up.

Bug: 1163174
Change-Id: I193d7821b7819339912a6ba92bdb28e8fa893256
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611269
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Reviewed-by: Antonio Sartori <antoniosartori@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845560}
2021-01-21 08:50:10 +00:00
Lukasz Anforowicz
39a8aef536 Relax security checks for for data: navigations in MHTML.
Before this CL, NavigationRequest::GetOriginForURLLoaderFactory would
skip security checks for navigations happening within MHTML, *except*
for navigations to data: URLs:

    // Old, incorrect code - the condition below matches MHTML
    // subframes, *except* for navigations to data: URLs:
    if (IsLoadedFromMhtmlArchive() && !IsInMainFrame())
      return origin;

After this CL, the data: URLs are also excluded, by refactoring
NavigationRequest::IsForMhtmlSubframe and using it for avoiding
the security checks in GetOriginForURLLoaderFactory:

    // New, correct code (after this CL IsForMhtmlSubframe doesn't
    // exclude navigations to data: URLs).
    if (IsForMhtmlSubframe())
      return origin;

The CL similarly updates the security checks in RenderFrameHostImpl
(the ones based on `is_mhtml_document_`) so they also cover data:
navigations within MHTML.

    // Old, incorrect code (excluding data: URLs within MHTML):
    is_mhtml_document_ = [...]
                         navigation_request->IsLoadedFromMhtmlArchive();

    // New, correct code (covering data: URLs within MHTML):
    is_mhtml_document_ = [...]
                         navigation_request->IsMhtmlOrSubframe();

Bug: 969696
Fixed: 1155862
Change-Id: I9ba24f8ba1cf8a67454f74b0ae1f7f2493923a33
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2591287
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838313}
2020-12-17 23:50:15 +00:00
Guido Urdaneta
ef4e919472 Reland "Move base/test/bind_test_util.h to base/test/bind.h"
This reverts commit 8bd07a6cf9.

Reason for revert: This revert was incorrect and breaks the build.

Original change's description:
> Revert "Move base/test/bind_test_util.h to base/test/bind.h"
>
> This reverts commit a4493a6f80.
>
> Reason for revert: This CL breaks internal builds (e.g. /chrome/browser/media/kaleidoscope/internal/kaleidoscope_browsertest.cc).
>
> Original change's description:
> > Move base/test/bind_test_util.h to base/test/bind.h
> >
> > Stop relying on us to remember arcane file names when writing tests,
> > and repeating the directory hierarchy into the file name.
> >
> > R=​dcheng@chromium.org
> > TBR=
> > NOPRESUBMIT=true
> >
> > Change-Id: I49c951162939c7dcef44883bee740f94b2f49e09
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523099
> > Commit-Queue: danakj <danakj@chromium.org>
> > Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#825145}
>
> TBR=danakj@chromium.org,dcheng@chromium.org
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Change-Id: If165b8443662baa564895e994ea0d772348e6da6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2526102
> Reviewed-by: Denis Kuznetsov [CET] <antrim@chromium.org>
> Commit-Queue: Denis Kuznetsov [CET] <antrim@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#825328}

TBR=danakj@chromium.org,dcheng@chromium.org,antrim@chromium.org

# Not skipping CQ checks because this is a reland.
NOPRESUBMIT=true
NOTREECHECK=true

No-Try: True
Change-Id: I6a8c0c8bbb1c8f87cc7f2df7a8b3388971292975
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2526683
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825329}
2020-11-09 15:06:24 +00:00
Denis Kuznetsov [CET]
8bd07a6cf9 Revert "Move base/test/bind_test_util.h to base/test/bind.h"
This reverts commit a4493a6f80.

Reason for revert: This CL breaks internal builds (e.g. /chrome/browser/media/kaleidoscope/internal/kaleidoscope_browsertest.cc).

Original change's description:
> Move base/test/bind_test_util.h to base/test/bind.h
>
> Stop relying on us to remember arcane file names when writing tests,
> and repeating the directory hierarchy into the file name.
>
> R=​dcheng@chromium.org
> TBR=
> NOPRESUBMIT=true
>
> Change-Id: I49c951162939c7dcef44883bee740f94b2f49e09
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523099
> Commit-Queue: danakj <danakj@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#825145}

TBR=danakj@chromium.org,dcheng@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: If165b8443662baa564895e994ea0d772348e6da6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2526102
Reviewed-by: Denis Kuznetsov [CET] <antrim@chromium.org>
Commit-Queue: Denis Kuznetsov [CET] <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825328}
2020-11-09 14:21:28 +00:00
danakj
a4493a6f80 Move base/test/bind_test_util.h to base/test/bind.h
Stop relying on us to remember arcane file names when writing tests,
and repeating the directory hierarchy into the file name.

R=dcheng@chromium.org
TBR=
NOPRESUBMIT=true

Change-Id: I49c951162939c7dcef44883bee740f94b2f49e09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523099
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825145}
2020-11-07 01:53:08 +00:00
arthursonzogni
3fc224bfea [Navigation] Add IsLoadedFromMhtmlArchive()
Prior to this patch RenderFrameHostImpl::is_mhtml_document_ wasn't set
for iframes. This was very confusing.

This patch makes the NavigationRequest to compute whether the new
document is an MHTML one. This is now less confusing. Moreover this
allows:
- Fixing a TODO(lukasza) [Done in this patch]
- Compute the sandbox flags for MHTML document [In follow-up].

Bug: 1041376
Change-Id: Id99f99b8daf709687986490a06906b2d96ecca0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2450270
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814621}
2020-10-07 10:41:16 +00:00
arthursonzogni
07baf8358e Add tests about MHTML vs sandbox flags.
Make sure MHTML document works correctly regarding sandbox flags.

Bug: 1041376
Change-Id: I6bc12e7ab5861f51f39af44005f715c603c78e3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2450152
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814589}
2020-10-07 08:35:53 +00:00
danakj
10f3237a20 Point includes to content/browser/renderer_host instead of frame_host/ (5/x)
The code has moved, so update the includes.

R=avi@chromium.org

Bug: 1091083
Change-Id: I560162df09d04a63a7155500b8d3205440086ec1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2411402
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: danakj <danakj@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807205}
2020-09-15 22:25:16 +00:00
arthursonzogni
d5149d9fb7 [MHTML] Fix is_mhtml_document() after same-document navigation.
render_frame_host->is_mhtml_document() became false after a
same-document navigation, which is wrong.

This is fixed by here.

R=acolwell@chromium.org,nasko@chromium.org
TBR=nasko@chromium.org

Bug: 1126391
Change-Id: Ie473c396ea9769356c39d8eee1d1915c0a136807
Fixed: 1126391
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404340
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Aaron Colwell <acolwell@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806665}
2020-09-14 16:35:17 +00:00
arthursonzogni
736fcf5085 [MHTML] Test is_mhtml_document() after same-document navigation.
The RenderFrameHostImpl::is_mhtml_document_ attribute is reset after
same-document navigation, which is a bug found in:
https://chromium-review.googlesource.com/c/chromium/src/+/2395777

This adds regression tests. The fix is easy and will come in follow-ups.

Bug: 1126391
Change-Id: Ic5d166da4a73cda7e5fe9a04402cb0a813c9bf49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2401019
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805331}
2020-09-09 15:34:54 +00:00
Daniel Cheng
cdb951cc9c Don't CHECK when a same-document navigation cancels an MHTML navigation.
Bug: 1122072
Change-Id: Ic89dc4c0ff343da1cc989f242070735a11811644
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2381066
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804061}
2020-09-03 04:06:45 +00:00
Daniel Cheng
8a8a920150 CHECK that CommitNavigation/CommitFailedNavigation IPCs always commit.
Currently, state synchronization between the browser and the renderer
process is complicated and buggy for cross-process navigations. The
renderer process is responsible for processing the commit IPC and then
reporting success back up to the browser process, which then updates its
state. However, it's unclear if this can lead to races.

Instead, if it is possible to assume that one `CommitNavigation()` IPC
from the browser always maps to one committed navigation in the
renderer, the code can be simplified to remove multiphase navigation
commits. This means the browser would be able to mark a provisional
local frame as committed as soon as it sends a commit IPC to the
renderer for that frame.

As an initial step in this direction, this CL implements a renderer-side
`CHECK()` that a request to commit a navigation from the browser always
results in a committed navigation, with some initial exemptions for
fallback content for embedded content, et cetera.

However, this new `CHECK()` exposed some existing bugs in MHTMLx
handling. The browser side navigation code does not know enough about an
MHTML archive to determine if a commit will succeed or fail. Instead,
the browser always assumes that a subframe navigation request will
succeed and simply always calls `CommitNavigation()`. Unfortunately, the
renderer silently ignores commit requests in subframes if the associated
resource cannot be found in the MHTML archive, which triggers the new
`CHECK()`.

To fix this, committing a navigation to a non-existent MHTML resource
will now simply commit a document constructed from an empty string with
the text/html MIME type. This required updating the expectations for
some existing MHTML tests that tested loading of non-existent MHTML
resources. Before, the last committed URL would simply be empty, since
the commit would silently be dropped. After, the last committed URL is
now the URL of the non-existent resource.

Finally, NavigationMhtmlBrowserTest.IframeAboutBlankNotFound exhibited
a large number of complex interactions that still are not fully
understood. It looks like the renderer now reports load completion
*after* the about:blank fragment navigation completes, so update the
test expectations accordingly...

Bug: 999255
Change-Id: I2f9ac23b5668886b8b3bbbdcb7925f8784480c25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2335323
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796508}
2020-08-10 19:46:57 +00:00
Lei Zhang
9989f27452 Switch some content/ tests to use simpler base::WriteFile() variant.
Bug: 418837
Change-Id: I98f0b1206f622930740109660c649ad3b7ac333d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2191574
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#767430}
2020-05-11 19:21:21 +00:00
Peter Kasting
919ce657e4 Add missing #includes of browser_test.h.
This is a step towards doing full IWYU of browser_test.h, which will
have other benefits.

Completely mechanical and already R+ed as part of r765923.

Tbr: sky
Bug: none
Change-Id: Icb7ab728098a6cf29c0920da4b524e96a7c024c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2186411
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766361}
2020-05-07 10:22:36 +00:00
Balazs Engedy
683d2c7a8f Revert "IWYU for browser_test.h."
This reverts commit 66a53c909a.

Reason for revert: Breaks compile on official branded builders.

Original change's description:
> IWYU for browser_test.h.
> 
> Include this directly in relevant test files.  This lets us convert the
> HAS_OUT_OF_PROC_TEST_RUNNER checks in this file and
> view_event_test_base.h into #errors, and force people to not even
> include this file in files that can't use it.
> 
> Bug: none
> Tbr: sky
> Change-Id: I86626099eb047eb53e8b3611de38ba6bebc01a0b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136117
> Commit-Queue: Peter Kasting <pkasting@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#765923}

TBR=sky@chromium.org,pkasting@chromium.org,thestig@chromium.org

Change-Id: I4583916602404c310a93f571dd2c78645c6bd567
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2184132
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765931}
2020-05-06 10:36:40 +00:00
Peter Kasting
66a53c909a IWYU for browser_test.h.
Include this directly in relevant test files.  This lets us convert the
HAS_OUT_OF_PROC_TEST_RUNNER checks in this file and
view_event_test_base.h into #errors, and force people to not even
include this file in files that can't use it.

Bug: none
Tbr: sky
Change-Id: I86626099eb047eb53e8b3611de38ba6bebc01a0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136117
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765923}
2020-05-06 09:38:56 +00:00
Devlin Cronin
ed376d85f6 [Cleanup] Use WebContentsConsoleObserver in //content/browser tests
Update tests under //content/browser (not including subdirectories) to
use WebContentsConsoleObserver instead of ConsoleObserverDelegate.  This
allows us to observe console messages added without overriding the
existing delegate of the WebContents.

Bug: 1034150
Change-Id: Icae6452f3b7753cf6fa8da4caab8a5756687164d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2173343
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#764726}
2020-05-01 18:37:55 +00:00
Alex Ilin
cf96655e16 Reland "[base] Remove base::SharedMemory and base::SharedMemoryHandle"
This reverts commit 8c36510cc3.

Reason for revert: Added missing include on ChromeOS.

Original change's description:
> Revert "[base] Remove base::SharedMemory and base::SharedMemoryHandle"
> 
> This reverts commit fa7e8cc73e.
> 
> Reason for revert: It looks like there was at least one missed instance of transitively including file_util. Sample build log: https://ci.chromium.org/p/chrome/builders/ci/chromeos-kevin-google-rel/4373
> 
> Original change's description:
> > [base] Remove base::SharedMemory and base::SharedMemoryHandle
> > 
> > There are no users of the deprecated shared memory left, so its code
> > can safely removed.
> > 
> > To use shared memory in Chrome, please refer to
> > base::WritableSharedMemoryRegion and base::ReadOnlySharedMemoryRegion
> > classes.
> > 
> > This CL removes all remaining #includes of
> > "base/memory/shared_memory.h" and
> > "base/memory/shared_memory_handle.h". They are replaced by new shared
> > memory includes when needed.
> > 
> > It also appears that "base/files/file_util.h" and
> > "base/posix/eintr_wrapper.h" were transitively included in many places
> > through the removed files. This CL includes them explicitly in all
> > those files.
> > 
> > TBR: wfh@chromium.org
> > Bug: 795291
> > Change-Id: I97ecac4b529c0ad6498b6e5ccf01515f750448ad
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1919152
> > Commit-Queue: Alex Ilin <alexilin@chromium.org>
> > Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> > Reviewed-by: Jochen Eisinger <jochen@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#717588}
> 
> TBR=dcheng@chromium.org,jochen@chromium.org,alexilin@chromium.org
> 
> Change-Id: I16c6e4c2ada01240d577706478cf739ce1061ee5
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 795291
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929252
> Reviewed-by: Tommy Martino <tmartino@chromium.org>
> Commit-Queue: Tommy Martino <tmartino@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#717644}

TBR=dcheng@chromium.org,tmartino@chromium.org,jochen@chromium.org,alexilin@chromium.org

Change-Id: I437cf7f93965858840170eb49b2d611b37e79b25
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 795291
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929221
Reviewed-by: Alex Ilin <alexilin@chromium.org>
Commit-Queue: Alex Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#717663}
2019-11-21 16:13:52 +00:00
Tommy Martino
8c36510cc3 Revert "[base] Remove base::SharedMemory and base::SharedMemoryHandle"
This reverts commit fa7e8cc73e.

Reason for revert: It looks like there was at least one missed instance of transitively including file_util. Sample build log: https://ci.chromium.org/p/chrome/builders/ci/chromeos-kevin-google-rel/4373

Original change's description:
> [base] Remove base::SharedMemory and base::SharedMemoryHandle
> 
> There are no users of the deprecated shared memory left, so its code
> can safely removed.
> 
> To use shared memory in Chrome, please refer to
> base::WritableSharedMemoryRegion and base::ReadOnlySharedMemoryRegion
> classes.
> 
> This CL removes all remaining #includes of
> "base/memory/shared_memory.h" and
> "base/memory/shared_memory_handle.h". They are replaced by new shared
> memory includes when needed.
> 
> It also appears that "base/files/file_util.h" and
> "base/posix/eintr_wrapper.h" were transitively included in many places
> through the removed files. This CL includes them explicitly in all
> those files.
> 
> TBR: wfh@chromium.org
> Bug: 795291
> Change-Id: I97ecac4b529c0ad6498b6e5ccf01515f750448ad
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1919152
> Commit-Queue: Alex Ilin <alexilin@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Jochen Eisinger <jochen@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#717588}

TBR=dcheng@chromium.org,jochen@chromium.org,alexilin@chromium.org

Change-Id: I16c6e4c2ada01240d577706478cf739ce1061ee5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 795291
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929252
Reviewed-by: Tommy Martino <tmartino@chromium.org>
Commit-Queue: Tommy Martino <tmartino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#717644}
2019-11-21 15:14:58 +00:00
Alex Ilin
fa7e8cc73e [base] Remove base::SharedMemory and base::SharedMemoryHandle
There are no users of the deprecated shared memory left, so its code
can safely removed.

To use shared memory in Chrome, please refer to
base::WritableSharedMemoryRegion and base::ReadOnlySharedMemoryRegion
classes.

This CL removes all remaining #includes of
"base/memory/shared_memory.h" and
"base/memory/shared_memory_handle.h". They are replaced by new shared
memory includes when needed.

It also appears that "base/files/file_util.h" and
"base/posix/eintr_wrapper.h" were transitively included in many places
through the removed files. This CL includes them explicitly in all
those files.

TBR: wfh@chromium.org
Bug: 795291
Change-Id: I97ecac4b529c0ad6498b6e5ccf01515f750448ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1919152
Commit-Queue: Alex Ilin <alexilin@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#717588}
2019-11-21 11:05:52 +00:00
Mike West
24134160cb Prevent sandboxed frames from navigating to javascript:.
Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags
can cause JavaScript execution in their origin by navigating to a
`javascript:` URL via `target=_blank` or similar. This is technically
correct, but surprising.

https://github.com/whatwg/html/pull/5083 aims to tighten that check to
match developers' expectations that `javascript:` URLs controlled by a
page that's been sandboxed away from script will not execute.

Bug: 1014371
Change-Id: I3b5fa676e73cbf78485b85ce2593284bce2e68cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916467
Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716035}
2019-11-16 18:53:06 +00:00
Lukasz Anforowicz
42d3d07faf Remove content::kAboutSrcDocURL and use GURL::IsAboutSrcdoc() instead.
This CL replaces strict-equality comparisons like
  if (url == GURL(content::kAboutSrcDocURL)) ...
with
  if (url.IsAboutSrcdoc()) ...

Unlike the old code, the new code correctly handles about:srcdoc#ref and
other corner-cases (see gurl_unittest.cc for more examples).  Note that
in the long-term URLs like about:srcdoc#ref should not be encountered in
practice (see https://crbug.com/974300), but for now such navigations
are still possible (e.g. frames can directly navigate to
about:srcdoc#ref by setting window.location).  Using IsAboutSrcdoc
instead of strict-equality should correctly account for the current
implementation state (and should remain correct in the long-term).

To prevent reoccurence of strict-equality comparisons, the CL also
removes the content::kAboutSrcDocURL constant.

Bug: 973922
Change-Id: I2bd80c82c395a4659ccb50f4caf236baa5ad3c8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1659195
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#670330}
2019-06-19 01:06:42 +00:00
arthursonzogni
654ed175ac Add test MHTML + CSP FrameAncestor interaction.
Is Content-Security-Policy: frame-ancestors enforced in MHTML iframes?
Currently, it isn't.

Add the test NavigationMhtmlBrowserTest.CspFrameAncestor to document the
current behavior and for being notified when it will change.

Bug: 969711
Change-Id: I94f882cd00ec838f944d6dec41932be1447af2b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1641246
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667970}
2019-06-11 14:41:04 +00:00
arthursonzogni
09aa34d15f Fix data-URL in MHTML document.
It regressed and wasn't tested.

Previous CL adds a regression test:
https://chromium-review.googlesource.com/c/chromium/src/+/1631399

This CL fixed the issue and enables the regression test
NavigationMhtmlBrowserTest.IframeDataUrlFound
NavigationMhtmlBrowserTest.IframeDataUrlNotFound

Bug: 967307, 936696, 969696
Change-Id: Ibfbaf9fd121b7149b5b377d01af3ecbe0fa83326
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1635469
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Nate Chapin <japhet@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665907}
2019-06-04 14:44:34 +00:00
Findit
94aec95470 Revert "Test: MHTML document loaded inside a data-URL parent."
This reverts commit 631cf612e8.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 665876 as the
culprit for failures in the build cycles as shown on:
https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtLzYzMWNmNjEyZTg4YmUzZWIyMWQ0MmY2ZTFjYzYxZjk3NDlmYWY3OGUM

Sample Failed Build: https://ci.chromium.org/buildbot/chromium.memory/Mac%20ASan%2064%20Tests%20%281%29/53748

Sample Failed Step: content_browsertests

Original change's description:
> Test: MHTML document loaded inside a data-URL parent.
> 
> In an MHTML document, blink::DocumentLoader::archive_ is transmitted
> from parent to children. data-URL aren't loaded from the MHTML archive.
> In this case, does it means children of data-URL aren't able to be
> loaded from the MHTML archive? Hopefully, it is currently working. They
> are able to load from the MHTML document, because |archive_| continue to
> be transmitted.
> 
> This CL adds a test to ensure this continue to work in the future.
> 
> Bug: None.
> Change-Id: Icb51dc48691112cf9e45dfe8cb81d389544a0c41
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1635669
> Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#665876}


Change-Id: Iab5a838b789e845537a3a81a8f87cd54516b1162
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: None.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1643089
Cr-Commit-Position: refs/heads/master@{#665896}
2019-06-04 13:57:31 +00:00
arthursonzogni
631cf612e8 Test: MHTML document loaded inside a data-URL parent.
In an MHTML document, blink::DocumentLoader::archive_ is transmitted
from parent to children. data-URL aren't loaded from the MHTML archive.
In this case, does it means children of data-URL aren't able to be
loaded from the MHTML archive? Hopefully, it is currently working. They
are able to load from the MHTML document, because |archive_| continue to
be transmitted.

This CL adds a test to ensure this continue to work in the future.

Bug: None.
Change-Id: Icb51dc48691112cf9e45dfe8cb81d389544a0c41
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1635669
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665876}
2019-06-04 11:55:11 +00:00
arthursonzogni
ae02e6d969 Add MHTML navigation test suite.
Navigation to MHTML document needs to be tested. There are some blink web tests,
but no real browser tests. This adds the NavigationMhtmlBrowserTest set of
tests. It contains an helper class to quickly build and use MHTML archives
easily in tests.

New tests:
+ NavigationMhtmlBrowserTest.IframeFound
+ NavigationMhtmlBrowserTest.IframeNotFound
+ NavigationMhtmlBrowserTest.IframeDataUrlNotFound
+ NavigationMhtmlBrowserTest.IframeDataUrlFound
+ NavigationMhtmlBrowserTest.IframeAboutSrcDocFound
+ NavigationMhtmlBrowserTest.IframeAboutSrcDocNotFound
+ NavigationMhtmlBrowserTest.IframeAboutBlankFound
+ NavigationMhtmlBrowserTest.IframeAboutBlankNotFound
+ NavigationMhtmlBrowserTest.IframeJavascriptUrlFound
+ NavigationMhtmlBrowserTest.IframeJavascriptUrlNotFound
+ NavigationMhtmlBrowserTest.IframeContentIdUrlFound
+ NavigationMhtmlBrowserTest.IframeContentIdUrlNotFound

Some weird expectations have been found, but not investigated yet.

The test NavigationMhtmlBrowserTest.IframeDataUrl is not enabled, because it
reaches a DCHECK. See https://crbug.com/967307. It needs to be fixed in a follow
up.

The main goal for this CL is to prepare for:
https://chromium-review.googlesource.com/c/chromium/src/+/1547521
New tests will make us a bit more confident.

Bug: 967307, 936696

Change-Id: I71cee7a4377467126f10b22b9d828f539045e102
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1631399
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665860}
2019-06-04 10:23:11 +00:00