Commit Graph
106 Commits
Author SHA1 Message Date
Nicolas Chevobbe 70a460e04e Bug 1509440 - Fix JsTerm completionText handling with Left/Home/End keys; r=Honza.
Differential Revision: https://phabricator.services.mozilla.com/D12772
2018-11-27 12:39:45 +00:00
Brian Hackett 7b65fc9428 Bug 1508840 - Handle messages with no execution point in the console, r=jlast. 2018-11-20 12:37:31 -10:00
Jason Laster 609c5a77d9 Bug 1504222 - Notify the client when devtools goes from replaying to recording. r=dwalsh
Tags:

Bug #: 1504222

Differential Revision: https://phabricator.services.mozilla.com/D11593
2018-11-16 10:24:27 -05:00
Nicolas Chevobbe 79147a9c34 Bug 1216632 - Make autocompletion work on $_ and $0; r=bgrins.
To make $0 autocompletion work, we need to pass the current
selectedNode actor from the frontend, so we can retrieve the
object reference later.
For $_, we need the webconsole actor reference to be able
to retrieve the last input result.
Since the list of parameters of JsPropertyProviders was
getting a bit long, we transform them in an object so it's
more legible on the consumer side.
Mochitests are added for both helpers to ensure this work
as expected.

Differential Revision: https://phabricator.services.mozilla.com/D11866
2018-11-15 09:49:14 +00:00
Nicolas Chevobbe a4f31f916b Bug 1390768 - Use new SmartTrace component in webconsole; r=Honza.
Depends on D11603

Differential Revision: https://phabricator.services.mozilla.com/D11604
2018-11-12 15:42:40 +00:00
Nicolas Chevobbe 1216204781 Bug 1462394 - Handle autocompletion data fetching and caching in Redux; r=Honza.
This patch moves all the logic we currently have
baked-in JsTerm to handle the autocompletion data:
- deciding to fetch from the server or the cache
- handling concurrent requests
- managing the cache.

This is now done through dedicated Redux actions and reducers.
In the JsTerm, where the autocompletePopup still lives, we
handle those data changes in componentWillReceiveProps.

Some tests were modified in order to pass with these changes.

Differential Revision: https://phabricator.services.mozilla.com/D11454
2018-11-12 16:07:37 +00:00
Nicolas Chevobbe 33fad905b8 Bug 1505024 - Disable codeMirror search addon in JsTerm; r=Honza.
This patches fixes a bug where hitting Cmd+F while
the filter input of the console was focused was
triggering codeMirror search addon, displaying the
search UI *in* JsTerm.
To prevent this, we add the ability for any consumer
of the Editor component to disable the search addon.
In the editor, in such case, we simply don't initialize
the event listeners that activate the search addon.
A test case is added to ensure we don't regress this.

Differential Revision: https://phabricator.services.mozilla.com/D11037
2018-11-06 14:08:13 +00:00
Jan Odvarko cfe87fe162 Bug 1476097 - Use the Menu API's edit menu for all context menu textboxes within the toolbox; r=bgrins,flod
Differential Revision: https://phabricator.services.mozilla.com/D6494
2018-11-05 10:52:27 +00:00
Margareta Eliza Balazs 59ee57e27a Backed out changeset 796f3bfbaa2d (bug 1476097) for perma dt failures in devtools/client/debugger/new/test/mochitest/browser_dbg-breakpoints-actions.js CLOSED TREE 2018-10-30 14:27:52 +02:00
Jan Odvarko 16f6621023 Bug 1476097 - Use the Menu API's edit menu for all context menu textboxes within the toolbox; r=bgrins,flod
Differential Revision: https://phabricator.services.mozilla.com/D6494
2018-10-29 16:24:03 +00:00
Nicolas Chevobbe 1de75c386e Bug 1498531 - Localize Webconsole WebReplay Jump icon; r=loganfsmyth,Honza.
This patch adds localization for the WebReplay Jump icon, and uses
the same terminology as the one used in the context menu that triggers
the same action.
The Jump button was used in-place of the existing level icons (Error, Warning, …),
and was only displayed when the message was hovered. We now ensure the
level icon is always visible and that we only show the Jump icon when the
message is hovered.
Finally, the button was styled targeting the title attribute in CSS, which
seemed a little brittle. We now use a dedicated class which should
be safer and more future proof.

Differential Revision: https://phabricator.services.mozilla.com/D8533
2018-10-22 05:26:33 +00:00
Brian Hackett c5057986cb Bug 1496881 - Fix test for whether we are paused at a console message. 2018-10-20 07:59:49 -06:00
Mark Banner 6462447652 Bug 1486741 - Enable ESLint rule comma-dangle for all of mozilla-central (manual fixes). r=mossop
Depends on D8389

