This CL makes use of the new `size_t`-based APIs in `//content`.
See https://crrev.com/c/5414148 for motivation.
This CL may have introduced new integer conversions - in those cases the
CL attempts to have well-defined behavior (e.g. using
`base::checked_cast`). OTOH, this CL did *not* attempt to fix old
integer operations (e.g. old `int` => `uint32_t` / `size_t` conversions,
or old additions that may potentially overflow).
Bug: 40284755
Change-Id: Id1d3c2b863cf524d1132346aed7e330bc3509688
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5416894
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1286002}
CachedMetadata is an opaque data blob optionally stored alongside
responses in the response cache. It stores data specific to the
response -- in particular, for JavaScript files it will store the V8
code cache. Before this patch, CachedMetadata was sent to the renderer
using a separate OnReceiveCachedMetadata message, after
OnReceiveResponse.
This mechanism is only used by the Service Worker installed resources; in the HTTP cache case, there is a separate "isolated code cache"
which is queried at the same time as the HTTP cache and the two
requests are synchronised (cf. https://crbug.com/812168). This means
that, before this patch, HTTP code caches were received at the same
time as the body (thanks to the synchronisation), but Service Worker code caches were received _after_ the body (which is sent as part of
OnReceiveResponse). The consequence was that Service Worker code
caches were dropped in favour of (re)parsing the script response body,
as that parse was started before the CachedMetadata was received.
Now, rather than a separate OnReceiveCachedMetadata, send an optional
CachedMetadata alongside the headers and body in OnReceiveResponse.
This allows the receiver of the response to more carefully interleave
dealing with the metadata and body.
Review note: Since the Service Worker is the only user of this API, the
interesting parts of this patch are the handling of service worker
and the changes in the Blink UrlLoaderClient. Unfortunately, there are
other implementers of the UrlLoaderClient interface which either
ignore or trivially pass through the cached metadata, and the
signature change of the OnReceiveResponse method makes this CL
impossible to split by subdirectory for these trivial changes.
Bug: 1350077
Change-Id: I43cce62bf573691247cb8ccc362a4b73541185a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3811219
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Daniel Murphy <dmurph@chromium.org>
Reviewed-by: David Trainor <dtrainor@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Josh Simmons <simmonsjosh@google.com>
Cr-Commit-Position: refs/heads/main@{#1040492}
These may have needed to be separate before, but not anymore. Add a
feature flag to enable this so we can measure performance and disable if
we see any issues.
OnReceiveResponse now takes an optional data pipe that is only sent if
the feature is enabled. URLLoaderClients don't check the feature, and
instead use the data pipe if it's available earlier. The main producer
to update is the network service's URLLoader implementation. For
simplicity I didn't update all the other producers since most don't
affect performance and the clients handle both cases. I additionally
only updated service worker, extensions, WebUI and blobs.
Bug: 1017710
Change-Id: Icc85fa781dac7951fabcc1d82220630dd374f6b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3410912
Reviewed-by: Wez <wez@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Clark DuVall <cduvall@chromium.org>
Reviewed-by: Min Qin <qinmin@chromium.org>
Reviewed-by: Tarun Bansal <tbansal@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: Ben Kelly <wanderview@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#962758}
The DataPipe constructor has no way to check for errors if creation
fails, so it CHECKs and crashes. CreateDataPipe offers a way to check
the return value.
Bug: 944990
Change-Id: I55a32566d62406f6c5bc34a8571bfced82d0aa1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2657352
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#848702}
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}
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}
This is hopefully the last step before finally adding
WARN_UNUSED_RESULT to NavigateToURL().
Apart from adding straightforward expectations for regular and redirect
cases, this fixes a couple more bugs:
- AppendingFrameInWebUIDoesNotCrash was broken on Android, because it
used chrome://tracing, which doesn't exist on Android.
- A couple of tests in WebContentsImplBrowserTest (e.g.,
ChangeDisplayMode) were navigating to about://blank (instead of
about:blank), which results in an error rather than a blank page.
Bug: 425335
Change-Id: Id80040de9c3383c517f2df95b819f314e6b29f30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1819852
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699854}
This test was using a net::URLRequestInterceptor so was not actually
working correctly with network service. The interceptor it was using
also assumes it is on the IO thread which was causing issues when
running NS in-process on its own thread.
Bug: 908993
Change-Id: I009ddf13b53cecac9615c4d2019405ddede57c69
Reviewed-on: https://chromium-review.googlesource.com/c/1357405
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612879}
- Moving tests to use EmbeddedTestServer where possible.
- net::test_server::EmbeddedTestServer references to net::EmbeddedTestServer
- Using server.Start() instead of server.InitializeAndWaitUntilReady()
- Renaming test_server() to be spawned_test_server() or embedded_test_server()
- Enabling tests disabled due to SpawnedTestServer compatibility
BUG=496825
Review URL: https://codereview.chromium.org/1411073005
Cr-Commit-Position: refs/heads/master@{#357645}
This deletes the chromium-side tests for showModalDialog. We're about to disable
this feature from the Blink side, which would otherwise break these tests. The
plan is to leave the implementation behind a flag for a release or two in case
we need to restore the feature on short notice.
This CL is a partial re-land of https://codereview.chromium.org/165793003.
R=darin@chromium.org
BUG=345831
Review URL: https://codereview.chromium.org/246013006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265711 0039d316-1c4b-4281-b951-d872f2087c98
We're leaving this in for M35.
> Remove tests and code for showModalDialog
>
> This deletes the chromium-side implementation logic and a few tests for
> showModalDialog. I believe more simplification is possible to do without the
> design constraints imposed by showModalDialog but we should probably start
> small in case we run into unexpected compat issues.
>
> R=darin
> BUG=345831
>
> Review URL: https://codereview.chromium.org/165793003TBR=jamesr@chromium.org
Review URL: https://codereview.chromium.org/201153003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257356 0039d316-1c4b-4281-b951-d872f2087c98
This deletes the chromium-side implementation logic and a few tests for
showModalDialog. I believe more simplification is possible to do without the
design constraints imposed by showModalDialog but we should probably start
small in case we run into unexpected compat issues.
R=darin
BUG=345831
Review URL: https://codereview.chromium.org/165793003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252883 0039d316-1c4b-4281-b951-d872f2087c98
A client's didReceiveResponse can cancel a request; by protecting the
Context we avoid a use after free in this case.
Interestingly, we really had very good warning about this problem, see
https://codereview.chromium.org/11900002/ back in January.
R=darin
BUG=241139
Review URL: https://chromiumcodereview.appspot.com/15738007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202821 0039d316-1c4b-4281-b951-d872f2087c98
> Test that 404 subresource bodies with nested message loops don't crash.
>
> This is a browser test because DumpRenderTree doesn't run nested message loops. The failure case was that a nested message triggered from an element that has signalled an error but had an open request would receive a body for the request and crash/fail an assertion.
>
> This test checks the WebKit side fix for this issue, see https://bugs.webkit.org/show_bug.cgi?id=103563
>
> R=sky@chromium.org
>
> Review URL: https://chromiumcodereview.appspot.com/11778083TBR=gavinp@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176897 0039d316-1c4b-4281-b951-d872f2087c98
This is a browser test because DumpRenderTree doesn't run nested message loops. The failure case was that a nested message triggered from an element that has signalled an error but had an open request would receive a body for the request and crash/fail an assertion.
This test checks the WebKit side fix for this issue, see https://bugs.webkit.org/show_bug.cgi?id=103563R=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11778083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176882 0039d316-1c4b-4281-b951-d872f2087c98
The content_shell doesn't provide a prerendererclient (and chromium and DumpRenderTree do). This browsertest makes sure that encountering a prerendering element doesn't crash the content_shell.
This patch must land after https://bugs.webkit.org/show_bug.cgi?id=95036 lands and is gardened into Chromium.
R=jam@chromium.org
BUG=144556
Review URL: https://chromiumcodereview.appspot.com/10869068
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153596 0039d316-1c4b-4281-b951-d872f2087c98
Move the WebContentsImpl class to files in web_contents.
BUG=105875
TEST=no change
Review URL: http://codereview.chromium.org/10054012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131845 0039d316-1c4b-4281-b951-d872f2087c98
I considered taking out GetSelectedTabContents altogether and having people just use GetSelectedTabContentsWrapper()->web_contents() per the existing comment in browser.h, but there are a lot of callers and it seemed too long to type.
BUG=98716
TBR=joi
Review URL: http://codereview.chromium.org/9015022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116122 0039d316-1c4b-4281-b951-d872f2087c98
Unfortunately, I haven't been able to reproduce bug 103058 very well
in WebKit's LayoutTest engine, because DumpRenderTree's libraries interfere with
resource lifetime; a browser_test doesn't have this issue, so it's able to
act as a good regression test for this issue.
BUG=103058
Review URL: http://codereview.chromium.org/8531002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110321 0039d316-1c4b-4281-b951-d872f2087c98