Commit Graph
342 Commits
Author SHA1 Message Date
Philip Pfaffe a63b9e9d60 Land symbol server backend
Bug: chromium:1013513
Change-Id: I9dee892cc591081c51ed2a094dcfef63e4386c48
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2157027
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Reviewed-by: Eric Leese <leese@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
2020-04-30 17:56:46 +00:00
Sigurd Schneider ba81851dad [issues] Add IssueManager abstraction
This CL adds a central singleton that collects all issues from all
known targers. This singleton is then used by the issues view to
display issues.

This change enables correct handling of issues that arise from OOPIF
and worker sources.

Fixed: chromium:1073797
Change-Id: I75a8bb46d240f63df013c0b06506cad7fb2e5a8f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2168885
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2020-04-29 11:14:55 +00:00
Jack Franklin c6577bae1c Add support for Platform.UIString calls in GRDP parsing
Now UIString is defined in Platform [1] we need to update the GRDP
parsing code to look for calls to it rather than `Common.UIString`.

We still support `Common.UIString` so this CL extends the script to look
for:

1) Usage outside of Platform:

```
import * as Platform from '../platform/platform.js';

Platform.UIString.UIString('foobarbaz');
```

2) Usage inside of Platform:
```
import {UIString} from './UIString.js';

UIString('foobarbaz');
```

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

Change-Id: I8c0f97817709e936bdddce8f0b60d759e80fd1ba
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2170067
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
2020-04-28 14:13:33 +00:00
Tim van der Lippe 96de606848 Start with typechecking sdk/NetworkManager.js
Throughout this process we learned the following:
- The magically generated agents need to be properly exposed
on the target, rather than setting them on the TargetBase prototype.
- We need to rename the protocol proxy api definitions to use
the invoke_ naming, such that we can use structured request bodies.
This will allow us to no longer rely on parameter ordering and
does not require additional changes to the underlying Closure
generated code.
- Instead of using a symbol as an index on a different class, use
a WeakMap to keep track of the link between the NetworkRequest
and the NetworkManager. This breaks the circular dependency and
allows us to remove the lookup with the symbol

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

