Commit Graph
28 Commits
Author SHA1 Message Date
Paul Lewis 7b1e0f41ab Adds Puppeteer types
DISABLE_THIRD_PARTY_CHECK=Updates the deps list as well as the node_modules

Change-Id: Ia9a6d26a89d85c0ca24253892ec3aa2858fe034a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2009108
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-01-20 14:02:00 +00:00
Tim van der Lippe f86acf8203 Remove Puppeteer installation
We can set the PUPPETEER_SKIP_CHROMIUM_DOWNLOAD environment variable to
not install a local Chromium installation. Update the preinstall script
to verify that this variable is set. If you want to update the deps, you
can now run `npm run install-deps` to get the update.

DISABLE_THIRD_PARTY_CHECK=Fixing node_modules

Change-Id: I6d77a77f343f8869a17434e7b83951b6380444d0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2003319
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-01-16 13:32:46 +00:00
Tim van der Lippe 91e71b3c5d Update README with format and check command
The `npm run format-py` should not be used, as it does not use
clang-format. `git cl format --js` is the appropriate formatting
command.

Moreover, we did not reference the `npm run check` command in the
README. Since we run these checks on CQ, we should include it.

Change-Id: Id0d9f1fefebc980b122e62e48e66a626df122e26
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2002605
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
2020-01-15 19:05:53 +00:00
Tim van der Lippe 8aaca9e8f1 Update node_modules to include typescript-eslint
DISABLE_THIRD_PARTY_CHECK=Updates package.json

Bug: 1041811
Change-Id: I9493880aed334f02e5899efed3fc8bb964d0bbb0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1998770
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-01-14 13:05:28 +00:00
Jan Scheffler de6e6cca2c Add unit tests to package.json
This cl adds two commands to package.json:
- unittest to run the karma tests
- debug-unittest to run the karma tests in debug mode

Change-Id: I9cc6ec13d1d219b979bef8d10d050936870a7da5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1971411
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
2019-12-17 12:13:36 +00:00
Tim van der Lippe ac961dd56b Fix check_gn and add it to check script
check_gn will now properly check the contents of all_devtools_modules and copied_devtools_modules in the BUILD.gn.
We don't ship the wasm_source_map/types.js, as it only includes information for Closure.
Therefore, remove this file from the `modules` array and append it in Closure instead.

Fixed: 1033882
Change-Id: I3361096941869d39ce3b717327c4001d146a5286
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1969473
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2019-12-16 14:29:28 +00:00
Tim van der Lippe f561673038 Add test-local NPM script
This allows running tests in the DevTools repo which makes it a bit
easier to run tests in there.

Example invocation:

npm run test-local -- -t Default http/test/devtools/console/console-eval-uses-repl-mode.js

Change-Id: I801690ac5134bec63f58e41a0b0ddd856b4ec190
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1964353
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
2019-12-12 15:44:43 +00:00
Mathias Bynens 2bca61df77 Add npm run check command that runs all checks
Ain't nobody got time for running each check individually, and
relying on CQ for basic checks can be embarrassing. This patch
introduces a single command that can be used to run all checks.

Change-Id: I2756ed167a7113e34d8fbd7b2f63b3ff36996f03
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1953778
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Mathias Bynens <mathias@chromium.org>
2019-12-09 15:31:36 +00:00
Yang Guo a711c06b43 Remove outdated extract_module script
Change-Id: I1b9d525baf83398959ecf8df34ab50ca5c695ee0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1950168
Commit-Queue: Yang Guo <yangguo@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Yang Guo <yangguo@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2019-12-04 14:49:15 +00:00
Yang Guo 6e99c7c542 Move test and localization scripts
R=tvanderlippe@chromium.org

Change-Id: I9bfa77ef2791638b07089e4faf405f834ff47148
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1947525
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
2019-12-03 16:48:56 +00:00
Paul Lewis 911c1b8a93 Updates node_modules
DISABLE_THIRD_PARTY_CHECK=Package needs updating with node_modules
Change-Id: I889f1b86c586e37307a3e13ad762aa56d1ece150
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1946468
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2019-12-02 14:54:54 +00:00
Paul Lewis d903909f9c Updates deps script; adds Puppeteer
This is a prequisite for loading DevTools in hosted mode and track how
long it takes for the FE to boot up. This CL adds Puppeteer to the deps
as well as tidying the manage_node_deps script some.

