Commit Graph
44 Commits
Author SHA1 Message Date
Benedikt Meurer 4dc2bc2b22 [cleanup] Remove another bunch of unnecessary Promise.resolve()s.
This cleans up the (unnecessary) use of `Promise.resolve()` in the
following files:

- sdk/RemoteObject.js
- sdk/RuntimeModel.js
- sdk/Script.js
- sdk/SDKModel.js
- sdk/CompilerSourceMappingContentProvider.js
- sdk/Connections.js
- sdk/NetworkManager.js

Bug: chromium:1161501
Change-Id: I404e3e175a3b41a2b4ca4cac1178c4d7254f4d11
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2653092
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2021-01-28 10:45:12 +00:00
Tim van der Lippe 05149e9772 Remove ls from legacy-defs
This adds all missing imports for `ls` to all files. After this change,
all usages of `ls` will now properly be resolved to a LocalizedString
rather than a normal string.

R=jacktfranklin@chromium.org

No-Presubmit: True
Change-Id: Icf6d8c3b8bea1f9e66f4b6b58e4ae4c7f99e6f9c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2629554
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>
2021-01-15 12:53:50 +00:00
Tim van der Lippe d7cfd14814 Fix no-implicit-coercion errors in front_end/
R=jacktfranklin@chromium.org

No-Presubmit: True
Bug: 1082789
Change-Id: Ic77884bf7e9b5dc74053915b3b10699368841b66
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2595268
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-01-07 12:40:16 +00:00
Tim van der Lippe e4d64e7ae0 Remove unrestricted from comments that include other annotations
For all comments that contained both the unrestricted annotation
and any other potential annotation, remove only the unrestricted
annotation.

R=szuend@chromium.org

No-Presubmit: True
Bug: 1011811
Change-Id: I27dd67f657cdb1a9233d768eea81cabe2591f5f7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2569759
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2020-12-02 15:31:52 +00:00
Benedikt Meurer a3b434580d [sdk] Break another cycle between sdk/ and bindings/
Set the "wasm://dwarf" fake source map URL on scripts only when the
Wasm DWARF debugging experiment is disabled. This way the Gimli based
prototype will not interfere with the language plugin manager based
extension.

Bug: chromium:1150029, chromium:1083146
Change-Id: I4ce070798d57f819fc11af6217f4f6e1bddfd6fc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2550644
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2020-11-20 08:22:16 +00:00
Benedikt Meurer 438cee3e08 [wasm] Hide gutter context menu options that don't work.
The following context menu options don't currently behave correctly with
WebAssembly or simply don't make sense, and are thus hidden from the UI
for now:

- 'Add condition breakpoint'
- 'Add logpoint'
- 'Edit breakpoint'
- 'Never pause here'
- 'Blackbox script'
- 'Continue to here'

Introduce a `DebuggerWorkspaceBinding.scripts()` method to iterate all
the scripts that are related to a given `UISourceCode`. We use that
method to check that every script related to the current `UISourceCode`
is JavaScript, and thus supports the full range of debugging
capabilities.

Bug: chromium:1136484
Change-Id: If6277b43b2fb2fb73e9f3aae53e09074b614f6ed
Fixed: chromium:1142275
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2498222
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2020-10-26 12:17:25 +00:00
Sigurd Schneider 0f2aa31583 More comprehensive initiator tracking for developer resource loads
This CL introduces an initiator object for loads that go through
the PageResourceLoader. This enables the page resource loader to
forbid certain resource loads based on the URL of the resource and
the URL of the initiator. This is important, for example, for loading
extension source maps.

Bug: chromium:974543
Change-Id: If2b1d8f93be60ad0d3ca8261074b92625ed58c02
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2339316
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2020-08-06 11:51:17 +00:00
Philip Pfaffe edad8321ca [wasm debug] Add an API for Language Plugins Extensions
This CL extends the existing extension API to support debugger language
plugins hosted inside chrome extensions. The patch adds a new
experimental interface to allow extensions to egister a language plugin,
which then gets called by the debugger to provide debug information.

Drive-By: Drop the experimental out-of-process language plugin made
obsolete by the language extensions.

Bug: chromium:1083146
Change-Id: Icbf755e5761f6b7a5df6406a725e38eba965683e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2245146
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
2020-07-20 11:08:07 +00:00
Benedikt Meurer a14393ff9a [sdk] Propagate protocol errors from Debugger.getScriptSource.
When using `invoke_getScriptSource`, we need to explicitly check whether
the result carries an error, and if so, turn that into an `Error`
manually.

