0
Commit Graph

208 Commits

Author SHA1 Message Date
Lukasz Anforowicz
f81687c7b9 Remove |uses_post| (redundant wrt |post_body|).
This CL removes |uses_post| from OpenURLParams and NavigateParams and
replaces reads of that field with checks if |post_body| is non-null.
Similarily, |uses_post| is removed from FrameHostMsg_OpenURL_Params.

FWIW, |uses_post| and |browser_initiated_post_data| were introduced
together in https://chromiumcodereview.appspot.com/21378002/.  I don't
understand why two fields (rather than one) were used (one hypothesis is
that for renderer-initiated navigations only |uses_post| was preserved
while dropping |post_data|).  |browser_initiated_post_data| was renamed
to |post_data| (and support for renderer-side POST navigations was
added) in https://codereview.chromium.org/2038233002/.

Bug: 1007041
Change-Id: I6d0bbfc683d2e2e9d3de425d7895e6ef0c2f84b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1873156
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Varun Khaneja <vakh@chromium.org>
Reviewed-by: Tarun Bansal <tbansal@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709496}
2019-10-25 16:16:39 +00:00
arthursonzogni
b64b584260 bfcache: Fix SecurityExploitBrowserTest.InvalidBeginNavigationInitiator
1) The test has been fixed by:
   https://chromium-review.googlesource.com/c/chromium/src/+/1816509
   The fix was to flush the BackForwardCache to avoid the
   FrameHostInterceptor to miss "simulating RenderFrameHostCreated" on
   the RenderFrameHost in the BackForwardCache.

2) Flushing the cache became asynchronous, which caused the test to fail
   again.
   https://chromium-review.googlesource.com/c/chromium/src/+/1807321

In this CL, instead of flushing the BackForwardCache, we create the
FrameHostInterceptor before the navigations. That way, it can correctly
index every created RenderFrameHost. It won't have to simulate receiving
RenderFrameHostCreated anymore.

Bug: 1017605
Change-Id: I882d459e53a84331f4ec8dfaa4df1b07cc160c2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1878187
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709408}
2019-10-25 09:09:51 +00:00
Julie Jeongeun Kim
2811b95e9e Convert URLLoaderFactory from //content to new Mojo types
This CL converts URLLoaderFactory from //content
to new Mojo types using PendingRemote and Remote.

Bug: 955171
Change-Id: I106caf8803c9897d6a671042bbc94d3f90a8450a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863933
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#708859}
2019-10-24 00:36:12 +00:00
Arthur Hemery
d6297f272f [navigation] Removing IsPerNavigationMojoInterface in individual tests.
NavigationClient is now on by default, so removing an unused branch in tests.

Also removing a test that does not make sense anymore.

Bug: 784904
Change-Id: Ibf91fdfbdc23d03a9f5a966ca02c82314fcdca97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1821558
Commit-Queue: Arthur Hemery <ahemery@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708177}
2019-10-22 14:34:41 +00:00
Alexander Timin
26864e16e1 [bfcache] Do not cache pages which have ongoing subframe navigations
Ensure that we don't cache pages which have in-progress navigations
in one of the subframes.

Together with already existing check for whether the frame is active
during navigation start this ensures that we never commit navigation
in an inactive frame.

R=arthursonzogni@chromium.org,lowell@chromium.org,alexmos@chromium.org
CC=nasko@chromium.org

Change-Id: I71e0b325dfefb9269af85b50c2617b7ab9a306af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1860338
Commit-Queue: Alexander Timin <altimin@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707214}
2019-10-18 02:00:06 +00:00
Sergio Villar Senin
d7f2ee7f61 Remove public/web/web_triggering_event_info.h dependency from chrome/browser
In order to remove the dependency, the web_triggering_event_info.h file was
moved to public/common/navigation. Since the file is no longer in the public/web
directory we are also renaming it to triggering_event_info.h (and the enum
defined in that file to TriggeringEventInfo).

In order to avoid clashes between class and method names the
TriggeringEventInfo() method in FrameLoader had to be renamed to
GetTriggeringEventInfo().

Bug: 1008303
Change-Id: I0daba0ea71c1ebe879d78db39844d41db727ee0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1860417
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Sergio Villar <svillar@igalia.com>
Cr-Commit-Position: refs/heads/master@{#706835}
2019-10-17 09:02:41 +00:00
arthursonzogni
85bc116f4d Cleanup: remove old code used to discard pending NavigationEntry.
In RenderFrameHostManager, the speculative RenderFrameHost may be
deleted by using CleanupNavigation(). The speculative RenderFrameHost
may contain multiple pending NavigationRequests. When they are deleted,
their matching pending NavigationEntry must be discarded.

This is now done automatically in NavigationRequest's destructor by
releasing the PendingEntryRef, thanks to patch:
https://chromium-review.googlesource.com/c/chromium/src/+/1815129

Bug: None.
Change-Id: I5f88e5dafa5188eeab29d5c5a55b8f8306bd83d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1860031
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705956}
2019-10-15 14:44:13 +00:00
Lukasz Anforowicz
9666a169b8 Remove view-source: and file: related ShouldFork considerations.
Site Isolation and process allocation should work correctly even in
absence of a cooperating renderer process - there should be no need for
the renderer-side ChromeContentRendererClient::ShouldFork.  This CL
removes the view-source: and file: related ShouldFork considerations.

