Commit Graph
23 Commits
Author SHA1 Message Date
Benedikt Meurer ae824e6ff5 [bindings] Introduce uiLocationRangeToRawLocationRanges().
This introduces a new uiLocationRangeToRawLocationRanges() method to the mapping layer which will be used by possibleBreakpoints() in the
BreakpointManager in the future to determine the set of raw location
ranges within which to ask V8 for breakable locations.

The new uiLocationRangeToLocationRanges() takes into account even
special cases like holes that can result from funny source maps, and in
the future should also be useful to compute the skip ranges for the
auto-stepping logic.

For the SourceFormatter ScriptMapping we kept the assumption that the
ranges must be contiguous even though they don't necessarily are (for
formatted documents with inline scripts), but the whole SourceFormatter
functionality is basically deprecated at this point and will soon be
removed (in-place pretty printing was enabled by default with M-111
already).

Bug: chromium:1409365
Change-Id: I3ec7db0ad32272a0af96c2c06f8506d4886bbe9e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4196922
Reviewed-by: Simon Zünd <szuend@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
2023-01-30 11:47:19 +00:00
Benedikt Meurer b086c01501 [cleanup] Simplify DefaultScriptMapping.
Remove the global WeakMaps from the DefaultScriptMapping and replace
them with per-instance Maps that are properly updated. Since there's
still the static `scriptForUISourceCode()` method around, we use the
same temporary workaround as in the `CompilerScriptMapping` of having
a global Set of all the instances meanwhile.

Also most importantly the UISourceCode to Script mapping is always
a 1:1 reverse mapping of the Script to UISourceCode mapping (while
our implementation was maintaining a Set of scripts for each of the
UISourceCodes in the global mapping).

With this change it's not only more efficient (avoiding the potentially
huge WeakMaps and favoring much cheaper - from a GC perspective - Maps),
but also easier to reason about the behavior of this mapping.

Bug: chromium:1379221
Change-Id: I5ed2493d2a001f315d690b7883a1d68ce369b1e5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4161377
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
2023-01-16 07:36:45 +00:00
Kim-Anh Tran 2e83d334b6 Add uiSourceCodeForScript to DebuggerWorkspaceBinding
The new method is used to get a uiSourceCode for a given script. This
will be used for instrumentation pauses, when we await a uiSourceCode
for setting a breakpoint.

This CL also adds instrumentation breakpoint tests for inline
scripts (with and without the html uiSourceCode being available),
and for regular scripts; with the latter one replacing an old
test using the old infrastructure. These tests all make use of the
uiSourceCodeForScript method.

Bug: 1396298, 1395337
Change-Id: Ic699a39cc414bd831d2d34afdd848317d32eae90
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4111047
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
2023-01-12 08:54:35 +00:00
Benedikt Meurer 2379762d89 [sourcemaps] Fix sourcemaps for inline scripts with sourceURLs.
When resolving locations in inline <script>s with `//# sourceURL`
annotations we must not add the line/column offsets.

Fixed: chromium:1405134
Change-Id: If600f547a9687e4517c16d8f58d14f27758b9277
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4136099
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
2023-01-05 20:47:54 +00:00
Jaroslav Sevcik 006dc9d1ea [breakpoints] Improved handling of breakpoints in inline scripts
If a user adds a breakpoint in an inline script before the embedding
document is loaded, the breakpoint will not be persisted under the
correct URL, so the breakpoint does not persist across reloads.

This patch makes sure that we use the emedding document's URL for
breakpoints in inline scripts. This unfortunately requires some
tricky translation between the inline script's and the embedding
document's line-column coordinates.

Bug: chromium:1355758
Change-Id: I903d3dd5656fdb67da4ecf25c89bbf4eb7983b1c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4061712
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
2022-12-01 06:05:16 +00:00
Jaroslav Sevcik ec855d6e98 [sources] Fix location mapping for inline scripts
If the debugger stops in an inline script without source URL before the
embedding HTML arrives, the stopping position in the source view is off.
This adjusts the source positions to account for the fact that for
scripts without sourceURL, v8 provides source positions in embedder
coordinates, but the devtools maps to the embedded script locations.

Bug: chromium:1325457
Change-Id: Ia56bec7fe1c3db678c4167a0ef01d4fffbfccada
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4038144
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
2022-11-21 08:02:46 +00:00
Jack Franklin 3a80260722 Inline type imports in front_end
This CL enables the `inline_type_imports` rule for devtools-frontend,
and is the result of running the auto-fixer to update all imports
accordingly.

Bug: 1319340
Change-Id: I303256476fd4e94f4505bbf4355c0070ac101aa9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3752799
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2022-07-13 09:26:00 +00:00
Kim-Anh Tran f58a83ed9c Reland "Enable synchronization on instrumentation breakpoints"
This is a reland of commit 1b596f3b4b.

