Commit Graph
31 Commits
Author SHA1 Message Date
Peter Marshall 1d8da1fddb Don't instantiate a SourceFormatter when modules are imported
This was causing problems when trying to write a unit test that
included a file which transitively included formatter.js, which was
instantiating a SourceFormatter, leading to a chain of unfortunate
events which relied on some other module already being loaded, which
it wasn't.

To avoid the dependency chain between the imports, expose a function
getSourceFormatter which lazily instantiates a shared instance.

Bug: 1136848
Change-Id: I7c255186e53e131127ba00b7f719f2f1b34301c2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2456592
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
2020-10-13 08:36:28 +00:00
Sigurd Schneider 59a84f1857 [ts] Type-check front_end/coverage/CoverageListView.js with TypeScript
Bug: chromium:1011811
Change-Id: I63de10d07ca488f79b75e1769ddef16ff32e47b8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2440501
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-10-05 14:35:43 +00:00
Andres Olivares 03d9c75f88 [ts] Typecheck data-grid/SortableDataGrid.js with TypeScript
Bug: chromium:1011811
Change-Id: I35a0f5694cc8d701ae3f78155ec0647e3d87e9a2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2440272
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Andres Olivares <andoli@chromium.org>
2020-10-01 15:46:41 +00:00
Jan Scheffler 688afaac76 Migrate front_end/coverage to devtools_entrypoint
R=aerotwist@chromium.org, jacktfranklin@chromium.org

Bug: 1101738
Change-Id: I28a7cc3e6f4abeb83fffb0b0110ec6a83e1de04f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2329776
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-07-30 15:04:30 +00:00
Sigurd Schneider 307d82aaac Modernize CoverageView/CoverageListView
This makes improvements towards TypeScriptification, but much more work
is required.

Bug: chromium:1011811
Change-Id: Ic3c00cfc640dce0fdd6f132a19975436ff2a4617
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2277986
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2020-07-03 09:15:35 +00:00
Sigurd Schneider 11657914d7 [cleanup] Make it clear that DataGrid.createCell creates an HTMLElement
Change-Id: I95a8f0f352220dfcc348fa497e9200b2453d3057
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2270542
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-06-30 14:46:08 +00:00
Mathias Bynens 88e8f15748 Enable no-case-declarations lint rule
Lexical declarations in `case` and `default` clauses are a footgun,
since they are visible in the entire switch block, but they only
get initialized upon assignment, which only happens if the relevant
`case` is actually reached.

To ensure that such lexical declarations only apply to the current
`case` (which is usually the intention), `case` clauses containing
them should be wrapped in curly braces to create an explicit block.

More information:
https://eslint.org/docs/rules/no-case-declarations

Change-Id: I63d9341fcd76d4b9ce8281bd0e6573b886577f08
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2119685
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-03-25 15:26:13 +00:00
Paul Lewis 7cbdcaef5c [global] Remaps self.Workspace.workspace
Moves self.Workspace.workspace to an instance() method.

Bug: 1058320
Change-Id: I56f31b8bbba2db09ae25349516dba013ed807642
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2109760
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-03-19 11:12:32 +00:00
Jack Lynch d9a5b6e2c1 Fix disappearing focus in Performance and Coverage
This CL fixes two similar issues where focus disappears or moves to
invisible objects. The first is that Performance panel timeline
currently keeps tabstops while blank, creating the appearance of focus
being lost after tabbing past the "Learn more" link. Hiding the
flamechart widget when it has nothing to show avoids focus moving to it.

In the coverage drawer, focus is lost completely when the user presses
the reload and record button. To avoid this, I've made the coverage
drawer check for focus when a recording begins and focus the datagrid if
the drawer has focus.

Video of performance working properly: https://i.imgur.com/OQKmeh9.mp4

