Commit Graph
32 Commits
Author SHA1 Message Date
Tim van der Lippe 7f2002c598 [globals] self.runtime
Migrate all usages of self.runtime to Root.Runtime.Runtime.instance().

This also requires various type updates, as now Closure/TypeScript
can better understand the code and discover issues.

R=jacktfranklin@chromium.org

Bug: 1011811
Change-Id: Ice07aa0ca959e61a6acdf4618b9a272d8c1096b8
Fixed: 1081614
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2434339
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-09-29 10:52:39 +00:00
Tim van der Lippe d1a00aacb9 [globals] self.UI.context
R=jacktfranklin@chromium.org

Bug: 1058320
Change-Id: Icc1d806782e7624fff02e719670a2cca59070ddd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2364594
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-08-19 16:24:38 +00:00
Jan Scheffler f1f45a8c14 Migrate front_end/object_ui to devtools_entrypoint
R=aerotwist@chromium.org, jacktfranklin@chromium.org

Bug: 1101738
Change-Id: I32e970380fc80fd25233639242a05bbad63cb120
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2324587
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Auto-Submit: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-07-29 14:29:44 +00:00
Benedikt Meurer 80ef20871d [JavaScriptAutocomplete] Add support for optional chaining syntax
Previously we only supported auto-completion for properties when the
expression was "name." or "name[". This change adds support to also
cover the new "name?." syntax.

Drive-by-fix: Also add tests for auto-completion with regular dot
notitation as well as bracket notation.

Bug: chromium:1066415
Change-Id: If9767d5c4009715576e2afd4d14328eefd2c82b8
Fixed: chromium:1017086
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2203440
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-05-15 10:20:16 +00:00
Michael Liao 32f6f55c06 [JavaScriptAutocomplete]: Fixing unhandled exception when compileScript returns null
Issue:
- JavaScriptAutocomplete.isExpressionComplete calls RuntimeModel.compileScript
- When RuntimeModel.js hits an InspectorBackend.ProtocolError, it returns null
- isExpressionComplete doesn't handle the null case and checks result.exceptionDetails causing an unhandled exception

isExpressionComplete: https://cs.chromium.org/chromium/src/third_party/devtools-frontend/src/front_end/object_ui/JavaScriptAutocomplete.js?type=cs&q=if+(!result.exceptionDetails)+-f:out+file:JavaScriptAutocomplete.js&sq=package:chromium&g=0&l=676
compileScript: https://cs.chromium.org/chromium/src/third_party/devtools-frontend/src/front_end/sdk/RuntimeModel.js?type=cs&q=RuntimeModel.compileScript+-f:out&sq=package:chromium&g=0&l=265

Changes:
- Add null case to isExpressionComplete
Change-Id: I5c54310c465f588a00f5678da9fc625629c532c6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2111359
Commit-Queue: Michael Liao <michael.liao@microsoft.com>
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
2020-03-24 03:03:11 +00:00
Paul Lewis 4a896b29ab [global] Remaps self.SDK.consoleModel
Moves self.SDK.consoleModel to an instance() method.

Bug: 1058320
Change-Id: I52e403c85e6d478e43f7f82d48a34cba0c4fe47d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107626
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-20 12:32:37 +00:00
Simon Zünd a5e36d3036 Consider all JavaScript to have side effects
Instead of trying to guess whether some JavaScript code
has side-effects or not in the DevTools front-end, we now
rely on V8's more robust capability to figure that out.

This CL is a rebased re-upload of Yangs CL: https://crrev.com/c/1956891

R=petermarshall@chromium.org

Bug: chromium:1031243
Change-Id: Ic3451ecd69251a5a9c1cb5066efeabe2d55c707b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2096712
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
2020-03-12 06:25:20 +00:00
Paul Lewis daac106699 [global] Remaps self.SDK.targetManager
This CL changes references to self.SDK.targetManager (the global
instance of SDK.SDKModel.TargetManager) over to
SDK.SDKModel.TargetManager.instance(). To keep both TypeScript and
Closure happy we must make a method on the TargetManager class itself,
since it only allows private constructors to be accessed by static
methods on the class.

Bug: 1058320
Change-Id: I6ca35024c21cf24254fd6273138a1ab3e163ee00
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2088092
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-05 14:58:03 +00:00
Tim van der Lippe b1f2b6cce6 Remove typedefs from {object_ui,network,layer_viewer,input,inline_editor}-legacy.js
Bug: 1006759
Change-Id: I617f10f94b969a49a6d24bf00ba4f24409aa6211
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2060293
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-02-20 17:26:46 +00:00
Jack Franklin c9802f1f2f Create StringUtilities module and migrate escapeCharacters
First step towards removing `String.prototype.__` and instead defining
modules of pure functions.