Bug: chromium:1099680
Change-Id: I1a75ecf82d68bdeff9a673089b4ee6fa64985f86
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2270175
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2020-06-26 14:07:06 +00:00
Sigurd Schneider 398ed8b4cb Remember frameId for DevTools-initiated loads
This is pre-work for future CLs where we want to know which frame
triggered a DevTools initiated load.

Bug: chromium:1069378
Change-Id: Ib1e98c80e089046551cf9c4e42af5141ef0d08f6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2249919
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-06-18 11:04:36 +00:00
Benedikt Meurer b358e5fae9 [wasm] Handle disassembly on the editor level
Simplify the handling of non-breakable lines in general, and make
both the line mapping as well as the non-breakable lines iteration
unittestable.

Drive-by-fix: Implement binary search for more efficient
Wasm bytecode reverse mapping.

Fixed: chromium:1056632
Bug: chromium:1071432, chromium:1043047
Change-Id: Ibb2c029a7011206f0676d630c0c94a33fc83d3d8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2220098
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
2020-06-02 13:17:10 +00:00
Benedikt Meurer f6bc843257 [sdk] Properly encapsulate and await Script content.
The content of the `Script` is lazily loaded, but wasn't properly
encapsulated in a Promise and `await`ed correctly everywhere. This
change fixes that and removes the `_source` and `_originalSource`
fields from the `Script`. There are still data races left with
respect to Wasm source mapping, and those will be fixed in a later
CL once it's clear how we propagate this information.

Bug: chromium:1056632
Change-Id: I43b47825cfa41a8595c353b4205c0ef471ed524d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2218008
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
2020-05-28 15:04:30 +00:00
Sigurd Schneider 7b92165625 Convert TextUtils.ContentProvider.DeferredContent to tagged union
This actually discovered a bug in the implementation of
JavaScriptBreakpointsSidebarPane where the error condition
wasn't checked.

Bug: chromium:1011811, chromium:1079233
Change-Id: Ic2f3c990a587aa7077edd26a2445789355ebe0a4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2194877
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2020-05-19 13:16:36 +00:00
Philip Pfaffe f5e2e5abac Fix Wasm debugging based on the DWARF SourceMap approach
After the DebugSymbols CDP change landed, the backend stopped reporting
the fake wasm://dwarf source map urls. Until we properly support
DebugSymbols in the frontend, bring the fak url back in the frontend to
fix the DWARF SourceMap approach.

Bug: chromium:1082720
Change-Id: I366993c7183b9d47b7f42f7d2517571907f913f3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2201636
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
2020-05-14 14:49:25 +00:00
Wolfgang Beyer 7730698789 Fix return type after porting to TypeScript
Bug: chromium:1011811, chromium:1079233
Change-Id: I3c68b5e1859725991eba615dfddd22ac276ac0fb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2201638
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Wolfgang Beyer <wolfi@chromium.org>
2020-05-14 13:47:24 +00:00
Wolfgang Beyer 493b76784e Port Script.js to TypeScript
Bug: chromium:1011811, chromium:1079233
Change-Id: Ia54603a0ecd19787dedd9cd25cf8bfe25771a8d7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2199131
Commit-Queue: Wolfgang Beyer <wolfi@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-05-14 12:01:24 +00:00
Tim van der Lippe 86e3a6a5ad Add missing return types for function parameters in sdk/
These are required for the upcoming TypeScript 3.9.2 upgrade.

R=jacktfranklin@chromium.org

Bug: 1011811
Change-Id: I6e9d568ea8a9c7482d355a7d8bc084a579a0202e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2199120
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-05-13 11:31:01 +00:00
Z Duong Nguyen-Huu 4890aa6fee [wasm] Disallow setting breakpoints on unbreakable lines in WAT
Toggle non-breakable Wasm Disassembly lines to class of
'cm-non-breakable-line'.
Disallow to put breakpoint in non-breakable WAT as well.

Change-Id: Ib4fbb1cb7728a43790c719a9b12e248cab8bc163
Bug: chromium:1043033
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2160000
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Eric Leese <leese@chromium.org>
2020-05-07 17:05:49 +00:00
Tim van der Lippe dc9d2515c5 Add @ts-nocheck annotations to sdk and typecheck sdk/Connections.js
To enable full parallelization of all files in sdk/, we can add the
@ts-nocheck annotation to all files. This suppresses existing
TypeScript errors in these files.

