Commit Graph
118 Commits
Author SHA1 Message Date
Tim van der Lippe 3387bd4064 Move startup files to GN
There previously were two special files that were handled
by `build_release_applications`: root.js and RuntimeInstantiator.js.
Both files are explicitly part of the startup process of DevTools
and its various entrypoints.

To remove the copying from `build_release_applications`, we have
to move these to the relevant `devtools_entrypoint`. Since a
`devtools_entrypoints` bundles all subdirectories, we can't keep
these files in `front_end/` directly. Instead, we move these files
to `startup/` to denote their special-casing in the startup process.

Next to that, we have to fix all usages of these files in the entrypoints.
For all JavaScript entrypoint files, all side-effect legacy files
that are loaded by `startup.js` (previously known as `root.js` and renamed
to prevent confusion with the `root/` module) are removed. All
"additional" legacy files that a particular entrypoint requires are
still loaded as-is.

The RuntimeInstantiator is moved to become an implementation detail
of `startup/`. Therefore, all of the usages that were previously
importing from `RuntimeInstantiator` now import via `startup.js`.

In the end, the special-casing of these files are removed and renamed
for clarity. In the future, we want to remove the complicated
entrypoints startup process, but we are not ready for that yet.
That will require additional cleanups with `resources` in `module.json`
before that change can happen.

R=aerotwist@chromium.org

Bug: 1131500
Change-Id: I198d5a62d2aab70f842c68d9b4c0871fde1587a4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2485072
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-10-20 12:55:34 +00:00
Tim van der Lippe 3aa84724e0 Remove scripts support from module.json
This removes all references to and declarations of the scripts array
as defined in the module.json files.

R=aerotwist@chromium.org

Fixed: 1105476

Change-Id: I8edcebb5a527c235c606f79283adf5c977a47886
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2416513
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-09-22 11:44:35 +00:00
Sigurd Schneider 64e7f0648f Reland "Typecheck sdk/SourceMap.js with TypeScript"
This reverts commit dfe3e28145.

Reason for revert: Reland

Original change's description:
> Revert "Typecheck sdk/SourceMap.js with TypeScript"
> 
> This reverts commit c9118a78a3.
> 
> Reason for revert: Layout test update encovered an actual functional change: https://test-results.appspot.com/data/layout_results/linux-rel/401616/blink_web_tests%20%28retry%20shards%20with%20patch%29/layout-test-results/results.html
> 
> Original change's description:
> > Typecheck sdk/SourceMap.js with TypeScript
> > 
> > R=​sigurds@chromium.org,rreverser@google.com
> > 
> > Bug: chromium:1011811, chromium:1079233
> > Change-Id: Ied723f6d952cfe8f40b885f63d36eef6b614ed72
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2215850
> > Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
> > Reviewed-by: Ingvar Stepanyan <rreverser@google.com>
> > Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
> 
> TBR=sigurds@chromium.org,tvanderlippe@chromium.org,rreverser@google.com
> 
> Change-Id: I3956a020caf198b9f69459f650248837799d72a1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:1011811, chromium:1079233
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2230504
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>

TBR=sigurds@chromium.org,tvanderlippe@chromium.org,rreverser@google.com

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

Bug: chromium:1011811
Bug: chromium:1079233
Change-Id: I4f58efdfd23f97177526381655ab3834b4164bd2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2418435
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2020-09-19 09:13:20 +00:00
vidorteg 3e2942e2b8 Removing i18n-bundle.js generation on build time.
This PR removes the i18n-bundle.js bundle generation, instead the file
is generated beforehand and checked in so it can be consumed like any
other module.

Bug: 1127204
Change-Id: I79e8369269d0cd1885d6d9fc2346dddf3af1a5a4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2411415
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-09-17 17:07:18 +00:00
Tim van der Lippe 88a5d76f5f Fix auto-unittest compile target
Since the inspector_overlay moved, we also moved the karma.conf.js.
However, `npm run auto-unittest` was not properly building the
karma configuration file, as that was moved into its parent
directory.

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

Change-Id: Ic74c01632fb28de6afe70e0d8555e79f97bbdb33
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2401017
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2020-09-09 12:01:49 +00:00
Alex Rudenko ca9078f199 Move unittests karma config out of the frontend folder
Change-Id: I06e28e5a9afbbf7daa569a9b699c60e4554ed5a9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2395404
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-09-09 06:02:48 +00:00
Alex Rudenko 0e8d7f4c64 Move inspector_overlay to the top level
This CL moves inspector_overlay out of the front_end folder.
Unit tests remain under the front_end for now as we need to see
how to move them (they rely on karma config and helpers).

