Commit Graph
992 Commits
Author SHA1 Message Date
Tim van der Lippe 652ccb7ac2 Add rollup-plugin-minify-html-template-literals to node_modules
R=jacktfranklin@chromium.org

Bug: 1213034
Change-Id: I5da8225f60b53870a1c67d6b5d02a464c08f4eb2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2917088
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-06-02 11:00:34 +00:00
Tim van der Lippe 69775386db Update TypeScript to 4.3.2
Also fix the presubmit bug that prevents us from uploading
any new updates to the node_modules from Mac, as that installs
`fsevents`, which has a binary file that can't be checked.
For more information on that, see
https://bugs.chromium.org/p/chromium/issues/detail?id=1210746#c32

DISABLE_THIRD_PARTY_CHECK=PRESUBMIT fix
R=szuend@chromium.org

Bug: 1210746
Change-Id: Ie1a62698456384be2298adfd8deaa6735bf76337
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2922502
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2021-05-27 18:52:33 +00:00
Tim van der Lippe 8b929548c0 Also add license headers for .gni files
R=jacktfranklin@chromium.org

Bug: 1213449
Change-Id: I3228629bbaa1c3824a721a93782356ec71855513
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2919951
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-26 16:19:23 +00:00
Tim van der Lippe 81752507db Integrate license header check in PRESUBMIT
Also fix the script to only allow absolute paths, since the presubmit
script handles absolute paths only.

R=jacktfranklin@chromium.org

Bug: 1213449
Change-Id: Id1c0c55ec1c039eadd343445645655910b06da8c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2919950
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-26 15:06:53 +00:00
Tim van der Lippe 1dc9ecb63c Add script to check license headers for BUILD.gn files
The script currently processes all BUILD.gn files in the
top level directories and automatically adds the required
license header if missing.

In a follow-up CL the script will be integrated in the
PRESUBMIT.py.

R=jacktfranklin@chromium.org

Bug: 1213449
Change-Id: Ifea17b0fd3301158c098513d0cc9d7d7c50e3fe3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2919948
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-05-26 14:38:55 +00:00
Jack Franklin 8425afc1eb [DarkMode] filter.css
Also discovered that the stylelint rule needs to allow
`rgb(var(...))`, so fixed that as a drive-by. This will change in time
but was the easiest path to getting the first migration stage done.

Bug: chromium:1152736
Change-Id: I70816edee5217dc3f52804877b04dd479a6edb15
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2909588
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-25 14:28:17 +00:00
Alex Rudenko 7c94b5f29e Compress md files
This CL adds compression for md files resulting in ~16KB reduction
in binary size of chromium resources.

Bug: chromium:1211337
Change-Id: I5f5482ae0bc297adea4c4bea0c911b4303877484
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2916384
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2021-05-25 13:37:47 +00:00
Jan Scheffler 0f14e2b82c [Unit tests] Show html coverage results location
This cl informs developers where they can find the result when running
unittests with the html coverage report enabled.

Bug: None
Change-Id: Id6784d9070fc2ad1f1be2a1da58b0d5baf174f8a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2912102
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-25 08:58:53 +00:00
Jan Scheffler ef7787df1a [Unit tests] Improve output for unit tests
This change replaces the 'spec' report with a 'mocha' report in karma
when the '--expanded-reporting' flag is set. If it is not set and the
tests fail, a hint is added to the console to enable the flag to get a
more verbose output of why the tests are failing.

Bug:None
Change-Id: Ia41615362332459a4d89aef0440cea0ec266157b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2912098
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
2021-05-25 08:26:23 +00:00
Alex Rudenko 8505e32b7b Implement caching for file compression during builds
This CL adds a new script to compress files using brotli. The new script
maintains a cache of compressed files so if the file was previously
compressed and has not been changed, it is not compressed again.
The compression happens only in release builds. Also, this CL
includes JSON into the compression list saving ~0.7MB in binary size.