We can then one-by-one remove these annotations and fix the issues
reported in these files. This allows us to parallelize the work
and work on many files at the same time.

As a starter, I typechecked sdk/Connections.js to verify that
typechecking works while all other files are not checked yet.
I did do so by locally suppressing all TypeScript errors in
SDKModel.js and remove the `instance` method on `TargetManager`.
I then confirmed that rebuilding with TypeScript correctly
fails on the missing method, but does not require SDKModel.js
itself to be typechecked.

Bug: 1011811
Change-Id: I46de3839f7d837e951967dd932218bda00c6ad5b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2156352
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-04-22 13:17:59 +00:00
Simon Zünd 182134236e Rename namespace import for protocol_client to ProtocolClient
R=tvanderlippe@chromium.org

Bug: chromium:1011811
Change-Id: Idf3e9eb8f6d52db78f563de53b7576ec6c9b9cdc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107557
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-19 12:08:52 +00:00
Philip Pfaffe ae8ec54beb Handle script language and code offset reported from the backend
Better identify handlable scripts in cxx dwarf language plugin

DISABLE_THIRD_PARTY_CHECK=Update JS Protocol

Bug: chromium:1057569
Change-Id: Ifbfd9d155483c609b1aed42f3264f1a30490af1d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2083142
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
2020-03-19 09:42:42 +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 18f0489a60 Reland: Move ContentProvider.js and StaticContentProvider.js to text_utils.
They used to live under common.

This is to avoid the dependency from common to text_utils caused by
the method performSearchInContent.

Layout tests were disabled:
https://chromium-review.googlesource.com/c/chromium/src/+/2096995

CL to fix and re enable tests
https://chromium-review.googlesource.com/c/chromium/src/+/2096018/


Bug: 1011811
Change-Id: I76415076366d748ed0b4fe6ff32c73bae0db1312
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2097337
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-17 12:12:17 +00:00
Simon Zünd b4c9ea79e7 Revert "Move ContentProvider.js and StaticContentProvider.js to text_utils."
This reverts commit ba56abb36c.

Reason for revert: Breaks two layout tests:
https://ci.chromium.org/p/devtools-frontend/builders/ci/DevTools%20Linux/739

The Try bot also caught this for this CL but was green for some reason.

Original change's description:
> Move ContentProvider.js and StaticContentProvider.js to text_utils.
> They used to live under common.
> 
> This is to avoid the dependency from common to text_utils caused by the method performSearchInContent
> 
> Bug: 1011811
> Change-Id: Ic6ccb32d8c18abda7b259ca14bafca4c7c2003ab
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2090785
> Commit-Queue: Jose Leal <joselea@microsoft.com>
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>

TBR=joselea@microsoft.com,tvanderlippe@chromium.org

Change-Id: Ie8c99b77123e916d9f0cde73339f9cac22fff3ef
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1011811
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2095308
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2020-03-10 06:29:38 +00:00
Jose Leal Chapa ba56abb36c Move ContentProvider.js and StaticContentProvider.js to text_utils.
They used to live under common.

This is to avoid the dependency from common to text_utils caused by the method performSearchInContent

Bug: 1011811
Change-Id: Ic6ccb32d8c18abda7b259ca14bafca4c7c2003ab
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2090785
Commit-Queue: Jose Leal <joselea@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-10 00:33:29 +00:00
Tim van der Lippe 00d4ce380f Fix usages for Common.DeferredContent typedef
This typedef could not live in `common.js`, as it was referenced in
files in common/ itself.

Bug: 1006759
Change-Id: If058bde3ab0d0ad2b2474ae522391c4f61cdfc71
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2056482
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-02-14 15:21:06 +00:00
Tim van der Lippe 5ed0fb968c Fix internal bindings in sdk/
These were some left-over fixes that regressed while doing phase 3 of
ESM. It includes fixing the typedefs in sdk-legacy to be in the proper
file and exported.

Bug: 1006759
Change-Id: I939d4287a78888fba65d4baed04ee90f14c88e23
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2055065
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-02-14 15:21:06 +00:00
Tim van der Lippe d41d863344 Migrate sdk/ to import cross-module
Bug: 1006759
Change-Id: I1f4d365ca078007f9d5e5b005e748bac3993e8da
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2016757
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-01-23 16:10:20 +00:00
Sigurd Schneider 5029dac177 Provide frameId getter on Script
Bug: chromium:1043120
Change-Id: I8625bd091b25d54ccf30780b6094c5ce6e7dc13b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2007498
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2020-01-20 09:23:58 +00:00
Tim van der Lippe 9293af7230 Migrate sdk/ to ESM internally
Bug: 1006759
Change-Id: I2bb0c8eaa4fdc89edd8da2b12d9fd0e08d427174
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2003327
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-01-17 15:17:17 +00:00
Tim van der Lippe 0c21af5553 Use module scope for workers
This changes the Common.Worker to create Workers that use the module
scope rather than the global scope. It allows us to use es-imports,
which consequently allows us to remove the bundling during the build
step. This should hopefully improve the Ninja non-determinism that we
were facing when making changes to files that are used in the various
workers.

