Commit Graph
1772 Commits
Author SHA1 Message Date
Sigurd Schneider 20ec8a5f2d Use await pattern in sab issue e2etest
Bug: chromium:1223300
Change-Id: I6c7793aa3d9891e5dc1dcb08010cc1b78ca7006f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2987966
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2021-06-28 07:45:50 +00:00
Sigurd Schneider 6e7618301a Use await pattern in quirks mode e2etests
Bug: chromium:1223300
Change-Id: I08e7bae7250c0d9d6bea4babd00c7167a8997cc0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2987965
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2021-06-28 07:10:30 +00:00
Sigurd Schneider 77d9eb1c72 Await resouce section in navigator-user-agent-issues e2etest
Bug: chromium:1223300
Change-Id: Ia6c738d0fa318b36aeeaed5302f7fca825de5746
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2987964
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2021-06-28 06:41:30 +00:00
Jan Scheffler 1270e76c13 [Underscore Migration] Migrate common/Progress
This patch is part of the underscore migration that adds the private
keyword to all properties that start with an underscore and removes the
underscore.

Bug:chromium:1207342
Change-Id: I64fdc84cbd85017b8379576a5e87df2f1cdcf80a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2969428
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-25 20:36:08 +00:00
Sigurd Schneider 9028e9a9ca Await resource section in low text contrast tests
Bug: chromium:1223300
Change-Id: Ia12aa07e859f91ac5d73ef99ca185de1a31f6b91
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2983023
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2021-06-25 11:58:16 +00:00
Sigurd Schneider 6cf1fdb535 Use options bag for ConsoleMessage constructor
Depends on test update CLs:
Disable tests in https://crrev.com/c/2988019
Update and reenable tests: https://crrev.com/c/2988020

Bug: chromium:1213393
Change-Id: I12478e4906e31226e2fc31696f8f03c01dd02a9b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2987959
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2021-06-25 10:11:17 +00:00
Sigurd Schneider c6edb07a29 Fix waiting logic in e2e test
The test application/frame-tree_test.ts:
  The Application Tab shows stack traces for OOPIF
did not properly wait for the stacktrace to get populated.

Bug: chromium:1202024
Change-Id: I6b38c0de3616e082269f2858a78b72d1d3d1210b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2987960
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Wolfgang Beyer <wolfi@chromium.org>
Auto-Submit: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
2021-06-25 08:05:16 +00:00
Sigurd Schneider 423b2bec97 Reland: Add component for linking to network requests
This CL adds a component that can be used to link to a network request.
The component optionally uses a RequestResolver to resolve the request
if only a requestId (in the form of an affected request) is provided.
The component updates its state once the request becomes available,
thereby supporting plasticity of the UI.

This is a plain reland of https://crrev.com/c/2960617. Landing
the CL originally uncovered a deficiency in the way our tests
were written, see crbug.com/1223300.