Bug: chromium:1211337
Change-Id: I8ed8189d762f5532a261d748cbc2eb8a4be9a25e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2905507
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-25 06:45:43 +00:00
Tim van der Lippe 4fb02b1c0b Add support for depending on non-TS targets
Currently, we have the dependencies on the generated locales
scattered into `front_end/` and the `test/unittests/`. However,
i18n should typically be the only folder that should know about
the locales. The reason we split these off, is that we don't want
to rebuild all of DevTools whenever somebody changes a localization
string.

That said, with the recent updates to the build system, it is
now possible to add them to `public_deps`, to ensure we don't
need to rebuild all of DevTools.

R=szuend@chromium.org

Bug: none
Change-Id: I9892362032c80862cc224682fe5dc73fde91af21
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2912720
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-25 04:43:53 +00:00
Tim van der Lippe e902a9ea64 Type check Rollup configuration with TypeScript
By moving the configuration file to `scripts/build`, we are correctly
using the `moduleResolution = 'node'`. Then, we enable TypeScript with
`// @ts-check`, we get warnings in VS Code. There were some small fixes.
Mostly that it removed an unnnecessary closure and `buildStart` hook,
which we no longer require. Additionally, the `output` format now
conforms to what Rollup expects.

R=jacktfranklin@chromium.org

Bug: none
Change-Id: I55daf8e6f3e32f81afd9e0b13ffc7b49bddfedfc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2910110
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-24 11:57:57 +00:00
Takuto Ikuta 0e87680f36 Reland "Reland "use python3 in devtools-frontend by default""
This reverts commit 7c57958680.

Reason for revert:
This uses dict instead of set in modular_build.py for deterministic
output.
ref: https://softwaremaniacs.org/blog/2020/02/05/dicts-ordered/en/

I confirmed that devtools_app.js is the same in repeated builds.

Original change's description:
> Revert "Reland "use python3 in devtools-frontend by default""
>
> This reverts commit 0d4947c37e.
>
> Reason for revert: https://crbug.com/1211770
>
> Original change's description:
> > Reland "use python3 in devtools-frontend by default"
> >
> > This reverts commit a8336c1e58.
> >
> > Reason for revert:
> > use universal_newlines instead of text for
> > https://docs.python.org/3/library/subprocess.html#subprocess.Popen
> >
> > I tried to divide this CL in to make py2/3 compatible and switch in
> > another CL. But that hit another issue due to the difference of string
> > type around io.StringIO and cStringIO.StringIO like
> > https://logs.chromium.org/logs/devtools-frontend/buildbucket/cr-buildbucket.appspot.com/8846743161604002304/+/u/compile/raw_io.output_failure_summary_
> >
> > So decided to re-land the switch with fix for known issue.
> >
> > I confirmed this works for python3.6 too.
> >
> > Original change's description:
> > > Revert "use python3 in devtools-frontend by default"
> > >
> > > This reverts commit 37c0bf698d.
> > >
> > > Reason for revert:
> > > Compatibility issues with python 3.6.
> > >
> > > Original change's description:
> > > > use python3 in devtools-frontend by default
> > > >
> > > > Fixed: 1205624, 1205625
> > > > Change-Id: Iddaf2a49bffd92140d1877784ffd9f5dd83ac3de
> > > > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2902988
> > > > Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
> > > > Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> > > > Reviewed-by: Michael Achenbach <machenbach@chromium.org>
> > > > Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> > >
> > > Change-Id: Ic426154f58798dd8631f9bac101521f0b25ea54c
> > > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2906060
> > > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > > Commit-Queue: Michael Achenbach <machenbach@chromium.org>
> >
> > Bug: 1210939, 1205624, 1205625
> > Change-Id: Ia7ddf5ab37c8df3e2f682bf89cb55ef30e663341
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2909053
> > Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> > Reviewed-by: Michael Achenbach <machenbach@chromium.org>
>
> Bug: 1210939
> Bug: 1205624
> Bug: 1205625
> Bug: 1211770
> No-Tree-Checks: true
> No-Presubmit: true
> Change-Id: Ic3a6add15b4126dfe818b445a5227253d296ee96
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2910016
> Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
> Reviewed-by: Michael Achenbach <machenbach@chromium.org>

