Commit Graph
979 Commits
Author SHA1 Message Date
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
Tim van der Lippe 0fa20648c8 Use relative file input for GRD script
We can use the _expected_grd_files list as input, since this is
already relative to the root directory. Therefore, we no longer
need to keep track of these relative directories.

R=alexrudenko@chromium.org

Bug: 1174013
Change-Id: I18bf22cf4cc5b99786c813aed8967ff40ecde01c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2848230
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2021-04-28 10:12:24 +00:00
Tim van der Lippe 508aa46b98 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>
2021-04-28 09:45:05 +00:00
Tim van der Lippe 1f3df9a2c0 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>
2021-04-28 09:08:53 +00:00
Tim van der Lippe 7d4f6c4889 Fix wasmparser integration
Prior to this fix, the wasmparser_worker entrypoint would include
specific files from third_party/wasmparser. However, since the
files were included as part of a separate package, rolling up the
target could cause issues. They should have been part of the
`sources` of the wasmparser_worker entrypoint, but they were instead
included as `deps`. Even better would be to not include specific
files from the wasmparser and instead use an entrypoint.

In the specific case reported in crbug.com/1203165, the wasmparser
implementation was updated. As such, GN reran
`third_party/wasmparser` and determined that
`entrypoints/wasmparser_worker:wasmparser_worker` required
recompilation (since one if its dependencies were updated. However,
since `entrypoints/wasmparser_worker:wasmparser_worker` wasn't
producing a different output, GN would determine that it wouldn't
have to run rollup. This conclusion is wrong and is an artifact of
the inclusion of specific files of `third_party/wasmparser` by
the entrypoint.

To fix this, we should rollup all relevant sources in
`third_party/wasmparser` instead. That way, whenever the wasmparser
implementation is updated, it will properly roll up its content
into its bundle, ready for consumption by the entrypoint.

R=jacktfranklin@chromium.org

Bug: 1203165
Change-Id: Ic29ddea0d1f8e953e11e71a6a0e4e65c5f0f1ad6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2853559
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-27 14:33:30 +00:00
Tim van der Lippe 19dba6b42b Restrict ui/legacy:bundle visibility
This locks down the visibility of ui/legacy:bundle to the various
folders that already depend on it. For now, the visibility is
quite broad, as there is still plenty of code depending on the
legacy UI implementation.

Consequently, downstream projects (such as the Edge DevTools fork)
will break if they depend on this bundle. Therefore, add a GN arg
that allows the visibility to be extended. To use this GN arg,
downstream projects can change their `default_args` in the root
`.gn` file:

default_args = {
  devtools_ui_legacy_visibility = [
    "//front_end/forked/folder/*",
  ]
}

This means that they can broaden the visibility of UI. It is still
recommended to remove as many of the dependencies on UI as feasible,
but that will likely not finish any time soon.

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

Bug: 1202788
Change-Id: I868e88ee3b1c66dd7c79d30d07648a7d2828e8f2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2853551
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-04-27 13:14:05 +00:00
Tim van der Lippe ada1b595b7 Remove old DevTools GRD
This removes the GRD that was previously put in gen/devtools and
removes copying all files into gen/devtools as well.

This requires https://crrev.com/c/2844838 to land first in Chromium
and rolled into DevTools itself.

R=alexrudenko@chromium.org

Fixed: 1174013
Change-Id: I8fa4272caa371d126a46ef61da0071ba9d3a85ae
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2848229
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-04-27 09:33:41 +00:00
Tim van der Lippe b4ab8dae8a Generate GRD file in target_gen_dir
This generates the GRD file in out/Default/gen/front_end with the Chromium file
in out/Default/gen/third_party/devtools-frontend/src/front_end. After
https://crrev.com/c/2844838 is submitted, we can remove the old
outfile and remove the copying into out/Default/gen/devtools.

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

Bug: 1174013
Change-Id: Idd7d992c443fcd84d3df83e461d9b5379f9e2b1b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2846331
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2021-04-23 10:08:47 +00:00
Sigurd Schneider b9d0e036f6 Add issues for CORS invalid credentialed requests
This CL adds issues for the CORS error codes

InvalidAllowCredentials
PreflightInvalidAllowCredentials

This also adds the $host_port replacement for headers in .rawresponse
files. This is useful if a HTTP header need to whitelist an origin
(which includes the port). Since our test setup changes the port
we host on every time, this placehoder is used in
test/e2e/resources/issues/acac-invalid.rawresponse

Screenshot: https://imgur.com/a/6lhV7WB

Bug: chromium:1141824
Change-Id: I9fb4a944241a5479b55cf5f97d46001346bb8a26
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2846328
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
2021-04-23 09:05:18 +00:00
Tim van der Lippe 3edd9d7219 Remove intermediate lists that were used in GRD generation
Since we now use the GN metadata to specify all relevant files,
we no longer require these lists. That allows us to clean up the
various actions to no longer having to check the contents of the
lists.

R=aerotwist@chromium.org

Bug: 1174013
Change-Id: Ia361aec69fe9af702a7667e33f7fc389f8a5a24f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2844169
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-04-22 12:19:57 +00:00
Tim van der Lippe 0d8ffe34d5 Use GN metadata to compute GRD files
GN metadata allows to specify and later query metadata from any
action in our build graph. Using GN metadata, we can specify
GRD files on an action and collect these files on the top level.
Then, we can compare the list of collected files to the expected
GRD files in `devtools_grd_files.gni` to ensure they match.

As a follow-up change, we can remove the intermediate lists we have
been specifying in `all_devtools_modules.gni` and
`devtools_module_entrypoints.gni`, which now become obsolete. That's
because both `devtools_module` and `devtools_entrypoint` now specify
the files in their respective metadata and essentially perform the
check that all relevant files are collected.

R=aerotwist@chromium.org

Also-By: alexrudenko@chromium.org
Bug: 1174013
Change-Id: I9dd2e6f7e010b5c25f83556511af12d5d1c2ec7c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2843322
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-04-22 11:50:37 +00:00
Simon Zünd 1ef0fe1ba3 [ts] Upgrade typescript to 4.3-beta
R=tvanderlippe@chromium.org

Bug: 1196203
Change-Id: Ia4162039831919cf5a3273a720cc73d56bf534f9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2846324
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-22 10:06:17 +00:00
Tim van der Lippe ed0c9a1332 Cleanup forwarding variables in node_action
Now all variables are properly forwarded, which means we no
longer have to list individual GN properties to be fowarded
that are used in the numerous `node_action` definitions.

Since `args` and `scripts` are specifically used in `node_action`,
these must not be forwarded.

R=alexrudenko@chromium.org

Bug: 1174013
Change-Id: I1edcaadc3cb49dd0546c244115328fc8aca51ba0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2843317
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2021-04-21 14:55:16 +00:00
Tim van der Lippe fddcf408ff Move theme_support to ui/legacy/theme_support
R=aerotwist@chromium.org

Bug: 1187573
Change-Id: I1ca8b563b670777bc6a5d43b46fc9de6d8bba03a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2831973
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-04-19 13:45:39 +00:00