Commit Graph
566 Commits
Author SHA1 Message Date
Tim van der Lippe 19a45dfd55 Remove is_legacy_javascript_entrypoint
This removes the now-obsolete is_legacy_javascript_entrypoint build flag,
which was used as part of the devtools_entrypoint migration.

This uncovered that accessibility was still using devtools_pre_built
and a file was missing from the GRD variable.

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

Fixed: 1101738
Change-Id: Ie1556ccc1d1563c855417de18e896308de0cfe19
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2356305
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-08-28 12:32:29 +00:00
vidorteg 1fd76f85b1 Reland "Localization: creating and integrating i18n module"
This reverts commit 8f012723b7.

The cause of the i18n not working on debug configuration was that
some files were missing from the grd lists.
- Added i18nImpl, i18n-bundle.js with a similar process to the rest
  of the modules.

To make it easy to review:
the first patchset contains the reland with no modifications the >2 patchset
contains the fixes, so if you diff Patchset 1 vs > 1 you should see the fixes
described above.

Change-Id: Iee3767b6afeb1a039be952f787886f94c0752f56
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2376945
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-08-27 16:46:17 +00:00
Yang Guo 8f012723b7 Revert "Localization: creating and integrating i18n module"
This reverts commit 5bba7de065.

Reason for revert: breaks `gn gen out/Default` for a fresh build.

Original change's description:
> Localization: creating and integrating i18n module
> 
> This CL is part of the Infrastucture phase, it:
> - Creates an i18n module that contains devtools custom wrappers for
>   third_party/i18n library.
> 
> Change-Id: I259110f36349ff7e11501ae576852b6ae20425ee
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2309709
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Simon Zünd <szuend@chromium.org>
> Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>

TBR=petermarshall@chromium.org,aerotwist@chromium.org,szuend@chromium.org,vidorteg@microsoft.com,chrche@microsoft.com,tvanderlippe@chromium.org

Change-Id: I4283ba8d92aeafb6d05e6a05f68fbd5e3b22956f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2375198
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
2020-08-25 20:53:34 +00:00
vidorteg 5bba7de065 Localization: creating and integrating i18n module
This CL is part of the Infrastucture phase, it:
- Creates an i18n module that contains devtools custom wrappers for
  third_party/i18n library.

Change-Id: I259110f36349ff7e11501ae576852b6ae20425ee
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2309709
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
2020-08-25 16:28:51 +00:00
Wolfgang Beyer cdedf581e5 Revert "Update Mocha and rollup-plugin-terser"
This reverts commit ecc4ecb65c.