Bug: 1055375
Change-Id: I553d48cad29611ae1828bc423f0d6ba7e7a6383e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2070680
Reviewed-by: Brian Cui <brcui@microsoft.com>
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
Commit-Queue: Jack Lynch <jalyn@microsoft.com>
2020-02-26 20:16:36 +00:00
Tim van der Lippe 5669023210 Migrate coverage/ to import cross-module
Bug: 1006759
Change-Id: If7dc92bd13da08bf0b2b5ac3668cb9ea56eaeb5e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2052170
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-02-12 18:36:03 +00:00
Paul Lewis 10e83a9276 [Global] Update refs to Workspace.workspace
Bug: 1006759
Change-Id: Ic3d797a12e9c00b3b428e68bfd5be4b99a0d606c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2016756
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-01-23 14:33:20 +00:00
Tim van der Lippe 6a3f48ef1e Migrate coverage/ to ESM internally
Bug: 1006759
Change-Id: If91b5c08dc40166640e8e7e2a24364d8b2b51f95
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1991519
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-01-09 14:46:41 +00:00
Brandon Goddard bd51b1d1e9 Coverage: Update URL cell in datagrid screen reader label to full url
This cl updates the URL cell of the datagrid in the coverage tool
to use the full url as the accessible text when using browse mode
to view the cell.

Previously, if a long url was truncated, the screen reader would read out
the individual truncated divs. Now, it reads out the full url when navigating
to the cell.

Before: https://imgur.com/59etRQ8

After: https://imgur.com/UUKLG1b

Bug: 963183
Change-Id: I698cda0596080e62ff68ad54f8215f56ee74dcdb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1973722
Reviewed-by: Lorne Mitchell <lomitch@microsoft.com>
Reviewed-by: Brian Cui <brcui@microsoft.com>
Commit-Queue: Brandon Goddard <brgoddar@microsoft.com>
2019-12-18 19:09:27 +00:00
Brandon Goddard 5bd7d46697 Datagrid: Update Role to Application and Add aria-labels for Nodes
This CL updates the Datagrid so that it has the role of application.
This causes screen readers like NVDA to interact with it in an
application mode, similar to focus mode. It also adds the ability
for each node to specify how it wants its accessible text read, and
updates the accessible text for the datagrid on each selection or
on expanding/collapsing a node.

The goal of this change is that SR users wouldn't have to toggle modes
or get the massive content dump when hitting a datagrid.
Since grid is a div, a div receiving focus is expected by SR's to dump all
text unless role=applicaiton is set, which is not desirable for datagrids.
It is the recommended approach
for custom div sections that require specific user interaction
to mark role="application" and specify through custom labels how SR
users should interact. https://github.com/nvaccess/nvda/issues/7360
This is the same approach used by google sheets and excel online.

Additionally, SRs that support changing modes  can still navigate
the table in browse mode by changing modes after the
datagrid receives focus.

More references:
http://blog.jantrid.net/2015/12/woe-aria-surprisingly-but-ridiculously.html
https://github.com/nvaccess/nvda/issues/7807
https://www.davidmacd.com/blog/does-aria-label-override-static-text.html

Change-Id: I7c563fbdb358e3f68e62bac1c3fefcddb8f65307
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1967346
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Amanda Baker <ambake@microsoft.com>
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
Commit-Queue: Brandon Goddard <brgoddar@microsoft.com>
2019-12-17 23:32:46 +00:00
Sigurd Schneider 810aa6cba2 [coverage] Fix formatting from coverage list view
We won't support cyclic dependencies, so after the introduction of
the CoveragePlugin in source, the SourceFormatter must move to a
package up in the hierarchy to be usable by both Source.* and
Coverage.*.

Bug: chromium:1004203, chromium:1034005
Change-Id: Ia5fcf0e7b2caa6d44620b6e4dc712086df49ef0b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1964332
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2019-12-16 10:13:57 +00:00
Michael Liao 18769f2106 [Common - Data Grids]: bundling data grid parameters + Adding required name field for all data grids
Issue:
- Data grids in DevTools do not have an aria-label
- There are a ton of DataGrid parameters and adding one is messy

Changes:
- Naming all data grids
- Created DataGrid.Datagrid.Parameters type to hold data grid parameters (including a required gridName field)

Bug: 963183
Change-Id: I83b130d468fb80034be264b45b86b799f650e978
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1891652
Commit-Queue: Michael Liao <michael.liao@microsoft.com>
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
2019-12-12 19:12:26 +00:00
Jan Scheffler 0027820ae2 Add coverage information to status bar
This patch adds a new statusbar item to the sources panel
to inform developers about the coverage of the current file
or to open the coverage panel if no coverage has been reported yet.