Bug: 1027519
Change-Id: Ie5f3ef47f481972c721f7382f9b0ed99d287d07c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1939800
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2019-11-28 10:40:33 +00:00
Yang Guo 879d97b05d Move hosted mode scripts
Also set useful default for Chromium path for Linux.

Change-Id: Idcf5a229f254a8081338630bf9279678fb03e111
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1893089
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
2019-11-05 13:36:56 +00:00
Paul Lewis 75090cfd93 Reland "Updates node_modules and update script"
This is a reland of 4df552c652

Original change's description:
> Updates node_modules and update script
> 
> Change-Id: I3fcf49bc416301a030d298cfc48c448bfeba4335
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1878808
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Paul Lewis <aerotwist@chromium.org>

Change-Id: I97d1442c21420488fadde3f17f67cd4e3b959be6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1880030
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
2019-10-25 13:19:06 +00:00
Lorne Mitchell db3885dd80 Revert "Updates node_modules and update script"
This reverts commit 4df552c652.

Reason for revert: Breaks esprima.

Original change's description:
> Updates node_modules and update script
> 
> Change-Id: I3fcf49bc416301a030d298cfc48c448bfeba4335
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1878808
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Paul Lewis <aerotwist@chromium.org>

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

Change-Id: Iad2bcdf98a486476715d1e829cdce450c5f218af
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1880098
Reviewed-by: Lorne Mitchell <lomitch@microsoft.com>
Commit-Queue: Lorne Mitchell <lomitch@microsoft.com>
2019-10-24 21:53:24 +00:00
Paul Lewis 4df552c652 Updates node_modules and update script
Change-Id: I3fcf49bc416301a030d298cfc48c448bfeba4335
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1878808
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2019-10-24 14:48:04 +00:00
Yang Guo 4fd355cc40 Switch to new repository 2019-10-21 08:08:56 +02:00
Aaron Gable c9d00052df Revert "Reland "Convert ui/ARIAUtils.js to an ES module""
This reverts commit ec810baced8e07ca3e9f2b801703be433807d2a2.

Reason for revert: causing eslint failures on Linux Tests:
/b/s/w/ir/third_party/blink/renderer/devtools/front_end/dom_extension/DOMExtension.js
  817:10  error  'onInvokeElement' is defined but never used  no-unused-vars
https://ci.chromium.org/p/chromium/builders/ci/Linux%20Tests/81950

