Since workers do not support modules [1], it is not possible to
currently import any ESM DevTools module. To be able to migrate
text_utils/ to ESM, we would need to duplicate a large portion of
text_utils/, which would be unmaintainable.
We already had the same situation when we migrated platform/ to ESM and
decided to copy the relevant functions, but this time around that is no
longer an option.
Thus, the 2 workers (heap_snapshot_worker and formatter_worker) are now
being bundled on build time. This means that in a release build, the
respective entrypoints are bundled and inserted in the output.
To bundle, we use `rollup`, which is a bundler only concerned with
rolling up ES modules. All other functionality of rollup (such as
tree-shaking) is unused. We can revisit later if we need a bundler for
the rest of devtools, but since we are in active migration to ESM that
is infeasible at this point in time.
As part of this CL, the following folders are migrated to ESM:
- cm_headless/
- formatter_worker/
- heap_snapshot_model/
- heap_snapshot_worker/
- text_utils/
Since text_utils is also an autostart module for the shell, this is the
only module that is imported from root.js.
Some of these modules also include files that are annotated with
skip_compilation and thus run with dummy files during Closure
compilation.
Note that, because of the usages of import-statements in the workers
and the blocking bug [1], the workers are generated even when Chromium
is built with `debug_devtools=true`.
Since heap_snapshot_model/ also used in the profiler, we have to eagerly
load this module in root.js. Once all other dependencies of the profiler
have been migrated to ESM, we can remove this import-statement.
[1]: crbug.com/680046
Bug:1013129,1006759
Change-Id: I4c03c7b8a1f351ae9693cbcd922412083dd34bba
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1883707
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
TL;DR: When retrieving the file content with localization scripts,
normalize the line ending to LF.
Issue:
When a grdp file containing multi-line strings has CRLF line ending,
the parser doesn't work because the IDS hash is calculated based on the
content of the <message> tag, which expects LF line ending. The multi-
line string ends up having a different expected hash, and the parser
complains about it.
Repro:
Change line ending of front_end/coverage/coverage_strings.grdp to CRLF.
Fix:
Normalize line ending to LF when retrieving the file content.
Change-Id: If3a33978724a4bf9635738c67ada211e5e996e30
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1895994
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Mandy Chen <mandy.chen@microsoft.com>
Any module that is not autostart and has `modules` specified in its `module.json`
will now have its entrypoint dynamically imported. Update the release build script
to output the `modules` array as well so that the Runtime can load it.
Add additional entrypoints to `platform` and `dom_extension` to be consistent
with the naming patterns of all other modules
Bug:1006759
Change-Id: If6d10a13a62354079e3f8ee49bee4ecdcffa6758
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1893085
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
This adds native location resolver, written in Rust and compiled to
WebAssembly, that can parse DWARF information from other given
WebAssembly modules and resolve addresses <-> source location mappings
in both directions.
From V8 side, this depends on recently added Debugger.getWasmBytecode
command and on a special "wasm://dwarf" source map URL reported for Wasm
modules that contain DWARF information.
On the JavaScript side, this uses autogenerated JavaScript bindings by
wasm-bindgen to an internal context which contains all parsed data and
lazily creates SDK.SourceMapEntry when requested. These bindings are
further wrapped into a public class that implements SDK.SourceMap
interface.
---
Always auto-step over Wasm DWARF
Wasm doesn't have any other source when DWARF is used for source
mapping, so it will step into an empty source pane.
This is not very useful, so let's always auto-step to the next resolved
location.
There are talks about stabilising auto-stepping for JS source maps as
well, but for now limiting to just the new functionality should be
safer.
Change-Id: I6e981dcd33a03a5db2f2b1e39a93372c5ba09b97
Bug: 1016772
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1872581
Commit-Queue: Ingvar Stepanyan <rreverser@google.com>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
The localization parser currently logs the error stack and error message
when running without the --autofix flag. Since the stack includes the error
message, this CL takes out the call to log the error message to avoid
duplicate error messages.
Bug: 941561
Change-Id: If8c5f05148be6e2eb666eb17cefe649715006209
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1820088
Reviewed-by: Lorne Mitchell <lomitch@microsoft.com>
Commit-Queue: Mandy Chen <mandy.chen@microsoft.com>
Cr-Original-Commit-Position: refs/heads/master@{#703813}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c9ef1c432008114038aade7d70fe815a036e7068
After converting the `ui/` folder to ESM, there was a significant performance
regression in terms of file size of the `resources.pak`. It turns out that we
were not minifying ESM files, but we did do that before with Closure.
Update the `copy_devtools_modules` to also invoke rjsmin to minify the
JavaScript source code.
Before:
$ du -h -B K out/Default/resources.pak
12096K out/Default/resources.pak
After:
$ du -h -B K out/Default/resources.pak
11752K out/Default/resources.pak
Before the original CL transforming `ui/` landed:
$ du -h -B K out/Default/resources.pak
11860K out/Default/resources.pak
This means that after converting `ui/` to ESM, we saved 90KB. We suspect
this is because we are no longer transpiling to ES5, but instead serve
source ES6.
Bug: 1010910
Change-Id: I7dd07ff788d014e9f9a8e25e168c58c010cd00af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1837814
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#702500}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 8d2021d8394b9a248436fb6976070629cdffd961
Introduce a new namespace "Root" to be able to disambiguate between
Runtime the namespace and Runtime the object.
roll CodeMirror
The above line is necessary to fix the presubmit, which complains
about CodeMirror changes. This is only updating a type reference.
Bug: 1006759
Change-Id: I04941d9f18649701060e3035f7eeb2ef3abb51e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829708
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#701257}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 17cc008cf6ad28c6e8c07c638a1b380ca30e7f79
The Chromium/Google style guides does not enforce curly braces for
single-line if-statements, but does strongly recommend doing so. Adding
braces will improve code readability, by visually separating code
blocks. This will also prevent issues where accidental additions are
pushed to the "else"-clause instead of in the if-block.
This CL also updates the presubmit `eslint` to run the fix with the
correct configuration. It will now fix all issues it can fix.
Change-Id: I4b616f21a99393f168dec743c0bcbdc7f5db04a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1821526
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Jeff Fisher <jeffish@microsoft.com>
Cr-Original-Commit-Position: refs/heads/master@{#701070}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7e0bdbe2d7f9fc2386bfaefda3cc29c66ccc18f9
This reverts commit 25a9b3bd7404d49e55772ffba046ed8df65ad14e.
Reason for revert: Memory snapshots work again
Original change's description:
> Revert "[DevTools]: Moves common to ES modules"
>
> This reverts commit e064553334d4b0c925f0b1f0e2e0234be66b71be.
>
> Reason for revert: Memory tool fails to take heap snapshots with this
> error: https://imgur.com/hzR9Eqw
>
> Original change's description:
> > [DevTools]: Moves common to ES modules
> >
> > This CL converts the contents of the common/ folder over to ES modules
> > from the current custom module system. It includes statements in each
> > file that will pollute the global namespace, allowing the non-ESM code
> > to continue working as before.
> >
> > Bug: 1006759
> > Change-Id: Ib591e49155000381f85999a5da6c467ad0160996
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1816563
> > Reviewed-by: Yang Guo <yangguo@chromium.org>
> > Commit-Queue: Paul Lewis <aerotwist@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#699728}
>
>
> Change-Id: Ic0d526780451e8bb4de538f11c85859a3badfb0f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 1006759
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825463
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#699835}
Bug: 1006759
Change-Id: I48c7e84262bb295e5830cac8a79a274226df046c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825420
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#699981}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 75a39ca7ac8dcfc6a830db07a5a389ca9ab27b1d
This CL converts the contents of the common/ folder over to ES modules
from the current custom module system. It includes statements in each
file that will pollute the global namespace, allowing the non-ESM code
to continue working as before.
Bug: 1006759
Change-Id: Ib591e49155000381f85999a5da6c467ad0160996
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1816563
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#699728}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e064553334d4b0c925f0b1f0e2e0234be66b71be
The backend changes[1] for localizing devtools leverage the existing
webui functionalities, which consume a list of id mappings from the id
of a string used in the frontend (i.e. the English string) to the IDS_
key of the string in the corresponding grdp file. Example:
const LocalizedString kLocalizedStrings[] = {
...
{"Editable", IDS_DEVTOOLS_2c09e798bf8c5a82d211331c82893a0f},
...
}
This patch adds scripts that generate the structure. The output will be
two files, devtools_ui_strings_map.h and .cc, under
<generated files root directory>/chrome/browser/ui/webui
(e.g. D:/chromium/src/out/Release/gen/chrome/browser/ui/webui).
The design is to create a build step that calls generate_devtools_ui_strings.py,
which then calls generate_devtools_ui_strings.js. Integration into the build
system will come as a another patch, because it depends on the first set of
changes[2].
Example arguments to generate_devtools_ui_strings.js to generate output
files (invoke under '--root_gen_dir', e.g. D:/chromium/src/out/release/gen
in the example below):
['D:/chromium/src/third_party/node/win/node.exe',
'D:/chromium/src/third_party/blink/renderer/devtools/scripts/build/generate_devtools_ui_strings.js',
'--root_gen_dir', 'D:/chromium/src/out/release/gen',
'--output_header', 'chrome/browser/ui/webui/devtools_ui_strings_map.h',
'--output_cc', 'chrome/browser/ui/webui/devtools_ui_strings_map.cc']
[1]: https://crrev.com/c/1672628
[2]: https://crrev.com/c/1628927
Bug: 941561
Change-Id: Ic03dae24cd074219790c6eec5df3183c24bf15a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1671848
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Mandy Chen <mandy.chen@microsoft.com>
Cr-Original-Commit-Position: refs/heads/master@{#699370}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 3927e5494ba1866261dc577d8f93660fd9f04b5d