Bug: 1210939
Bug: 1205624
Bug: 1205625
Bug: 1211770
Change-Id: I2acb2968e68f55a663cd5221c1c92b16301392cd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2910020
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
2021-05-24 09:58:37 +00:00
Paul Lewis 2afe8be656 Skip VSCode settings update on error
I had a rogue comma in my settings.json file. This prevented the require
from running correctly, which in turn stopped gclient sync from running.
This CL adds a try-catch around the code so that on any error, the
update is skipped.

This CL also adds a bypass option, so that people can opt out of syncing
their VSCode settings entirely.

R=jacktfranklin@chromium.org

Bug: None
Change-Id: I3d90dc0546fcc145c881cb1aa49964e79db3f24f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2914873
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Paul Lewis <aerotwist@chromium.org>
2021-05-24 09:12:16 +00:00
Jan Scheffler c53174b651 Add karma-mocha-reporter to node_modules
Bug:None
Change-Id: I35b9113b8e8191e2e76dbd9fdd20e88137ef8d6f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2912097
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
2021-05-21 21:26:23 +00:00
Takuto Ikuta 7c57958680 Revert "Reland "use python3 in devtools-frontend by default""
This reverts commit 0d4947c37e.

Reason for revert: https://crbug.com/1211770

Original change's description:
> Reland "use python3 in devtools-frontend by default"
>
> This reverts commit a8336c1e58.
>
> Reason for revert:
> use universal_newlines instead of text for
> https://docs.python.org/3/library/subprocess.html#subprocess.Popen
>
> I tried to divide this CL in to make py2/3 compatible and switch in
> another CL. But that hit another issue due to the difference of string
> type around io.StringIO and cStringIO.StringIO like
> https://logs.chromium.org/logs/devtools-frontend/buildbucket/cr-buildbucket.appspot.com/8846743161604002304/+/u/compile/raw_io.output_failure_summary_
>
> So decided to re-land the switch with fix for known issue.
>
> I confirmed this works for python3.6 too.
>
> Original change's description:
> > Revert "use python3 in devtools-frontend by default"
> >
> > This reverts commit 37c0bf698d.
> >
> > Reason for revert:
> > Compatibility issues with python 3.6.
> >
> > Original change's description:
> > > use python3 in devtools-frontend by default
> > >
> > > Fixed: 1205624, 1205625
> > > Change-Id: Iddaf2a49bffd92140d1877784ffd9f5dd83ac3de
> > > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2902988
> > > Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
> > > Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> > > Reviewed-by: Michael Achenbach <machenbach@chromium.org>
> > > Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> >
> > Change-Id: Ic426154f58798dd8631f9bac101521f0b25ea54c
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2906060
> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > Commit-Queue: Michael Achenbach <machenbach@chromium.org>
>
> Bug: 1210939, 1205624, 1205625
> Change-Id: Ia7ddf5ab37c8df3e2f682bf89cb55ef30e663341
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2909053
> Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> Reviewed-by: Michael Achenbach <machenbach@chromium.org>

Bug: 1210939
Bug: 1205624
Bug: 1205625
Bug: 1211770
No-Tree-Checks: true
No-Presubmit: true
Change-Id: Ic3a6add15b4126dfe818b445a5227253d296ee96
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2910016
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
2021-05-21 13:19:43 +00:00
Takuto Ikuta 0d4947c37e Reland "use python3 in devtools-frontend by default"
This reverts commit a8336c1e58.

Reason for revert:
use universal_newlines instead of text for
https://docs.python.org/3/library/subprocess.html#subprocess.Popen