Bug: 1003957, 883549
Change-Id: I5598807c358bf81f9c9e827383d0d1dd51d5ba17
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1841667
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705329}
2019-10-12 00:54:20 +00:00
arthursonzogni
0a1649749d bfcache: Fix SecurityExploitBrowsertest.InvalidBeginNavigationInitiator.
The FrameHostInterceptor observe RenderFrameHost creation and
destruction. In its constructor, it simulate observing RenderFrameHost
creation for every active RenderFrameHost. It misses the ones in the
BackForwardCache. This causes a mismatch later when it observe a
RenderFrameHost deletion.

Change-Id: Ifabf5eab92f3275d71e5a7d760f44e4178e00d6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1816509
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705020}
2019-10-11 08:35:20 +00:00
Ken Rockot
289101268d Fix misc ScopedFeatureList usage (8/8)
ScopedFeatureList is unsafe to use after browser threads have been
started. This constraint will imminently be enforced by DCHECK to
prevent further erroneous usage from landing.

This CL corrects usage within miscellaneous Content browser tests
as well as Chrome tests related to site islation.

This is split from a larger CL where in some rare cases, correction
was too complex to resolve before landing the DCHECK, so corresponding
test(s) may be disabled instead of fixed.

Bug: 846380
Change-Id: Idf6fcaabc37d09b49acb70ad3bd177985bed91cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1850736
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704749}
2019-10-10 19:07:58 +00:00
Yutaka Hirano
fe5510cf66 Disable "HtmlImportsRequestInitiatorLock"
We see some breakage on M78, so we are disabling the feature. After
merging this change to M78 I will revert this change.

Bug: 1006292
Change-Id: Ie56d2ac5cdd6ed8ea0fdf8c124a3f01c24731eed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1846832
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703615}
2019-10-08 07:30:33 +00:00
Alex Moshchuk
8969de2a67 Enforce WARN_UNUSED_RESULT on NavigateToURLAndExpectNoCommit().
Bug: 425335
Change-Id: I4556bb5b1ef2e58b6599746de13b37af22adf5d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1830358
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Auto-Submit: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700930}
2019-09-28 01:12:26 +00:00
Henrique Ferreiro
3bb206b589 Migrate file_chooser.mojom to the new Mojo types
Convert the implementation and all users of the
blink::mojom::FileChooser interface.

Bug: 955171, 978694
Change-Id: I3ebd6685c5b5c08e3c92dbea172ceeadb3d93c99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1789305
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/master@{#697576}
2019-09-18 12:48:23 +00:00
Julie Jeongeun Kim
ed2e5ba73d Convert NavigationClient to new Mojo types
This CL converts NavigationClientAssociatedPtrInfo,
NavigationClientAssociatedPtr, NavigationClientPtr,
and NavigationClientAssociatedRequest to new
Mojo types.

It also updates BeginNavigation from frame.mojom
and methods and members which implements it with
new Mojo types.

Bug: 955171
Change-Id: I2ed4aa7cdf57361c982e3adc696cc9ead797630b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1797823
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#695984}
2019-09-12 10:14:17 +00:00
Julie Jeongeun Kim
caacf91019 Convert WidgetPtr to new Mojo types
This CL converts WidgetPtr to new Mojo types.

It updates CreateNewWidget() and CreateFullscreenWidget()
from render_message_filter.mojom and methods and members
which implement these interfaces.

Bug: 955171
Change-Id: Ibc1a871b182716c216e90d4a9d041917cf35e278
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1792471
Commit-Queue: Julie Kim <jkim@igalia.com>
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695903}
2019-09-12 02:13:05 +00:00
Hiroshige Hayashizaki
8ee3f7e6d3 Use context document's ResourceFetcher for subresources of HTML imported documents
To enforce using main Document's origin
for subresources of HTML imported Documents,
this CL disables loading using HTML imported Documents' ResourceFetcher,
and switches the following subresources to use context document's
ResourceFetcher and origin:
- classic <script>s,
- Styleheets loaded via <link rel="stylesheet">, and
- Styleheets loaded via @import

(context documents should be the main Documents for HTML imported Documents)