https://imgur.com/a/axWRJvJ

This cl depends on crrev.com/c/1955587 to disable tests.

Fixed: 1022013
Change-Id: Ibd57bc6fa8a0730574abe8e009f67b245f43d0e3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1905828
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Auto-Submit: Jan Scheffler <janscheffler@chromium.org>
2019-12-09 14:06:22 +00:00
Brandon Goddard c4eacc1612 Coverage: Add title for visualization in coverage tool
This change adds a title to the last column in the
coverage tool datagrid. The title gives context to
screen readers for the usage visualization.

Before: https://imgur.com/7B2lvTA

After: https://imgur.com/PkPmNBN

Bug: 963183
Change-Id: I14834a090b2c53eb412a7d851eb3708872724907
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1913623
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
Commit-Queue: Brandon Goddard <brgoddar@microsoft.com>
2019-12-04 16:00:15 +00:00
Jan Scheffler 626d647409 Add percentage calculation to URLCoverageInfo
Change-Id: Ibebe2e04caf71c7770deefb48c343a605dc01d9b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1917538
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Brandon Goddard <brgoddar@microsoft.com>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
2019-11-25 15:36:44 +00:00
Paul Lewis 595a273cfc Migrates coverage/ to esm
Bug: 1006759
Change-Id: I4bcbfad6d9512331df9394a0a182521cadb8e6dc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1928917
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2019-11-21 11:35:23 +00:00
Jan Scheffler f44777e922 Add CSS files without coverage to Coverage Model
This patch makes sure that all CSS files are registered in
the Coverage Model even when not covered yet.

Fixed: 949045
Change-Id: Iaf2524ec99336c4bdb0f74ead3ceaee819fafa9a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1903471
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
2019-11-08 10:29:16 +00:00
Sigurd Schneider 4679744565 [coverage] Add missing else case
Bug: chromium:1004203
Change-Id: Ic13473966e57889769da92169272e725bcfd5381
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1899522
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2019-11-06 14:00:05 +00:00
Sigurd Schneider ae24399231 [coverage] Fix two bugs in coverage recording
- The value of an <option> is a string, not a number, hence block
   coverage could not be selected.
 - JavaScriptPerBlock is misleading; the value is a flag that indicates
   that JavaScript coverage is present (and presence of
   JavaScriptPerFunction indicates that only per function coverage is
   present).

Bug: chromium:1004203
Change-Id: Ib59fd94c8cace48cafcf62b179fa492531379a7e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1899510
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
2019-11-05 13:04:36 +00:00
Sigurd Schneider 7789823ec9 [coverage] Add block coverage as an option again
Bug: chromium:1004203
Change-Id: I86471de5596ee7c3044ca5ab885e257520f14992
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1891417
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
2019-11-04 13:15:14 +00:00
Sigurd Schneider 7a52be2a83 [coverage] Expose per block coverage for layout tests
This CL allows tests to collect block coverage. This is pre-work for
re-enabling the layout tests that were disabled in
	http://crrev.com/c/1879455

This does not expose per block coverage in the DevTools frontend.

Bug: chromium:1004203
Change-Id: I5852fc5c0b5a5abc07291d4220629faa515c8139
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1881561
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2019-10-30 10:51:04 +00:00
Sigurd Schneider d4f572c25c [coverage] Only support per function coverage
Per block coverage is far more expensive to collect, so we
opt for per function coverage for now. We plan on bringing
back block coverage at some point as an additional choice.

The main draw-back of the more coarse-grained per function
coverage is that inline scripts are now reported as covered
as soon as their first line was executed (because inline
scripts are treated like a function on the V8 side).

Here is a comparison. Note how the inline scripts in the
index file now show higher coverage.

Before/After: https://imgur.com/a/WnEXCWs

Bug: chromium:1009396
Change-Id: I1c0da7b45c099206028f08300d7c3a92b10a4433
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1880038
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
2019-10-28 09:46:29 +00:00
Brandon Goddard 331f9ef258 Devtools: A11y (Screen Reader) improvements for Coverage tool
This change adds accessible text to columns in the coverage tool
that were not previously screen reader accessible. It adds accessible text
for the Total bytes column to prevent the numbers from being read separately
due to the spaces. It adds a label to the Unused Bytes column to prevent
screen readers from interpreting the column as 1 large percentage
instead of separate bytes value and percentage values.
And it  adds accessible text to describe the bars
in the last column. Text reads
"X% of file unused. Y% of file used."