Differential Revision: https://phabricator.services.mozilla.com/D8391
2018-10-19 08:33:17 +00:00
Mark Banner 3d6aaad3f5 Bug 1486741 - Enable ESLint rule comma-dangle for all of mozilla-central (automatic fixes). r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D8389
2018-10-19 12:55:39 +00:00
Nicolas Chevobbe f040be9941 Bug 1499070 - Fix timestamp for evaluation result; r=Honza.
When sending a command to the server, a timestamp is
computed before evaluating the string, and is then
sent back to the client in the packet.
However, if top-level await, or somme :commands, the
evaluation takes more time, which means the timestamp
is now innacurate.
For those cases, we update the timestamp before sending
the packet to the client.

Differential Revision: https://phabricator.services.mozilla.com/D8734
2018-10-18 09:41:53 +00:00
Bogdan Tara cb7970a285 Backed out changeset 0e8706e5d2ff (bug 1473841) for browser_jsterm_completion_invalid_dot_notation.js failures CLOSED TREE 2018-10-18 10:43:58 +03:00
Nicolas Chevobbe 577eaaaaa8 Bug 1473841 - Transform property access on a dot-notation invalid name into an element access; r=bgrins.
This patch turns property access that would result in
Syntax error (e.g. `x.data-test`) into element access
(e.g. `x["data-test"]`) when accepting a completion
value in the console input.
In order to do that, we use Reflect to parse  a custom
expression where we try to define the property the user
is going to accept. If this throws, this means we need to
modify the input into an element access.
A test is added to make sure this works as expected.

Differential Revision: https://phabricator.services.mozilla.com/D8952
2018-10-17 20:55:26 +00:00
Nicolas Chevobbe 77367c875a Bug 1425542 - Move inspectObjectActor away from jsterm; r=bgrins.
Differential Revision: https://phabricator.services.mozilla.com/D8519
2018-10-15 14:23:51 +00:00
Jason Laster e283e89e72 Bug 1496468 - Add a console pause indicator. r=loganfsmyth
Differential Revision: https://phabricator.services.mozilla.com/D7741
2018-10-04 20:14:53 +00:00
Anshul Malik 1f1b02f2f0 Bug 1495300 - Add paused and jump badge to console api messages r=jlast
Differential Revision: https://phabricator.services.mozilla.com/D7327
2018-10-02 18:32:55 +00:00
Jason Laster 7d999d369f Bug 1491471 - Move the OI store to the console. r=nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D5911
2018-09-27 20:09:51 +00:00
Nicolas Chevobbe 6518d8653d Bug 1410820 - top-level await evaluation should be handled as regular evaluation; r=bgrins.
This patch turns the current top-level handling, which relies on
the console API to print the result of the await expression, into
something natively handled by the server.

First, we don't add a .then handler to the generated async iife by
the mapper. We also removes the case we added in the JsTerm to *not*
print the result for top-level await expression.

In order to make the server capable of handling generated async iife
caused by the mapper, we send to evaluateJsAsync the `mapped` object
that `mapExpression` returns. This way, the server can check if an
expression was originally a top-level await.

If it is the case, we get the promise from the async iife and wait for
it to settle. If it resolves, we simply return the result, as a grip,
to the client. If it rejects, we return a special packet indicating to
not print anything to the client. The error will be reported by the
engine as `uncaught exception: …`.

We add several tests and modify the existing one to make sure we handle
top level await correctly in different situation (resolving, rejecting,
when paused in the debugger, when using $_, …).

Differential Revision: https://phabricator.services.mozilla.com/D6903
2018-09-27 15:59:47 +00:00
Nicolas Chevobbe 3f0c42ed54 Bug 1494545 - Make Ctrl+Space open the autocomplete popup in the console; r=Honza.
Differential Revision: https://phabricator.services.mozilla.com/D7049
2018-09-27 16:36:11 +00:00
StefanYohansson b66b832859 Bug 1172314 - Print arguments passed into console.trace. r=bgrins.
Added trace extra parameters to be printed alongside console.trace() output.