`escapeCharacters` is a good first step as it's not used much [1].

[1]:
https://cs.chromium.org/search/?q=f:front_end+escapeCharacters&sq=package:chromium&type=cs

Bug: 1050549
Change-Id: Icf23e0d1f362050d2354b0e9b71cce1012103a2d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2056475
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-02-14 14:28:53 +00:00
Tim van der Lippe 64a94d8105 Migrate object_ui/ to import cross-module
Bug: 1006759
Change-Id: Ic6a53e6183e3621771c019c4c9692c072f812736
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2019123
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-01-24 12:13:48 +00:00
Paul Lewis e504fd6a5f [Global] Updates refs to SDK.consoleModel
Bug: 1006759
Change-Id: Ifa6d7f177a22a38eaa4f3a16a26c797659ddee98
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2017145
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-01-23 17:10:50 +00:00
Paul Lewis 4ae5f4f5ce [Global] Update refs to SDK.targetManager
Bug: 1006759
Change-Id: I0686ef929b89e75c2ea8a731c593d955eca85935
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2015119
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-01-23 10:56:40 +00:00
Paul Lewis d85dc3874a Migrates object_ui/ to ESM internally
Bug: 1006759
Change-Id: I958134ba20988888e9fd1377c30eec5bd9cac2ed
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1994973
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-01-14 18:34:58 +00:00
John Emau c13cd77e04 Fix autocomplete TypeError: protoNames is not iterable
Background:
protoNames is needed to display JavaScript object properties in the
autocomplete flyout. For example when editing code snippets in the
console, watches, and source pane.

Problem:
When callFunctionJSON fails due to a Protocol Error protoName is null [1]
which will cause the runtime TypeError: protoNames is not iterable [2].

Solution:
Check that protoNames is truthy before iterating over it; return early
with an empty array if protoNames is falsy.

[1]: https://cs.chromium.org/chromium/src/third_party/devtools-frontend/src/front_end/sdk/RemoteObject.js?l=658&rcl=6ced335a
[2]: https://cs.chromium.org/chromium/src/third_party/devtools-frontend/src/front_end/object_ui/JavaScriptAutocomplete.js?l=172&rcl=6ced335

Change-Id: I1431d3de6333bfd331e8ec1a1446d8051aa24157
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1919852
Commit-Queue: John Emau <John.Emau@microsoft.com>
Reviewed-by: Mandy Chen <mandy.chen@microsoft.com>
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
2020-01-11 04:06:21 +00:00
Tim van der Lippe 3574172dc4 Migrate object_ui/ to ESM
Bug:1006759
Change-Id: Ib6726f32d5424dc615055ea7ea2b1658fc44b2c4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1928920
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2019-11-21 15:49:14 +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
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
Joel Einbinder cb28fa5e88 DevTools: Don't label top level completions as from the first prototype
In an object like {abc: 123}, the property 'abc' was mistakenly labeled
as being from the Object prototype.

ScreenShot: https://i.imgur.com/bdIWNDt.png

Bug: none

Change-Id: I85aed6eaa6561afbc54f52115ec9bf539fd345eb
Reviewed-on: https://chromium-review.googlesource.com/c/1460180
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: Erik Luo <luoe@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#630533}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9746319d367067421d8cfabd83408fc478a90cea
2019-02-08 23:24:34 +00:00
Joel Einbinder d8924985b2 DevTools: Add $0 and $_ to autocomplete
Change-Id: I232a60e72b500fce1e995231d79a2a32313fd58e
Reviewed-on: https://chromium-review.googlesource.com/c/1392174
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#619856}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 4861a63889bacf46e3724f57c3df98e99c4dad4e
2019-01-04 01:50:19 +00:00
Alexey Kozyatinskiy 330bffbda3 DevTools: remove callbacks from RemoteObject.js
We have two version of a lot of methods: method and methodPromise.
It makes searching of methods usages in codebase a little harder, this
CL replaces all callback based methods with promisified one.

R=luoe@chromium.org

Bug: none
Change-Id: If30da32e1b062734d7db54b9c5a87ece73ef1d39
Reviewed-on: https://chromium-review.googlesource.com/1235212
Reviewed-by: Erik Luo <luoe@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#593291}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 6abe7663589214aa561a1a674c20a570effdeff1
2018-09-21 19:20:18 +00:00
Joel Einbinder 9b2d96dc3c DevTools: Select exact matches before other items in autocomplete.
This makes sure that if the user types in a property exactly, it will
always be the default selected suggested item.