This CL doesn't modify the following subresources:
- XHR and Fetch API (because they get the ResourceFetcher from
  the current execution context obtained from the current ScriptState,
  which is already the same as the context document)
- <img>s and other subresource types; they seem disabled
  in HTML imported Documents, or not covered by tests.
  We'll add a UMA to see if there are any subresources missed by this CL.

This CL doesn't modify base URLs,
i.e. keeps using HTML imported Documents' base URLs.

[The changes outside third_party/blink/renderer/ and
the following paragraphs are originally by lukasza@chromium.org from
https://chromium-review.googlesource.com/c/chromium/src/+/1750084]

This change affects some scenarios where HTML imports can end up using a
request_initiator that doesn't match request_initiator_site_lock.  We
think that this breaking changes is acceptable, because:

A) The old behavior leads to a security bug that can be exploited even
   without compromising a renderer - see https://crbug.com/961614.

B) The behavior is behind the features::kTrustworthyRequestInitiator
   kill switch, so we can quickly disable the new behavior if any
   trouble is spotted on the Beta or Stable channel.  See also
   blink::features::kHtmlImportsRequestInitiatorLock.

C) HTML Imports are deprecated at M70, and will be removed in M80.
   See also https://www.chromestatus.com/feature/5144752345317376

D) The behavior affects only a subset of fetches related to HTML
   imports.  In particular, most fetches will use request_initiator
   set to the importer of the module.  Only some fetches will use
   request_initiator set to the module origin.  For more specific
   examples see:
   https://docs.google.com/document/d/153oiCNNMksDWuvzY36WF1iD_i_ahs9X6RXxsZcpfuyg
   (listing of how "bar.com/module.html requests of “/resource.json”
   in 3 different ways")

E) It seems unlikely that the module author / the module server
   would CORS-allow the module importer to request D1) the module
   itself but D2) not the subresources fetched by the module.
   For reference, this aspect was discussed in May 2019 in an internal
   email thread titled "HTML Imports and enforcing security properties".

Bug: 961614
Change-Id: Ifefeb786a0d8773c51533b2b16bd7643b83466db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1753330
Auto-Submit: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693544}
2019-09-05 07:17:47 +00:00
Miyoung Shin
2be9da7a00 Convert DocumentInterfaceBroker to new Mojo types
This CL converts DocumentInterfaceBroker{Ptr, Request} in content,
blink, extension and media to the new Mojo types and uses
pending_remote<blink.mojom.DocumentInterfaceBroker> in
document_scoped_interface_bundle.mojom and
pending_receiver<blink.mojom.DocumentInterfaceBroker> in
frame_messages.mojom.

Bug: 955171, 978694
Change-Id: Ic0ccabb445febbf8b2bd81aa754fc0abecfb77b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1781900
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693066}
2019-09-04 09:04:10 +00:00
Julie Jeongeun Kim
061709e8ff Convert BlobPtr from Write() and Register() to new Mojo types
This CL converts BlobPtr from Write in
native_file_system_file_writer.mojom and Register in
blob_url_store.mojom and updates methods and members
to implement them.

Bug: 955171, 978694
Change-Id: If254a289988e7a7eb852988cb99a3a2e9a254e65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1757946
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#692982}
2019-09-04 02:33:43 +00:00
Miyoung Shin
da5da32e4b Convert NavigationInitiator to new Mojo types
This CL converts NavigationInitiator{Ptr, Request} in content and
blink to the new Mojo types, and uses
pending_remote<blink.mojom.NavigationInitiator> in frame.mojom.

Bug: 955171, 978694
Change-Id: I89d54747b61cc1cfa4e0ee46c1013b560150c07e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1776157
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692429}
2019-09-02 10:07:37 +00:00
Julie Jeongeun Kim
249cfbb257 Convert BlobURLTokenPtr/PtrInfo to new Mojo types
This CL converts BlobURLTokenPtr and BlobURLTokenPtrInfo
to new Mojo types.
It updates BeginNavigation from frame.mojom,
CreateWorkerHostAndStartScriptLoad from
dedicated_worker_host_factory.mojom, and Connect from
shared_worker_connector.mojom

Bug: 955171, 978694
Change-Id: If9cbac3e3500803e9f9bb8914c59c8ba14ea2149
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1774422
Commit-Queue: Julie Kim <jkim@igalia.com>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691955}
2019-08-30 06:44:05 +00:00
Julie Jeongeun Kim
47499a0c48 Convert TrustedURLLoaderHeaderClient to new Mojo types
This CL converts TrustedURLLoaderHeaderClientRequest,
TrustedURLLoaderHeaderClientPtrInfo and
TrustedURLLoaderHeaderClientPtr to new Mojo types.

