Commit Graph
542 Commits
Author SHA1 Message Date
Jack Franklin cf3f695566 Fix non-nullable bug in bridges interface output
Fixes a bug where required fields were not prefixed with `!` in the
component bridges.

I also discovered that this doesn't play nicely with the union type
generation (!"fool"|"bar") doesn't make sense, but because we're not
going to support union types (as they don't convert cleanly into Closure
types) I've skipped those tests. I have a WIP CL that will strip out
this support (in favour for explicit errors telling people they can't
use union types in the Closure bridge code) so that CL will remove those
types.

Change-Id: Ibd2daf9520e492d975d38cd9e8dd2338cde6e009
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2349175
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-08-12 11:41:37 +00:00
Ian Clelland 2f5d7054bb Don't abort copying multiple files when one matches
Bug: 1115386
Change-Id: Ib9be093c232066a21843acc078189ce0da3bde53
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2351521
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-08-12 10:26:57 +00:00
Changhao Han d2454323cb TS-componentize Computed tab's style property and style trace elements
This also helps future work, for example, Computed style grouping,
to be TS-componentized as well.

Bug: chromium:1106251, chromium:1096230
Change-Id: I2f8a977f4e3f701905354cb4edb15702cb8cd2a3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2336723
Commit-Queue: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-08-11 13:52:51 +00:00
Paul Lewis 7e3e7bb351 Early exit from copy-file(s).js
Now that we have copy functions that do not create hardlinks in gen, it
shouldn't be necessary to remove the target file before writing. This CL
removes the unlinking and early exits.

Change-Id: I8e099224479458d446977f930065b4c54a3d0ac6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2334972
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-08-11 11:53:41 +00:00
Jack Franklin 2924ca1425 Add enum generation to bridges
This CL adds the ability for the bridges generator to parse a TypeScript enum
and generate the appropriate JS and typedocs on the Closure side in the bridge.

Change-Id: Icc748053de96c07e931406915ac33396ab5bf141
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2349171
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-08-11 11:42:11 +00:00
Alex Rudenko a39d214440 Layout pane
This CL adds a new layout panel to the sidebar in Elements. Currently,
the pane only displays CSS Grid settings. In the future, the list of
all CSS grids will show up above the settings. The new panel is behind
the CSS Grid experiment flag.

Screenshot: https://i.imgur.com/T5Kd5Wi.png

Bug: 1109177
Change-Id: I7b5620ce6818df68d1f9cb36975be3679ca16837
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2317315
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Brandon Goddard <brgoddar@microsoft.com>
Reviewed-by: Patrick Brosset <patrick.brosset@microsoft.com>
Reviewed-by: Peter Müller <petermueller@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2020-08-11 05:46:01 +00:00
Paul Lewis 7b17f160f7 [global] Stage second impl of ThemeSupport
Theme Support is currently in the ui/utils subdirectory. This ultimately
creates a circular dependency when we move to accessing it via imports
rather than by the global namespaced version. This CL creates an inert
copy of the Theme Support logic in the top level folder, and a future CL
will migrate all call sites to this version and remove the current
implementation in ui/utils.

Change-Id: I628b335dcc34fba29c79d11e4180593bb936f798
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2346370
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-08-10 15:44:55 +00:00
Jack Franklin 12bc13e26d Add enum parsing support to component bridges
This CL introduces the parsing aspect of adding TS enum support to the component
bridges generation code. It _does not_ add full support for them, we still do
not output anything into the generated bridge, but I'm splitting it up into
smaller CLs.

This CL makes the tree walker understand and be aware of enums such that we can
then generate the relevant Closure doc comments (which will be in a follow-up
CL).

Change-Id: I5c91bb6bac291eef1aa99e685bbdee55e82ccd48
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2346369
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-08-10 15:16:25 +00:00
Jack Franklin a6e1d2d160 Fix type reference detection in bridge generator
This CL fixes one particular case when the AST traversal wasn't thorough
enough; if you extend an interface, we need to also check the interface
that's being inherited from for any types that need to be pulled into
the bridge.

For example:

```
interface A {...}
interface B {
  a: A
}
interface C extends B {
  ...
}
```

If the bridge generator decides that interface `C` should be in the
bridge, we need to walk through its parents (in this case, `B`) to check
for any other nested type references that should be included in the
bridge. In this case, because `B` references the `A` interface, we need
to add the `A` interface to the bridge.