Bug: 1006759
Change-Id: I7ac209817b1576d2accd790f1bf7ef6a658f5605
Fixed: 1013129
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1981615
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-01-08 15:12:05 +00:00
Eric Leese 9307b14e07 Disassemble Wasm in front end
This change uses the WasmParser library to disassemble
Wasm modules in the dev tools frontend. This will allow us to remove
the disassembly from the backend.

Bug: chromium:1013527
Change-Id: Iee751fa3da6c3b3d4ccd48c96f801f898406f28f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1941748
Commit-Queue: Eric Leese <leese@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2020-01-07 08:04:57 +00:00
Ingvar Stepanyan 1a8762b0f1 Add native DWARF support
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>
2019-10-30 00:51:22 +00:00
Sigurd Schneider d3ddd33257 [bindings] Fix location translation for inline script with #sourceURL=
Translation between source locations of inline scripts with #sourceURL=
did not work correctly, because the SourceFormatter handled them like
inline scripts. DevTools opens them in its own window, and then
continues to refer to locations in the file by the original positions
in the containing document; however, the line endings used for
formatting are line endings for the script only (in contrast to line
endings for other inline scripts, which just reuse the line endings
of the containing document).

This CL adds a hack to handle inline scripts with #sourceURL= separately
which entails that the SourceFormatter now also needs to know that
such scripts are displayed in their own frame (as it is supposed to
produce valid uiLocations). A redesign at some point in the future must
clean this up; at the moment only fragmental knowledge about how this is
supposed to work exists.

Bug: chromium:1003497, chromium:1005789
Fixes: chromium:1017738
Change-Id: I3e13c6bc76b8692ce6badc09880c41d1a7e444c4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1875713
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2019-10-25 09:06:15 +00:00
Rob Paveza 2eb8c14505 DevTools: Display error when source file can't load
The source editor, when it cannot load a particular file, will simply
display a blank file instead. At the bottom, this is because the APIs
used to load the files do not have a way to propagate an error up to
the call site. Rather, the callback either is never called, or is
called with just an empty string.

This refactor changes the way the project system loads file contents
by replacing the callback model with a Promise-based model. However,
in this version, rather than propagating an error (handled via
catch), the error is exposed as a property on the object passed via
the the load functions. Although it might be preferable to use
async throw/catch, because there are ~4-5 layers of redirection
through the project system, the added complexity seems to not really
justify that work. I'm open to reconsidering this design, though.

Attempting to load a file via file:// which does not exist previously
produced no error because the DevToolsUIBindings handler would just
always resolve with no content and HTTP status 200. I had previously
addressed that bug in this changeset, but I've split it out to
https://chromium-review.googlesource.com/c/chromium/src/+/1847833 .

Sample "after" screenshot: https://imgur.com/a/tlm90sg

Bug: 961940
Bug: 941035