Bug: 1011811
Change-Id: I6cf25533b32793636d970b0a6c108f739d4e757e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2167868
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-04-28 13:37:23 +00:00
Mathias Bynens 8555df09c4 Make scripts/deps/*.py executable
This patch makes `scripts/deps/*.py` executable so that they can be
invoked directly without the need to explicitly invoke Python.

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

No-Presubmit: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165756
Change-Id: Ifeda6045b366a90bae5be1d43373e512e8c22197
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165796
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2020-04-27 14:43:36 +00:00
Tim van der Lippe fcf8179a6a Fix issues with SDK compilation
Even though we were using the SDK files in the unittests for SDK,
not all files were included. A CL which attempts to use sdk.js (e.g.
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165757)
would then fail on several generated .d.ts issues.

Issues fixed:
- Usage of `Object` instead of `Map` causing issues with a type
alias of `string`, since TypeScript object notation only allows
primitives to be used as indices.
- Missing return types for function types
- A reference to `Protocol.NetworkAgent` which does not exist on
the protocol. Instead, that is part of the protocol-proxy-api.
Therefore, we must include the declaration file in the ts_library.
This also showed that the `ProtocolApi` needs to be exported
instead of declared.

This means that for any future reference to any Protocol type
that is actually an agent, we should be using the
`ProtocolProxyApi` definitions instead. To make sure Closure
understands that type, I aliased it in the externs.

R=jacktfranklin@chromium.org
CC=​sigurds@chromium.org,szuend@chromium.org
DISABLE_THIRD_PARTY_CHECK=Typescript fixes

No-Presubmit: true
Bug: 1011811
Change-Id: I4f5a488edb2d5fa6c5ed12d33411efb5f7fb8133
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165795
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-04-27 14:22:46 +00:00
Jack Franklin 93f52244c5 Reland "Move UIString into Platform"
This is a reland of 992295e37d

Original change's description:
> Move `UIString` into `Platform`
>
> Platform is the "lowest" part of DevTools - e.g. it depends on nothing.
>
> We have code we want to move to Platform but cannot because it needs
> `ls` and therefore creates a circular dependency. So this CL moves
> UIString into Platform.
>
> To avoid rewriting a lot of imports we re-export it from `common.js`.
>
> Change-Id: I399bbe8593e043148c4c7e51f598cbd73a89f639
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165758
> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Paul Lewis <aerotwist@chromium.org>

Change-Id: I482323d1b35eb38066a571cb8630078b6cff6cde
TBR=aerotwist@chromium.org,tvanderlippe@chromium.org,jacktfranklin@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165793
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-04-27 13:59:26 +00:00
Mathias Bynens 6ac9100804 Revert "Move UIString into Platform"
This reverts commit 992295e37d.

Reason for revert: breaks tree

Original change's description:
> Move `UIString` into `Platform`
> 
> Platform is the "lowest" part of DevTools - e.g. it depends on nothing.
> 
> We have code we want to move to Platform but cannot because it needs
> `ls` and therefore creates a circular dependency. So this CL moves
> UIString into Platform.
> 
> To avoid rewriting a lot of imports we re-export it from `common.js`.
> 
> Change-Id: I399bbe8593e043148c4c7e51f598cbd73a89f639
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165758
> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Paul Lewis <aerotwist@chromium.org>

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

Change-Id: Ic75fa4dfd49a2c413eee37b03d4c1f54e70eee20
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165789
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-04-27 12:38:27 +00:00
Jack Franklin 992295e37d Move UIString into Platform
Platform is the "lowest" part of DevTools - e.g. it depends on nothing.

We have code we want to move to Platform but cannot because it needs
`ls` and therefore creates a circular dependency. So this CL moves
UIString into Platform.

To avoid rewriting a lot of imports we re-export it from `common.js`.

Change-Id: I399bbe8593e043148c4c7e51f598cbd73a89f639
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165758
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-04-27 11:57:16 +00:00
Mathias Bynens e231df478c Revert "Roll deps"
This reverts commit 99d87e940b.

Reason for revert: https://ci.chromium.org/p/devtools-frontend/builders/ci/Stand-alone%20Linux/1355?

Original change's description:
> Roll deps
> 
> This patch includes some manual changes to the MediaModel, in order
> to support the new playerMessagesLogged and playerErrorsRaised events
> which are added in the roll.
> 
> The patch also includes the result of:
> 
>     scripts/deps/roll_deps.py $CHROMIUM_SRC_DIR $DEVTOOLS_FRONTEND_DIR
> 
> As a drive-by, this patch also makes `scripts/deps/*.py` executable so
> that they can be invoked directly without the need to explicitly invoke
> Python.
> 
> DISABLE_THIRD_PARTY_CHECK=see above
> 
> No-Presubmit: true
> Bug: chromium:1075437
> Change-Id: I794006f5a2077c8929f7d28bdd3f7b308603b6d9
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165756
> Commit-Queue: Mathias Bynens <mathias@chromium.org>
> Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>

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

Change-Id: If8c4886b61ef1200bdcd2e93604f7d67c57235ff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1075437
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2167397
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-04-27 11:48:48 +00:00
Mathias Bynens 99d87e940b Roll deps
This patch includes some manual changes to the MediaModel, in order
to support the new playerMessagesLogged and playerErrorsRaised events
which are added in the roll.

The patch also includes the result of:

    scripts/deps/roll_deps.py $CHROMIUM_SRC_DIR $DEVTOOLS_FRONTEND_DIR

As a drive-by, this patch also makes `scripts/deps/*.py` executable so
that they can be invoked directly without the need to explicitly invoke
Python.

DISABLE_THIRD_PARTY_CHECK=see above

No-Presubmit: true
Bug: chromium:1075437
Change-Id: I794006f5a2077c8929f7d28bdd3f7b308603b6d9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165756
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-04-27 11:13:45 +00:00
Tim van der Lippe 0c197e5a9e Add extensions for implicit imports in named export declarations
R=jacktfranklin@chromium.org

Change-Id: I9886922dc14e0bc05248a1d1a7c3f85304ea7c9f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2167756
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>
2020-04-27 10:50:35 +00:00
Tim van der Lippe efb2a94cdc Run Karma unittests on the Ninja output directory
This significantly speeds up Karma execution times to about 12 seconds on an unchanged build folder.
It uses the Ninja build output to find the unittest files.

You can run the new script with:

npm run unittest
npm run unittest -- --target=Release

To make sure you perform a minimal build and run tests right after it, run:

npm run auto-unittest
npm run auto-unittest -- --target=Release

If no ninja-build-name is set, it assumes that `out/Default` exists.
The `auto-unittest` command will run autoninja for you on the output folder.

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

No-Presubmit: true
Bug: 1061125
Change-Id: I45edd11e422c5cdc8a4fc0bbb6bc43e386519aa9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2102717
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Brandon Goddard <brgoddar@microsoft.com>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-04-27 10:16:15 +00:00
Mathias Bynens 51980699f7 Avoid unnecessary use of Object.entries
Previously, the script would output code of the form:

    new Map(Object.entries({
      'word-wrap': 'overflow-wrap'
    }));

This patch simplifies that down to:

    new Map([
      ['word-wrap', 'overflow-wrap']
    ]);

No-Presubmit: true
Bug: chromium:1039620, chromium:1075437
Change-Id: Ia102b46b70bdbb227c5ff41742fcb82940d48eb9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165787
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-04-27 09:32:55 +00:00
Jack Lynch 966040b2c0 Add chords to the DevTools
This CL adds the ability to bind actions to a sequence of two
keypresses, rather than just one (e.g. Ctrl+K Ctrl+O). VS Code refers to
these as chords [1]. As we move forward with custom keyboard shortcuts,
it's necessary to implement chords in the DevTools so that users
can match their shortcuts to editor shortcuts that use chords or assign
custom chords. This CL also adds a Ctrl+K Ctrl+S shortcut to open the
shortcuts settings for testing purposes, but I plan to remove that
shortcut before landing this change. It will return later as part of the
VS Code editor preset.

My implementation of chords here is focused on two-keypress
shortcuts, e.g. Ctrl+K Ctrl+Shift+Q would be a valid chord but Ctrl+K
Ctrl+K Ctrl+O would not be because it has three parts. Limiting chords
to two parts simplifies the implementation and matches a similar
restriction in VS Code. Although other editors like vim and Atom allow
shortcuts of arbitrary length, that's not really a feature that users
have asked for and it would introduce extra complexity into
ShortcutRegistry for questionable gain. However, the new structure of
ShortcutRegistry leaves open the possibility of enabling
arbitrary-length shortcuts in the future.

ShortcutRegistry's approach to handling a key has been changed as
follows:

If a keypress comprises only modifiers (e.g Ctrl+Shift), then it's
ignored. The DevTools already disallow modifier-only shortcuts, so this
change just prevents modifiers from clearing the chord timeout.

If the first half of a chord has been pressed within the timeout
(currently 1000ms), then clear the timeout and try to execute the
current key as the second half of a chord. If that isn't a valid chord,
then try to execute both keys as separate shortcuts in sequence.

If there isn't an active timeout and the keypress is potentially the
first part of a chord, then set _activePrefixKey and
_activePrefixTimeout. If the timeout expires without a second key being
pressed, attempt to handle the keypress as an individual shortcut.

If the keypress isn't potentialy the first part of a chord and there
isn't an active timeout, then it will be handled as normal.


There were a few shortcuts handled outside of ShortcutRegistry (e.g.
sources.rename, debugger.toggle-breakpoint) that made the assumption
that checking the key of a single event was enough to determine whether
it matched a shortcut, so that flow has been reworked to centralize all
shortcut-matching in
ShortcutRegistry.handleKey().


Custom shortcuts design doc: https://docs.google.com/document/d/1oOPSWPxCHvMoBZ0Fw9jwFZt6gP4lrsrsl8DEAp-Hy7o/edit
[1] https://code.visualstudio.com/docs/getstarted/keybindings#_keyboard-rules

Bug: 174309
Change-Id: I1b3f384d7c65e41d0dbc5e32854fb331e052823f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2125620
Commit-Queue: Jack Lynch <jalyn@microsoft.com>
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
2020-04-23 22:01:51 +00:00
Jack Franklin 28447fd262 Add ESLint rule to ban assert.equal
`assert.equal` is a non-strict check - it uses `==`. In our tests we
should either use:

* `assert.strictEqual` which uses `===`
* `assert.deepEqual` which does
a comparison on objects.

Change-Id: I872f9be140dc4c60b199fce94f95d0c12ee2bbc0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2160929
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-04-23 12:41:30 +00:00
Benedikt Meurer 3244d968e1 [CodeMirror] roll CodeMirror to 5.53.2
Also fix instructions and roll_codemirror.py script, and add the
new `wast.js` web mode for WebAssembly disassembly (which is going
to be hooked up in a follow up CL).

Bug: chromium:1042721
Change-Id: I2f14934b48528439b707538a64dfff4c2ac846e1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2159505
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
2020-04-23 10:11:09 +00:00
Tim van der Lippe 80c102878f Add ESLint rule for skipped tests
This makes sure that every skipped test also has a corresponding
CRBug filed to track re-enabling that test. Additionally, every
skipped test must have an attached comment with an explanation
as to why it is skipped.

R=jacktfranklin@chromium.org

Change-Id: I006a66ab32e7c014ef2287cb79f50b77de559a20
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2159518
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-04-22 13:32:39 +00:00
Tim van der Lippe 08279933ef Use Mocha configuration file instead of commandline arguments
This has two benefits:
1. We can now "pre-process" the arguments. It therefore allows us
to specifically set the tests we want to run. Before this change,
we would incorrectly include JavaScript files that were outputs
from (since-removed) TypeScript tests. Since adding these as
arguments to the Mocha invocation causes issues on Windows bots
with "arguments too long" errors, we should be using the config
file.
2. We can add additional arguments here without the need
of passing all the arguments from `run_test_suite.py` in.

R=petermarshall@chromium.org
TBR=aerotwist@chromium.org

Bug: 1071369
Change-Id: Icab02b1117f4095081987b65c8151ddf04239e11
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2157044
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
2020-04-22 12:35:19 +00:00
Tim van der Lippe 869374bcab Port shared test runner logic into separate package
The shared test runner logic was reimplementing parts of Mocha,
in particular the test logging and filtering. Moreover, it was
booting the hosted mode server and puppeteer outside of Mocha.

Mocha supports root level hooks [1]. These hooks allow us to
perform work before a test starts. Moreover, by using the
before and after hook, we can run logic before and after
all tests.

By using these hooks, we can extract the "boot the hosted mode
server and hookup puppeteer" part to these root hooks.
Additionally, we can reset the pages in the `beforeEach`, which
means that tests themselves don't have to reset the pages.

We also put the implementation code into third_party/conductor,
as we would like to reuse this logic for the Puppeteer tests.
The Puppeteer test suite now also uses Mocha and has very
similar requirements as to our DevTools tests. By extracting
from DevTools, we can look into expanding the test runner to
other usecases, but that is out of scope for now.

[1]: https://mochajs.org/#root-level-hooks

Bug: 1071369

Change-Id: Ie9f954359d9de84da564b74b6f5517dd535db008
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2150458
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-04-20 10:32:58 +00:00
Andrey Kosyakov be26c1703e Only declare trailing optional param names as {type=} in generated JSDoc
This fixes front-end compilation in case a parameter that was previously
non-optional is made optional in the protocol.

Change-Id: I86f02d3dbdccff5a65636a98edcfe81476c8455e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2150158
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Andrey Kosyakov <caseq@chromium.org>
2020-04-16 00:14:59 +00:00
Tony Ross 9f64a3e168 Fix check-type-closure for serverless Java installs
I ran into this while trying to reproduce Closure failures locally for
a different CL. Python's built-in remove method on lists returns None
instead of the modified list, which was causing the resulting value in
exec_command to be incorrect when a Java install without a server JVM
was used.

Change-Id: Ib2629b513c2f6401c51654e68792509796366e61
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2150731
Reviewed-by: Leo Lee <leolee@microsoft.com>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Tony Ross <tross@microsoft.com>
2020-04-15 18:23:48 +00:00
Tim van der Lippe b0f499fbae Fix eslint import rules to warn on test import extensions
Tests should also use imports that end with an extension, particularly
as it can silently fail in Karma.

We discovered this issue in
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2144163/4/test/e2e/application/cookies.ts#10

R=janscheffler@chromium.org

Change-Id: Ic379cb90b8e201b55a24010dc45565f6f45d910e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2150450
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
2020-04-15 14:02:58 +00:00
Tim van der Lippe 650668eda9 Fix ES module import linter for module entrypoints
Module entrypoints need to be of the form:
import * as File from './File.js'

This makes sure that all usages of the symbols in a cross-namespace
module use the form Namespace.File.Symbol.

We discovered this issue in
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2120014/5/front_end/common/common.js#14

R=mathias@chromium.org

Change-Id: If550c3d11456c1ac31ad3230705439e58d226d11
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2150452
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2020-04-15 13:09:08 +00:00
Tim van der Lippe ef991621e0 Update Karma to 5.0.1
The breaking changes listed in
https://github.com/karma-runner/karma/releases/tag/v5.0.0 do not
apply to us.

This should also include support for Edgium per
https://github.com/karma-runner/karma/pull/3440

R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=Update karma

Bug: 1068145
Change-Id: I7567b2db14dbf59aaf9c091220157bf55d155810
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2144050
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
2020-04-15 08:03:17 +00:00
Tim van der Lippe 9813224fa7 Port linter check to Node
We ignore some files for ESLint, as they are either generated or
third_party. However, when someone tries to change these files,
ESLint would emit a warning stating that the file in question is
ignored.

This issue was reported to ESLint in https://github.com/eslint/eslint/issues/9977
The suggested workaround is to use the CLIEngine to filter out
the problematic paths. However, since our script was written in
Python, that API is not accessible to us.

Therefore rewrite the script to Node and filter out the problematic
files. The calls to CLIEngine were mostly taken from eslint/lib/cli.js,
which was the previous file used by `node_modules/bin/eslint`.

R=jacktfranklin@chromium.org
CC=sigurds@chromium.org

Change-Id: Iee600f0e0d99fcb6eeeb203a952a50fe35f9aaf3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2149316
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
2020-04-14 16:25:25 +00:00
Tim van der Lippe dfd18c4e75 Remove istanbul-diff from node_modules
The package is unused at the moment. It was originally added in
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2024871
to enable karma-coverage support. However, istanbul-diff itself
is not required for that process, as we still generate the
karma-coverage report without it.

R=liviurau@chromium.org
DISABLE_THIRD_PARTY_CHECK=Remove istanbul-diff

Bug: 1068145
Change-Id: I38df9ebdfeb5232f013ea45b4a596239bfd63d7b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2137391
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-04-14 11:21:15 +00:00
Tim van der Lippe c27927c22e Remove esprima
Esprima is an older parser that does not support modern JavaScript
features. Moreover, we are no longer this parser in either the
ESLint pipeline nor the localization pipeline. Therefore, we can
remove our mirror on GitHub and delete it from node_modules.

R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=Remove esprima

Change-Id: I372b66c973424752bcd487954504c20b2282d0d6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2140940
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-04-09 11:42:50 +00:00
Tim van der Lippe 597193051b Use karma-coverage in favor of community-maintained packages
We were using community-maintained for integrating Istanbul with
Karma. However, there appears to be an official karma-coverage
plugin that is maintained by the Karma team. Moreover, the latest
changes on that plugin have removed dependencies on packages
that have reported vulnerabilities.

Therefore, use karma-coverage and remove the old community-maintained
packages to significantly reduce the amount of vulnerable NPM
packages.

R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=Remove old community-maintained packages

Bug: 1068145
Change-Id: Ie81c185155db6598fc0cd05d9405670a0568c1c1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2140942
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-04-09 11:34:20 +00:00
Jack Lynch f0d1424881 Ready module.jsons for multi-keypress shortcuts
Currently, ShortcutRegistry allows multiple shortcuts to be stored
within the same binding in a module.json, e.g. `"shortcut": "F8
Ctrl+\\"` creates two shortcuts, one on F8 and another on Ctrl+\. When
multi-keypress shortcuts/chords are added in the future, they'll use the
same format such that the above example would be interpreted as a single
shortcut bound to the F8 Ctrl+\ sequence. In order to allow that, it's
necessary to split up all of the existing shortcuts that are stored in
space-delimited strings so that they'll continue to function as
expected. This CL also updates the module.schema.json to disallow spaces
in shortcuts, a restriction that will be removed once multi-keypress
shortcuts are implemented.

Custom keyboard shortcuts design doc: https://docs.google.com/document/d/1oOPSWPxCHvMoBZ0Fw9jwFZt6gP4lrsrsl8DEAp-Hy7o/edit#heading=h.2xpjzz3fl1ju

Bug: 174309
Change-Id: I853f9918ad2892b2f4c4f3aec53013d7a6455f67
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2123807
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Commit-Queue: Jack Lynch <jalyn@microsoft.com>
2020-04-08 23:34:59 +00:00
Tim van der Lippe bd52a5110c Use typescript-eslint parser for localizability pipeline
While clang-format and eslint support the modern javascript features,
the localizability pipeline did not. It was using esprima, which is
a parser that is not well maintained and does not support modern
features.

For our ESLint configuration, we are using the typescript-eslint
parser, which is compatible with espree, the parser powering ESLint.
Both espree and typescript-eslint have an API that is very similar
to esprima.

Therefore, update the localizability pipeline to use the espree API
with the concrete implementation of the API by typescript-eslint.

In the future, the localizability pipeline should probably be an
ESLint plugin so that we can unify the parsing experience.

A follow-up CL will remove all usages of esprima.

R=jacktfranklin@chromium.org

Fixed: 1068966
Change-Id: Idcffb8d649f006d7cf0b3de0ee0d886cb3848230
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2140939
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-04-08 13:52:11 +00:00
Tim van der Lippe ccf7258887 Remove explicit dependency on handlebars
We don't explicitly depend on handlebars in any of our scripts.
Instead, it is a sub-dependency for one of our dependencies.

To make sure we don't pin to an old version of Handlebars,
remove the explicit dependency for now.

R=jacktfranklin@chromium.org

Bug: 1068145
Change-Id: I63b7ef882b7a23c52e17a3e5bc5c1e22b5300e00
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2139975
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-04-08 08:16:15 +00:00
Tim van der Lippe 99190c9d94 Update Mocha to 7.1.1
None of the breaking changes listed in
https://github.com/mochajs/mocha/releases/tag/v7.0.0
appear to be relevant for us.

R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=Update Mocha

Bug: 1068145
Change-Id: I4aec1e775595a0cfcfaa307a8aad7fc9abad22ca
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2137392
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-04-07 16:05:24 +00:00
Tim van der Lippe a4e6e7642d Update karma-typescript to 5.0.2
There don't appear to be any relevant breaking changes in
https://github.com/monounity/karma-typescript/releases/tag/v5.0.0

R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=Update karma-typescript

Bug: 1068145
Change-Id: I780d8c572bbfc4253f3ff5e52a33c23733d4262a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2137388
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
2020-04-07 14:47:34 +00:00
Tim van der Lippe fdbd42e2f8 Add eslint-import-plugin to node_modules
Will be used to make sure no default exports are in DevTools.

The PRESUBMIT.py has been updated to skip running the formatting check
if node_modules files are affected, to workaround crbug.com/1068198.

DISABLE_THIRD_PARTY_CHECK=Add plugin to node_modules

Bug: 1068198
Change-Id: I04d4dc813daa01099f21d40edf47aaefcc0b045f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2135610
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>
2020-04-07 14:27:34 +00:00
Tim van der Lippe be2d34de7a Update Rollup to 2.3.3
I have checked https://github.com/rollup/rollup/releases/tag/v2.0.0
and none of the breaking changes appear to be applicable to us.

I have manually confirmed that with this build on a production bundle
of DevTools, the output is okay and the build is working as intended.

R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=Update rollup

Bug: 1068145
Change-Id: I6a7ce6eaacb29fdfd1462642c976b81ce9c20e03
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2137385
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-04-06 13:56:18 +00:00
Tim van der Lippe c8f6ffd7c3 Update ESLint to 6.8.0
Also update the PRESUBMIT linter configuration to make sure
it actually runs the linter when updating ESLint. Otherwise,
it would not properly do the full linter check.

R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=Update ESLint

Bug: 1068145
Change-Id: Ibf2de156366dc64c90ee1aced5537d2038e7a268
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2137384
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-04-06 13:52:18 +00:00
Tim van der Lippe 35cca41271 Allow manage_node_deps to run custom npm commands
This allows us to execute the following:

npm run install-deps -- outdated

Which is equivalent to `npm outdated`, although it will run on the
actual node_modules output (that we can verify is unchanged).

Most of the npm commands require the private information to exist.
Therefore, if we run a custom command we first have to install with
`npm ci` to get the private information. Then we have to execute
the command, perform the cleanup and only after that finisht the
script. If we would bail out right after executing the custom command,
the private information would remain in the repository.

R=jacktfranklin@chromium.org

Fixed: 1068132
Change-Id: I50d3538a7115783dea19e1899faf17b1622f22ff
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2137381
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-04-06 13:01:08 +00:00
Surma 0a34c98ea0 Important changes to Whitespace
Change-Id: Id2d3fd2efdf7df4c5a337a361d9dd960d912a096
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2132228
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Surma <surma@chromium.org>
2020-04-01 14:52:09 +00:00
Ted Meyer 7e5ebf014b Adds End2End test for the Media tab.
I had to add support for running the tests with chromium
--enable-features flags. This isn't on by default though, I'll leave
that up to you to turn on. The tests just exit early if the flag isn't
present.

Change-Id: I132ca71796d8f069a6fba0342f10f2f2b18c7b62
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2125249
Commit-Queue: Ted Meyer <tmathmeyer@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-31 16:29:03 +00:00
Tim van der Lippe 846c6a1466 Remove unused global references in workspace-legacy.js
These are not used in our layout tests or module.json files

R=aerotwist@chromium.org

Bug: 1064958
Change-Id: Ia80d231758e202de92daa2bf53ae9c0e5476f545
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2122141
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-27 12:21:11 +00:00
Tim van der Lippe d25ae40485 Remove unused scripts files
They are referenced nowhere and not used in the current workflows.

R=yangguo@chromium.org

Change-Id: Ie1dd6e8afc352aa5f30a69a863199c21bf4c99f7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2122348
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-26 16:58:20 +00:00
Jack Franklin d3f547209d Component bridges generation
This CL introduces a script to generate `_bridges.js` files for TypeScript web components.

For further details see:

* `scripts/component_bridges/README.md` in this CL.
* Modernising UI components: https://docs.google.com/document/d/1Asq9BDFFvnsqhDbpu2Ez92pugPN2-8nq50O6sNO0SpY/edit
* Building bridges to a TypeScript world: https://docs.google.com/document/d/1qpa5QSSHrvvo_w73GV0hOJRug4N0_9JfFDw01d-NaCE/edit#heading=h.7nki9mck5t64

Change-Id: I95656acd6d22f5e09d178875dd3bcaf47da75a9c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2108761
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-03-26 11:36:00 +00:00
Paul Lewis ae5e8fb631 Adds support for e2e parallelization
Change-Id: I9af281bc40223a5ceb2a6f71ce247970beea4b02
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2116050
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-25 16:45:33 +00:00
Mathias Bynens 88e8f15748 Enable no-case-declarations lint rule
Lexical declarations in `case` and `default` clauses are a footgun,
since they are visible in the entire switch block, but they only
get initialized upon assignment, which only happens if the relevant
`case` is actually reached.

To ensure that such lexical declarations only apply to the current
`case` (which is usually the intention), `case` clauses containing
them should be wrapped in curly braces to create an explicit block.

More information:
https://eslint.org/docs/rules/no-case-declarations

Change-Id: I63d9341fcd76d4b9ce8281bd0e6573b886577f08
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2119685
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-03-25 15:26:13 +00:00
Tim van der Lippe 6021e3e22e Automatically fix imports with missing file extensions
Missing file extensions are a runtime error in the browser, even though
TypeScript accepts imports without a file extension.

R=jacktfranklin@chromium.org

Bug: 1011811
Change-Id: I5c5abac2c45be7c8151340cc3981c74c89e96fb7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2116444
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-24 12:19:42 +00:00
Tim van der Lippe 44d389ace1 Relax import style rules for inner-module imports
Since imports within a module can be of any style, relax the rules
to also allow `import * as` for all files, not only ARIAutils.js

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

Change-Id: I9cd8973176c200c72a6009496e07404b959435a6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2116442
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-24 11:28:42 +00:00
Simon Zünd f69667700c Emit real TypeScript enums for inline declared protocol enum types
Commands, Events and Object types can declare "inline enums" to
restrict the possible values of a 'string' field.

Example field:

  referrerPolicy: ('unsafe-url'|'...'|'...')

To enable type-checking with TypeScript and stay compatible with
existing code, we now generate explicit enums. The naming scheme
for the enum names is adapted from code_generator_frontend.py
and needs to always match.

Example generated enum for the above code:

  export enum RequestReferrerPolicy {
    UnsafeUrl = 'unsafe-url',
    NoReferrerWhenDowngrade = 'no-referrer-when-downgrade',
    NoReferrer = 'no-referrer',
    Origin = 'origin',
    OriginWhenCrossOrigin = 'origin-when-cross-origin',
    SameOrigin = 'same-origin',
    StrictOrigin = 'strict-origin',
    StrictOriginWhenCrossOrigin = 'strict-origin-when-cross-origin',
  }

This is necessary as we didn't had any type for this enum before
but existing code was using

  Protocol.Network.RequestReferrerPolicy

as a type in JSDoc.

R=tvanderlippe@chromium.org

Bug: chromium:1011811
Change-Id: I4b4aa04b69fa4d7bf3b79ad97d61d4e3bfb7e228
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2113374
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-23 15:47:21 +00:00
Simon Zünd c385b48e5d Emit TypeScript enums in protocol.d.ts for Protocol enums
Instead of

    export type MixedContentType = ('blockable'|'...'|'none');

we know emit

    export enum MixedContentType {
      Blockable = 'blockable',
      OptionallyBlockable = 'optionally-blockable',
      None = 'none',
    }

This is necessary as existing JavaScript code accesses these
enums using

   Protocol.Security.MixedContentType.None

R=tvanderlippe@chromium.org

Bug: chromium:1011811
Change-Id: Id4bf2c1333affcdc4df37a43bf95379700e3e9d0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2113373
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-23 15:17:31 +00:00
Tim van der Lippe 5d2d79b814 Fix presubmit check to always run when generated files change
We are changing the build output in the generated file, but were not
properly checking that these were changed, as the presubmit check
was ignoring files in the `front_end/generated` folder.

Also fix the issue where the InspectorBackendCommands.js would be
changed to not emit the typedef.

R=szuend@chromium.org

Bug: 1011811
Change-Id: I2e09bce9cae69f4191d93de177b5ab5bb7da46c0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2115630
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-23 12:34:41 +00:00