Change-Id: Id211e2e02c12fed9ebb7c6456640bf87c3be70ac
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2339560
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-08-06 16:11:17 +00:00
Jack Franklin b2d32f12d2 Tidy up type reference look-ups in bridges
This CL moves the logic for looking up a reference to one place in the component
bridges. This is needed as soon we're going to support enums and we need to be
able to easily look up a string reference and find the right interface/type
alias/enum.

Change-Id: I108d84be8343989b0b94e51431bf79af4a7f7afb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2339555
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
2020-08-06 11:54:27 +00:00
Paul Lewis 20d9bb09b4 Update copy paths to be absolute
The path wrangling we do for copy-files.js does not work on all builds.
This CL updates the paths to use absolute ones everywhere.

Bug: 1113321
Change-Id: I7d8c3bb500ee4fcff6d4b564c17230bafb6b9b2f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2339528
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-08-06 10:11:57 +00:00
Jack Franklin 0c0cfd6d04 Component bridges: support interface inheritance
Extends the bridges to support interfaces extending others, much like we allow
for types.

Change-Id: Ia502005c47350779076ce5645e79d406f5525fbc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2339320
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-08-06 08:58:47 +00:00
Jack Franklin c5986015e1 Fix extra typedef braces for union types
The bridges generator had a bug where all typedefs were wrapped in two
pairs of braces, rather than just one.

You only want two braces when you're defining an object type def, not
for any other cases.

Change-Id: I1a4f606b2305265824def2c7b290a430cba892f5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2336807
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-08-05 10:36:21 +00:00
Jack Franklin 580a4b1d52 Script to re-generate all bridges
This script will regenerate all _bridge.js files, which will be useful when we
come to fixing bugs in the generation and need to apply that across the entire
codebase.

Change-Id: Id2a12f9b134564f221ff49d7beb92861544c0dcf
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2332809
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
2020-08-04 22:35:39 +00:00
Jack Franklin 0df663714f Bridges: fix complex type finding across imports
This CL fixes a bug where the code that hunts for nested interfaces ran
_before_ we parsed any extra interfaces that come from imported modules.

The fix is to run the code that hunts for nested interfaces _after_ we
gather all potential interfaces from all the imports referenced.

Change-Id: I776007671a4f3801b0fe1e83fb01d7f009a93f77
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2336720
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-08-04 14:07:03 +00:00
Paul Lewis de0d0a288f [TypeScript] Ensure no hardlinks before tsc runs
When TypeScript writes to pre-existing files, it will overwrite the
contents, but it won't create a new file per se. If files in gen/ were
previously created by devtools_pre_built they will be hardlinked to the
original source file, thus any changes tsc makes to the file in gen will
be reflected back to the source. This causes an issue with ninja, since
it believes on the next run that the source file has changed.

This CL updates the behavior of devtools_pre_built such that it no
longer calls gn's copy, but rather a node utility that ensures that
there is a freshly minted copy of the file rather than a hardlink.

Change-Id: I11a23fce764101eb237e434a64159223ef8d700e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2335277
Auto-Submit: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-08-04 08:36:03 +00:00
Paul Lewis 2828f7640e Unlinks files for devtools_entrypoint
Inside of devtools_entrypoint we use gn's copy command. This generates
hardlinks, which can sometimes mean that incremental builds get into a
broken state. This CL changes those copy commands over to being node
actions that ensure the files are copied rather than hardlinked, and it
also unlinks files before writing them (if they exist) to prevent the
case where hardlinked files are overwritten.

R=jacktfranklin@chromium.org

Change-Id: I86a1f351780afc3ac725c690866b4ac9dd649fd1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2335056
Auto-Submit: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-08-03 12:51:08 +00:00
Jack Franklin 30cf061187 Align bridges generator with Clang format
The bridges were outputting functions as:

`x() {}`

But Clang would change that to:

```
x() {
}
```

It was a bit annoying that everytime the bridge file changed the
presubmit would fail as it reformatted, so this change brings the
bridges fully in line with Clang (e.g. a presubmit shouldn't make
changes to it).

Change-Id: Ie27a73b3d2933cf967c320d3c7c6122e4d6d806d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2332810
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-08-03 09:53:57 +00:00
Jack Franklin 3186e69eb7 Component bridges: export the generated class
When TS tries to generate d.ts files, it needs the class to be exposed
so it can reference it.