Bug: chromium:1217975
Change-Id: Ideccf4f9e64cf451a8c28583a9d72e717ff6706f
Cq-Include-Trybots: luci.devtools-frontend.try:devtools_frontend_mac_rel
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2983021
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
2021-06-25 07:11:56 +00:00
Dan Clark 905f814dba Show source for constructed stylesheets with sourceUrl.length > 0
A CSSStyleSheet imported as a CSS module script has the constructed
flag set
(https://wicg.github.io/construct-stylesheets/#cssstylesheet-constructed-flag).
This is because it is useful to treat imported CSSStyleSheets the same
way as stylesheets created via `new`. For example we want to be able
to add both to document.adoptedStyleSheets, and we want both to treat
@import rules the same way.

Up to this point DevTools didn't show sources for constructed
stylesheets because they were all assumed to be sheets created
with `new`. But, we do want to show sources for constructed sheets
created for CSS module script imports.

So, this change checks for an empty sourceURL when deciding whether
or not to show source for a constructed stylesheet.

This requires the Blink change [1], which starts passing an empty
sourceURL for `new`ed stylesheets.

[1] Blink change: https://chromium-review.googlesource.com/c/chromium/src/+/2964539

Bug: 1125357
Change-Id: I7163966c66c990647e40a72d0ef9d6ba30f41cfb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2964580
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Dan Clark <daniec@microsoft.com>
2021-06-24 15:18:37 +00:00
Alex Rudenko 9518059da6 [Recorder] Filter out keyboard generated click events
Fixed: chromium:1222579
Change-Id: I592004a03e0e4960458c9dd512a0c9b8ec630502
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2982140
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2021-06-24 13:12:27 +00:00
Alex Rudenko 8789801451 [Recorder] Use bounding client rect to compute the click point
Bug: chromium:1221043
Change-Id: I28b72b2b8d60b5e8ab1fd7c2ebedb635b3b8de86
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2982141
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2021-06-24 10:23:06 +00:00
Sigurd Schneider 375ca3a602 Await resource section in heavy ads issue test
Bug: chromium:1223300
Change-Id: Ia762f2073e986f5e5f3cf4fddf98a1f6aa2bb597
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2983022
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2021-06-24 09:02:47 +00:00
Sigurd Schneider 72dd75dc6c Await resource table in issue tests
This refactors some of the issue tests to await the table contents
instead of just checking it. This refactoring allows to test content
that may change dynamically, e.g. when new information becomes available
such as a network request.

Bug: chromium:1223300
Change-Id: Iadced03ffbec6c23f521093168c7dcab82edc424
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2983020
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2021-06-24 08:41:47 +00:00
Sigurd Schneider 76cb0e9d20 Refactor matching helpers to support tables
Bug: chromium:1223300
Change-Id: Ifb464b5c7bc3c068e71ccc0f71cf995b3103bfb2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2983019
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2021-06-24 08:07:48 +00:00
Johan Bay 29236e333a Add "Copy string as {JavaScript, JSON} literal" context menu items
This change also fixes issues when copying other primitive values such
as -0, NaN, and bigints.

Bug: 1208389
Change-Id: I4dfb36679b87376b0e94bbc7b36fe7ecb513cac5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2982132
Commit-Queue: Johan Bay <jobay@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2021-06-23 13:42:47 +00:00
Alex Rudenko eac2c02d48 [Recorder] Record and replay input on non-text input fields
This is done by interpreting the type of the input element at runtime
and generating the appropriate sequence of actions. In the future,
the currently pretty long script could be replaced by a new
Puppeteer API.

Fixed: chromium:1221504
Change-Id: Ic14ff54dc1fa1ba04725a18c033dd9fe4ea141ce
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2978354
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
2021-06-23 11:16:39 +00:00
Tim van der Lippe 2f0dcbabb5 Fix formatting of SCSS files
While we had infrastructure to correctly format SCSS files, formatting
a `.scss` file never worked, as the formatter worker missed the
case to do so.

Therefore, add the case and while we are at it, add corresponding
unit tests. These unit tests were taken from
third_party/blink/web_tests/http/tests/devtools/syntax-highlight-css.js
which was only asserting on AST structure, rather than formatted
output.

R=jacktfranklin@chromium.org

Bug: 1203169
Change-Id: I5453858c3493168db9b1403f9ddab205488ad8d1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2978355
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-06-22 14:44:08 +00:00
Tim van der Lippe 591e00454b Revert "Add component for linking to network requests"
This reverts commit 5be8e37c41.

Reason for revert: https://logs.chromium.org/logs/devtools-frontend/buildbucket/cr-buildbucket/8843807658951242785/+/u/E2E_tests/stdout makes CORS test flake on Mac

Original change's description:
> Add component for linking to network requests
>
> This CL adds a component that can be used to link to a network request.
> The component optionally uses a RequestResolver to resolve the request
> if only a requestId (in the form of an affected request) is provided.
> The component updates its state once the request becomes available,
> thereby supporting plasticity of the UI.
>
> Bug: chromium:1217975
> Change-Id: I94faa598bb520d4cbdf003ca7858ec759fcc8a6c
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2960617
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
> Commit-Queue: Sigurd Schneider <sigurds@chromium.org>

Bug: chromium:1217975
Change-Id: I2d0a9b08a913a179dba913878c8789c55308ed66
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2978380
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Wolfgang Beyer <wolfi@chromium.org>
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
2021-06-22 13:35:49 +00:00
Johan Bay 5715a7b980 Enable "copy" context menu for primitive values
This change adds the "copy" context menu and "store as global variable"
menu item for console evaluations that return primitive values.
These features was previously only enabled for objects and primitive
values inside objects.
We also fix a bug where we would send an invalid CDP command when users
copied primivites inside objects.

Bug: 1208389
Change-Id: I28a85d1bcfb8325098d4d35cee7f3e83e919185c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2978352
Commit-Queue: Johan Bay <jobay@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2021-06-22 13:08:48 +00:00
Jack Franklin 5b1ab68316 [DataGrid] focusable cell logic improvements
This CL is a mix of changes within the DataGrid that improve the logic
around focusable cells. Prior to this CL the DataGrid stored one
value, which was the cell that the user would select if they tabbed
into the DataGrid. That got confusing as we used that value to also
represent the currently active cell that the user has clicked on.

This CL splits those concerns up into two properties, and improves how
we track when the user is or isn't focusing within the data-grid. It
also moves some event handlers from `click` to `focus` for the table
cells which is just a nice tidy up.

Bug: 1211346
Change-Id: If6449f5381134892705f7f42f24b226f8dbf170a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2935284
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-06-22 12:10:10 +00:00
Johan Bay 9ea04a81e0 Reland "Improve Console display of strings"
This is a reland of crrev.com/c/2959898 which caused the roll to fail.
This has been fixed by updating expectations in `front_end/Tests.js`

Original change's description:
> Improve Console display of strings
>
> We recently changed how we display the output to ensure that we always
> display valid JavaScript literals. Unfortunately, the current solution
> can be confusing to users, who might feel that the amount of escaping is
> excessive and makes the output unreadable.
>
> This change introduces `formatAsJSLiteral` that given a string escapes
> appropriate special characters and wraps the string in either single
> quotes, double quotes, or back ticks depending on the string content.
> The function furthermore escapes script tags to ensure that the result
> can be safely copied to HTML.
>
> Both regular Console output and preview have been updated to use this
> formatter instead of JSON.stringify for displaying strings.
>
> This change adds unit tests for the new formatter and rebaselines all
> e2e tests that depend on Console outputs.
>
> Doc: https://goo.gle/devtools-strings
> Bug: 1208389
> Change-Id: Iebfe39c2e40c21aa5a813a1ebd26a5109fa59ab6
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2959898
> Commit-Queue: Johan Bay <jobay@chromium.org>
> Reviewed-by: Mathias Bynens <mathias@chromium.org>
> Reviewed-by: Changhao Han <changhaohan@chromium.org>

Bug: 1208389
Change-Id: I6f443e65364d9707d02aeaab0227bd691300b417
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2978351
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Johan Bay <jobay@chromium.org>
2021-06-22 11:19:09 +00:00
Tim van der Lippe 46244285d4 Cleanup TypeScript configuration files and root OWNERS
This moves the required TypeScript configuration files into
/config/typescript/, which allows us to cleanup the root OWNERS.
Doing so will make it easier to make infrastructure refactorings
in our TypeScript configuration (if we for example need to add
a new file), while not requiring ENG_REVIEW_OWNERS.

DISABLE_THIRD_PARTY_CHECK=Configuration changes
R=yangguo@chromium.org,szuend@chromium.org

Bug: none
Change-Id: Icffd52d37c37b52651dc8125948dc90b2b79cdf5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2975287
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-22 10:45:59 +00:00
Philip Pfaffe d097e515dc Mark asyncScopes as canceled on timeout
When an e2e test times out, running promises aren't aborted. Instead,
any errors that are thrown are silently swallowed. When not being
careful, in-flight promises can still mess up state, or even never
detect timeouts. waitForFunction is especially vulnerable to this,
because it's running an infinite loop inside the test process. This CL
extends AsyncScopes to carry a flag when a timeout was triggered, which
allows waitForFunction to bail.

Bug: none
Change-Id: I30ebcc45419c4000a1b2a25096ca1211bf2400a0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2978374
Auto-Submit: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
2021-06-22 10:40:48 +00:00
Alex Rudenko 2ea873dac5 [Recorder] Recorder and replay click event offsets
This CL adds offsetX/offsetY to click events allowing to be more
precise when clicking an element. This solves a problem
of clicking on complex inputs such as date inputs where it matters
where exactly the click happened.

As a drive-by I fixed the wrong viewport measurements being captured.
Happy to extract to a separate CL if the clicking part will be
controversial.

Bug: chromium:1221043
Change-Id: I9e18a3e77ddb99f93712f1065da1a0fe3a1cbfa7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2975282
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
2021-06-22 08:36:58 +00:00
Jan Scheffler 03323f8a26 [Underscore Migration] Prework
This patch renames non trivial getters or setters to better convey
what they do.

Bug:chromium:1207342
Change-Id: I244c20976a6546f887d7d31343ee234019182c32
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2969426
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2021-06-22 07:54:57 +00:00
Tim van der Lippe ccad35eaf4 Add test/unittests/README.md
For those new to the repository and unit testing, we add a README
that describes the most common tasks for unit testing.

R=dsv@chromium.org

Fixed: 1221492
Change-Id: Iae43609c7a02b09a8d5056fe280176a74bce904c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2975284
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Danil Somsikov <dsv@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Danil Somsikov <dsv@chromium.org>
2021-06-21 15:04:42 +00:00
Tim van der Lippe 8b2737f432 Revert "Reland "Improve Console display of strings""
This reverts commit daf25bd29c.

Reason for revert: Test expectation failures in some browser tests https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8843811406261131888/+/steps/browser_tests__retry_shards_with_patch__on_Windows-10-18363/0/logs/Deterministic_failure:_DevToolsTest.TestDeviceEmulation__status_FAILURE_/0

Original change's description:
> Reland "Improve Console display of strings"
>
> This is a reland of 9242d13569
> which caused a failure on the chromeos bot. This has been fixed
> in this CL by updating a test expectation in `front_end/Tests.js`
>
> Original change's description:
> > Improve Console display of strings
> >
> > We recently changed how we display the output to ensure that we always
> > display valid JavaScript literals. Unfortunately, the current solution
> > can be confusing to users, who might feel that the amount of escaping is
> > excessive and makes the output unreadable.
> >
> > This change introduces `formatAsJSLiteral` that given a string escapes
> > appropriate special characters and wraps the string in either single
> > quotes, double quotes, or back ticks depending on the string content.
> > The function furthermore escapes script tags to ensure that the result
> > can be safely copied to HTML.
> >
> > Both regular Console output and preview have been updated to use this
> > formatter instead of JSON.stringify for displaying strings.
> >
> > This change adds unit tests for the new formatter and rebaselines all
> > e2e tests that depend on Console outputs.
> >
> > Doc: https://goo.gle/devtools-strings
> > Bug: 1208389
> > Change-Id: Iebfe39c2e40c21aa5a813a1ebd26a5109fa59ab6
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2959898
> > Commit-Queue: Johan Bay <jobay@chromium.org>
> > Reviewed-by: Mathias Bynens <mathias@chromium.org>
> > Reviewed-by: Changhao Han <changhaohan@chromium.org>
>
> Bug: 1208389
> Change-Id: I63b343c5251611f688029c5b833fb7e1f777c6cc
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2974927
> Commit-Queue: Johan Bay <jobay@chromium.org>
> Reviewed-by: Mathias Bynens <mathias@chromium.org>
> Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>

Bug: 1208389
Change-Id: I446ad5502d946a22feddaa342be5a86c1854f1c3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2974932
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-06-21 14:51:13 +00:00
Sigurd Schneider 5be8e37c41 Add component for linking to network requests
This CL adds a component that can be used to link to a network request.
The component optionally uses a RequestResolver to resolve the request
if only a requestId (in the form of an affected request) is provided.
The component updates its state once the request becomes available,
thereby supporting plasticity of the UI.

Bug: chromium:1217975
Change-Id: I94faa598bb520d4cbdf003ca7858ec759fcc8a6c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2960617
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2021-06-21 13:52:52 +00:00
Tim van der Lippe 2de57703f4 Add support for specifying custom coverage folders
With this patch, when running the unit tests with coverage enabled,
you can now specify the subset of folders you want. This allows us
engineers to run coverage reporting for the folders that they are
interested in, while ignoring all the other folders. Doing so
significantly speeds up coverage collection and therefore the
developer cycle on working on unit tests + coverage.

An example invocations of the unit tests with specific folders:
COVERAGE_FOLDERS='front_end/{ui/components,core/common}' npm run auto-unittest
COVERAGE_FOLDERS='front_end/ui/components' npm run auto-unittest

R=aerotwist@chromium.org

Bug: none
Change-Id: Ia29657bcf9848364e83ea99873c5a7e0d61f54be
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2969245
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-21 11:30:58 +00:00
Alex Rudenko 6cf7613575 [Recorder] Query shadow root in waitForSelector
Bug: chromium:1215440
Change-Id: Ie3e74153445567e5e4c18cccdc83ba55db98f179
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2975280
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2021-06-21 10:45:08 +00:00
Johan Bay daf25bd29c Reland "Improve Console display of strings"
This is a reland of 9242d13569
which caused a failure on the chromeos bot. This has been fixed
in this CL by updating a test expectation in `front_end/Tests.js`

Original change's description:
> Improve Console display of strings
>
> We recently changed how we display the output to ensure that we always
> display valid JavaScript literals. Unfortunately, the current solution
> can be confusing to users, who might feel that the amount of escaping is
> excessive and makes the output unreadable.
>
> This change introduces `formatAsJSLiteral` that given a string escapes
> appropriate special characters and wraps the string in either single
> quotes, double quotes, or back ticks depending on the string content.
> The function furthermore escapes script tags to ensure that the result
> can be safely copied to HTML.
>
> Both regular Console output and preview have been updated to use this
> formatter instead of JSON.stringify for displaying strings.
>
> This change adds unit tests for the new formatter and rebaselines all
> e2e tests that depend on Console outputs.
>
> Doc: https://goo.gle/devtools-strings
> Bug: 1208389
> Change-Id: Iebfe39c2e40c21aa5a813a1ebd26a5109fa59ab6
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2959898
> Commit-Queue: Johan Bay <jobay@chromium.org>
> Reviewed-by: Mathias Bynens <mathias@chromium.org>
> Reviewed-by: Changhao Han <changhaohan@chromium.org>

Bug: 1208389
Change-Id: I63b343c5251611f688029c5b833fb7e1f777c6cc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2974927
Commit-Queue: Johan Bay <jobay@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2021-06-21 10:43:58 +00:00
Danil Somsikov 2a6024123d Also show time as unknown and omit "not yet finsihed" warning for
requests for preserved requests.

Bug: 1072006
Change-Id: Ie81db9ef920c44b4d2d2a8d2000d77250dd45572
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2972693
Commit-Queue: Danil Somsikov <dsv@chromium.org>
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
2021-06-21 08:28:08 +00:00
Johan Bay 10dcd44ac4 Revert "Improve Console display of strings"
This reverts commit 9242d13569.

Reason for revert: causes a failure on the chromeos bots which can be
fixed by updating an expectation file on the devtools side.
We therefore revert this CL and re-land with the expectation patched.

Original change's description:
> Improve Console display of strings
>
> We recently changed how we display the output to ensure that we always
> display valid JavaScript literals. Unfortunately, the current solution
> can be confusing to users, who might feel that the amount of escaping is
> excessive and makes the output unreadable.
>
> This change introduces `formatAsJSLiteral` that given a string escapes
> appropriate special characters and wraps the string in either single
> quotes, double quotes, or back ticks depending on the string content.
> The function furthermore escapes script tags to ensure that the result
> can be safely copied to HTML.
>
> Both regular Console output and preview have been updated to use this
> formatter instead of JSON.stringify for displaying strings.
>
> This change adds unit tests for the new formatter and rebaselines all
> e2e tests that depend on Console outputs.
>
> Doc: https://goo.gle/devtools-strings
> Bug: 1208389
> Change-Id: Iebfe39c2e40c21aa5a813a1ebd26a5109fa59ab6
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2959898
> Commit-Queue: Johan Bay <jobay@chromium.org>
> Reviewed-by: Mathias Bynens <mathias@chromium.org>
> Reviewed-by: Changhao Han <changhaohan@chromium.org>

Bug: 1208389
Change-Id: I4ab58ab724ffe8833d4a44c91da05e191d3a41bc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2974923
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2021-06-21 07:58:38 +00:00
Danil Somsikov 09d734dcc2 Make UI string a sentence to avoid confusion.
Bug: 1182537
Change-Id: I5e14ea626dbd5ff477465a85d31b4b596e209b70
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2960456
Commit-Queue: Danil Somsikov <dsv@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2021-06-21 07:15:38 +00:00
Alex Rudenko 2ed3ca4778 [Recorder] implement buffering for keyboard interactions with input
elements

With this CL, when the user focuses on an input element, the client
enters a special mode that handles event slightly differently:

- it publishes keyup events from the previous keyboard navigation
immediately.
- it captures the rest of keyboard events into a buffer.
- when a change or blur event is sent to the element, it interprets
the buffer and correctly publishes keyboard events that lead
to the navigation.

This way we lose some precise events that happen during interaction
with an input as we capture only the final result but we are also
able to maintain keyboard navigation events and handle complex
inputs like input[type=color|slider] where keyboard or mouse events
are not enough to capture the input. Additionally, we achieve shorter
scripts because keyboard events are grouped into a change event again.

Fixed: chromium:1221037, chromium:1221046
Change-Id: Id2949c1ec88c5becbffd262e5b95628d6e6300f4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2972784
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2021-06-18 13:24:04 +00:00
Johan Bay 9242d13569 Improve Console display of strings
We recently changed how we display the output to ensure that we always
display valid JavaScript literals. Unfortunately, the current solution
can be confusing to users, who might feel that the amount of escaping is
excessive and makes the output unreadable.

This change introduces `formatAsJSLiteral` that given a string escapes
appropriate special characters and wraps the string in either single
quotes, double quotes, or back ticks depending on the string content.
The function furthermore escapes script tags to ensure that the result
can be safely copied to HTML.

Both regular Console output and preview have been updated to use this
formatter instead of JSON.stringify for displaying strings.

This change adds unit tests for the new formatter and rebaselines all
e2e tests that depend on Console outputs.

Doc: https://goo.gle/devtools-strings
Bug: 1208389
Change-Id: Iebfe39c2e40c21aa5a813a1ebd26a5109fa59ab6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2959898
Commit-Queue: Johan Bay <jobay@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2021-06-18 12:13:54 +00:00
Danil Somsikov b5e2b3b8e4 Address web bundle e2e test flakiness.
To do that, wait for (the effect of) web bundle events, i.e. expect test
before doing any checks. The network log view might not show web bundle
specific data until web bundle events are received.

Bug: 1182537
Change-Id: I0e8eefb7bb6c9664da3d70a34f18306090bc84e3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2963820
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Commit-Queue: Wolfgang Beyer <wolfi@chromium.org>
Auto-Submit: Danil Somsikov <dsv@chromium.org>
2021-06-18 12:01:34 +00:00
Alex Rudenko 4be7a18629 Enable flaky recorder test
There seems to be some inherent flakiness related to the sources UI.
This CL fixes the flakiness by retrying to stop the recording multiple
times. It's acceptable for now to keep the coverage because soon
recorder will have a dedicated UI.

Bug: 1219505
Change-Id: Ib4a5a8f1329d466b78859bd7052dfb15b9d188bb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2959899
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
2021-06-18 11:20:14 +00:00
Jan Scheffler 3d889a2069 [Underscore Migration] Prework on Progress.ts
This patch renames Progress.worked to Progress.incrementWork
to better convey what it does.

Bug:chromium:1207342
Change-Id: I48088bf7cce017ba4899729ea8fa7a9a8f51c0e2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2969424
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
2021-06-17 15:52:58 +00:00
Danil Somsikov cd1691bc4f Show pending requests from the previous page as unknown.
Only keep alive requests can survive page unload and there's no more
connection to devtools to report the request status.

Bug: 1072006
Change-Id: Ibd30bbd5ea240f2acf56258c2e67eed52d4d12ce
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2963192
Commit-Queue: Danil Somsikov <dsv@chromium.org>
Auto-Submit: Danil Somsikov <dsv@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2021-06-17 13:11:17 +00:00
chait pinnamaneni 750a2d1627 Adds fields for client hints form in Device settings and added the same form in network conditions panel
Improves UX for adding client hints in device settings screen. Instead of adding semi-colon separated value for brands, users will be able to input in different fields. Also added the same form to network conditions panel, so users can easily change client hints from network conditions. In network conditions, user agent client hints gets automatically updated when user changes device from dropdown.

Device settings:
Before: https://i.imgur.com/sn3E1dV.png
After: https://i.imgur.com/rBMNjQt.png

Network conditions panel:
https://i.imgur.com/Sk9k3Bb.png

Bug:1215598
Change-Id: Ie9f75456c67e30bb133675bef756a828fa117719
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2933920
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Brandon Walderman <brwalder@microsoft.com>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Maksim Orlovich <morlovich@chromium.org>
Commit-Queue: Chait Pinnamaneni <cpinnamaneni@microsoft.com>
2021-06-16 18:26:58 +00:00
Alex Rudenko fd136e001e Rename DEBUG env var to DEBUG_TEST
Currently, you cannot run tests in non-debug mode
and turn on debug logging from Puppeteer that relies
on https://www.npmjs.com/package/debug.

Running `DEBUG=puppeteer.* ...` would also start the
test runner in a debug and non headless mode. This
CL renames the DEBUG variable that DevTools test runner
relies on so that debug logging is independent from the
debug mode we have for tests.

Bug: none
Change-Id: I8b8476f7c26c07eea1db29bfae74d4fb61afd42c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2963755
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2021-06-16 12:47:15 +00:00
Kim-Anh Tran cd2521669d [settings] Add setting to disable auto-focus on the sources panel
This adds a setting to DevTools to disable auto-focusing on the
sources panel if a Debugger.paused event is received.
The context here is that extensions may be attached that do not
want that behavior (e.g. if source debugging is happening in
another panel that is provided by the extension).

Bug: b/182581017
Change-Id: I7a50c0c6eb7d5eb7abe45bcfafc40e394a4b8e17
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2960171
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Mraz Marian <mraz@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2021-06-16 12:39:35 +00:00
Jan Scheffler 2c906fa4f4 [Recorder] Replay in UI
Bug: chromium:1199787
Change-Id: I48367c44bb0ce6db6839e28621d66dd8725f153f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2953265
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2021-06-16 11:26:35 +00:00
Victor Porof f5df24165c Persist network throttling preset choice between DevTools sessions
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>
2021-06-15 09:15:04 +00:00
Simon Zünd 1f6b19ae8d [e2e] Disable recorder test on Mac
R=alexrudenko@chromium.org

Bug: chromium:1219505
Change-Id: I3a6d91a70ce91bc82347f47477e366fd508ca956
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2960455
Commit-Queue: Simon Zünd <szuend@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Simon Zünd <szuend@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2021-06-14 15:05:34 +00:00
Philip Pfaffe 47c97317c0 [language plugins] Support descriptions on formatted values
Sometimes variables have values that have a special semantic name, such
as nullptr or enumerator labels. With this change, formatters can return
a description along with a formatted value that will be used as the
description of the remote object presenting the value.

Bug: 1217613
Change-Id: I52558b5e82c62bbf9216f200f6463bf24645d76e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2951134
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2021-06-14 14:35:04 +00:00
Tim van der Lippe 465ceddbdb Update assertNotNull to also check for undefined
The `NonNullable` type in TypeScript already excludes `undefined`
from the possible types, but we weren't properly checking for
it in the if-statement.

R=szuend@chromium.org
CC=pfaffe@chromium.org

Bug: none
Change-Id: I9320f0c7662d46d562d6544f35d45380043d4409
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2960173
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-14 13:56:44 +00:00
Michael Lippautz ea3882b497 e2e/memory tests: Change pending activities test
Change test that ensures that "Pending activities" are present.

Before this CL, we would test that a root group "Pending activities"
exists which contains the actual pending activities, e.g. MediaQueryList
in the test.

After the CL, we ensure a different graph where a that a regular object
named "Pending activities" retains the pending activities. In addition,
we test the the object retains the activities via some intermediate
backing store represented as InternalNode.

Blink dependency: https://crrev.com/c/2954763
Follow up removing old behavior: https://crrev.com/c/2960454

Bug: chromium:1056170
Change-Id: I1cfd3c13c55ca2d4c29056fdb2ac9fabbcbbc0bb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2956328
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
2021-06-14 13:51:05 +00:00
Simon Zünd db7686deb5 [issues] Fix AttributionReportingIssue.fromInspectorIssue
The intial AR CL got the interface wrong. This CL fixes the
corresponding `fromInspectorIssue` so it takes a complete protocol
issue object instead of just the details.

Drive-by: Issues without "Learn more" links currently have a somewhat
large empty bottom margin. This CL skips adding the link container div
when there are no links specified.

R=sigurds@chromium.org

Bug: chromium:1190735
Change-Id: Ia6c251020a0061d9b9b08fa12a9f80a1b07a3e90
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2960616
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2021-06-14 13:11:34 +00:00