Commit Graph
968 Commits
Author SHA1 Message Date
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
Jan Scheffler ec7ade6441 [ESLint] Fix ui/components rule
Bug: chromium:1198900
Change-Id: I516051c82ca2388dcc63de02fcf69b68733db32e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2831445
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-16 15:37:35 +00:00
Jan Scheffler 7a9279607b [ESLint] Check ui/component imports
This cl adds an eslint rule to check ui/components imports
for a preceding side-effect import. If the side-effect could not
be found, it automatically adds one.

Bug: chromium:1198900
Change-Id: I66ac7c7a366029ab97455d91950dd2898893e807
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2831444
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-16 14:45:25 +00:00
Simon Zünd a38b38ff4f [deps] Add @types/marked package
R=jacktfranklin@chromium.org

Bug: chromium:1108699
Change-Id: I53591b274be31411b08b65da0f09aeb4dcfdcb3a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2831434
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2021-04-16 12:24:45 +00:00
Tim van der Lippe 7256e5e754 Move formatter_worker to entrypoints/formatter_worker
R=aerotwist@chromium.org

Bug: 1187573
Change-Id: I12afe682c2781651ff7cdc1650843010e2c8cbfd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2826294
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-04-15 10:30:32 +00:00
Tim van der Lippe e622f55864 Move component_docs to ui/components/docs
R=jacktfranklin@chromium.org

Bug: 1187573
Change-Id: I2f8225ba1b9fc9848cf497ec0235756ace0f4831
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2826290
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-14 15:08:31 +00:00
Tim van der Lippe 67d60bf707 Move ExpandableList from ui/components to ui/components/expandable_list
R=jacktfranklin@chromium.org

Bug: 1187573
Change-Id: Id1bdf233133cff65f00cd311cedeb69d6413e53f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2825794
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-14 12:50:41 +00:00
Patrick Brosset 5d02bbd8c7 Make isInChromiumDirectory also work when inside chromium
I use the standalone devtools-frontend checkout process like most people
working on devtools, however I placed this repo inside chromium here:
D:\dev\chromium\devtools\devtools-frontend
This way I have both src and devtools-frontend side by side.

I just realized that this prevented me from running the css linter.
Indeed, run_lint_check_css.js tries to find the path to stylelint exe
file based on whether devtools is standalone or integrated in
chromium.src.
If it sees a directory named chromium inside the path, it assumes
devtools is integrated in chromium.src which, in my case, is wrong.

The change attempts to make this logic a little bit more safe by
checking a longer part of the path.
This resolves my issue.

Bug: 1198532
Change-Id: I872429da0751280bef5a4ec68602001421f55056
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2821855
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Brandon Walderman <brwalder@microsoft.com>
Commit-Queue: Patrick Brosset <patrick.brosset@microsoft.com>
2021-04-14 09:42:02 +00:00
Tim van der Lippe d75fee3703 Automatically fix filename in localization ESLint rule
With this change, running the presubmit will automatically update
the wrong paths to the correct value, saving a manual replacement.

R=szuend@chromium.org

Bug: none
Change-Id: Ib98d760d6fd4157aeba0dfed8a8c4496b33f5cc2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2821816
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2021-04-13 17:02:06 +00:00
Jack Franklin 075c2fd6fe Fix errors when linting theme colors in border-X properties.
This CL fixes the fact that the stylelint rule wouldn't deal with:

```
border-bottom: var(--foo) solid var(--color-details-hairline)
```

It does this via a naive regex that splits the border value into its
three pieces, and then only lints the final declaration, which is the
color.

Bug: 1198504
Change-Id: I409adaf8b8777112ce4f3b24f0a6f63bd7435c25
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2823831
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-04-13 16:12:48 +00:00
Tim van der Lippe 8499fe2ad0 Move data_grid to ui/legacy/components/data_grid
It also updates the ES Modules ESLint rule to allow for the import
from DataGrid to the legacy UI folder, as they are now nested.

R=aerotwist@chromium.org

Bug: 1187573
Change-Id: I8a6a577b10464216efafed10e62f24ca0c06e194
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2821870
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-04-12 17:21:23 +00:00
Tim van der Lippe 9646971c47 Remove dagre_layout
This code is unused and will not be shipping with DevTools in the
near future. It is also third_party code, so we will need to follow
the third_party procedure if we want to add back this code.

R=aerotwist@chromium.org

Bug: 1187573
Change-Id: I83af5983bf5223dc167ac2d9c824b39a559df717
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2821875
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-04-12 16:42:33 +00:00