Change-Id: I073d25d6673a9a9f26879a8645643a23e37b161a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2329773
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
2020-07-31 14:22:20 +00:00
Philip Pfaffe 7d128bd540 [eslint] Ensure that linting doesn't crash on a custom it.skip
Change-Id: I3fc841a4c0e34b1c29686157ba3089e620036f51
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2332230
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-07-31 13:35:59 +00:00
Peter Marshall a29e76f622 tests: Use source maps for better error output for e2e tests
Explicitly depend on the source-map-support package. Other packages
already used this indirectly so the files already exist in node_modules.

Add source-map-support/register to the require list for mocha which
means every e2e test will have source mapped error stacks by default.

Bug: 1104096
Change-Id: Id185ee76e82c100f1f763195673759f3f2319090
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2332222
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
2020-07-31 12:45:19 +00:00
Jack Franklin 425100947a Fix errors with Object type in component bridges
The component bridge code would think `Object` is a type that it needs
to define as a Closure typedef but in fact it doesn't, it's built-in to
TS and maps to Closure's Object type. So if we find any, don't try to
define them to be converted, and instead output it directly as an
`Object` in Closure.

Change-Id: Ied707d131b95a8f595832f6e2080722f49522efb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2329778
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
2020-07-30 16:20:30 +00:00
Jack Franklin 4e556fa817 Copy sourcemaps into resources/inspector in is_debug mode.
This introduces the change that was reverted in https://crrev.com/c/2310810,
with the fix for the revert issue.

DISABLE_THIRD_PARTY_CHECK=ts library change