Change-Id: If121611090e9c35eeb1de162b59f8a9f72f696d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817677
Reviewed-by: Lorne Mitchell <lomitch@microsoft.com>
Reviewed-by: Jeff Fisher <jeffish@microsoft.com>
Commit-Queue: Lorne Mitchell <lomitch@microsoft.com>
Cr-Original-Commit-Position: refs/heads/master@{#705438}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 61ec2a233d9a7bf4bb4b3e610de6fc233ae0d46e
2019-10-13 18:02:38 +00:00
Tim van der Lippe 9b7d21d126 Migrate sdk/ to ESM
Bug: 1006759
Change-Id: I3f5917ab3f5b3fb823ca460c395301ba19eed2df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1841792
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#703381}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 5a7c8d13f806d781e8edb96a9b1f152d4fe1258a
2019-10-07 18:48:07 +00:00
Benedikt Meurer d3cabc7836 [devtools] Only strip //# sourceURL= lines at the end of the source.
Previously the DevTools UI would strip out //# sourceURL=... and
//@ sourceURL=... lines from the script in the frontend no matter
where they showed up in the source code, which means that all the
positions after this line will be off by 1 between frontend
and backend. It's generally also very confusing to developers that
we're removing code from the script before showing it.

In general, we should just display exactly the code that the developer
wrote (similar to Firefox DevTools and Safari WebInspector), however
there's quite a bit of internal logic relying on the special handling
of sourceURL comments (at the end), for example when it comes to
snippets. So meanwhile we only remove the comments when they are found
at the end of the source code, which is where tools put them.

Bug: chromium:1003497
Change-Id: I4404e2f7b6b61d50f85e44bbd9e0ae56675670af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1840512
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#703244}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 41700f354fcb17636b6d8a280a5f291423e22813
2019-10-07 09:50:36 +00:00
Tim van der Lippe 1d6e57a0e3 Always add braces to single-line if-statements
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
2019-09-30 11:55:34 +00:00
Sigurd Schneider 5cc892d5f9 [devtools] Resolve less uiLocations to non-existent CSS/script locations
Both Bindings.cssWorkspaceBinding.uiLocationToRawLocations and well as
Bindings.debuggerWorkspaceBinding.uiLocationToRawLocations resolve
locations to non-existing CSS and Script locations. This patch fixes
Bindings.debuggerWorkspaceBinding.uiLocationToRawLocations to not do
this anymore, and hacks
Bindings.cssWorkspaceBinding.uiLocationToRawLocations to not do it
for formatted sources anymore. For the ultimate fix, we need to get
the end position for inline CSS from the back-end. This will allow
us to clean-up the hack as well.

The significance of this change is that it enables precise coverage
gutters for inline CSS and inline scripts.


Bug: chromium:1004203, chromium:1005708, chromium:1005789
Change-Id: Ieadb2aef7e610ecec35e28f5f1cc4516a28a0780
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814299
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#698431}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0a2176832ad71200173bab203b83a4128062683c
2019-09-20 10:21:41 +00:00
Tim van der Lippe ffa7862d4e Update Closure compiler to v20190729
The new compiler caught a lot of pre-existing issues in the codebase.
Sadly, the old compiler version was not smart enough to understand the
new changes. Therefore, the changes have be included in the same CL as
the compiler update.

Most of the changes are related to better handling of prototype and
class inheritance, as well as handling of null/undefined tracking.

Change-Id: I3941a3a240a4d09c4945e1e20d2521090ef837c9
Bug: 991710
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762081
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@google.com>
Auto-Submit: Tim van der Lippe <tvanderlippe@google.com>
Cr-Original-Commit-Position: refs/heads/master@{#696761}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: ca93474213278e32e36d6ace1474c56884030757
2019-09-16 12:07:12 +00:00
Alexey Kozyatinskiy d91714258d DevTools: show origin url for anonymous scripts
R=lushnikov@chromium.org

Bug: chromium:646849
Change-Id: I8141bcdcfef7d9734ee9f1c97bfa552160fdcd9d
Reviewed-on: https://chromium-review.googlesource.com/1182865
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#586149}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: cc09ed9dfa66c1c27020fafe36c07601b947d2ad
2018-08-25 21:39:58 +00:00
Alexey Kozyatinskiy 3a2eb28446 [DevTools] replace snippets mapping with snippet FileSystem
New snippets use file system instead of own mappings.

R=lushnikov@chromium.org

Bug: none
Change-Id: I7c8e9c1f88f3a555ba98ba613658dbde39c3f0a0
Reviewed-on: https://chromium-review.googlesource.com/1173751
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#584771}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 54feed0d242111c0fd08db4315bffccdcfdad749
2018-08-21 16:22:02 +00:00
Alexey Kozyatinskiy 94b0f5dd37 [DevTools] simplify script with source map blackboxing
Current logic produces one Debugger.setBlackboxedRanges call on each
scriptParsed event. It makes our frontend too much chatty.
This CL simplify blackbox manager. With new logic blackbox manager
sends Debugger.setBlackboxedRanges iff script has sourceMap and at
least one sourceURL from sourceMap is blackboxed.
When blackbox pattern changed frontend will send setBlackboxedRanges
iff ranges are affected by change.

R=lushnikov@chromium.org

Change-Id: I8b9511f9feba50127de4add98c8d191877103145
Reviewed-on: https://chromium-review.googlesource.com/1162308
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#580742}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 2ba8a2397295a119aa848a1067ff1960ce2bb3f7
2018-08-04 04:44:54 +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