Commit Graph
1015 Commits
Author SHA1 Message Date
Jack Franklin 6c391a0969 [DarkMode] remove cmdevtools.darkmode.css
This CL re-writes `cmdevtools.css` to migrate all the colors over to
CSS variables, and defines those colors in dark mode also. To generate
this CSS I wrote a very hacky script that parsed the original CSS,
found all the colors, and then generated the variable names and
values. It used the original legacy color patching code to generate
the dark mode values.

Given `cmdevtools.css` now contains all dark mode overrides, this CL
removes the darkmode stylesheet for `cmdevtools.css`. Given that it's
the only dark mode CSS sheet, this CL also removes all the
infrastructure for generating and checking these sheets are up to
date.

The motivation for doing this work is that maintaining the darkmode
CSS stylesheets means we have to keep the legacy patching around in
order to (re)generate the stylesheets. Doing this one off script to
move all the overrides into the original file means we don't need to
keep the legacy patching around.



Bug: chromium:1152736
Change-Id: I0cf07d54370716299819478356b42728e0e3aadb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2982137
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-06-25 10:53:26 +00:00
Kriti Sapra 1d765a5fdf Added new .css.js files to grd_files_debug_sources
We got alerted that DevTools was not loading in chrome due to .css.js
files not being listed in the grd_files_debug_sources. This CL has the
fix for that. It adds all the migrated CSS files so far to the
debug grd files.

Bug: 1106746
Change-Id: I9b75581e59ecd3290b4fd4eecf1ddbcd46954e18
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2979698
Commit-Queue: Kriti Sapra <kritisapra@google.com>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-06-23 09:44:29 +00:00
Simon Zünd 918e280504 Revert "Added grd_files_sources to generate_css template"
This reverts commit d2b207117a.

Reason for revert: Seems to break debug compilation step:
https://ci.chromium.org/ui/p/devtools-frontend/builders/ci/Linux%20Compile%20Debug/3919/overview

Also confirmed locally.

Original change's description:
> Added grd_files_sources to generate_css template
>
> Bug: 1106746
> Change-Id: I4bbfc0b577248e810521460c9fb35f9dcb320f9b
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2978357
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Commit-Queue: Kriti Sapra <kritisapra@google.com>

Bug: 1106746
Change-Id: Iddd80ce81fb74092d7852b3e4f93bafa5bf7b0bd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2979696
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Auto-Submit: Simon Zünd <szuend@chromium.org>
2021-06-23 06:28:50 +00:00
Kriti Sapra d2b207117a Added grd_files_sources to generate_css template
Bug: 1106746
Change-Id: I4bbfc0b577248e810521460c9fb35f9dcb320f9b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2978357
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Kriti Sapra <kritisapra@google.com>
2021-06-22 16:28:21 +00:00
Tim van der Lippe 4b99b80a80 Update Terser to mangle private class fields
Using a regex to denote all properties that can be mangled, we
can mangle all private class fields. Since we know that private
class fields are only accessed in a class, we know that terser
can safely mangle the properties in a single rolled up bundle.

Mangling of private class fields on `core/sdk/` has shown an
expected 8.6% bundle size improvement.

R=aerotwist@chromium.org

Doc: https://docs.google.com/document/d/13yeJuvIq8JYFXSOsjRgcXzQVrIviJmukvxj27rn1Ab8/preview
Bug: 1222126
Change-Id: Id3bb3f4ff4af295eddaa4bce3bff4fabe4d87794
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2975285
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-06-22 13:39:19 +00:00
Tim van der Lippe 2af52cb561 Explicitly add terser to node_modules/
While we were already including terser as a transitive dependency
via rollup-plugin-terser, the resolved version was quite old.
By explicitly adding terser to our node_modules deps, we can ensure
we are using a recent version.

R=aerotwist@chromium.org