Changes:
1. Gated behind an experiment
2. Removed changes that are currently not used since it's gated
   (i.e. test changes)

Original change's description:
> Enable synchronization on instrumentation breakpoints
>
> This CL introduces the synchronization point for setting
> breakpoints on new scripts using instrumentation breakpoints.
>
> Instrumentation breakpoints will trigger at the first statement
> of a newly run script. Afterwards we wait for all resources
> that we need to set a breakpoint (if one is cached for that
> particular script), set it, and resume.
>
> Note: this will not correctly synchronize the case where we
> just opened DevTools or just created a new target, as at this
> point some scripts might have started running. For this, we
> need to synchronize the Debugger.enable call, which is something
> that is left to take care of.
>
> Bug: chromium:1229541, chromium:1133307, chromium:1300509
> Change-Id: I44e9b053a7cf64cc1f477a68ce9389cd92a1d05d
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3470237
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
> Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>

Bug: chromium:1229541, chromium:1133307, chromium:1300509
Change-Id: I19553ddac9530fa3ccac6b245a3dd89da88c6d51
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3542248
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
2022-04-21 07:43:46 +00:00
Kateryna Prokopenko 2a1b3a93b0 Type all path and URL variables in WorkspaceImpl to Branded Types
Bug: 1299780
Change-Id: I1dffe6edc834cf5914d48c4e331510b1866f78b8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3484200
Reviewed-by: Eric Leese <leese@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Kateryna Prokopenko <kprokopenko@chromium.org>
2022-03-22 10:45:29 +00:00
Kim-Anh Tran bbb5232d14 Revert "Enable synchronization on instrumentation breakpoints"
This reverts commit 1b596f3b4b.

Reason for revert: closed the tree, more blink tests to adapt

Original change's description:
> Enable synchronization on instrumentation breakpoints
>
> This CL introduces the synchronization point for setting
> breakpoints on new scripts using instrumentation breakpoints.
>
> Instrumentation breakpoints will trigger at the first statement
> of a newly run script. Afterwards we wait for all resources
> that we need to set a breakpoint (if one is cached for that
> particular script), set it, and resume.
>
> Note: this will not correctly synchronize the case where we
> just opened DevTools or just created a new target, as at this
> point some scripts might have started running. For this, we
> need to synchronize the Debugger.enable call, which is something
> that is left to take care of.
>
> Bug: chromium:1229541, chromium:1133307, chromium:1300509
> Change-Id: I44e9b053a7cf64cc1f477a68ce9389cd92a1d05d
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3470237
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
> Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>

Bug: chromium:1229541, chromium:1133307, chromium:1300509
Change-Id: I9eccdf065820854746ec7ad4643362859c9960e4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3506653
Auto-Submit: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Johan Bay <jobay@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Owners-Override: Kim-Anh Tran <kimanh@chromium.org>
2022-03-08 13:45:41 +00:00
Kim-Anh Tran 1b596f3b4b Enable synchronization on instrumentation breakpoints
This CL introduces the synchronization point for setting
breakpoints on new scripts using instrumentation breakpoints.

Instrumentation breakpoints will trigger at the first statement
of a newly run script. Afterwards we wait for all resources
that we need to set a breakpoint (if one is cached for that
particular script), set it, and resume.

Note: this will not correctly synchronize the case where we
just opened DevTools or just created a new target, as at this
point some scripts might have started running. For this, we
need to synchronize the Debugger.enable call, which is something
that is left to take care of.

Bug: chromium:1229541, chromium:1133307, chromium:1300509
Change-Id: I44e9b053a7cf64cc1f477a68ce9389cd92a1d05d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3470237
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
2022-03-08 12:08:41 +00:00
Tim van der Lippe 2d9a95ce7b Suppress all existing promise races
To suppress the races, we mark these invocations with `void` per
the instructions of `no-floating-promises`. This explicitly marks
these statements as side-effect promises.

Engineers can later analyze these void statements and determine
whether the promise races are intentional or accidental.

R=jacktfranklin@chromium.org

Bug: 1239617
Change-Id: I6b7a24cf21029d6ff73b112b3e8255ebab8c60ec
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3366467
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim Van der Lippe <tvanderlippe@chromium.org>
2022-01-04 16:08:08 +00:00
Benedikt Meurer a992c9dfc6 Remove position adjustment for inline scripts with #sourceURL.
Following up on https://crrev.com/c/3069289 the back-end reports
positions (raw locations) for inline scripts with `//# sourceURL`
annotations relative to the start of the <script> tag content, rather
than relative to the surrounding document.

The DevTools front-end however was still trying to make up for the
wrong positions reported by the back-end, leading to negative line
numbers being reported and sometimes jumping to the wrong line when
using inline scripts with `//# sourceURL` annotations.