Reason for revert: This CL is suspected of breaking the roll into
chromium (https://crbug.com/1121242#c2).

Original change's description:
> Update Mocha and rollup-plugin-terser
> 
> These two packages had NPM advisories filed against them. Luckily,
> we can upgrade to versions where they are fixed.
> 
> The upgrade of rollup-plugin-terser includes the upgrade to Terser 5.
> Looking at its changelog (https://github.com/terser/terser/blob/master/CHANGELOG.md#v500-beta0)
> we seem to not be affected. Our build also works as expected.
> 
> DISABLE_THIRD_PARTY_CHECK=Update node modules
> R=​petermarshall@chromium.org
> 
> Change-Id: I6974a73d92a1a210b705246053be5c2af268605b
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2372148
> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
> Commit-Queue: Peter Marshall <petermarshall@chromium.org>
> Reviewed-by: Peter Marshall <petermarshall@chromium.org>

TBR=petermarshall@chromium.org,tvanderlippe@chromium.org

Change-Id: I969ca281c77d299038332f93ffd477925e191073
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2374207
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Commit-Queue: Wolfgang Beyer <wolfi@chromium.org>
2020-08-25 08:29:20 +00:00
Tim van der Lippe ecc4ecb65c Update Mocha and rollup-plugin-terser
These two packages had NPM advisories filed against them. Luckily,
we can upgrade to versions where they are fixed.

The upgrade of rollup-plugin-terser includes the upgrade to Terser 5.
Looking at its changelog (https://github.com/terser/terser/blob/master/CHANGELOG.md#v500-beta0)
we seem to not be affected. Our build also works as expected.

DISABLE_THIRD_PARTY_CHECK=Update node modules
R=petermarshall@chromium.org

Change-Id: I6974a73d92a1a210b705246053be5c2af268605b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2372148
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-08-24 12:14:14 +00:00
Tim van der Lippe 662c01bba2 Remove ProtocolProxyApiWorkaround
The upstream issue has been fixed in TypeScript 4 and therefore this workaround
is no longer necessary.

R=sigurds@chromium.org

Change-Id: I4a831566f3a7f7756f8938668c38e5fabe2ca14c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2367947
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
2020-08-21 14:10:19 +00:00
Tim van der Lippe 5f83b28dd7 Update TypeScript to 4.0.2
DISABLE_THIRD_PARTY_CHECK=Updating TypeScript
R=szuend@chromium.org

Fixed: 1120303
Change-Id: I342cfacaf25c4b450bb00703454fe69db4b6f3cb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2367944
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2020-08-21 13:17:14 +00:00
Jack Franklin 314b8c8aea Fix empty function bodies in component bridges
If we have a helper method that returns data, TS will moan about there
not actually being a return in the function body. Adding code that
throws an error fixes this and is safe as this bridge code is never
executed, it exists to satisfy our compilers.

Change-Id: Iff34733adac4267ff04aff1ba0bb58a38c71dd6b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2366794
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-20 09:54:55 +00:00
Ilya Sherman a46c048cda Pull code for formatting the X-Client-Data header from Chromium/upstream
This is the devtools side of https://chromium-review.googlesource.com/c/chromium/src/+/2360517

R=mathias

Bug: chromium:1103854
Change-Id: I5ec32a4e84a0f873ec5372579728a94f47a83463
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2361093
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Auto-Submit: Ilya Sherman <isherman@chromium.org>
2020-08-19 05:25:27 +00:00
Jack Franklin c6b0252897 Component bridges: error if using TS built-in type
Because the bridge generator won't try to generate built-in types, if
you use one in your component, it won't be replicated in the bridge. So
if we see this let's error loudly.

Change-Id: Ifea063f134e77a66c9d5d2bbb7553e0beb5564db
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2362574
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-08-18 16:54:39 +00:00
Jack Franklin d0022b00cf Improve public methods support in bridges
- Error if a method doesn't have an explicit return type.
- Correctly generate `@return {void}` from a :void annotation
- If a public method returns an interface, add that to the list of
  interfaces to convert.
- Update all tests and fixtures accordingly.

Change-Id: I9b9aba451d04f714951b793faeec8979bac4fb8a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2362567
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-08-18 11:45:38 +00:00
Jack Franklin a6a4ad6fdf Copy devtools_entrypoint sourcemaps into resources
Fixed: 1115876
Change-Id: I9b797acc355129e2f97a94a06001f3bd82b0299b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2354091
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-08-18 10:26:28 +00:00
Jack Franklin 384827a10c Add supports for Sets to TypeScript bridges
Change-Id: Id9093812be0d6d72eb71e2ae4bb240fff87f7d1b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2360023
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-08-17 14:59:56 +00:00
Jack Franklin 2137e8afdc Support HTML element types in component bridges
Change-Id: I44e4c1dd44b5a46cc612853facd6e764e39d4020
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2360014
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2020-08-17 10:42:56 +00:00
Jack Franklin 3094061f12 Add support for Map to component bridges
Change-Id: I76dc254dee9e25d2cbc46ae1d26f704598819dcd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2360011
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Changhao Han <changhaohan@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2020-08-17 09:47:26 +00:00
Peter Marshall f8f4ea4e9f tests: Add a lint check for it.repeat()
We don't want these accidentally committed.

Bug: 1101782
Change-Id: I67a820bbaa6b8a8d1cb4a1a6afdb29bc8dacdc5e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2354107
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-08-17 08:04:25 +00:00
Peter Marshall 467b0b1632 tests: Use mocha-extensions in e2e tests
The extensions have helpers like it.repeat() and async tracing which
make development and debugging easier. All the tests will import from
the extensions file now rather than mocha directly.

A follow-up CL will add lint checks for this.

Bug: 1101782
Change-Id: I7b1a540be1685375b06f1db5d0fda2f2879446c2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2354104
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-08-17 07:37:56 +00:00
Alex Rudenko 4632dfbde7 Support enum members as types
This CL adds basic support for enum members being used as
types. For example, the following

{ prop: MyEnum.MEMBER }

will be compiled to Closure as

{ prop: MyEnum }

allowing us to write type-safe TypeScript while the
Closure types will be less safe.

Change-Id: Ica67c1d3c8c5447572d14288df339e79c7df5f70
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2354094
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-08-13 16:18:50 +00:00
Brandon Goddard 331043706c Add Presubmit for Devtools Experiment Telemetry
This CL adds a new Presubmit check that ensures that all devtools
experiemnts that are registered in MainImpl.js are also placed
in the UserMetrics.js file so that they have telemetry registered.

Explainer:
https://docs.google.com/document/d/1pcvN11C4onSXqOE0dTjUUHodMj55bRVl_5_e3kMg_rs/edit?ts=5f2329dc#heading=h.ezo3vjjctj8w

Bug: 1107636
Change-Id: If7ca22ef641b037717b808b7c57cc57c6f502536
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2341797
Commit-Queue: Brandon Goddard <brgoddar@microsoft.com>
Reviewed-by: Kalon Hinds <kahinds@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Patrick Brosset <patrick.brosset@microsoft.com>
2020-08-13 16:10:50 +00:00
Jack Franklin a22614c51d Regenerate all bridge files
* Adds a MANUALLY_EDITED_BRIDGE note on LayoutPane pending improved enum supports.
* Makes the regen script run clang-format to avoid diffs that are only formatting.

Change-Id: Ie5768c24a61bb3809b6bf337348d604aa4c17cd2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2354099
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
2020-08-13 14:42:01 +00:00
Jack Franklin f20a184a01 Log errors when regenerating all component bridges
Without this change if you run regenerate-all-component-bridges and one
of the files causes an error, that will stop execution immediately. This
CL means the rest of the component bridges will still be regenerated,
and we'll log out the error for the component that caused the problem.

Change-Id: I26627f0836f7684bb28d45ea50ff19ef692e98dd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2354097
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-13 13:38:20 +00:00
Jack Franklin 2b34a92342 Fix bridges generation of non-nullable types
A previous CL fixed a bug where type references in Closure typedefs were not
prefixed with ! correctly. However, that fix was a little eager, and started
prefixing functions and nullable types with ! too, which is incorrect.

This CL fixes that and adds some test cases, as the fact that the previous CL
landed is a clear sign we were missing test coverage of those specific cases.

Change-Id: I17bde9138fd04b0e2b6087a1008d99b603884e8b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2354095
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-13 11:37:30 +00:00
Jack Franklin e5d1555020 Remove string literal support from bridges
Closure has no equivalent for a literal string type (e.g. `type X = "a"`).

Previously the bridges code would generate these but now we error loudly.

Note: this CL does not go through all the bridges and update them; that
will be done in a follow up CL.
Change-Id: I42652e31787173f1707a533085b39e7e841f6857
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2351778
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-08-13 11:13:20 +00:00
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