I tried to divide this CL in to make py2/3 compatible and switch in
another CL. But that hit another issue due to the difference of string
type around io.StringIO and cStringIO.StringIO like
https://logs.chromium.org/logs/devtools-frontend/buildbucket/cr-buildbucket.appspot.com/8846743161604002304/+/u/compile/raw_io.output_failure_summary_

So decided to re-land the switch with fix for known issue.

I confirmed this works for python3.6 too.

Original change's description:
> Revert "use python3 in devtools-frontend by default"
>
> This reverts commit 37c0bf698d.
>
> Reason for revert:
> Compatibility issues with python 3.6.
>
> Original change's description:
> > use python3 in devtools-frontend by default
> >
> > Fixed: 1205624, 1205625
> > Change-Id: Iddaf2a49bffd92140d1877784ffd9f5dd83ac3de
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2902988
> > Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
> > Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> > Reviewed-by: Michael Achenbach <machenbach@chromium.org>
> > Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
>
> Change-Id: Ic426154f58798dd8631f9bac101521f0b25ea54c
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2906060
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Michael Achenbach <machenbach@chromium.org>

Bug: 1210939, 1205624, 1205625
Change-Id: Ia7ddf5ab37c8df3e2f682bf89cb55ef30e663341
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2909053
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
2021-05-20 07:49:35 +00:00
Michael Achenbach a8336c1e58 Revert "use python3 in devtools-frontend by default"
This reverts commit 37c0bf698d.

Reason for revert:
Compatibility issues with python 3.6.

Original change's description:
> use python3 in devtools-frontend by default
>
> Fixed: 1205624, 1205625
> Change-Id: Iddaf2a49bffd92140d1877784ffd9f5dd83ac3de
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2902988
> Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
> Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> Reviewed-by: Michael Achenbach <machenbach@chromium.org>
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>

Change-Id: Ic426154f58798dd8631f9bac101521f0b25ea54c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2906060
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
2021-05-19 17:13:34 +00:00
Jack Franklin 7d1724637a Upgrade typescript to 4.3.1-rc
Bug: none
Change-Id: I73fb412249882015b150f3a6e621164700c00e6d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2897285
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-19 11:30:32 +00:00
Takuto Ikuta 37c0bf698d use python3 in devtools-frontend by default
Fixed: 1205624, 1205625
Change-Id: Iddaf2a49bffd92140d1877784ffd9f5dd83ac3de
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2902988
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-18 14:41:02 +00:00
Jack Franklin 1d1253c7c9 sync-vscode-settings now copies from devtools-workspace-settings.json
This CL upgrades the sync-vscode-settings.js script to copy from the
`.vscode/devtools-workspace-settings.json` into
`.vscode/settings.json`, rather than have it hardcode the settings
into the script.

Bug: none
Change-Id: I250b122b47decc8fad937c9030e38603c4f0c403
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2902818
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-18 14:04:41 +00:00
Tim van der Lippe c78a7193d7 Move ESTree types to acorn
Not every single ts_library invocation has (and should have) access
to the ESTree types. Therefore, re-export these types via Acorn,
which is the only user of these types.

This also improves the build performance, as we are no longer
rebuilding all of DevTools when these types change.

DISABLE_THIRD_PARTY_CHECK=Tsc cleanup
R=szuend@chromium.org

Bug: 1209844
Change-Id: Ib182ba4f7877d26eea844ac75180542ce2bac44a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2900444
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2021-05-18 05:24:23 +00:00
Tim van der Lippe 7330337eda Remove protocol definitions from global file
DISABLE_THIRD_PARTY_CHECK=Protocol removal
R=jacktfranklin@chromium.org

Fixed: 1208357
Change-Id: I7439947b8ee4573acc0baa930fc1a5b6018b082f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2897519
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-17 13:18:32 +00:00
Jack Franklin 04bf47b6f9 Fix stylelint rule error in text editor
This is a weird test case but if you've got Stylelint in your editor and
you're working on changing files, I've found that after typing "var("
(and my editor adding the closing ")"), the theme_colors rule tries to
run against this and fails as it expects the var() to contain a variable.
So if we do detect var(), we just do nothing and wait for the user to
actually fill it in.