Bug: 955171, 978694
Change-Id: I282ceb552522adc42e8b03d64d26b1bf1c2dd5be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1768841
Commit-Queue: Julie Kim <jkim@igalia.com>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#691055}
2019-08-28 07:23:18 +00:00
Alex Moshchuk
4174c19893 Fix several problematic uses of NavigateToURL() in content_browsertests.
This converts a few more files to expect the right result from
NavigateToURL(), fixing behavior in several tests in the process.
Most of these files had tests that would fail if we simply added
EXPECT_TRUE to their use of NavigateToURL().  Some of the causes of
that were:

- Navigating to invalid/broken URLs
  (MHTMLGenerationTest.InvalidPath, TracingControllerTest.*)

- Navigating to javascript URLs that actually ended up navigating
  the page (or some other frame) somewhere else.
  (BookmarkletTest.Redirect*, SessionHistoryTest.*)

- Navigating to URLs that redirect to other URLs
  (VerifyCrossSiteRedirectURL, RedirectAndRespondWithNavigationPreload)

- Navigating to URLs with a broken test server that was incapable
  of actually serving the right files.
  (NetworkServiceBrowserTest.SyncXHROnCrash)

- Navigating to URLs that result in a crash
  (SecurityExploitBrowserTest.DidCommitInvalidURL)

- Navigating to a webui URL that doesn't exist in content/
  (WorkerNetworkIsolationKeyBrowserTest).  Bonus points for
  then relying on cross-process behavior of error page
  isolation to accidentally satisfy the test's requirements.

Bug: 425335
Change-Id: I471479b5811f89793f105dce429fa13f342e0df5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1759900
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688577}
2019-08-20 16:58:09 +00:00
Sami Kyostila
8e4d5a915e content/browser: Always specify thread affinity when posting tasks
*** Note: There is no behavior change from this patch. ***

The PostTask APIs will shortly be changed to require all tasks to explicitly
specify their thread affinity, i.e., whether the task should run on the thread
pool or a specific named thread such as a BrowserThread. This patch updates all
call sites with thread affinity annotation. We also remove the "WithTraits"
suffix to make the call sites more readable.

Before:

    // Thread pool task.
    base::PostTaskWithTraits(FROM_HERE, {...}, ...);

    // UI thread task.
    base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI, ...}, ...);

After:

    // Thread pool task.
    base::PostTask(FROM_HERE, {base::ThreadPool(), ...}, ...);

    // UI thread task.
    base::PostTask(FROM_HERE, {BrowserThread::UI, ...}, ...);

This patch was semi-automatically prepared with these steps:

    1. Patch in https://chromium-review.googlesource.com/c/chromium/src/+/1635827
       to make thread affinity a build-time requirement.
    2. Run an initial pass with a clang rewriter:
       https://chromium-review.googlesource.com/c/chromium/src/+/1635623
    3. ninja -C out/Debug | grep 'requested here' | cut -d: -f1-3 | sort | \
           uniq > errors.txt
    4. while read line; do
         f=$(echo $line | cut -d: -f 1)
         r=$(echo $line | cut -d: -f 2)
         c=$(echo $line | cut -d: -f 3)
         sed -i "${r}s/./&base::ThreadPool(),/$c" $f
       done < errors.txt
    5. GOTO 3 until build succeeds.
    6. Remove the "WithTraits" suffix from task API call sites:

       $ tools/git/mffr.py -i <(cat <<EOF
       [
         ["PostTaskWithTraits",                            "PostTask"],
         ["PostDelayedTaskWithTraits",                     "PostDelayedTask"],
         ["PostTaskWithTraitsAndReply",                    "PostTaskAndReply"],
         ["CreateTaskRunnerWithTraits",                    "CreateTaskRunner"],
         ["CreateSequencedTaskRunnerWithTraits",           "CreateSequencedTaskRunner"],
         ["CreateUpdateableSequencedTaskRunnerWithTraits", "CreateUpdateableSequencedTaskRunner"],
         ["CreateSingleThreadTaskRunnerWithTraits",        "CreateSingleThreadTaskRunner"],
         ["CreateCOMSTATaskRunnerWithTraits",              "CreateCOMSTATaskRunner"]
       ]
       EOF
       )

This CL was uploaded by git cl split.

R=boliu@chromium.org, tsepez@chromium.org