Bug: none
Change-Id: Ie10a808ce3cbe80138183a9704816aa966a01f16
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2975283
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-22 11:16:28 +00:00
Tim van der Lippe 324d60372c Update Mocha to 9.0.0
The breaking changes in 9.0.0 (
https://github.com/mochajs/mocha/blob/master/CHANGELOG.md#900--2021-06-07)
do not affect us, as we are running Node 14+ and are compatible
with ESM-first loading.

R=szuend@chromium.org

Bug: none
Change-Id: I53dbfdd492ddded2e0a41676606471240bb4b129
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2975286
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-06-22 05:00:22 +00:00
Kriti Sapra 15269c4cf5 Created script to create .css.js files for CSS files
Bug: 1106746
Change-Id: I7612419d19815ce5ad67c842215f65f93ca90769
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2960177
Commit-Queue: Kriti Sapra <kritisapra@google.com>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-18 11:18:54 +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
Simon Zünd 52e202093a [deps] Upgrade eslint to 7.28.0 and typescript-eslint to 4.27.0
R=tvanderlippe@chromium.org

Bug: 1057042
Change-Id: I0c658894c7c75a773e39314c66862c7af76d876c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2963817
Auto-Submit: Simon Zünd <szuend@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-16 09:10:18 +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
Kriti Sapra 3937e6f1f8 Added ESLint rule to ensure all .css.js files that are being
imported exist in the file system.

Initally, we wanted to create a `.d.ts` file for each CSS file to
ensure that the file being imported actually exists. However, when
ninja is building `tsc` uses the generated `tsconfig` file in `gen`.
In the `tsconfig.json` `files` list it will see the original TS file
that's in the source tree. When it goes to see the TS file and sees
the `import styles from 'foo.css.js'`. However, that file does not
exist in the files list of the entrypoint or the source tree, so TS
never finds it.

Instead we went with the approach of adding a `declare module` to type
all `.css.js` files and then use a lint rule to ensure that if you
import `foo.css.js` that there is a `foo.css` file in the tree.

Bug: 1106746
Change-Id: I8a65734bf4a9b359f8210b0011f14800c5d9426b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2953260
Commit-Queue: Kriti Sapra <kritisapra@google.com>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-14 10:49:33 +00:00
Jan Scheffler 9245dae50b [ESLint] Add rule to prevent self closing custom elements
Bug: None
Change-Id: I082b787fb56159ef9465fe8f0b5c3d5623ab9890
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2955365
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-11 15:55:55 +00:00
Jan Scheffler 551be57016 Update puppeteer to v10.0.0
DISABLE_THIRD_PARTY_CHECK=Update puppeteer requires type changes

Bug: None
Change-Id: Ifda85d161fc94567e4cfaaab0acc2da2f2c29d30
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2953266
Auto-Submit: Jan Scheffler <janscheffler@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-11 09:22:36 +00:00
Tim van der Lippe 0b2df65238 Update @web/rollup-plugin-import-meta-assets to pull in upstream fix
This update contains the same fix as we had locally applied in
https://crrev.com/c/2939994/4/node_modules/%2540web/rollup-plugin-import-meta-assets/src/rollup-plugin-import-meta-assets.js

R=aerotwist@chromium.org

Bug: 1216402
Change-Id: Ie8cabe55a1beac1c06c25c73d43b6f00fac12732
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2951129
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-06-10 10:23:00 +00:00
Tim van der Lippe 727227900c Dynamically optimize svgs
Currently, we optimize our SVGs out-of-sync and have a Python
script and PRESUBMIT check to make sure that the SVGs are correctly
optimized. This means that the SVGs are duplicated in the Images
folder and requires developers to install `svgo` on their command
line, which could be using differing versions.

Instead, we can optimize the SVG images (which is computationally
cheap) during build time using the rollup-plugin-import-meta-assets
and svgo packages. The rollup plugin traverses the required SVG
image files and puts them and rewrites them to the Images/ folder
(rather than in src/), while also allowing us to optimize them
along the way.

DISABLE_THIRD_PARTY_CHECK=Removing script from package.json
R=jacktfranklin@chromium.org

Bug: 1216402
Change-Id: Ieb6932b9a81753be5ecbccd00a5d84bd0efa23f8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2939994
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-06-10 10:09:30 +00:00
Tim van der Lippe 4de48df446 Add rule to enforce deep equality comparisons for array assertions
Not every chai assertion uses deep comparisons. For arrays, we need
to make sure that not just the array itself, but also its contents
and its members are equal. There are only a subset of assertions
in chai that do that, so allow only these in our test assertions.

R=dsv@chromium.org

Fixed: 1218015
Change-Id: Ib7eb5864cf65a54ef17b9d637cd8e3b94323edb6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2950163
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-09 16:13:08 +00:00
Danil Somsikov 73839bd1b0 Mark resource from the WebBundle as such and show WebBundle-specific errors.
Bug: 1182537
Change-Id: I1a35a676005cf60d725f23fac0a3900c1a1c21bc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2949050
Commit-Queue: Danil Somsikov <dsv@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-09 15:31:48 +00:00
Danil Somsikov 9ac07f536e Support .headers files in devtools hosted mode server.
This is similar to what WPT does (https://source.chromium.org/search?q=f:third_party%2Fblink%2Fweb_tests%2Fexternal%2Fwpt%2Fresources.*%5C.headers$)
and is needed to support binary resources with custom headers, such as
webbunles.

Bug: 1182537
Change-Id: I0e089a9a3ff43cd5082d0cd20f7c89ceec42c60e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2944947
Commit-Queue: Danil Somsikov <dsv@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-06-08 14:55:34 +00:00
Tim van der Lippe 706ec965fb Add packages to optimize svgs dynamically
These packages will be used to dynamically optimize SVG images
during the build.

R=jacktfranklin@chromium.org

Bug: 1216402
Change-Id: I04e95aa7d79c9d67beaf8a7861182c52b16b7d0f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2939992
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-04 13:32:16 +00:00
Tim van der Lippe 0005b80576 Minify html template literals in release mode
Because of https://github.com/asyncLiz/minify-html-literals/issues/37
we are unable to minify CSS in template literals. However,
since we are moving CSS over into separate files, we can minify
these CSS files separately.

This also caught two issues with our templates, one of which was missing
the closing tag name whereas the other was missing the closing angle
bracket. As such, in release mode, we are now fully validating our
HTML structure.

R=jacktfranklin@chromium.org

Fixed: 1213034
Change-Id: Ieb4708334e627d368cb94db541b545b9dea5e895
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2922503
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-06-03 11:23:07 +00:00
Tim van der Lippe 4965ccdd03 Update types packages
This includes the fixes for istanbul-reports and ESTree.
Some functional changes were required to make the type checker
happy again.

DISABLE_THIRD_PARTY_CHECK=Functional changes for types
R=jacktfranklin@chromium.org

Bug: none
Change-Id: I57964301d51b5e94cd6ca8a5453bdc51ca6d9758
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2933803
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-06-02 16:36:54 +00:00
Philip Pfaffe 3ae8373dda Mark crashpad_handler binary as executable on download
Bug: none
Change-Id: If57b662eea0ff99ecbf6cbc3c57a685e77edaad1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2931812
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
2021-06-02 11:36:24 +00:00
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