Bug: chromium:1152736
Change-Id: Id78fa4f7b05a1107e609bd7b0cde5c0f4bbbc8e7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2896898
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-17 09:59:12 +00:00
Tim van der Lippe ede1b93b2c Add @types/rimraf
So that we can use rimraf in TypeScript files.

R=jacktfranklin@chromium.org

Bug: 1206705
Change-Id: I48abb54727a628e5046f6a8033c88a04828ace05
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2897295
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>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-05-14 16:51:40 +00:00
Tim van der Lippe eb876c6b1e Generate const enums in protocol.d.ts
Some files currently rely on the Protocol to be available on the
global scope. However, the Protocol definitions are defined in
a .d.ts file, which isn't available on runtime. Therefore,
attempting to import Protocol with non-type imports would retain
the imports in the `.js` files and break on runtime.

Since the only usages of the Protocol on runtime are the enums,
we can make them const, such that they get inlined as intended.
Then, `import * as` will work again, as the enums are inlined and
the import is removed from the `.js` file.

DISABLE_THIRD_PARTY_CHECK=Protocol update
R=jacktfranklin@chromium.org

Bug: 1208357
Change-Id: I749e57c9f51596866b61cab686c59f00bc8a8eb4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2897277
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-14 15:51:00 +00:00
Tim van der Lippe 27ff2f24ca Add DCHECK function to Platform
In the Chromium backend engineers can use `DCHECK()` to ensure
certain invariants are held, but only execute these assertions
in a debug build. [1] Release builds do not ship with DCHECKS enabled.

In a similar fashion, introduce a build-time generated function
`DHCECK` that is only generated when `devtools_dcheck_always_on`
is set as GN arg. By default, `is_debug` builds enable
`devtools_dcheck_always_on`. However, in a release build, you can
explicitly set `devtools_dcheck_always_on` to `true` to achieve
the same effect.

When the GN arg is set, the build generates the `dcheck.js` file
with an implementation that checks the condition and fails if
it is not met. When the arg is not set, the function implementation
remains empty and becomes a noop.

To make sure that these functions calls are removed in a release
build (rather than being a noop), the terser configuration is
updated to treat these functions as pure. As such, terser will
remove any calls if the function implementation is empty. In a
release build that explicitly turns out the dchecks, terser
will not remove the function calls.

Lastly, to make sure that all code related to the dcheck is removed,
the condition needs to be a lambda. If we were to make it a raw
boolean, then `terser` would not be able to determine whether it
can remove the condition itself and would leave that behind. In other
words, the `DCHECK` call would still leave some artifacts behind,
namely the condition computation itself. By making it a lambda,
terser can deduce that the lambda creation has no side-effect and
remove the lambda if the `DHCECK` call is removed.

R=aerotwist@chromium.org

[1]: https://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/c++/c++.md#check_dcheck_and-notreached

Bug: none
Change-Id: Ic396f102141d9eb67c8690bd2a601b56061b9d8c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2894390
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-14 13:47:30 +00:00
Jack Franklin 082afdbe1f Remove components_import eslint rule
Now we've completed the move to LitHtml v2 and the static tags, we can
remove this rule as we don't need to rely on side-effect imports
anymore.

Bug: 1153077
Change-Id: I7967d6b1995fc77460ec7815d7ab08243553e567
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2897283
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-14 13:41:10 +00:00
Jack Franklin e9f62582dd Lint for consistent component tag names in component definitions
This CL lints that for a given component that all the references to
its tag name are the same.

```
class Foo extends HTMLElement {
  // Check that this name
  static litTagName = LitHtml.literal\`devtools-foo\`
}

// And this name
ComponentHelpers.CustomElements.defineComponent('devtools-foo', Foo);

declare global {
  interface HTMLElementTagNameMap {
    // And this one are the same
    'devtools-foo': Foo
  }
}
```

