Commit Graph
21 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 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
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
Sigurd Schneider 75a90b9eea Introduce the PageResourceLoader bottleneck for loading resources
This introduces a singleton PageResourceLoader and refactors loading of
additional developer resources to go through the loader. The loader
keeps track of all resources that get loaded, together with potential
load errors. If we ever decide to use a different method for loading
resources, we only need to change the PageResourceLoader.

Additionally, the loader limits the number of concurrent requests to
500, so as to not overload the backend. This is important, because
there is a limit of 2700 concurrent requests in the network stack -
if that limit is reached, additional requests will fail. Previously,
we introduced code in the back-end that retries requests, but this is
not a good approach, because only DevTools requests are retried.

Doing the rate limiting in the front-end has the downside that multiple
DevTools sessions don't have a shared limit, but simplifies the require-
ments for the back-end, so we think it is a good trade-off.

Bug: chromium:1069378
Change-Id: I05a9f3c79c685347c1e48b30c49f56801ae39fc3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2270537
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-06-29 15:31:53 +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
Sigurd Schneider 085beaa595 Promisify MultitargetNetworkManager.loadResource
Change-Id: I3ebff0a9fca7608e89cdf96aa5f289f76bd72637
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2246510
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2020-06-16 06:50:59 +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
Tim van der Lippe cd0bb373d1 [global] Remaps SDK.multiTargetNetworkManager
R=aerotwist@chromium.org

Bug: 1058320
Change-Id: Icb43c143ef0ca14bd3c9280cc5096862c892d030
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2173373
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-05-04 10:24:11 +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
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
Paul Lewis 5a922e78b5 [Global] Update refs to SDK.multitargetNetworkManager
Bug: 1006759
Change-Id: Id9152c0982e46484e0254ef9559bedad62e1bc6e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2017146
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-01-24 12:30:58 +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 a327cdef91 [sourcemaps] Report error message on resourceLoad error
This CL adds reporting of a human readable string which includes the
internal error code if a source map load fails. We could think about
providing a web.dev page with an explanation of the internal error
codes. In any case, this fine-grained distinction should be an
improvement for referencing errors on sites like stack-overflow. If
all else fails, the internal error code can be looked up in
net_error_list.h in the chromium sources.

Screenshot: https://imgur.com/a/dWjG1GS

Bug: chromium:1030746
Change-Id: I04ddbc3f98ab2d6c54fb067a89408cbb60217477
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1998761
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2020-01-22 11:42:13 +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
Sigurd Schneider 4c5f0c6744 [sourcemaps] More detailed error reporting for failed SourceMap loads
This CL reports internal error numbers to the DevTools console. This is
immediatelly useful for early adopters. We'll add text messages if this
turns out to be useful.

Bug: chromium:1030746
Change-Id: Id4f84a1822e0e01268821d6b643dde4f5f437b3f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1958994
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2019-12-11 13:14:54 +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