This CL fixes the Pretty-Print Infobar not formatting the source file
when the Pretty-Print button is pressed. The bug was caused by a subtle
change to the button delegate when it was updated to support TypeScript
causing it to no longer invoke the format function.
The CL slightly modifies the ScriptFormatterEditorAction to have button
a event handler to absorb the unused 'event' argument, so the Infobar
does not need to pass one to toggleFormatScriptSource.
Bug: 1159531
Change-Id: I8e1876e8ce0ebc1e498e81a619a905a007cabdf5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2596121
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Brian Cui <brcui@microsoft.com>
This was causing problems when trying to write a unit test that
included a file which transitively included formatter.js, which was
instantiating a SourceFormatter, leading to a chain of unfortunate
events which relied on some other module already being loaded, which
it wasn't.
To avoid the dependency chain between the imports, expose a function
getSourceFormatter which lazily instantiates a shared instance.
Bug: 1136848
Change-Id: I7c255186e53e131127ba00b7f719f2f1b34301c2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2456592
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Content for .wasm files is fetched as Base64-encoded string and served
like that all the way up to the UI layer. Thus the minified script de-
tection logic often thinks that this is a minified JavaScript file and
would offer to format it, which doesn't make any sense, and also doesn't
really work anyways. This changes the predicate to not even consider
Wasm wire bytes for formatting all together.
Fixed: 1094880
Bug: 1071432
Change-Id: I6bda7969eea1ddf8039b22f9c509ed922fc5843c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2246502
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
This CL makes several improvements to the Infobar component.
Most notably, action(s) can now be taken directly from the Infobar
itself. Clients of the Infobar component can pass any number of action
buttons during construction depending on the context.
Infobar has three uses presently in DevTools;
two of those use cases are actionable and have been upgraded with
this new experience:
- "Pretty print this minified file?" now has a "Pretty-print" button
where users can directly pretty-print the file.
- "This script is blackboxed in the debugger" now has an "Unblackbox"
button, plus a "Configure" button that opens Blackboxing settings.
The layout has been updated to reflow responsively for narrow
window widths and high zoom. Accessibility considerations include:
- Keyboard navigation: Infobar itself can now gain focus and be
dismissed by pressing the Esc key. Pressing the Enter key will
open the Learn More section.
- Screen reader support: Infobar contents are read aloud in a natural
and predictable fashion. The ARIA "alert" role is used on the Infobar
text content.
- High contrast support: Infobar text and buttons are visible in high
contrast view. Note, the icons are not high-contrast compliant;
HC icon updates throughout DevTools is a future task.
Demo: https://i.imgur.com/kNjI4pA.gif
Bug: 1056348
Change-Id: Id2e695af367fb8f5a1c489fa8d3d94c8974458fb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1981175
Commit-Queue: Brian Cui <brcui@microsoft.com>
Reviewed-by: Fabio Rocha <fabio.rocha@microsoft.com>
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