Bug: 1153077
Change-Id: I29694449cb37950d1a5ff5391779e16e462926e2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2897279
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-14 12:57:20 +00:00
Tim van der Lippe b571d43df3 Add explanation to generate_protocol_resources
R=yangguo@chromium.org

Bug: none
Change-Id: I186e32ee0eb323e0f068eecbb3bce6c50a1f43c9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2894391
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
2021-05-14 10:40:35 +00:00
Jack Franklin b620bb41c9 Enforce event names and allow event name references
This CL updates our ESLint rule for custom event names:

* It changes it from wanting kebab-case to allonewordnopunctuation
* It allows references to CustomEvent.eventName for times when it's
  useful to define the event name as a static.

The CL therefore updates a variety of events through the codebase that
were kebab-case. go/building-ui-devtools has also been updated.

Fixed: 1176758
Change-Id: Ifbe9851bc2f6bbe9347ec886cc8c026248cc5c43
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2894389
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-14 10:39:29 +00:00
Tim van der Lippe 2a1eac282b Remove leftover from protocol-proxy-api global removal
This should have been included in https://crrev.com/c/2891760

R=jacktfranklin@chromium.org

Bug: 1208357
Change-Id: I27c9bbadad03a20f62bb2fdd97f844dc4852096f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2894392
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-05-13 16:22:04 +00:00
Tim van der Lippe 5bf64b9856 Make the Protocol definitions importable
Currently, all Protocol type definitions live on the global scope.
Additionally, the protocol files are included in all ts_library
targets. However, we don't want the protocol definitions to be
available in, for example, reusable UI components.

Therefore, we should move to a system where all files that want
to refer to the protocol types should import them instead.
However, doing so in 1 large CL will be problematic, which is
why it should be both globally available and importable as an
interim step.

To do so, we augment the existing protocol definitions to export
them as namespace and regular export. Then, we introduce a separate
file that imports the protocol types and augments the global scope
with the definitions. Now, protocol is both importable and remains
available on the global scope.

The reason that we need a separate file is that TypeScript disallows
you to augment the global scope in a file that also exports types.
Therefore, the global scope augmentation happens in protocol-globals.d.ts,
which will be removed once all Protocol type usages are imported.

To verify that this approach works, ProtocolClient imports the
required types, while SDK only imports it in AccessibilityModel.
All other files in SDK still refer to the global type.
In follow-up CLs, all pre-existing usages of Protocol will use
the import style.

DISABLE_THIRD_PARTY_CHECK=Updating protocol type format
R=szuend@chromium.org,jacktfranklin@chromium.org

Bug: 1208357
Change-Id: I1d75949b9cd3e37989c6cddf79ac849f5664a1e3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2891756
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-13 09:48:18 +00:00
Jack Franklin dc7c24deae Lint for ${Foo.litTagName} in LitHtml templates
This CL lands the rule; I'll enable in a follow-up.

Bug: 1153077
Change-Id: I28a10fb99bbe7c8c2da7801e4e132653b28b0fc1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2891842
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-13 08:35:28 +00:00
Jack Franklin 33b3951b92 Fix ESLint import extensions being missed
Bug: none
Change-Id: Ie3341a56224d7887b42c230ba966cc5eeba38fe4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2886932
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-12 14:30:57 +00:00
Tim van der Lippe 7882ce0ca7 Add DEPS hook for syncing VS Code settings
Now, when an engineer runs `gclient sync`, we will automatically
augment their VS Code settings to have the correct Node binary
for running the ESLint extension. The augmentation will always
preserve any pre-existing setting specified by the engineer.
If the file doesn't exist yet, it would also be created.

R=szuend@chromium.org,jacktfranklin@chromium.org