Bug: 968047
Change-Id: I346372d16a3856186ea74d14e0dd8a12f7cacae5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1729589
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683554}
2019-08-02 12:45:05 +00:00
John Abd-El-Malek
523b0b87f0 Remove network::ResourceRequest members that are no longer needed.
Bug: 934009
Change-Id: I396ea73e2d39bea85a93e07368cac6226680d146
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1731784
Auto-Submit: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683453}
2019-08-02 02:49:37 +00:00
Kinuko Yasuda
7d925ea2c5 Remove MojoBlobURLs flag as Network Service is now enabled by default
Change-Id: I37a084f25288cf473ebb3a37408534cb9a2d3977
Bug: 934009, 985682
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1728869
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683115}
2019-08-01 10:08:48 +00:00
Yutaka Hirano
f685b58fd7 Add COEP header handling
- "cross-origin-embedder-policy" set's the policy for frame.
 - dedicated worker's policy is set to the ancestor frame's policy.
 - nested frames with a conflicting policy is blocked.

SharedWorker / ServiceWorker are not yet supported. All the
implementation is behind the flag, and tested manually with
work in progress WPTs[1].

1: https://github.com/web-platform-tests/wpt/pull/17606

Bug: 887967
Change-Id: I70ed24841afde1b3c72dad40288744bb92a6f5dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715378
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682609}
2019-07-31 06:18:45 +00:00
John Abd-El-Malek
d96edf38e1 Remove last usage of ResourceDispatcherHostImpl before its deletion.
Bug: 934009
Change-Id: I9d5dfc911e30d5d765cf6e73b3f69867f3208ed2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1725049
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682001}
2019-07-29 22:04:52 +00:00
Lucas Furukawa Gadani
ef8290afc5 Convert content::CommonNavigationParams to mojom.
Bug: 984550
Change-Id: Id0acde76f86c50a2568d050c7b082d6510c3c108
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1700291
Reviewed-by: Tao Bai <michaelbai@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Lucas Gadani <lfg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681955}
2019-07-29 20:27:51 +00:00
Oksana Zhuravlova
fee097c076 [mojo] Introduce BrowserInterfaceBroker
This CL adds the mojom interface that the renderer will use to get
interfaces from the browser, as well as its implementation, functions
for registering interface handlers and all the necessary plumbing.

This CL also converts AudioContext to use BrowserInterfaceBroker.

Bug: 718652
Change-Id: I6b24bc802ca482feac1d8ae5fff7e5bf44215fa4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1688547
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681341}
2019-07-26 17:01:30 +00:00
Kinuko Yasuda
04a82ab1b3 Make sure BlobDispatcherHost is not needed with NetworkService
(We'll start deleting the code soon too)

Bug: 985682
Change-Id: I7a53b0849820bfe18b93d0aabaaedc83bc062527
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715775
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681198}
2019-07-26 06:13:39 +00:00
Aaron Colwell
e953e560a4 Add logic to convert empty SiteInstances to a default SiteInstance.
This change allows a top-level empty SiteInstance to become the default
SiteInstance if the URL for the top-level frame does not require a
dedicated process. This allows the top-level frame and any subframes
that do not require a dedicated process to share the same default
SiteInstance process.

Bug: 958060,78757
Change-Id: I920860b822474157897a0f3e3534cca87984599c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1693778
Commit-Queue: Aaron Colwell <acolwell@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680472}
2019-07-24 16:47:36 +00:00
Lukasz Anforowicz
77f3c101b5 Apply |allow_universal_access_from_file_urls| to CORB and OOR-CORS.
|allow_universal_access_from_file_urls| is one of
content::WebPreferences, that used to affect some layout tests and that
is exposed publicly via
WebSettings.setAllowUniversalAccessFromFileURLs [1].

Note that allow_universal_access_from_file_urls needs to be set *before*
a document is committed, because this setting is only inspected by
blink::Document::InitSecurityContext.  In other words, it is not
possible to change this setting during the lifetime of a frame (or
during the lifetime of a URLLoaderFactory).

Before this CL:

1. CORB would unconditionally ignore requests initiated from file:
   origins (in the past some layout tests would fail + blocking
   requests from file: origin might break Android WebView cases
   that have opted into |allow_universal_access_from_file_urls|).

2. OOR-CORS would ignore |allow_universal_access_from_file_urls|
   (possibly breaking some Android WebView scenarios - before this CL
   the new CorsFileOriginBrowserTest.UniversalAccessFromFileUrls test
   would succeed in InBlink mode and fail in InNetworkService mode).

After this CL:

3. RenderProcessHostImpl::CreateURLLoaderFactory takes an optional
   |content::WebPreferences*| argument and based on that argument
   may disable CORB and OOR-CORS by setting appropriate
   URLLoaderFactoryParams.