Before: https://imgur.com/qpAwxVF

After: https://imgur.com/GTqrstQ

Bug: 963183
Change-Id: I2b69cc32e935f94d2138f7964f449a4f0472182a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1710753
Reviewed-by: Lorne Mitchell <lomitch@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Brandon Goddard <brgoddar@microsoft.com>
Cr-Original-Commit-Position: refs/heads/master@{#707530}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c7b23afaf3b42c471cd6a30b6f8d40759e617591
2019-10-18 21:05:03 +00:00
Rob Paveza 2eb8c14505 DevTools: Display error when source file can't load
The source editor, when it cannot load a particular file, will simply
display a blank file instead. At the bottom, this is because the APIs
used to load the files do not have a way to propagate an error up to
the call site. Rather, the callback either is never called, or is
called with just an empty string.

This refactor changes the way the project system loads file contents
by replacing the callback model with a Promise-based model. However,
in this version, rather than propagating an error (handled via
catch), the error is exposed as a property on the object passed via
the the load functions. Although it might be preferable to use
async throw/catch, because there are ~4-5 layers of redirection
through the project system, the added complexity seems to not really
justify that work. I'm open to reconsidering this design, though.

Attempting to load a file via file:// which does not exist previously
produced no error because the DevToolsUIBindings handler would just
always resolve with no content and HTTP status 200. I had previously
addressed that bug in this changeset, but I've split it out to
https://chromium-review.googlesource.com/c/chromium/src/+/1847833 .

Sample "after" screenshot: https://imgur.com/a/tlm90sg

Bug: 961940
Bug: 941035

Change-Id: If121611090e9c35eeb1de162b59f8a9f72f696d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817677
Reviewed-by: Lorne Mitchell <lomitch@microsoft.com>
Reviewed-by: Jeff Fisher <jeffish@microsoft.com>
Commit-Queue: Lorne Mitchell <lomitch@microsoft.com>
Cr-Original-Commit-Position: refs/heads/master@{#705438}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 61ec2a233d9a7bf4bb4b3e610de6fc233ae0d46e
2019-10-13 18:02:38 +00:00
Tim van der Lippe 1d6e57a0e3 Always add braces to single-line if-statements
The Chromium/Google style guides does not enforce curly braces for
single-line if-statements, but does strongly recommend doing so. Adding
braces will improve code readability, by visually separating code
blocks. This will also prevent issues where accidental additions are
pushed to the "else"-clause instead of in the if-block.

This CL also updates the presubmit `eslint` to run the fix with the
correct configuration. It will now fix all issues it can fix.

Change-Id: I4b616f21a99393f168dec743c0bcbdc7f5db04a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1821526
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Jeff Fisher <jeffish@microsoft.com>
Cr-Original-Commit-Position: refs/heads/master@{#701070}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7e0bdbe2d7f9fc2386bfaefda3cc29c66ccc18f9
2019-09-30 11:55:34 +00:00
Sigurd Schneider a33a39bac9 [devtools] Open coverage drawer when coverage gutter is clicked
Bug: chromium:1004203
Change-Id: I5079a1b7096fc03ed51aa23014c403f9931dbf29
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1803295
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Michael Hablich <hablich@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#699329}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0d3d363817e8926ab31917152b5175632a9709a0
2019-09-24 14:09:12 +00:00
Blink Reformat 4c46d0969f The Great Blink mv for source files, part 2.
Move and rename files.

NOAUTOREVERT=true
NOPRESUBMIT=true
NOTREECHECKS=true
Bug: 768828
TBR=darin@chromium.org
NOTRY=true

Change-Id: I66d3b155808bc5bdbf237b80208e1e552bcf7f28
Reviewed-on: https://chromium-review.googlesource.com/1001153
Reviewed-by: Blink Reformat <blink-reformat@chromium.org>
Commit-Queue: Blink Reformat <blink-reformat@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#549061}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0aee4434a4dba42a42abaea9bfbc0cd196a63bc1
2018-04-07 15:32:37 +00:00