Bug: none
Change-Id: I8f4e31b9f12315fb65f5723b6072042cccccacab
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2886931
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2021-05-12 09:06:03 +00:00
Tim van der Lippe 382089011b Run npm audit
This syncs our dependencies to the latest version. There is still
a reported vulnerability in postcss, but we are luckily unaffected.
However, we can't upgrade postcss yet, as stylelint requires it
and can not use postcss 8 yet:
https://github.com/stylelint/stylelint/issues/4942#issuecomment-823513767

Also updated manage_node_deps.py to not run the full install when
running `ls`, to allow for easier inspection of our dependency graph.

R=jacktfranklin@chromium.org

Bug: none
Change-Id: I1c9e4836fca25500e2e7277ec82b13bf2b881dca
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2887731
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-05-11 16:18:42 +00:00
Jack Franklin a75ae7cbb3 Enforce import type when importing TS types.
Bug: none
Change-Id: I02ef1182143b7fe091ce92d59f04ac2188903e0d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2886925
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2021-05-11 14:00:22 +00:00
Simon Zünd e4da47f529 [ts] Add types for Intl.DisplayNames
This CL early adopts Intl types that haven't landed upstream in TS yet.

DISABLE_THIRD_PARTY_CHECK=Add types
R=tvanderlippe@chromium.org

Bug: chromium:1163928
Change-Id: I2a2084a58212c535df9dc7ef4c0c704ede737df7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2885264
Auto-Submit: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-11 10:19:18 +00:00
Jack Franklin 06ee0d9cf6 [Lit2] Lint against manual tag names
This CL adds an ESLint rule that bans the use of:

```
LitHtml.html`<devtools-foo>`
```

Because from now on we want to enforce:

```
LitHtml.html`<${Foo.litTagName}>`
```

I have disabled the rule in all locations where we do not yet do this,
and will be working to fix these problems over a series of CLs.


Bug: 1153077
Change-Id: I8d18243d0243ea1403d5d57dbeb32c8a9682d2dd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2876969
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-11 09:37:03 +00:00
Tim van der Lippe 7460028f70 Update run_test_suite to pass on coverage flag
When running `run_test_suite.js` you can now specify `--coverage`
to allow for coverage collection. This will used by the CQ
scripts to collect coverage for interactions tests.

R=jacktfranklin@chromium.org
CC=liviurau@chromium.org

Bug: 1206705
Change-Id: I555662f02efbf16165f1c8b3e47403e427d65a0a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2884241
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-11 09:29:08 +00:00
Tim van der Lippe baa6dec654 Add script to merge unit and interaction test coverage
This script can be invoked to obtain the coverage from the unit
and interaction tests and writes them to a coverage-summary.json
file that lives in `test/`. This file can then be used in favor of
karma-coverage/coverage-summary.json to upload to the Chromium
infrastructure.

As a follow-up, we should turn on coverage collection on CQ and
hook up this script after both unit and interaction tests have
completed.

R=jacktfranklin@chromium.org
CC=liviurau@chromium.org

Bug: 1206705
Change-Id: I52199940d6747ec13f208233e04dcf81a618a8fb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2884240
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-11 09:19:48 +00:00
Tim van der Lippe 23283e110a Instrument code with Istanbul for interactions tests
All interaction tests are now lazily instrumented with Istanbul
to obtain code coverage. The interactions tests can be started
with `COVERAGE=1` to obtain coverage. For that, the Mocha hooks
perform the eventual reporting and gathering of data. The instrumentation
is performed in the components server itself.

To make sure that we perform the minimal amount of work required
(since code coverage instrumentation is computationally expensive),
we preload pages to populate the instrumentation cache. Every
interactions tests should preload an example (most likely basic.html)
to populate the cache. Every subsequent test will then use the
already-instrumented code, rather than computing the code over
and over again.

The eventual code coverage is written to /interactions-coverage.
The results will eventually be merged with /karma-coverage
to obtain the union of both unit and interaction tests coverage.

R=aerotwist@chromium.org,jacktfranklin@chromium.org