4. CORB in NetworkService no longer unconditionally skips processing of
   requests initiated from file: origins
   (//services/network/cross_origin_read_blocking.cc changes).  OTOH,
   this behavior is preserved in pre-NetworkService code
   (//content/browser/loader/cross_site_document_resource_handler.cc
   changes).

5. Regression tests have been added:
   - CorsFileOriginBrowserTest.UniversalAccessFromFileUrls
        - fails before this CL in OOR-CORS/InNetworkService mode
        - shows that before this CL OOR-CORS might have broken Android
          WebView;  note that this step would fail if item3 above would
          not disable *both* OOR-CORS *and* CORB.
  - CrossSiteDocumentBlockingTest.BlockImages
        - now also covers requests from file: origin (this part fails
        before this CL)

[1] https://developer.android.com/reference/android/webkit/WebSettings#setAllowUniversalAccessFromFileURLs(boolean)

Bug: 873483, 980629
Tbr: anthonyvd@chromium.org for //components/translate
Cq-Include-Trybots: luci.chromium.try:linux_mojo
Change-Id: I7f71461a5ddd8225939df1e414689d58f7d99bda
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1172935
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#674692}
2019-07-04 01:26:24 +00:00
Lucas Furukawa Gadani
ebc8f7fc3e Refactor StrongAssociatedBinding to allow swapping the ownership in tests
Change-Id: Icbbf7bc4a242f89eb6be5841783c14c116f42c2c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1660040
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Lucas Gadani <lfg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#670133}
2019-06-18 18:06:48 +00:00
Shivani Sharma
11c23f555a Split Cache: Network isolation key for subresources in the URLLoaderFactory
This CL adds a network isolation key as a member in URLLoaderFactoryParams
which is used as the key for the Http cache and is propagated to the cache
in every URLRequest.
This CL is scoped to create and fill the key for subresources
which is done in RenderFrameHostImpl when a navigation is being committed.
RenderProcessHost::CreateURLLoaderFactory() interface is changed to accept
the network isolation key as an argument.
Follow up CLs would fill it up for navigation requests and worker
subresources.
Added unit tests in url_loader_unittests.cc and for the new mojom traits.
The existing browser test WebContentsSplitCacheBrowserTestEnabled.SplitCache
tests this change and the helper function is modified to also test the http cache
key in the RenderFrameHostImpl.

Bug: 910708
Change-Id: I066d53df5c1ad1abe84ecce67697ddd2bb5ee11c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1610218
Commit-Queue: Shivani Sharma <shivanisha@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Josh Karlin <jkarlin@chromium.org>
Reviewed-by: anthonyvd <anthonyvd@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#668057}
2019-06-11 18:18:39 +00:00
Arthur Hemery
bee4a75671 Navigation: Initial history subframe navigations use BeginNavigation.
When navigating back to a frame that has subframes, we should try to
restore the subframes to their latest history item. This is currently
done by OpenURL and should be done by BeginNavigation instead.

Design doc:
https://docs.google.com/document/d/13Rqdg1HBmtfnYMUXvg7SpUl3bJisTElfyMc1Ze8hLdE/edit#

This is patch 1/2.
This patch only modifies the behavior for
IsPerNavigationMojoInterface off.

Bug: 962518
Change-Id: I40c38663f964d3b4e0b09dcbab887d91a2faf282
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1578740
Commit-Queue: Arthur Hemery <ahemery@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664216}
2019-05-29 10:50:55 +00:00
Marijn Kruisselbrink
276d1ae439 [AppCache] Use UnguessableToken for appcache host IDs.
Rather than having the browser and renderer processes try to allocate
non conflicting integers, and keying everything of process id +
host id, instead identify all appcache hosts by a unguessable token.

This hopefully fixes some race conditions when a process id gets
reused for a new process before the old state has fully torn down, and
should make the code slightly more robust against compromised renderers
trying to claim pre-registered browser created AppCacheHosts that were
meant for a different process/frame.

Bug: 963661
Change-Id: I4fbf1835c3ca22ee26e7d1b9a6bd142d0152465d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1620697
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662283}
2019-05-22 18:44:04 +00:00
Daniel Cheng
57541bef61 Revert "network service: define an opaque ResourceType enum for embedder customization"
This reverts commit da5a52f67a.

Reason for revert: Decided not to use the trick of declaring an opaque enum,
since it's potentially confusing. Once network service is fully enabled, it
won't be needed as ResourceType won't need to be in the network service at all.

Original change's description:
> network service: define an opaque ResourceType enum for embedder customization
>
> Network service embedders that use the resource_type field can provide
> a custom definition of the enum to suit their needs.
>
> Tbr: jochen@chromium.org
> Change-Id: I27c04257c90e8cf0353287b7ec8971593772dac8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1575519
> Commit-Queue: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Matt Menke <mmenke@chromium.org>
> Reviewed-by: Bo <boliu@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#653476}

TBR=avi@chromium.org,dcheng@chromium.org,thestig@chromium.org,boliu@chromium.org,mmenke@chromium.org,tsepez@chromium.org,jochen@chromium.org

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