This change removes the hacks from the front-end and simply uses the
positions from the back-end, which are now correct.

Fixed: chromium:1270227
Bug: chromium:578269, chromium:1183990
Change-Id: I65a59f64f42230179f56218518e727116329ad5d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3291151
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
2021-11-22 07:01:30 +00:00
Tim van der Lippe 113abecd98 Reland "Migrate to private class fields in models/bindings"
This reverts commit 550eb43d4e.

Reason for revert: Fixed layout test

Original change's description:
> Revert "Migrate to private class fields in models/bindings"
>
> This reverts commit bad24493c9.
>
> Reason for revert: layout test causing autoroll failures: https://crrev.com/c/3218502
>
> Original change's description:
> > Migrate to private class fields in models/bindings
> >
> > R=​szuend@chromium.org
> >
> > Bug: 1222126
> > Change-Id: I3a6fbea503d3c0fded7208109e0d2b52b1159516
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3207879
> > Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
> > Reviewed-by: Simon Zünd <szuend@chromium.org>
>
> Bug: 1222126
> Change-Id: I47dd7e76d749c8f6503955f23ee9b5e452382ffb
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3218891
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>

Bug: 1222126
Change-Id: I80a7a70264de8236b8da860ff2ecc05b7ae32a85
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3218075
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-10-12 12:44:28 +00:00
Jack Franklin 550eb43d4e Revert "Migrate to private class fields in models/bindings"
This reverts commit bad24493c9.

Reason for revert: layout test causing autoroll failures: https://crrev.com/c/3218502

Original change's description:
> Migrate to private class fields in models/bindings
>
> R=​szuend@chromium.org
>
> Bug: 1222126
> Change-Id: I3a6fbea503d3c0fded7208109e0d2b52b1159516
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3207879
> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Simon Zünd <szuend@chromium.org>

Bug: 1222126
Change-Id: I47dd7e76d749c8f6503955f23ee9b5e452382ffb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3218891
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-10-12 09:14:00 +00:00
Tim van der Lippe bad24493c9 Migrate to private class fields in models/bindings
R=szuend@chromium.org

Bug: 1222126
Change-Id: I3a6fbea503d3c0fded7208109e0d2b52b1159516
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3207879
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2021-10-11 15:01:49 +00:00
Jan Scheffler 085122e946 [Underscore Migration] Migrate models/bindings
This patch is part of the underscore migration that adds the private
keyword to all properties that start with an underscore and removes the
underscore.

Bug:chromium:1207342
Change-Id: I26928144c6ade2c1494c81920c63b5e5ea9c7ade
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3077888
Auto-Submit: Jan Scheffler <janscheffler@chromium.org>
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-08-07 09:02:45 +00:00
Simon Zünd c100a8bb82 Use type-safe events for DebuggerModel
R=sigurds@chromium.org

Bug: 1228674
Change-Id: I2fa604a57cb8643b4081f4ba5d8a6f1f627c0632
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3062568
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2021-07-30 10:06:46 +00:00
Tim van der Lippe 877f04aa0e Remove eslint-disable statements from type imports
We no longer use the no-unused-vars and instead use the version
of typescript-eslint. The latter can properly detect unused
type-import usages. Therefore, we can remove the eslint-disable
statements, which are essentially noops.

This CL is the result of replacing

```
import type (.*) // eslint-disable-line no-unused-vars
```

with

```
import type $1
```

R=jacktfranklin@chromium.org

Bug: none
Change-Id: I141edcb7125e414c405760af1e4058bfdc6e30f3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3048473
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-07-26 12:53:27 +00:00
Simon Zünd 735921cd29 [cleanup] Move removeEventListeners off EventTarget
removeEventListeners is already an exported function. Removing
the static method from `EventTarget` allows us to make `EventTarget`
a true interface.

Bug: 1228674
Change-Id: I8a870edc90438f6556b08f3329df6b2f850be297
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2978375
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2021-07-13 12:33:35 +00:00
Jack Franklin a75ae7cbb3 Enforce import type when importing TS types.
Bug: none
Change-Id: I02ef1182143b7fe091ce92d59f04ac2188903e0d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2886925
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2021-05-11 14:00:22 +00:00
Tim van der Lippe 99aeaf3724 Move workspace to models/workspace
R=jacktfranklin@chromium.org

No-Presubmit: true
Bug: 1187573
Change-Id: Ia4bf7cb736dca976fb30d9e94beeda3e28115dce
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2815118
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-09 15:32:33 +00:00
Tim van der Lippe 959b6f067a Move bindings to models/bindings
R=jacktfranklin@chromium.org

No-Presubmit: true
Bug: 1187573
Change-Id: I48168f92899d652980df36cc15475da988f760c5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2810278
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-04-07 10:03:50 +00:00