Bug: 1206705
Change-Id: I5e19b1ecef23d21107210699cb29800556e0415e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2879986
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-10 14:44:42 +00:00
Tim van der Lippe a0dce6da2f Add NPM packages for coverage instrumentations
These packages and types are required to implement code coverage
instrumentation in interactions tests.

R=aerotwist@chromium.org,jacktfranklin@chromium.org

Bug: 1206705
Change-Id: Ie9c4f04dd93acc1c0fbab8ffa2be73dc4af076a9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2879985
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-10 12:26:02 +00:00
Kriti Sapra 2597b415c1 Added linting rule to use helper function to define component
Bug: 1205825
Change-Id: I78ce8199dc599be1f1121e65b72b83a8f73733c4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2878729
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Kriti Sapra <kritisapra@google.com>
2021-05-07 13:09:29 +00:00
Tim van der Lippe 5386d3bb32 Add ESLint rule to enforce custom element definition locations
This rule ensures that all custom element definitions are either
placed in `ui/components` or in a `components` sub-folder of
a panel. Since `inline_editor` and `ui/legacy` still have custom
element definitions in their respective folders, these are still
allowed for now.

R=jacktfranklin@chromium.org

Bug: 1206211
Change-Id: I137677ab947a8359d9164ddf1c7dfc421b6dfea9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2874683
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-06 14:33:28 +00:00
Yang Guo acbd630778 Remove outdated owner in scripts/
R=tvanderlippe@chromium.org

Bug: None
Change-Id: I4ce552aed36d51d190eecb25d75e06a729ed2ef3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2867545
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
2021-05-04 11:10:07 +00:00
Tim van der Lippe 6a9d241269 Update ESLint rule to handle nested folders properly
Before, the rule would incorrectly error on importing a sub-folder
from a top-level folder. E.g. if you would import
`elements/components/components.js` from a file in `elements/`.

By simplifying the logic, we change the behavior such that we now
more accurately reflect the behavior that Rollup uses.

R=jacktfranklin@chromium.org

Bug: none
Change-Id: I5a656552835bd3bbd86a8b5aaa65edaaf582f281
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2862787
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-04-30 14:28:13 +00:00
Tim van der Lippe 2acbbd12f3 Add default visibility to devtools_entrypoint
Any devtools_entrypoint now has a default visibility of solely the
targets that are specified in the same folder. If you want to allow
other folders to import your code, you can do so by adding an
explicit visibility to your target.

R=jacktfranklin@chromium.org

Fixed: 1202788
Change-Id: I35e4f0f8d94e909f98016246ad975bd5b898af5c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2856777
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-29 14:43:24 +00:00
Tim van der Lippe 9bd3674c17 Reland "Fix acorn-loose entrypoint and remove its exemption"
This reverts commit 508aa46b98.

Reason for revert: Fixed compilation error

Original change's description:
> Revert "Fix acorn-loose entrypoint and remove its exemption"
>
> This reverts commit 1f3df9a2c0.
>
> Reason for revert: https://logs.chromium.org/logs/devtools-frontend/buildbucket/cr-buildbucket.appspot.com/8848718136613443488/+/u/compile/stdout
>
> Original change's description:
> > Fix acorn-loose entrypoint and remove its exemption
> >
> > Third_party folders are no longer exempted from importing, to prevent
> > recompilation issues. As an example, crbug.com/1203165 showed that
> > upgrading a third_party package can introduce non-determinism.
> >
> > R=​jacktfranklin@chromium.org
> >
> > Bug: 1203165
> > Change-Id: I7bb3eb8b2038647ae0bef35bf21474c440177743
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2854674
> > Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
> > Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
> > Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
>
> Bug: 1203165
> Change-Id: Ic2a6279bf48df0d79dd63a139b777b2a251322fb
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2854682
> 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>

Bug: 1203165
Change-Id: Id7d7427017edbc0228402e087e580133c36f1f46
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2854683
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-28 10:43:34 +00:00