Tbr: jam@chromium.org
Change-Id: Ib91a35bea1225c04bbf25f7c6b82e17b9b59dba8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1597220
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#657157}
2019-05-07 07:51:07 +00:00
Daniel Cheng
da5a52f67a network service: define an opaque ResourceType enum for embedder customization
Network service embedders that use the resource_type field can provide
a custom definition of the enum to suit their needs.

Tbr: jochen@chromium.org
Change-Id: I27c04257c90e8cf0353287b7ec8971593772dac8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1575519
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653476}
2019-04-24 02:44:24 +00:00
Nate Chapin
3501550bca Don't send location API navigations through NavigationScheduler
This is a small code change with a lot of test changes. The two most
common reasons for those changes are:
* Cases where the ordering of messages reaching the browser process
  changed in ways that browser_tests were sensitive to.
* A navigation scheduled by NavigationScheduler doesn't prevent a
  DidStopLoading() callback, but starting the navigation
  immediately does prevent DidStopLoading(). So location API
  navigations inside onload used to result in two pairs of
  DidStartLoading/DidStopLoading callbacks, where there is now only
  one pair.

Bug: 914587
Change-Id: I83b016041c4579a64cf9ccfd7876dba335b799d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1526426
Commit-Queue: Nate Chapin <japhet@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653352}
2019-04-23 20:58:47 +00:00
Nate Chapin
e6fd9fbe3f Update tests in preparation for making location API navigations start synchronously
A bunch of tests need to be updated for a behavior change in
https://chromium-review.googlesource.com/c/chromium/src/+/1526426
These are the ones where the updated test passes before and after the
behavior change.

Bug: 914587
Change-Id: Ic8b34c4c205ea2f9bf59b620ca6baac47cd7b1ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1576025
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652884}
2019-04-22 18:06:02 +00:00
Nasko Oskov
7d94539fd7 Add CanAccessDataForOrigin check to RenderFrameHostImpl::CanCommitURL
This check was initially added in r629679 and then reverted in r633938
due to unexpected renderer process terminations. Some bugs were discovered
and fixed in the meantime, so this is an attempt to add the check back.
The CL includes crash keys to capture more information about the state
when the process is terminated to aid debugging. The instrumentation
will be removed separately if all goes smoothly.

Bug: 918565, 931895
Change-Id: I4de255731ee8251714132fdbea56777da4e4b440
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1549318
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652724}
2019-04-20 01:59:30 +00:00
Daniel Cheng
aee5c031a6 Make content::ResourceType an enum class.
This allows us to be more explicit when content::ResourceType needs to
be smuggled in an untyped int. It has the effect of introducing more
static_cast<int>, but this makes the conversion sites explicit.

This also allows several other incidental fixes:
- the Mojo version of the enum no longer defines a sentinel value (which
  violates best practices in the security guidelines)
- the C++ version of the enum can now define a compiler-enforced
  kMaxValue enumerator.
- Since kMaxValue is no longer a distinct value, dummy handling for this
  value can be removed. This revealed a quirk in
  chrome/browser/predictors/loading_data_collector.cc

Tbr: avi@chromium.org
Tbr: blundell@chromium.org
Tbr: droger@chromium.org
Tbr: rdevlin.cronin@chromium.org
Change-Id: I7203a029b1fcb06426c957d208e9278a25d4a45b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1569345
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652395}
2019-04-18 23:49:05 +00:00
Mike West
9286cf1b1d Navigations initiated from renderers must have webby ui::PageTransition values.
This patch verifies that incoming navigation requests from renderer processes
can only have `ui::PageTransition` values that meet the requirements of
`PageTransitionIsWebTriggerable()`. The process will be terminated if that
invariant is violated.

Bug: 946976
Change-Id: Ia1446964020455a05e824fbfb2456ea2d36cea6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1543255
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Josh Karlin <jkarlin@chromium.org>
Commit-Queue: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646284}
2019-04-01 13:44:58 +00:00
Kent Tamura
4a34826934 Fix a crash on FileChooserImpl
If a renderer process is compromised, and it calls both of
FileChooserImpl::OpenFileChooser() and EnumerateChosenDirectory() via
Mojo, the browser process could crash because ResetOwner() for
the first FileChooserImpl::proxy_ instance was not called.  We
should check nullness of proxy_ before updating it.

Bug: 941008
Change-Id: Ie0c1895ec46ce78d40594b543e49e43b420af675
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1520509
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#640580}
2019-03-14 01:44:27 +00:00
Etienne Pierre-doray
df8868a029 Disable SecurityExploitBrowserTest.AttemptDuplicateRenderWidgetHost.
SecurityExploitBrowserTest.AttemptDuplicateRenderWidgetHost is flaky
on all platorms.

TBR=boliu@chromium.org

