This CL adds the ability to create header overrides from the list of
network requests in the network panel via the context menu.
If a local folder for storing local overrides has already been
configured beforehand, the context menu takes the user straight to the
'.headers' file where header overrides are to be specified. If
overrides have not been configured before, the user has to name a
local folder for storing overrides first.
Video: https://i.imgur.com/kLGlOtL.mp4
Bug: 1297533
Change-Id: I8b31fe41d922e1662da68320fcc188c596c0a058
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3542245
Reviewed-by: Danil Somsikov <dsv@chromium.org>
Commit-Queue: Wolfgang Beyer <wolfi@chromium.org>
The main request for a Service Worker scripts currently gets stuck in
the "(pending)" state.
This test will currently fail like:
```
1) network/network-datagrid_test.ts: The Network Tab
shows the main service worker request as complete:
AssertionError: expected { Object (status, time, ...) } to have property 'status' of '200OK', but got '(pending)'
+ expected - actual
-(pending)
+200OK
```
The issue appears to be rooted in the misalignment of network request ids
between the inial network CDP event for the request compared with
subsequent events.
Running this test with an executable built from https://chromium-review.googlesource.com/c/chromium/src/+/3544685
passes.
Bug: 1304795
Change-Id: I14f8d64d58fad16e4ddb0acf2058ed4c613c5500
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3566669
Reviewed-by: Eric Leese <leese@chromium.org>
Reviewed-by: Danil Somsikov <dsv@chromium.org>
Commit-Queue: Danil Somsikov <dsv@chromium.org>
When filling the iframe that's showing the preview for html requests, we
encode the html contents as a data-url and also set the sandbox property
on the frame. This avoids remaking the request from within devtools.
It's still possible for the iframe to spawn some requests. With this CL
we prevent requests by setting the csp for the iframe.
Bug: 833147
Change-Id: Id77321465c91fd68e5d6c6c3681e48b39cb32d14
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3557989
Reviewed-by: Danil Somsikov <dsv@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
This CL changes e2e tests to load the DevTools frontend on the
'devtools-frontend.test' origin instead of using 'localhost'.
'localhost' is used by the target page. If we also load DevTools via
'localhost' than the two pages share window.localStorage and are
considered "same-origin", which hardly reflects reality.
To enable this CL, we have to change the hosted-mode server to set
some CORS headers. More specifically, we allow the DevTools frontend
to request arbitray resources from the hosted-mode server, while
target pages have to be explicit in their ".headers" or
".rawresponse" files.
The CL also rebaselines a couple of e2e test that expect exact
response sizes or expect exact response headers.
R=jacktfranklin@chromium.org, pfaffe@chromium.org
Bug: 1297458
Change-Id: Ie18069e2effcc53cfd10a19296dc5d5c74b40e17
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3467975
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
This is to make const enum in protocol.d.ts works with esbuild in
unittest.
Without this, const enum usage from protocol.d.ts is not replaced with
esbuild. So I need to make protocol.d.ts actual TypeScript file and make
it has corresponding JavaScript file with defined enums.
I also need to tweak how protocol.js is imported to make build/test pass
in both tsc and esbuild with child CL.
Bug: 1278663
DISABLE_THIRD_PARTY_CHECK=change generated/ and importing files
Change-Id: Ic5f27633c85bbfe8647636beef9b8625f33eabdd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3367593
Reviewed-by: Tim Van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
The click event only fires for elements that receive both a mousedown
and a mouseup event. Since DataGrid elements in the Network panel get
replaced every time a message is received on WebSockets, the click
event doesn't get fired if you click before a message and release after
the message. To fix this we'll listen for the mousedown event instead.
This has the added benefit that the request panel becomes visible
sooner, making it feel more responsive.
Fixed: 1222382
Change-Id: Ia44c47a90b4822530081caf63aec682e9f32186c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3293092
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Previously, DevTools would mark 404s on CORS requests as cors errors,
and point out missing headers. While the headers are *technically*
missing, the information that the request 404'd is more important to
web developers.
This CL prioritzes HTTP error codes (>=400) over CORS errors in the
network panel's status column. This was previously not possible, as
for CORS errors the underlying reponse code was not reported, which
changed in https://crrev.com/c/3043654.
Bug: chromium:782442
Change-Id: I38d9acc938bfbfe3b8f63e49cf81aaf7f0429fbe
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3055236
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
This functionality adds on top of the existing query mechanism, rather
than modify it.
This is because a query string can have multiple filters, some of them
regular expressions, some not. Each one of those filters could already
be negated with a "-" prefix, including the regular expressions. The
newly added top-level `invert` checkbox therefore inverts each one of
those individual filters, and properly handle the situation where a
query has multiple filters each with its own optional negation.
The drive-by changes to TextUtils.ts are primarily cosmetic, modernising
the JS slightly to help readability.
Change-Id: I3d429a98074eb3517ec891a848ea75c6c96d1ea5
Signed-off-by: Victor Porof <victorporof@chromium.org>
Bug: 1054464
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3034342
Reviewed-by: Mathias Bynens <mathias@chromium.org>
This patch does a few things to allow network throttling conditions to
persist. 1: It enhances `Setting` with custom serializer support. This
is because 2: All fields on `NetworkManager.Conditions` values are
considered to uniquely identify instances, and one of those fields is
a title, which may or may not be localized. Since localization strings
may change (or users might decide to use different locales between
sessions), when instances are persisted, localized titles should not be
irrecoverably baked. Therefore 3. A custom serializer "massages" the
serialization data to properly persist these titles, using i18n keys
when needed, or the baked title when these values are user-provided and
no localization is used.
In the future, it might be worthwhile to consider avoiding mixing up
presentation state (e.g.: displayed titles) with behavioral
state (e.g.: the throttling amounts). In this particular case, the
title (along with other properties) doubles as both part of group of
fields which (loosely) uniquely identify instances, as well as the
literal string displayed in the UI, which leads to these complications.
Fixing this however does not seem to be in the scope of this bug.
Tracked by bug 1219425.
R=mathias@chromium.org
Bug: 986267
Change-Id: I47d42d454f945412e97b5e747a6253d54f888ee0
Signed-off-by: Victor Porof <victorporof@chromium.com>
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2947255
Commit-Queue: Victor Porof <victorporof@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
This change is to fetch userAgentMetadata and override navigator.userAgentData when user selects a pre-canned user agent from the network conditions tab.
Created 3 test scenarios to cover the userAgentMetadata values:
1) a device with userAgentMetadata and fixed userAgent value;
2) a device with userAgentMetadata and dynamic userAgent value where browser version is filled in dynamically;
3) a device without userAgentMetadata.
Bug: 1174299
Change-Id: If38cbb1f26784af890c86b7140b90899a6aa8504
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2832109
Commit-Queue: Guangyue Xu <guangyue.xu@microsoft.com>
Reviewed-by: Brandon Walderman <brwalder@microsoft.com>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: John Emau <John.Emau@microsoft.com>
If the user prefroms the following steps:
1) Inspect a Network request
2) Select a Tab different from 'Header' (e.g 'Timing')
3) Open Performance (or any other) panel
4) Switch back to Network panel
Currently the Network panel will show the 'Header' tab instead of the
tab selected in 2). This is due to a wrong assumption in the code
that assumes the View is always freshly constructed. This is not
always the case.
This CL fixes this by force-selecting the tab only once, the first
time the view is shown after construction.
R=sigurds@chromium.org
Bug: chromium:1184578
Change-Id: I444ffacf1bd0d2377af3ab6f9f30482514f1e0c7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2732384
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>