Original change's description:
> Reland "Convert ui/ARIAUtils.js to an ES module"
>
> This is a reland of b3373919f86df10c190a8672ca828c7ea4b920e5
>
> Original change's description:
> > Convert ui/ARIAUtils.js to an ES module
> >
> > ES modules allow files to explicitly import and export symbols [1].
> > This patch migrates ARIAUtils.js to an ES module, while maintaining
> > backwards compatibility with existing usages of `window.UI.ARIAUtils`.
> >
> > The build system is updated to copy these modules verbatim, as it no
> > longer require pre-processing to be loaded. The `module.json` no longer
> > includes this file as a script, to make sure it is not double-bundled
> > into `shell.js`. Instead, it is added to the new field `modules`, which
> > contains all modules. By doing so, it becomes clear which files are
> > converted to modules already and which require the legacy references
> > to the global scope.
> >
> > This module and future modules will be imported from `root.js`, which is
> > added to all existing HTML application files.
> >
> > Design Doc: https://docs.google.com/document/d/1h9dOy3nNPNfZ2AtZXzB-DwJqG4Oo37WWvKLCuzCcPzo/edit?usp=sharing
> >
> > [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
> >
> > TBR=jochen@chromium.org
> >
> > Change-Id: Ie79c8f2fce3aff96fa28af0b575eae39bfe8e1a5
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1748949
> > Reviewed-by: Jochen Eisinger <jochen@chromium.org>
> > Reviewed-by: Yang Guo <yangguo@chromium.org>
> > Commit-Queue: Tim van der Lippe <tvanderlippe@google.com>
> > Cr-Commit-Position: refs/heads/master@{#697238}
>
> Change-Id: I7544cbf4364d0b1a3c2f137a4d17a1afdb1d4aed
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1810534
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#697626}

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

Change-Id: I445fd35f135450cd9e8ed4c69bf913662f461ce6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1811989
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#697824}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 901bcc219d9204748f9c256ceca0f2cd68061006
2019-09-18 23:35:18 +00:00
Tim van der Lippe 63a4d3dcd6 Reland "Convert ui/ARIAUtils.js to an ES module"
This is a reland of b3373919f86df10c190a8672ca828c7ea4b920e5

Original change's description:
> Convert ui/ARIAUtils.js to an ES module
>
> ES modules allow files to explicitly import and export symbols [1].
> This patch migrates ARIAUtils.js to an ES module, while maintaining
> backwards compatibility with existing usages of `window.UI.ARIAUtils`.
>
> The build system is updated to copy these modules verbatim, as it no
> longer require pre-processing to be loaded. The `module.json` no longer
> includes this file as a script, to make sure it is not double-bundled
> into `shell.js`. Instead, it is added to the new field `modules`, which
> contains all modules. By doing so, it becomes clear which files are
> converted to modules already and which require the legacy references
> to the global scope.
>
> This module and future modules will be imported from `root.js`, which is
> added to all existing HTML application files.
>
> Design Doc: https://docs.google.com/document/d/1h9dOy3nNPNfZ2AtZXzB-DwJqG4Oo37WWvKLCuzCcPzo/edit?usp=sharing
>
> [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
>
> TBR=jochen@chromium.org
>
> Change-Id: Ie79c8f2fce3aff96fa28af0b575eae39bfe8e1a5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1748949
> Reviewed-by: Jochen Eisinger <jochen@chromium.org>
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Tim van der Lippe <tvanderlippe@google.com>
> Cr-Commit-Position: refs/heads/master@{#697238}

Change-Id: I7544cbf4364d0b1a3c2f137a4d17a1afdb1d4aed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1810534
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#697626}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: ec810baced8e07ca3e9f2b801703be433807d2a2
2019-09-18 15:31:38 +00:00
Takuto Ikuta 4cabd3c98e Revert "Convert ui/ARIAUtils.js to an ES module"
This reverts commit b3373919f86df10c190a8672ca828c7ea4b920e5.

Reason for revert: https://ci.chromium.org/p/chromium/builders/ci/Linux%20Tests/81914

Original change's description:
> Convert ui/ARIAUtils.js to an ES module
> 
> ES modules allow files to explicitly import and export symbols [1].
> This patch migrates ARIAUtils.js to an ES module, while maintaining
> backwards compatibility with existing usages of `window.UI.ARIAUtils`.
> 
> The build system is updated to copy these modules verbatim, as it no
> longer require pre-processing to be loaded. The `module.json` no longer
> includes this file as a script, to make sure it is not double-bundled
> into `shell.js`. Instead, it is added to the new field `modules`, which
> contains all modules. By doing so, it becomes clear which files are
> converted to modules already and which require the legacy references
> to the global scope.
> 
> This module and future modules will be imported from `root.js`, which is
> added to all existing HTML application files.
> 
> Design Doc: https://docs.google.com/document/d/1h9dOy3nNPNfZ2AtZXzB-DwJqG4Oo37WWvKLCuzCcPzo/edit?usp=sharing
> 
> [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
> 
> TBR=jochen@chromium.org
> 
> Change-Id: Ie79c8f2fce3aff96fa28af0b575eae39bfe8e1a5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1748949
> Reviewed-by: Jochen Eisinger <jochen@chromium.org>
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Tim van der Lippe <tvanderlippe@google.com>
> Cr-Commit-Position: refs/heads/master@{#697238}

TBR=yangguo@chromium.org,jochen@chromium.org,aerotwist@chromium.org,mathias@chromium.org,tvanderlippe@google.com

Change-Id: I550f1082755ef4b9e7bc778e3afdaef324dae03a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808954
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#697355}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 53558661a67dcdf9d11bb2571d43ebca6f504670
2019-09-17 20:55:22 +00:00
Tim van der Lippe 321ff26d6d Convert ui/ARIAUtils.js to an ES module
ES modules allow files to explicitly import and export symbols [1].
This patch migrates ARIAUtils.js to an ES module, while maintaining
backwards compatibility with existing usages of `window.UI.ARIAUtils`.

The build system is updated to copy these modules verbatim, as it no
longer require pre-processing to be loaded. The `module.json` no longer
includes this file as a script, to make sure it is not double-bundled
into `shell.js`. Instead, it is added to the new field `modules`, which
contains all modules. By doing so, it becomes clear which files are
converted to modules already and which require the legacy references
to the global scope.

This module and future modules will be imported from `root.js`, which is
added to all existing HTML application files.

Design Doc: https://docs.google.com/document/d/1h9dOy3nNPNfZ2AtZXzB-DwJqG4Oo37WWvKLCuzCcPzo/edit?usp=sharing

[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import

TBR=jochen@chromium.org

Change-Id: Ie79c8f2fce3aff96fa28af0b575eae39bfe8e1a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1748949
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@google.com>
Cr-Original-Commit-Position: refs/heads/master@{#697238}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b3373919f86df10c190a8672ca828c7ea4b920e5
2019-09-17 15:56:41 +00:00
Joel Einbinder f6f86b6a43 DevTools: SVG Icons
This switches our icons to use svg instead of png. It replaces
the png optimizer with an svg optimizer.

Change-Id: I63f8de9059502ab952d39bbefe5da1f6d4708d37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1643403
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: Erik Luo <luoe@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#667807}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 56a647b2510baf3b314fab1130dbe08c191c9072
2019-06-10 23:19:12 +00:00
Lorne Mitchell c56ff2d968 Reland of "DevTools: Added GRD/GRDP files for all localizable strings in the DevTools."
This is a reland of https://chromium-review.googlesource.com/c/chromium/src/+/1613921/, which was reverted (Bug=966547) because
third_party/blink/renderer/devtools/front_end/langpacks/devtools_ui_strings.grd was being picked up by Google's internal localization pipeline.

Bug=941561

Change-Id: I9a97e16e367716189d34944b76605c9321d47092
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1627921
Reviewed-by: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Alexei Filippov <alph@chromium.org>
Commit-Queue: Lorne Mitchell <lomitch@microsoft.com>
Cr-Original-Commit-Position: refs/heads/master@{#664013}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 613ca444d07326b6f087c083af79a636a858a7d9
2019-05-28 23:35:03 +00:00
Krishna Govind 897c867a07 Revert "DevTools: Added GRD/GRDP files for all localizable strings in the DevTools."
This reverts commit 2f05fdbf2ab3458b4b3a3f2a86f908a3a7d04f79.

Reason for revert: Breaks chrome translation, crbug 966547

Original change's description:
> DevTools: Added GRD/GRDP files for all localizable strings in the DevTools.
> 
> This change includes...
> * A main GRD file for the DevTools (front_end/langpacks/devtools_ui_strings.grd)
> * GRDP files organized by subfolder
> * A node script that keeps the GRD/GRDP files in sync with the keys in the DevTools frontend
> * A git cl presubmit --upload check that runs the node script
> 
> Note: Subsequent changes will add a build step to generate a .pak file that contains these DevTools strings. You can read about the overall approach here (https://bugs.chromium.org/p/chromium/issues/detail?id=941561).
> 
> 
> Details of this design:
> ======================
> We followed a similar pattern used by WebUI where strings are encoded in GRIT GRD/P files, which are used by a localization service to perform translations. They are also consumed in the build step to generate a .pak file, which is loaded by the browser's resource system.
> 
> Chromium documentation:
> * https://www.chromium.org/developers/tools-we-use-in-chromium/grit/grit-users-guide
> * https://www.chromium.org/developers/design-documents/ui-localization
> 
> Frontend strings:
> -----------------
> These are the localizable strings that are displayed to the user.
> 
> GRDP <message> strings:
> -----------------------
> Each frontend string has a corresponding <message> entry in a GRDP file. These entries are what the localization service will use to perform localizations. It's also the input to the GRIT compiler, which generates a .pak file, which is loaded by the browser's resource_bundle system.
> 
> GRDP <messsage> placeholders:
> ----------------------------
> Frontend strings use placeholders, which are used to substitute in values at runtime.
> For example,
> 'This string has %s two placeholder %.2f.'
> 
> Since the order of the string may change in a different language, we need to encode the order of the placeholders. As such, in the GRDP file you'll find %s replaced with $[1-9].
> 
> For example,
> 'This string has <ph name="ph1">$1s</ph> two placeholder <ph name="ph2">$2.2f</ph>.'
> 
> Also, note that the precision and type of the placeholder is maintained (i.e. .2f).
> 
> Detecting changes:
> -----------------
> The check_localizable_resources.js script performs the following check and generates an error if there are any changes that need to be made to a GRDP file.
> 
> 1. Parses the frontend strings and hashes them.
> 2. Reads the messages from the GRDP files and hashes them.
> 3. Uses a difference between these two sets to report which strings need to be added and/or removed from GRDP files.
> 
> Optionally, the user can specify --autofix and it will automatically update the appropriate GRDP files.
> 
> Presubmit check:
> ---------------
> Running git cl presubmit --upload will run the check_localizable_resources.js script with the --autofix argument.
> 
> If there are any changes, they reported to the user like this.
> 
> ** Presubmit ERRORS **
> Error: Found changes to localizable DevTools strings.
> DevTools localizable resources checker has updated the appropriate grdp file(s).
> Manually write a description for any new <message> entries.
> Use git status to see what has changed.
> 
> BUG=941561
> 
> Change-Id: I5ac1656a037a6aaffeb4f64b103c4daec28be39a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1613921
> Reviewed-by: Joel Einbinder <einbinder@chromium.org>
> Reviewed-by: Alexei Filippov <alph@chromium.org>
> Commit-Queue: Lorne Mitchell <lomitch@microsoft.com>
> Cr-Commit-Position: refs/heads/master@{#662371}

TBR=alph@chromium.org,einbinder@chromium.org,exterkamp@chromium.org,jeffish@microsoft.com,lomitch@microsoft.com

Change-Id: Ic4ca7d000d10b2bc61b585198469ca30f051dc62
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 941561
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1627943
Reviewed-by: Krishna Govind <govind@chromium.org>
Commit-Queue: Krishna Govind <govind@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#662798}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: ceb872b6f6a02d707783563a225c77bb0c62170a
2019-05-23 20:33:45 +00:00
Lorne Mitchell 072e6f877f DevTools: Added GRD/GRDP files for all localizable strings in the DevTools.
This change includes...
* A main GRD file for the DevTools (front_end/langpacks/devtools_ui_strings.grd)
* GRDP files organized by subfolder
* A node script that keeps the GRD/GRDP files in sync with the keys in the DevTools frontend
* A git cl presubmit --upload check that runs the node script

Note: Subsequent changes will add a build step to generate a .pak file that contains these DevTools strings. You can read about the overall approach here (https://bugs.chromium.org/p/chromium/issues/detail?id=941561).


Details of this design:
======================
We followed a similar pattern used by WebUI where strings are encoded in GRIT GRD/P files, which are used by a localization service to perform translations. They are also consumed in the build step to generate a .pak file, which is loaded by the browser's resource system.

Chromium documentation:
* https://www.chromium.org/developers/tools-we-use-in-chromium/grit/grit-users-guide
* https://www.chromium.org/developers/design-documents/ui-localization

Frontend strings:
-----------------
These are the localizable strings that are displayed to the user.

GRDP <message> strings:
-----------------------
Each frontend string has a corresponding <message> entry in a GRDP file. These entries are what the localization service will use to perform localizations. It's also the input to the GRIT compiler, which generates a .pak file, which is loaded by the browser's resource_bundle system.

GRDP <messsage> placeholders:
----------------------------
Frontend strings use placeholders, which are used to substitute in values at runtime.
For example,
'This string has %s two placeholder %.2f.'

Since the order of the string may change in a different language, we need to encode the order of the placeholders. As such, in the GRDP file you'll find %s replaced with $[1-9].

For example,
'This string has <ph name="ph1">$1s</ph> two placeholder <ph name="ph2">$2.2f</ph>.'

Also, note that the precision and type of the placeholder is maintained (i.e. .2f).

Detecting changes:
-----------------
The check_localizable_resources.js script performs the following check and generates an error if there are any changes that need to be made to a GRDP file.

1. Parses the frontend strings and hashes them.
2. Reads the messages from the GRDP files and hashes them.
3. Uses a difference between these two sets to report which strings need to be added and/or removed from GRDP files.

Optionally, the user can specify --autofix and it will automatically update the appropriate GRDP files.

Presubmit check:
---------------
Running git cl presubmit --upload will run the check_localizable_resources.js script with the --autofix argument.

If there are any changes, they reported to the user like this.

** Presubmit ERRORS **
Error: Found changes to localizable DevTools strings.
DevTools localizable resources checker has updated the appropriate grdp file(s).
Manually write a description for any new <message> entries.
Use git status to see what has changed.

BUG=941561

Change-Id: I5ac1656a037a6aaffeb4f64b103c4daec28be39a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1613921
Reviewed-by: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: Alexei Filippov <alph@chromium.org>
Commit-Queue: Lorne Mitchell <lomitch@microsoft.com>
Cr-Original-Commit-Position: refs/heads/master@{#662371}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 2f05fdbf2ab3458b4b3a3f2a86f908a3a7d04f79
2019-05-22 21:58:44 +00:00
Mandy Chen 465b4f7931 DevTools: Add devtools localizability check to presubmit
This PR adds devtools frontend localizability check to the presubmit
script as reqeusted in
https://chromium-review.googlesource.com/c/chromium/src/+/1504254.

The new script, check_localizability.js, which run on frontend files
changed as part of the devtools presubmit check. In addition, you can
run $ npm run check-loc inside devtools/ to run the check on all
frontend js files.

**Note: Errors identified will be fixed and submitted as a separate
PR. **

check_localizability.js usage:

$ node check_localizability.js [-a | <.js file path>*]

-a: scan all devtools frontend js files
<.js file path>*: List of .js files with space-separated absolute paths

Localizability violations that it scans for:

- First argument to Common.UIString / UI.formatLocalized is not a string
- Conditional argument (e.g. cond ? trueCase : falseCase) found in
  Common.UIString / UI.formatLocalized / ls tagged template literal
- String concatenation is used with
  Common.UIString / UI.formatLocalized / ls``
- A specific argument to function is not localized (i.e. not wrapped in
  Common.UIString / UI.formatLocalized / ls``)
  - Currently, the script checks the third argument to createInput()

Here are a few examples of errors the script can output:

third_party\blink\renderer\devtools\front_end\resources\IndexedDBViews.js
 Line 1456: string concatenation should be changed to variable
substitution with ls: ' (' + Common.UIString('Key path: ')

third_party\blink\renderer\devtools\front_end\timeline\TimelineUIUtils.js
 Line 559-560: conditional(s) found in Common.UIString(
'%s [%s\u2026%s]', url, event.args['beginData']['startLine'] + 1,
endLine >= 0 ? endLine + 1 : ''). Please extract conditional(s) out
of the localization call.

Change-Id: I3243787ad5920b9b873f2feac7ed50a9c69bbe7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1524993
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Joel Einbinder <einbinder@chromium.org>
Commit-Queue: Mandy Chen <mandy.chen@microsoft.com>
Cr-Original-Commit-Position: refs/heads/master@{#643161}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: f1c8d4f5752ed8ab43babb602fa86121f8b14dbb
2019-03-21 22:52:54 +00:00
Joel Einbinder 08b53b8dfd DevTools: Generate jsconfig.json from module.json
This makes VSCode a lot faster in the DevTools codebase by only
autocompleting over the files depended on by this file.

Change-Id: I94421969291a135a46673c02722e77f0d6709426
Reviewed-on: https://chromium-review.googlesource.com/1058680
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: Erik Luo <luoe@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#558710}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 950b66e704654fe319225b5e1d2ac58f74cea0ce
2018-05-15 15:29:11 +00:00
Blink Reformat 4c46d0969f The Great Blink mv for source files, part 2.
Move and rename files.

NOAUTOREVERT=true
NOPRESUBMIT=true
NOTREECHECKS=true
Bug: 768828
TBR=darin@chromium.org
NOTRY=true

Change-Id: I66d3b155808bc5bdbf237b80208e1e552bcf7f28
Reviewed-on: https://chromium-review.googlesource.com/1001153
Reviewed-by: Blink Reformat <blink-reformat@chromium.org>
Commit-Queue: Blink Reformat <blink-reformat@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#549061}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0aee4434a4dba42a42abaea9bfbc0cd196a63bc1
2018-04-07 15:32:37 +00:00