Bug: 939338
Change-Id: I21f13d8651b52647f61a0bb8f92d943ff96e7def
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1508894
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638643}
2019-03-07 17:53:53 +00:00
Arthur Hemery
2a0a28bee3 Navigation: Reintroducing DidCommitProvisionalLoadInterceptor.
This patch reintroduces DidCommitProvisionalLoadInterceptor
(removed in
https://chromium-review.googlesource.com/c/chromium/src/+/1455470),
renamed as DidCommitNavigationInterceptor, to work with the new
NavigationClient interface.

It does so by adding an interceptor to the RenderFrameHostImpl, called
directly after entering the callback.

Bug: 784904
Change-Id: I7cbba4e9220017625676c7679c8606ad425712e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1477028
Commit-Queue: Arthur Hemery <ahemery@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638183}
2019-03-06 17:51:36 +00:00
Lukasz Anforowicz
2294ca8f7c Verify that all BeginNavigation IPCs contain an |initiator_origin|.
All renderer-initiated navigations should specify an |initiator_origin|
(CommonNavigationParams::initiator_origin is a base::Optional to
accomodate browser-initiated navigations and some extension APIs which
need to distinguish between no origin VS a unique origin).

Bug: 919144
Change-Id: I91ad5a2ecc1ac81c7f13f16f6eb281f814866411
Reviewed-on: https://chromium-review.googlesource.com/c/1474091
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635164}
2019-02-25 18:26:05 +00:00
Lukasz Anforowicz
3cfc1efd26 Verify |initiator_origin| in RenderFrameHostImpl::BeginNavigation.
This CL makes the following changes:

Product code changes:

- Moving most of verification of CommonNavigationParams that used to be
  done in RenderFrameHostImpl::BeginNavigation into a new helper
  function in frame_host/ipc_utils.cc - VerifyCommonNavigationParams.

- Making sure that VerifyCommonNavigationParams verifies things that used
  to be covered by RenderFrameHostImpl::BeginNavigation and *also*
  covers verification of |initiator_origin| (reusing other verification
  helpers present in frame_host/ipc_utils.cc).

- Auditing callers of SetRequestorOrigin and making sure they use the right
  origin - they should use the initiating frame's origin.  The following
  functions have been tweaked:
     1) blink::FrameLoader::ResourceRequestForReload
     2) blink::HTMLAnchorElement::HandleClick

  - Without tweak  some browser tests would have failed
    (e.g. the existing DNSErrorPageTest.StaleCacheStatus or the new
    ErrorPageNavigationReload_InSubframe_BlockedByClient in the
    RenderFrameHostManagerTest suite).

  - I also note that the tweaked line in
    blink::FrameLoader::ResourceRequestForReload was added in r529246
    which also added a regression test which still passes:
    RenderFrameDevToolsAgentHostBrowserTest.ReloadDinoPage

Test changes:

- Moving IsolateOrigin[ForTesting] from security_exploit_browsertest.cc
  into content/public/test/content_browser_test_utils.h

- Renaming DidCommitProvisionalLoadInterceptor into FrameHostInterceptor
  and supporting intercepting one more method of FrameHost -
  BeginNavigation (in addition to the old support for intercepting
  DidCommitProvisionalLoad).

- Adding test coverage for terminating a renderer that provides an
  invalid value in the |initiator_origin| argument of BeginNavigation.

- Adding test coverage for renderer-initiated reloading of an
  erorred-out subframe.

Bug: 919144
Change-Id: I2de74a634e6691b490cd94df1ac8494248f7c363
Reviewed-on: https://chromium-review.googlesource.com/c/1455470
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634486}
2019-02-22 02:29:29 +00:00
Lukasz Anforowicz
eebb0fb822 Partial revert of r629679 - RFHI::CanCommitURL / CanAccessDataForOrigin
This CL partially reverts r629679 to avoid incorrectly terminating
renderers in the wild - see the bugs listed below.

Bug: 918565, 931895
Change-Id: I6e0e7db87db4596c1f21520ceb942f5a34333e45
Reviewed-on: https://chromium-review.googlesource.com/c/1479077
Commit-Queue: Charlie Reis <creis@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#633938}
2019-02-20 23:16:58 +00:00
Nasko Oskov
fd52b6f09d Add CanAccessDataForOrigin check to RenderFrameHostImpl::CanCommitURL
This CL adds simple check for URLs reported during navigation commit
to ensure that the URL is allowed to commit in the process based on
ChildProcessSecurityPolicy::CanAccessDataForOrigin.

Bug: 918565
Change-Id: I7b24cbf160d5ae109e578177377db6a2f1ce667f
Reviewed-on: https://chromium-review.googlesource.com/c/1412689
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629679}
2019-02-06 19:21:15 +00:00