Design doc: https://docs.google.com/document/d/1yuQoNPtH2KxSFKoz3bRrQKu9wrPUjW4hx7idzAxb_B4/edit

Bug: 1100925
Change-Id: I0da88d9aae33602572d11485a3cbb46b5e3d588f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2395397
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Patrick Brosset <patrick.brosset@microsoft.com>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2020-09-08 10:38:09 +00:00
Christy Chen 23909d8cfc [Loc] Presubmit performance improvement
The current Loc presubmit are doing two checks: check_localizable_resources and check_localizability
(Details of what they are checking: https://docs.google.com/document/d/1L6TkT2-42MMQ72ZSBMFwUaq7M6mDgA2X0x8oHHKaV_U/edit#heading=h.w1no7qaa0mi0)

This CL merge two checks into one single check. check_localizability are modified into a utils file, and check_localizable_resources will also run those localizability checks when the files are visited. By doing this, we avoid the extra call to node during presubmit, and all files and nodes will only be visited once.

Also adding these fixes
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2370103
Fix:
- Pass the fullpath for comparison.(itemPath)
- Normalize comparison between paths
- using native fs.promises instead of promisify (https://github.com/nodejs/node/pull/26581)

Bug: 1116989
Change-Id: I054040d83a65b5f798a21c040096422e287bc799
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2381320
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Christy Chen <chrche@microsoft.com>
2020-09-04 05:07:07 +00:00
Paul Lewis 90faf09ce9 Update Closure Compiler and fix associated errors
Change-Id: I07cc1ea6b1b135571359136dfdec120ab4649b9e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2388060
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-09-02 08:41:50 +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
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
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
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
Simon Zünd a9f48fb117 Introduce thin wrapper module for third_party package 'marked'
This CL adds the //front_end/marked module as a thin wrapper for the
third_party package. Please note that //front_end/marked is currently
only usable from Closure land. Support for TypeScript-land is planned
but currently blocked on infra changes.

R=aerotwist@chromium.org

Change-Id: I91d0ce2772271ce09d608113ecb6fe13b48e1af2
Bug: chromium:1099162
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2287511
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2020-07-08 12:01:16 +00:00
Jack Franklin 77038d2910 Fix test_helpers on Python 3
The `print` statement with no wrapping parens causes a syntax error in
Python 3.

Fixes: 1102315
Change-Id: I08f1908f2af998d775c0723caafa5d68973e9d0c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2282510
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jecelyn Yeen‎ <jec@chromium.org>
2020-07-07 13:31:22 +00:00
Tim van der Lippe 60421845f4 Implement devtools_entrypoint
Port formatter_worker to use devtools_entrypoint, which is the abstraction
around `rollup`. It handles the creation of the rollup bundle, but leaves
it alone if you are building with `is_debug=true`. This way, we can keep
development use the existing workflow where individual files are fetched,
while in release mode we bundle the entrypoint into 1 big file.

In the future, anything we consider an entrypoint must use this method.
This would include third_party packages like lit-html and CodeMirror.
A follow-up CL will move the lit-html entrypoint back into
third_party/lit-html, as we no longer require it to be a direct subfolder
of `front_end/` (that was fixed in
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2270168)

DISABLE_THIRD_PARTY_CHECK=TypeScript fixes
R=aerotwist@chromium.org,jacktfranklin@chromium.org

Bug: 1098730
Change-Id: I5d2e67cc9c71291e8b67bbc29354e75239aae9a9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2267001
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-07-02 10:08:19 +00:00
Tim van der Lippe fe75007069 Run e2e-tests on build output
The e2e-tests now use the build output in resources/inspector in
the out directory. This allows us to introduce TypeScript-authored
files in the source directory `front_end`, which will get compiled
into resourc/inspector.

After to making a change to a e2e-test or the front_end, you need
to rebuild Devtools, after which you can run `npm run e2etest` as
normal.

Since we now use the build output, this also means that you can
run the e2e-tests on the release build. In other words, if you
build DevTools with build optimizations (such as Rollup), the
e2e-tests will now use the output (and thus provide test coverage).

DISABLE_THIRD_PARTY_CHECK=Node fixes
R=aerotwist@chromium.org,jacktfranklin@chromium.org

Fixed: 1088463
Change-Id: I02ec3c2476bc3647158fede9e1d347963b3a720a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2224809
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jose Leal <joselea@microsoft.com>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-06-29 11:35:23 +00:00
Ng Zhi An 1f7986a53e Use acorn-numeric-separator
Use `npm run build` to generate the mjs files.
Create a acorn-numeric-separator_types.mjs for closure to typecheck.
Create acorn-numeric-separator.mjs.d.ts for TS compiler.
Update acorn_types.mjs to allow Parser to take varargs.

Bug: chromium:1086817
Change-Id: I9f040ddaf5748f3d7437a075c3322335d8e076ec
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2261447
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-06-26 16:31:38 +00:00
Paul Irish 6580fb3e51 stylelint: exit gracefully if all affected files are ignored
Bug: chromium:1083142
Change-Id: I182e4555088b69ed15826d4d59882a09fcc3a58c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2268387
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Auto-Submit: Paul Irish <paulirish@chromium.org>
2020-06-26 10:11:55 +00:00
Ng Zhi An 8d54f1a43a Use acorn-logical-assignment
Bug: chromium:1080569
Change-Id: Id65b11e9df68f1e04ec2b84b18b8684db3452f37
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2235965
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-06-22 16:38:03 +00:00
Tim van der Lippe 1dccfa6085 Do not run coverage by default for Karma
This speeds up the time for the Karma unittests to run from 26 seconds
to 4 seconds, using the default arguments. You can still obtain
the coverage report by running

```
npm run auto-unittest -- --coverage
npm run unittest -- --coverage
```

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

Fixed: 1085426
Change-Id: I0c6be53a24223f9c9d3492143f0802ba9a15e60e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2251958
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-06-22 11:01:52 +00:00
Mathias Bynens ac76229e8a Force-replace Windows-style path separators for stylelint
stylelint requires POSIX-formatted paths/globs, even on Windows. This
patch ensures we pass such paths in the case where only specific files
are being linted (i.e. `PRESUBMIT.py` calls `run_lint_check_css.py`
with a list of potentially Windows-formatted file paths as arguments.

Bug: chromium:1083142
Change-Id: I1eea6bf146decd52bb978388d4e3e98f48ec91b3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2252007
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-06-19 08:40:21 +00:00
Mathias Bynens 0ec56611a7 Fix stylelint path resolution on Windows
On Windows, if your checkout is at:

    C:\devtools\devtools-frontend

Then the stylelint CLI lives here:

    C:\devtools\devtools-frontend\node_modules\stylelint\bin\stylelint.js

Prior to this patch, the lint CSS script was instead trying to use:

    C:\node_modules\stylelint\bin\stylelint.js

That is, it went two levels too far up the directory tree. This only
happened on Windows.

This patch avoids the problem altogether by forcing the root directory
to be the current working directory and passing a root-relative glob
instead.

As a drive-by, this patch cleans up the `_getFilesToLint` helper in
`PRESUBMIT.py`.

Bug: chromium:1083142
Change-Id: Ida7d19e4c1cb8954346a3103ce95748f0bc38f00
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2252005
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-06-19 07:33:31 +00:00
Mathias Bynens 8514078e45 Avoid pathlib dependency in CSS lint script
Although pathlib ships with Python 3, it’s not part of Python 2.
This patch re-implements the path logic using built-in APIs only,
to ensure the script works across multiple Python versions
regardless of which packages are installed locally.

Bug: chromium:1083142
Change-Id: Id96eadab288bec873f8ce2855ca0c2aed9417f0f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2249936
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-06-18 12:12:06 +00:00
Mathias Bynens 1b2c5e463e Enable stylelint on presubmit
Bug: chromium:1083142
Change-Id: I74136f2ba5b74d4385760e157e2495d706cb5c35
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2248184
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-06-18 10:41:46 +00:00
Tim van der Lippe dfe3e28145 Revert "Typecheck sdk/SourceMap.js with TypeScript"
This reverts commit c9118a78a3.

Reason for revert: Layout test update encovered an actual functional change: https://test-results.appspot.com/data/layout_results/linux-rel/401616/blink_web_tests%20%28retry%20shards%20with%20patch%29/layout-test-results/results.html

Original change's description:
> Typecheck sdk/SourceMap.js with TypeScript
> 
> R=​sigurds@chromium.org,rreverser@google.com
> 
> Bug: chromium:1011811, chromium:1079233
> Change-Id: Ied723f6d952cfe8f40b885f63d36eef6b614ed72
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2215850
> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Ingvar Stepanyan <rreverser@google.com>
> Reviewed-by: Sigurd Schneider <sigurds@chromium.org>

TBR=sigurds@chromium.org,tvanderlippe@chromium.org,rreverser@google.com

Change-Id: I3956a020caf198b9f69459f650248837799d72a1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1011811, chromium:1079233
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2230504
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-06-04 10:01:52 +00:00
Brian Cui 1cc53e02a8 Add --chrome-binary argument to unittest script
This CL adds an optional --chrome-binary argument to the unittest.py
script to use a specific Chrome binary to run unit tests against.
When no argument is specified, the script defaults to the downloaded
Chrome binary from `gclient sync` (same behavior as before).

We'd like to have the option of running unit tests on a Microsoft Edge
executable instead of the default downloaded Chrome executable.

Change-Id: Ice72f129086bcc1da56efa118280532cdbb25fd3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2202628
Reviewed-by: Brandon Goddard <brgoddar@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
Commit-Queue: Brian Cui <brcui@microsoft.com>
2020-06-03 17:32:55 +00:00
Tim van der Lippe c9118a78a3 Typecheck sdk/SourceMap.js with TypeScript
R=sigurds@chromium.org,rreverser@google.com

Bug: chromium:1011811, chromium:1079233
Change-Id: Ied723f6d952cfe8f40b885f63d36eef6b614ed72
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2215850
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Ingvar Stepanyan <rreverser@google.com>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
2020-06-03 12:26:34 +00:00
Tim van der Lippe 7a78ddbe52 Remove scripts/test/run_e2e.py
It is replaced by `scripts/test/run_test_suite.py --test-suite=e2e`.

Requires https://chromium-review.googlesource.com/c/chromium/tools/build/+/2224815/
to land first.

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

Bug: 1088463
Change-Id: I665b03f8f6f9fdb843072fc18aa7322fe17e41e1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2226556
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-06-02 11:59:20 +00:00
Tim van der Lippe 8cc37e6076 Add unused target flag to run_test_suite.py
We need to update the CQ bots to set the `target` flag for e2e-tests
to Release. However, we have to add a dummy flag first to change
the configuration. In a follow-up CL, we will actually start
using this flag in the e2e-test run.

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

Bug: 1088463
Change-Id: Iada85d812e1a55b8095f2c4adabfb3a0985877d3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2224814
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-06-02 10:59:20 +00:00
Tim van der Lippe 800891e5ad Use ESM build for acorn
This uses the `acorn.mjs` ESM build, rather than side-effect importing
it in `formatter_worker.js`. To make sure that Closure still understands
what is going on, we add `_types.mjs` files that describe the structure
for Closure.

To make sure that the unittests still work, Karma can now serve the `*.mjs`
files. The unittests have been updated to also no longer side-effect
importing acorn.

This CL requires https://chromium-review.googlesource.com/c/chromium/src/+/2212124
to land in Chromium first.

Bug: 1011811

Change-Id: I33c93b9cfb0c57b1970a98ecaa323481a4e0d1b1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2212165
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2020-05-27 16:07:17 +00:00
Ingvar Stepanyan 2aa60e27d7 Move wasm_source_map to ES module; update Rust+wasm tools
This is attempt to replace
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2208981
with fixes in the Rust source.

As such, it also converts wasm_source_map to ES modules to match
direction of the rest of DevTools codebase and updates the way typings
are handled with a custom ad-hoc to please Closure Compiler.

Bug: chromium:1082720
Change-Id: I028ba5d759ec2a812a663923be107d52d13e2dfb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2208141
Commit-Queue: Ingvar Stepanyan <rreverser@google.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2020-05-20 16:20:33 +00:00
Tim van der Lippe 6a935445b3 Port perf test suite to mocha runner
This resurrects the perf test suite, as the older test-runner setup
was removed, but the perf test suite was not ported.

Example output:

Spawning hosted mode server
  Boot performance
    ✓ run 1/37 (1185ms)
    ✓ run 2/37 (1234ms)
    ✓ run 3/37 (1213ms)
    ✓ run 4/37 (1376ms)
    ✓ run 5/37 (1327ms)
    ✓ run 6/37 (1235ms)
    ✓ run 7/37 (1352ms)
    ✓ run 8/37 (1439ms)
    ✓ run 9/37 (1332ms)
    ✓ run 10/37 (1290ms)
    ✓ run 11/37 (1229ms)
    ✓ run 12/37 (1241ms)
    ✓ run 13/37 (1233ms)
    ✓ run 14/37 (1203ms)
    ✓ run 15/37 (1177ms)
    ✓ run 16/37 (1336ms)
    ✓ run 17/37 (1526ms)
    ✓ run 18/37 (1465ms)
    ✓ run 19/37 (1537ms)
    ✓ run 20/37 (1709ms)
    ✓ run 21/37 (1760ms)
    ✓ run 22/37 (1704ms)
    ✓ run 23/37 (2549ms)
    ✓ run 24/37 (1387ms)
    ✓ run 25/37 (1934ms)
    ✓ run 26/37 (1860ms)
    ✓ run 27/37 (1309ms)
    ✓ run 28/37 (1295ms)
    ✓ run 29/37 (1391ms)
    ✓ run 30/37 (1569ms)
    ✓ run 31/37 (1562ms)
    ✓ run 32/37 (1442ms)
    ✓ run 33/37 (1431ms)
    ✓ run 34/37 (1646ms)
    ✓ run 35/37 (1927ms)
    ✓ run 36/37 (1600ms)
    ✓ run 37/37 (1587ms)
Mean boot time: 1475.28ms
50th percentile boot time: 1390.83ms
90th percentile boot time: 1860.02ms
99th percentile boot time: 2549.29ms

R=aerotwist@chromium.org

Change-Id: I1b6a79fdfc1b7c98f6156d3309b5b98ff8530476
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2209108
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-05-20 13:42:43 +00:00
Tim van der Lippe 1066bfdb3e Port cm_web_modes files to third_party/codemirror usages
This removes the cm_web_modes folder, as we now import from third_party
instead. We still double include the css.js and htmlmixed.js in the
formatter_worker and text_editor, but sadly we can't remove that until
the module.json files are removed.

roll CodeMirror

R=mathias@chromium.org

Bug: 1076825
Change-Id: I7b5a15bcc9db51b4a38be7db3d2da97aa9deb0f6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2179362
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-05-06 11:47:22 +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
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
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 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
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 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
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
Simon Zünd 3b0c540211 Rename front_end/protocol to front_end/protocol_client
This CL is part of the work to switch over to the TypeScript compiler
for type checking.

R=tvanderlippe@chromium.org

Bug: chromium:1011811
Change-Id: Ic709a193b252df7e9027c00cf20d8afe525a215a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107539
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-18 18:06:20 +00:00
Tim van der Lippe 6d51bf00ea Factor out Runtime to root/Runtime.js
front_end/Runtime.js was doing multiple things: it was instantiating
side-effecty descriptors and initializing applications, as well as
storing all state for the modules/extensions, etc...

To support proper ES Modules, we need to separate these. root/Runtime.js
contains simple classes that store the data and can be retrieved, as well
as some helper functions that will load the respective data.

The RuntimeInstantiator.js code includes the start functions used in the
entrypoints themselves. They will use an instance of the Runtime to
properly load the application.

Along the way, I also fixed various TypeScript errors, mostly around
incorrect or missing type definitions.

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

Bug: 1011811
Change-Id: If3ddea9267813691b3faeb6ea4b0cf64edbde1f4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107523
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-18 12:19:29 +00:00
Paul Lewis 2d7d65c5e8 [global] Remaps self.Common.settings
This CL changes references to self.Common.settings (the global
instance of SDK.Common.Settings) over to
Common.Settings.Settings.instance(). To keep both TypeScript and
Closure happy we must make a method on the Settings class itself,
since it only allows private constructors to be accessed by static
methods on the class.

Bug: 1058320
Change-Id: I04afc8caf64acf29cdda13ef03ad05cfff4786a1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2091450
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-16 22:04:07 +00:00
Tim van der Lippe 2a4ae2bdc3 Run ESLint only on affected files for regular uploads
For most of the PRESUBMIT invocations, the CL in question does not
change anything with regards to ESLint. Therefore, we can skip doing the
full check and only perform the check on relevant JavaScript and
TypeScript files.

However, if we do change the ESLint configuration (via one of the
involved build scripts/configuration files), we should run the full
check to make sure we are compliant.

`npm run check-lint` will still run the full lint check.

This saves about 15 seconds on a regular PRESUBMIT invocation, scaling
with the number of files changed.

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

Change-Id: I9c1bb055274bfa1d8cc47c9039a1196c92eba399
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2097993
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-12 16:18:05 +00:00
Tim van der Lippe 4a8441c385 Port license header check to ESLint
This improves the PRESUBMIT performance as we can rely on the AST
parsing of ESLint, meaning we don't have to parse AST twice.

It also allows us to use the nice `--fix` solution to insert the proper
license header in the files.

This shaves an expected 5 seconds of the presubmit time
(non-scientifically computed based on 2 uploads).

Change-Id: I5c53e9b232585f9ec46f86b36557c50bf80f7add
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2097992
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-12 16:08:22 +00:00