Bug: 879351
Change-Id: I4425e105ff9381e164b3455f5e727c28e3b2d931
Reviewed-on: https://chromium-review.googlesource.com/1211862
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#589358}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 101464900ae8093c7a343f3a2642e8c17540f31b
2018-09-06 23:15:45 +00:00
Joel Einbinder 9be181d450 DevTools: Use CodeMirror for the conditional breakpoint editor
This adds syntax highlighting, autocomplete, argument hints, and
smart enter to the breakpoint editor

Change-Id: I973be5e44ff94f36fbefdeb1eb472122ee2789a9
Reviewed-on: https://chromium-review.googlesource.com/1144195
Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org>
Commit-Queue: Andrey Lushnikov <lushnikov@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#577394}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: f5874da31db94985ad43b1d50b6689e07794c5a6
2018-07-24 01:28:17 +00:00
Joel Einbinder 2ef9e0655f DevTools: Move autocomplete logic ConsolePrompt->JavaScriptAutocomplete
This makes the code reusable for other CodeMirrorTextEditors that
might want the same autocomplete experience we have in the Console.

Change-Id: I8660249c08d920d86d2b82524b7bd50d9b5deb05
Reviewed-on: https://chromium-review.googlesource.com/1092080
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Erik Luo <luoe@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#572381}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c965d521e045567c17783c5afe1d41c5b1c04d8b
2018-07-03 22:53:57 +00:00
Joel Einbinder 7528f5f309 DevTools: Give argument hints for native function without names
Some native functions don't have names in their toString, so now
we use the identifier the user typed in as a fallback.

Change-Id: I79ad4e630a39ff23a109485ea5afded9d660d54e
Reviewed-on: https://chromium-review.googlesource.com/1063037
Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org>
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#559392}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 8c78c1f97014e7e249a522342890f0b9fbc2efba
2018-05-17 01:47:03 +00:00
Erik Luo 157d472fd7 DevTools: update autocomplete keywords to ES2017
This updates the JS autocomplete keyword list with keywords from
Section 11.6.2.1
https://www.ecma-international.org/ecma-262/8.0/index.html

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

Bug: none
Change-Id: Ia555723e35311a83d6e64f19fc253a3ea9368384
Reviewed-on: https://chromium-review.googlesource.com/1058562
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Erik Luo <luoe@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#558840}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 87f64561f24091df1737ce123877be324350e4f3
2018-05-15 21:30:25 +00:00
Joel Einbinder 3f23eb2bdd DevTools: Argument hints for native functions
Change-Id: Ia0e9f3c98735d64a1188b4373c90b7ef2684ea48
Reviewed-on: https://chromium-review.googlesource.com/1054582
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org>
Reviewed-by: Erik Luo <luoe@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#558527}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: a5be1a79f122d4496aa4a09ddfad0b475d878248
2018-05-14 23:27:51 +00:00
Joel Einbinder 2fc0fb7ea3 DevTools: Give argument hints in the console prompt
https://i.imgur.com/Y3OlPM2.png

Change-Id: Ic1d9ef1d47ff93ce77bfc3ae7173689bccf0cb2c
Reviewed-on: https://chromium-review.googlesource.com/1031096
Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org>
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#557030}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 66bdf19b13c9a1dffbd47121101e0b8aedde3495
2018-05-09 00:43:10 +00:00
Joel Einbinder 7228ed7828 DevTools: Clear autocomplete cache when the execution context changes
This was attempted before, but the ExecutionContextChanged event is
actually for when the name of an execution context changes, not for
when a new one is selected by the user (or the page is reloaded).

Also added a safety clear on DebuggerResumed

Change-Id: I4c9360139fe90beee2fa3d8a82317fc3aed1e6ae
Reviewed-on: https://chromium-review.googlesource.com/1040906
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#555627}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: ae75af0b961edbac04cd8db77e9efaf77e962436
2018-05-03 00:30:10 +00:00
Joel Einbinder 7e91656ac6 DevTools: Don't show duplicate suggestions in the console prompt
Previously properties were shown from every prototype of the object,
regardless of whether or not they were overridden by a higher properity
prototype. This could be confusing with for example '[].leng' which
showed length twice.

Change-Id: I7cee5b18a62d542bbf4562510c4c461afc59da60
Reviewed-on: https://chromium-review.googlesource.com/1026698
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@{#554270}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 82a54db3b748052649a2c156b5c5e1e125b5ee0e
2018-04-27 02:58:26 +00:00
Joel Einbinder e0dcbceb5a DevTools: Use throwOnSideEffects in console autocomplete
This lets us give suggestions for expressions like: ({abc: 4 + 3}).

Change-Id: Ia46b2eadb7725753408eb694414344075d00153e
Reviewed-on: https://chromium-review.googlesource.com/1014308
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#552547}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 00226e5a08d7c0d45e972668f5e9cb5b8911836d
2018-04-21 01:49:53 +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