Differential Revision: https://phabricator.services.mozilla.com/D7051
2018-09-27 13:27:57 +00:00
Nicolas Chevobbe 83a7159e33 Bug 1476656 - Trigger autocomplete on bracket; r=Honza.
This patch adds the ability to open the autocomplete popup when
typing an opening bracket (i.e. `[`]) in the console input.
This impacts a significant amount of function where we assumed
that the only way to get a completion was to use a dot.
We uses the rename `anylyzeInputString` function to get the
completion part from an input, as well as if the user is performing
an element access (i.e., using the bracket).
We then send that information to the webconsole actor, which send
it to the client.
This allows us to rely on a single parse of the input and gives us
access to this information everywhere we need to, be it on the client
or on the server.

We allow the user to type property name without quotes, and we add
them when the user accept an autocompletion.
We also automatically add a closing bracket (i.e. `]`), when it's needed.

Some test are added. On the server side to make sure the actor's autocomplete
function returns what's expected.
We take that as an opportunity to add test for commands.
On the client side, tests are added to ensure the different behavior works
as expected (check the completion text and the input  after accepting
the completion when the user entered some letters, or not, with or without
quotes, with different quotes, hitting the autocomplete cache, …).

A test which accesses the autocomplete cache was modified since the shape
of the cache changed to include the last matchProp as well as the
isElementAccess boolean.

Differential Revision: https://phabricator.services.mozilla.com/D6128
2018-09-26 13:54:35 +00:00
Nicolas Chevobbe 1ba7f2c7b4 Bug 1491354 - Extends top-level await mapping from debugger to toolbox; r=bgrins,jlast.
This patch makes the parser-worker available at the toolbox level.
This way, the console does not have to rely on the debugger being
open to map top-level await expression.
In order to make the worker works in the toolbox, some changes
are required (passing a window object, checking inToolbox differently).

We take this as an opportunity to *not* display the async iife result,
a promise, in the console. This is made by checking if the input was
mapped, and if so, ignoring the result we get from the server.

A couple tests are added to ensure the basic usage works as expected.

This patch should be considered as a v0 for top-level await evaluation
as there are things that are not perfect here. Since we rely on console.log
the result are treated differently from other evaluation results:
- the style is different
- the result gets added to the log cache (when restarting the console,
the results will still be displayed, but not the commands).
- the results can be filtered, although evaluation results should not
- `$_` after a top-level await evaluation returns the Promise created
by the async iife, not the result that was displayed in the console.

All those should be addressed in Bug 1410820.

Differential Revision: https://phabricator.services.mozilla.com/D6038
2018-09-24 08:17:30 +00:00
Nicolas Chevobbe 40b36716d0 Bug 1491776 - Do not use markText to show the completion text; r=bgrins.
Differential Revision: https://phabricator.services.mozilla.com/D6020
2018-09-18 19:22:01 +00:00
Brian Grinstead 479f64d5e3 Bug 1490086 - Disable autoCloseBrackets feature for console input;r=nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D5907
2018-09-17 16:08:24 +00:00
Nicolas Chevobbe 22d13795ec Bug 1491763 - Fix React warnings in ReverseSearchInput.js; r=Honza.
Differential Revision: https://phabricator.services.mozilla.com/D5996
2018-09-17 12:10:24 +00:00
Nicolas Chevobbe cd01f072ab Bug 1024913 - Enable reverse search in jsterm; r=bgrins,flod.
Differential Revision: https://phabricator.services.mozilla.com/D3114
2018-09-10 10:24:40 +00:00
Nicolas Chevobbe 2237e6a2b9 Bug 1024913 - Move jsterm auto-focus handling into App.js; r=bgrins.
The App component takes the whole document space, so we can move the
code that listen for every click in the console UI to decide if the
jsterm should be focused or not.
This feels more like the React way, and will also provide us better
access to the store and the props when we need them in this focus
handling (like this will be the case for hiding the reverse search UI).

Depends on D5150

Differential Revision: https://phabricator.services.mozilla.com/D5152
2018-09-10 10:22:47 +00:00
Nicolas Chevobbe c9859e81c2 Bug 1489554 - Do not open the autocomplete popup if there's a letter right after the cursor; r=Honza.
Differential Revision: https://phabricator.services.mozilla.com/D5396
2018-09-10 10:17:12 +00:00
Margareta Eliza Balazs 932d871487 Backed out 5 changesets (bug 1024913) for causing perma damp failures. CLOSED TREE
Backed out changeset 1c18e0422ffa (bug 1024913)
Backed out changeset c4e5a7ff8e53 (bug 1024913)
Backed out changeset 7f269add6e54 (bug 1024913)
Backed out changeset ccd6afc2a739 (bug 1024913)
Backed out changeset 1613377c1b43 (bug 1024913)
2018-09-10 10:25:32 +03:00
Nicolas Chevobbe f03d9b555b Bug 1024913 - Enable reverse search in jsterm; r=bgrins,flod.
Differential Revision: https://phabricator.services.mozilla.com/D3114
2018-09-10 05:16:00 +00:00
Nicolas Chevobbe b1d3e3d467 Bug 1024913 - Move jsterm auto-focus handling into App.js; r=bgrins.
The App component takes the whole document space, so we can move the
code that listen for every click in the console UI to decide if the
jsterm should be focused or not.
This feels more like the React way, and will also provide us better
access to the store and the props when we need them in this focus
handling (like this will be the case for hiding the reverse search UI).