Change-Id: Ibf4e6e6167b8fce56c83afa7319389fa5520db38
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2325215
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Brandon Goddard <brgoddar@microsoft.com>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-07-29 15:36:14 +00:00
Jan Scheffler f3277b2ec7 Add _sources suffix to ensure sorting in .gni files
This cl adds a _sources suffix to make sure files are sorted in
all_devtools_modules.gni and devtools_module_entrypoints.gni
[see: https://gn.googlesource.com/gn/+/master/src/gn/command_format.cc#386]


Change-Id: I21962895f7b72f1052c89b30cefdc843f7b36624
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2318263
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2020-07-28 11:53:11 +00:00
Jack Franklin db4aae28e7 Include nested interfaces when extending types
This CL fixes a bug in the bridges generation where nested types would
not correctly be added to the bridge when they were referenced via an
extended type.

For example, consider this code:

```
interface Detail {
  id: number;
}

type NamedThing = {
  name: string;
}

type Person = NamedThing & { details: Detail[] };
```

The bridges generator will correctly recognise that it needs to define a
`Person` typedef that includes all the members of `NamedThing` and also
the `details` field. But without this CL it will not realise that the
`Detail` interface is also referenced and therefore needs to be added to
the bridge.

This CL ensures when we extend types that we check their members for any
interfaces that are also required.

Change-Id: I5cf0de3ebc63dd56e71af8284ba6fe9fc10b396e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2320836
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-07-28 11:37:51 +00:00
Jack Franklin 7a25be0377 Make cross-reference script show errors
I had a bad gn file and running the cross-reference script didn't show
that but instead treated it as if gn knew of no dependencies and
therefore gave me a huge output of JS files that were not declared as gn
deps.

If the script gets an error, it should bail and log that error rather
than treat it as if there were no gn deps found.

Change-Id: I5672e97581659836adbf2fc1aa4fc5f837b78835
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2317308
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-07-28 08:54:01 +00:00
Mathias Bynens 4a0d19365c Reland “De-obfuscate X-Client-Data header values in Network tab”
Reland of: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316062

Screenshot: https://i.imgur.com/LJHFIp9.png
Note that the screenshot shows this as a response header instead of a
request header, since that was easier to test. In real-world scenarios
it would be a request header instead, but the UI looks the same.

CL preparing the ClientVariationsParser for use in the DevTools UI:
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316065

TBR=isherman@chromium.org,mathias@chromium.org,changhaohan@chromium.org,alexrudenko@chromium.org

Bug: chromium:1103854
Change-Id: I6b959a1d57bcbc84f8571257a88fcbec805bf330
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2318257
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-07-28 06:54:51 +00:00
Kalon Hinds 1ed85887c9 Detect URL-only strings in localizability check script
This patches adds a localizability check that detects and errors on
URL-only strings that are localized. Since URLs cannot be translated
there's no purpose in creating and maintaining grdp file entries for
them.

Change-Id: I3228f2935f54c839833822fd61374d3ce4ea68c7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2319836
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Commit-Queue: Kalon Hinds <kahinds@microsoft.com>
2020-07-28 00:00:20 +00:00
Jack Franklin 1e26f876a4 Component bridges: support overriding fields
Now the bridges generator supports extending types it also has to be
wary of types that override existing fields. For example:

```
type Person = { name: string, age: number};

type Jack = Person & { name: "jack" }
```

When we convert that to Closure, the bridges script needs to recognise
that the `Jack` type overrides the `name` field from Person, and
generate Closure that has:

```
* name:"jack"
* age:number
```

This CL makes that change by first collecting all members when we
extend, weeding out duplicates, and then converting them to Closure.

Change-Id: Iacd7fbf39844515257d2c331d6c4c4454b3bba60
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2318261
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-07-27 15:15:37 +00:00
Jack Franklin 132769c3d3 Component bridges: support types that extend types
With this change we support:

```
type Person = {}

type SomeOtherPerson = Person & {...}
```

Closure doesn't have a concept of types being extended, so the bridges
code will instead parse all the types and generate a new type for
Closure made up of all the members of any types that are extended.

Note that this CL does _not_ add support for interfaces that extend
another, ONLY types. Interface extending is coming in a follow up CL.

Change-Id: I3f8253663430d16f28f1bdc3c40e582d8ff09248
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2318258
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-07-27 13:18:17 +00:00
Mathias Bynens 43af8ef5d3 Revert "De-obfuscate X-Client-Data header values in Network tab"
This reverts commit d63cf4f023.

Reason for revert: [5770:5770:0726/142022.954931:WARNING:devtools_ui_data_source.cc(206)] Unable to find DevTools resource: third_party/chromium/client-variations/ClientVariationsParser.js

Original change's description:
> De-obfuscate X-Client-Data header values in Network tab
> 
> Screenshot: https://i.imgur.com/LJHFIp9.png
> Note that the screenshot shows this as a response header instead of a
> request header, since that was easier to test. In real-world scenarios
> it would be a request header instead, but the UI looks the same.
> 
> CL preparing the ClientVariationsParser for use in the DevTools UI:
> https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316065
> 
> Bug: chromium:1103854
> Change-Id: Ifb63c011df2ea7af8aeb47dd615e2b20863a02c1
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316062
> Reviewed-by: Ilya Sherman <isherman@chromium.org>
> Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
> Reviewed-by: Changhao Han <changhaohan@chromium.org>
> Commit-Queue: Mathias Bynens <mathias@chromium.org>

TBR=isherman@chromium.org,mathias@chromium.org,changhaohan@chromium.org,alexrudenko@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: chromium:1103854
Change-Id: Id405f5991fd33a4dff5dd13c44da5ac3e67609cd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2318251
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-07-27 11:15:07 +00:00
Jack Franklin 6fd3bb5abf Component bridges: Support nested interfaces/types in unions
This CL ensures that if a component has `type X = A|B` we will include
not only type `X` but also both `A` and `B` in the generated `_bridge`
file.

Change-Id: I580c9a221da7e753ae1313391d21db6e2fb4bacb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2318250
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-07-27 10:42:37 +00:00
Jack Franklin 2bad4bcfb0 Add support for type X = to component bridges
We previously only looked for interfaces, but sometimes we use types, so
now we support both.

There's still features that aren't supported - e.g. if you extend a
type, that won't work, but that's next on the list. Similarly we don't
parse union types to see if they contain other types, but that will also
be done in another follow-up CL. It's easier to incrementally add these
features than do them in one big go.

Change-Id: Ifa9c647b4b261a1ea1ca237d554733fed23221da
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2318247
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-07-27 09:43:37 +00:00
Jack Franklin 6ac73e3ba7 Add support for type aliases to component bridges generation
There's more to be done here - we don't support nesting these yet, but this is a
good start. I'm splitting all the work up into smaller CLs rather than add ALL
THE FEATURES in one go. Bug:

Change-Id: I4c39f336570b16835f082bb7b8a5b7f1608ec234
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316307
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2020-07-27 06:48:16 +00:00
Mathias Bynens 4ceefeb36e Add support for rolling ClientVariationsParser.js
Bug: chromium:1103854
Change-Id: Ie5cebb77290727aadf9e3074f4c95306119df17c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316074
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-07-25 08:16:54 +00:00
Jack Franklin 40876b86f0 Fix interface detection in union types in component bridges generator
If a setter took an object literal where the value was a union type
(e.g. `foo: Foo|null`) we would ignore it, and as such the bridge generator
would not include `Foo` in the bridge. This CL adds a check for union types
where we loop over each member and check if there's an interface in there.

Change-Id: I23039dea3af12d1bd0f3a3382e320a8c053cacc1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2317317
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-07-24 13:44:53 +00:00
Jack Franklin f037a3d352 Improve bridges generation interface detection
This CL fixes the component bridges so that it can find nested interfaces. That
is, if it sees:

```
interface Foo {
  bar: Bar
}
```

Before this CL only the `Foo` interface would end up in the _bridge.js as a
Closure typedef. Now, with this CL, it will also include the `Bar` interface in
the _bridge.js file too.

Change-Id: I87a614fd5620c6572a062458a3e4b7dd30ca86e6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316066
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-07-24 13:28:23 +00:00
Mathias Bynens d63cf4f023 De-obfuscate X-Client-Data header values in Network tab
Screenshot: https://i.imgur.com/LJHFIp9.png
Note that the screenshot shows this as a response header instead of a
request header, since that was easier to test. In real-world scenarios
it would be a request header instead, but the UI looks the same.

CL preparing the ClientVariationsParser for use in the DevTools UI:
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316065

Bug: chromium:1103854
Change-Id: Ifb63c011df2ea7af8aeb47dd615e2b20863a02c1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316062
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-07-24 09:04:39 +00:00
Mathias Bynens 718ac79a11 Integrate client variations parser
This patch configures the Closure typings and makes it possible to use
ClientVariationsParser.js in DevTools UI code.

These changes have already been reviewed [1], but they are now split
into a separate CL.

[1]: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316062

TBR=alexrudenko@chromium.org,changhaohan@chromium.org

Bug: chromium:1103854
Change-Id: Ic94d9c93727f3b6251d684bf3960e3a9de8f1392
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316071
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-07-23 16:41:08 +00:00
Jack Franklin 15a98cd148 Use local tsc for cross-referencing script.
So that we don't depend on people having TypeScript installed globally.

Change-Id: Iaaf0a5c1c28fe5775bc58a67289906df4391db84
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316069
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-07-23 15:55:18 +00:00
Mathias Bynens 4e81261c93 Revert "Integrate client variations parser"
This reverts commit 4efee5ce8a.

Reason for revert: causes build warning

Original change's description:
> Integrate client variations parser
> 
> This patch configures the Closure typings and makes it possible to use
> ClientVariationsParser.js in DevTools UI code.
> 
> These changes have already been reviewed [1], but they are now split
> into a separate CL.
> 
> [1]: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316062
> 
> TBR=alexrudenko@chromium.org,changhaohan@chromium.org
> 
> Bug: chromium:1103854
> Change-Id: Ia6533cbed8e33627109f244af67c122c2b2d2b2f
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316065
> Reviewed-by: Mathias Bynens <mathias@chromium.org>
> Commit-Queue: Mathias Bynens <mathias@chromium.org>

TBR=isherman@chromium.org,mathias@chromium.org,changhaohan@chromium.org,alexrudenko@chromium.org

Change-Id: Ife1a02ac07edc9fefb4fcf0f43a3a032300cf2b9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1103854
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316067
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-07-23 15:24:59 +00:00
Mathias Bynens 4efee5ce8a Integrate client variations parser
This patch configures the Closure typings and makes it possible to use
ClientVariationsParser.js in DevTools UI code.

These changes have already been reviewed [1], but they are now split
into a separate CL.

[1]: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316062

TBR=alexrudenko@chromium.org,changhaohan@chromium.org

Bug: chromium:1103854
Change-Id: Ia6533cbed8e33627109f244af67c122c2b2d2b2f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316065
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-07-23 15:05:08 +00:00
Paul Lewis 2f7079da66 Adds more cases for TS/GN cross-reference
TBR=jacktfranklin@chromium.org

Change-Id: Ib80f21e3410179e305b8fe7433658738144a03af
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316064
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-07-23 13:46:58 +00:00
Paul Lewis a1448c2f77 Adds cross reference script
It is possible for TypeScript to import a file that is not included in
the corresponding devtools_entrypoint as a dependency. In many cases
this would likely cause the build to fail, but it's also possible that a
dependency might have been provided as a dep of another entrypoint.
Given that ninja parallelizes builds this results in a race condition
where on some builds the dependency that wasn't declared is there, and
on some builds it is not. This is further complicated if build artifacts
from previous builds are kept around.

This CL introduces a script that can be run manually that cross
references the files that GN knows about, and the files that TypeScript
expects to be able to import. Any files expected by the TypeScript
compiler that are not declared in the BUILD.gn (even indirectly as a
dep of a dep etc) will be flagged.

Change-Id: Ieb95600f11bfc20e0e71d8792a7f344b13a0fb8e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2316063
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-07-23 13:15:28 +00:00
Simon Zünd 94beb690c0 Use 'forward_variables_from' in 'devtools_module'
This CL changes 'devtools_module' to use the standard way of
copying properties from the invoker. Not all devtools_module will
provide 'deps'. The current code assumes its always there, so modules
have to provide an empty deps list, otherwise we get build errors.

R=jacktfranklin@chromium.org

Change-Id: I49fd82ab1e54816c02fb99eccb70287d845b8233
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2310457
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2020-07-22 13:23:30 +00:00
Johan Bay 9dd9a4b882 Roll Puppeteer from v4.0.0 to v5.2.1
DISABLE_THIRD_PARTY_CHECK=updating node_modules deps

Change-Id: Ic6a2b99314bc3cd05f6283e261d8aa952bc56984
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2310451
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-07-22 06:54:36 +00:00
Brandon Goddard 55b591c650 Revert "Copy sourcemaps over in is_debug mode"
This reverts commit 9702c2c5dc.

Reason for revert: On Windows, this is failing to gn gen with is_debug = true with the following error: https://imgur.com/g3g4ADu

I bet the issue could be the source maps being copied over with fwd slash instead of os specific path separators


Original change's description:
> Copy sourcemaps over in is_debug mode
>
> DISABLE_THIRD_PARTY_CHECK=typescript library change
>
> Change-Id: I993b8a3c742cc7feea1ae1dee250aad7469eb22b
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2302069
> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
> Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>

TBR=sigurds@chromium.org,tvanderlippe@chromium.org,jacktfranklin@chromium.org

Change-Id: I0e4c1b308beee837f6be1b2e642350656fb284d4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2310810
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
Reviewed-by: Jack Lynch <jalyn@microsoft.com>
Reviewed-by: Brandon Goddard <brgoddar@microsoft.com>
Commit-Queue: Brandon Goddard <brgoddar@microsoft.com>
2020-07-21 19:03:55 +00:00
Jack Franklin 9702c2c5dc Copy sourcemaps over in is_debug mode
DISABLE_THIRD_PARTY_CHECK=typescript library change

Change-Id: I993b8a3c742cc7feea1ae1dee250aad7469eb22b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2302069
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-07-21 15:12:12 +00:00
Paul Lewis 1434e6f967 Changes ninja hardlink copy for file copy
The internal ninja copy action is, for Linux and Mac, the creation of a
hardlink. In the case of an is_debug = false build, we copy the
devtools_entrypoint file with ninja to the gen folder. However, should
the file then change in the gen folder, those changes will be reflected
back in the original source file since the two are hardlinked. This does
happen when the JavaScript file moves to being managed by the TypeScript
compiler, for example, because tsc often changes blank lines and adds
sourcemap information to the file. If the gen folder is empty and no
hardlink exists prior to build, there are no issues. If, on the other
hand, the hardlink exists, and the TypeScript compiler runs, the file
written in the gen folder will update, and then so will its original
source.

The ways to resolve this reflection back to the source folder is either
by deleting the gen folder before rebuilding (where one anticipates
changes being reflected in source), or, instead of using the ninja copy,
using an action to call out to a script that will ensure that a new file
is created and not hardlinked.

This CL chooses the latter path.

Change-Id: Id2cc8acdc240eb73ac736ddaf6f1eabdd08f8359
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2308534
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-07-21 14:34:02 +00:00
Paul Lewis 839037fe83 [TypeScript] disallow explicit any
This CL explicitly disallows use of the `any` keyword via eslint. This
is to make sure we don't accidentally miss typing info. This CL also
adds eslint-ignore statements for existing uses of any (mostly in tests)
as well as fixing a few cases where the types were simple enough to add
quickly.

R=jacktfranklin@chromium.org

Change-Id: Ia913a30d63c1ae3d969785af332a8dde512cc275
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2308544
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-07-21 14:31:32 +00:00