Depends on D5150

Differential Revision: https://phabricator.services.mozilla.com/D5152
2018-09-10 05:15:58 +00:00
Nicolas Chevobbe f3f45446b5 Bug 1479373 - Refactor autocomplete popup for performance; r=jdescottes.
This patch introduces some options that can be passed to
setItems and openPopup to prevent doing unecessary work.
The main ideas here are to create all the popup items and
put them in a document fragment which then will be appended
to the popup, so we don't add them one by one which can be costly.
When creatingthe items, we also create one directly with the
selected class if autoSelect is set to true. This way, we don't have
to toggle the class later (which led to another reflow).

We take this work as an opportinuity to clean up the component.
Unused function (like appendItem and removeItem) are removed,
selectedIndex does not use a getter/setter anymore.

Some of the consumers calls are updated and so is the component test.

Differential Revision: https://phabricator.services.mozilla.com/D4848
2018-09-06 05:48:02 +00:00
Dorel Luca f1adf73529 Backed out changeset ff6b5bae0da4 (bug 1479373) for devtools failures on devtools/client/inspector/rules/test/browser_rules_completion-new-property_04.js. CLOSED TREE 2018-09-05 15:10:37 +03:00
Nicolas Chevobbe 29bddc29c5 Bug 1479373 - Refactor autocomplete popup for performance; r=jdescottes.
This patch introduces some options that can be passed to
setItems and openPopup to prevent doing unecessary work.
The main ideas here are to create all the popup items and
put them in a document fragment which then will be appended
to the popup, so we don't add them one by one which can be costly.
When creatingthe items, we also create one directly with the
selected class if autoSelect is set to true. This way, we don't have
to toggle the class later (which led to another reflow).

We take this work as an opportinuity to clean up the component.
Unused function (like appendItem and removeItem) are removed,
selectedIndex does not use a getter/setter anymore.

Some of the consumers calls are updated and so is the component test.

Differential Revision: https://phabricator.services.mozilla.com/D4848
2018-09-05 08:34:47 +00:00
Nicolas Chevobbe decb40b746 Bug 1488336 - Group clear mark and markText for completion text; r=bgrins.
This way, codeMirror does not trigger so many reflows and
makes setAutocompletionText faster.
An unwanted side-effect was that it made closing the console
a lot slower. Looking at the closing code of the JsTerm, we
do call setAutocompletionText("") in the end, which we don't
really need since we destroy the editor shortly after. Removing
this call keeps closing time the same as before.

Differential Revision: https://phabricator.services.mozilla.com/D4905
2018-09-04 16:19:23 +00:00
Nicolas Chevobbe a7431b9434 Bug 1484979 - Fix old-jsterm UI glitches; r=bgrins.
The completion node was wrongly positioned as soon as the input overflowed.
We fix this by setting the completionNode height in resizeInput,
like we do for the inputNode.

The inputNode takes the whole remaining vertical space
when starting the console. But when typing, the height
is computed and set according to what's in the input.
Which means the input wasn't taking the remaining space
anymore, which could be weird (e.g. if the user wants
to select some text by starting dragging below the actual
input, although the UI would indicate it is possible).

The autocompletionPopup was a bit off due to 2 things:
- in the function that was returning the chevronWidth, we
were subtracting the autocomplete popup padding. But the
autocomplete popup already handles that itself.
- in the function that was computing the character width,
we were using offsetWidth which returned a rounded value.
This means that the further the autocompletion was displayed
at, the more the popup would be off. We use getBoundingClientRect().width
instead which gives us a decimal value.

And we also make sure to not alter the scrolling position in the inputNode
when accepting an autocompletion result (a test is added).

Differential Revision: https://phabricator.services.mozilla.com/D4207
2018-08-29 05:41:52 +00:00
Preeti Mukherjee bf8236b2bc Bug 696385 - change dom.a to dom.span in mozilla-central/devtools/client/webconsole/components/message-types/NetworkEventMessage.js#109; r=nchevobbe
MozReview-Commit-ID: 2PBUG8yQIXY

Differential Revision: https://phabricator.services.mozilla.com/D4136
2018-08-28 05:16:26 +00:00
Nicolas Chevobbe 8912f7cfae Bug 1485990 - Display 1-item-only autocomplete popup if autocompletion text can't be displayed; r=bgrins.
If the autocomplete only returns 1 item, we usually close the
popup and show the autocompletion text.
But in some cases the autocompletion text can't be shown (e.g.
there's some text after the cursor). So we end up showing
nothing for the user, which is not ideal.
In such case, this patch ensures we do show the popup so the
user can autocomplete and save some keystrokes.

Depends on D4061

Differential Revision: https://phabricator.services.mozilla.com/D4335
2018-08-27 16:25:57 +00:00
Nicolas Chevobbe 8d0154a21f Bug 672733 - Make autocomplete search case insensitive; r=Honza.
This patch adds a smarter heuristic for autocompletion results:
if the input first letter is lowercased, then we'll filter
matching properties case insensitively. But if the user starts
with an uppercase, we assume they know the property they want
and thus respect the casing.
For example: `win` will return both `window` and `Window`, but
`Win` will return `Window` only.
Due to this behavior, we change the order of the autocomplete
results so lowercased property are displayed before the uppercased
one.
If we take are example again, it's likely that if a user type `win`,
they want `window`, but the alphabetical order would return `Window`
first which would annoy user.

Now, since we return results that does not match exactly the user
input, we need to modify the frontend.

Usually, we only show the autocompletion popup if there are
at least 2 matching items, since 1 matching item will still
be displayed using the autocompletion text. But now, since the
input might not match, we want to still display the popup if
there is one matching item, but starts differentely than what
the user entered.
For example, the user typed `window.addeve`, which matches
`addEventListener`. The completion text will make it looks like
it will be completed to `window.addeventListener`, which would
be undefined. So showing the popup with the actual matching
property might avoid some confusion for the user.

A test was added to make sure the frontend works as expected.
Some test cases were added in the server test to make sure
the actor returns expected results. Other tests needed some
adjustement because of the insensitive case matches and the
new order of results.

Differential Revision: https://phabricator.services.mozilla.com/D4061
2018-08-27 16:08:56 +00:00
yulia 3074f9dd2e Bug 1483173 - introduce screenshot actor; r=ochameau
This patch introduces a screenshot actor, which allows the screenshot functionality to be
shared across tools, and also implements it for the toolbox itself

Differential Revision: https://phabricator.services.mozilla.com/D3341
2018-08-27 15:14:10 +00:00
Nicolas Chevobbe 0b55e4a09a Bug 1485510 - Fix mochitests that don't work with CM jsterm enabled; r=bgrins.
Differential Revision: https://phabricator.services.mozilla.com/D4209
2018-08-27 07:56:03 +00:00
fvsch 177dd3c565 Bug 1479750 - Part 2: Improve console alignment, visual consistency and icons; r=nchevobbe
Depends on D3482

Differential Revision: https://phabricator.services.mozilla.com/D3483
2018-08-23 08:00:24 +00:00
Brian Grinstead becddf3c2f Bug 1463669 - Enable syntax highlighting of input in the console output when possible;r=nchevobbe
When you enter JS into the console, we can now syntax highlight it in
the output when CodeMirror is enabled.

Differential Revision: https://phabricator.services.mozilla.com/D3842
2018-08-23 00:09:24 +00:00
Nicolas Chevobbe 9248f9f013 Bug 1483880 - Always hide the autocompletion popup in acceptProposedCompletion; r=Honza.
When hitting enter, if there was no autocompletionText shown (because
the input was matching a proposed value), then the autocompletion
popup wasn't closed.
We now close it every time, and only check the completionText to
insert a possible string after the cursor.
A test case is added to make sure we don't regress this.

Differential Revision: https://phabricator.services.mozilla.com/D3763
2018-08-22 11:40:09 +00:00
Nicolas Chevobbe edf76fe7da Bug 1479758 - Enable history navigation with Cmd/Ctrl ArrowUp/Down; r=bgrins.
Matches old-JsTerm behavior.

Depends on D2824

Differential Revision: https://phabricator.services.mozilla.com/D3196
2018-08-21 16:05:45 +00:00
Ciure Andrei 24922ea123 Backed out changeset 4f7d58a640b8 (bug 1483173) for browser_jsterm_screenshot_command_clipboard.js failures CLOSED TREE 2018-08-21 22:03:10 +03:00