Commit Graph
77 Commits
Author SHA1 Message Date
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
yulia 4c4b78c21a 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-21 13:10:52 +00:00
Nicolas Chevobbe 0377bffd06 Bug 1479521 - Refactor JsTerm autocompletion behavior; r=Honza.
We used to rely on different things to both display
the autocompletion text and accept an autocompletion.
This patches introduces new helper functions in order
to make the code more easy to reason about.
We also rollback our decision to show the popup when
there is only 1 item in the autocompletion list in
order to be more consistent with what Chrome does.

Differential Revision: https://phabricator.services.mozilla.com/D2824
2018-08-13 10:07:15 +00:00
Nicolas Chevobbe fb217fc428 Bug 1482826 - Fix DAMP autocomplete test; r=Honza.
We can now simply call setInputValue and the autocompletion
will happen. Since we are forcing the call to jsterm.complete,
there were 2 calls made to the server, making the measurements
in the test erroneous.
This also revealed a race in setInputValue: the text was
set by codeMirror before the cursor was actually moved. Which
means we were sending an erroneous autocompletion query to the
server.
We use codeMirror.operation to tell codeMirror to both set the
text and the cursor in a single operation.

Differential Revision: https://phabricator.services.mozilla.com/D3192
2018-08-13 10:07:18 +00:00
Nicolas Chevobbe d931b8a53f Bug 1480709 - Fix autocomplete popup misplacement; r=Honza.
The JsTerm relies on the codeMirror "change" event to
display the autocomplete popup, and then queries the
DOM to get the cursor element which will serve as an
anchor to the autocomplete popup.
Unfortunately, the "change" event is fired by the editor
__before__ the end of an operation (i.e. the actual DOM
update). Which means that if we are fast enough to get
the autocomplete items from the server, the cursor element
was not changed in the dom, and the computation of the anchor
is erroneous.
We fix this by listening to the "changes" event, which
is fired after the actual DOM changes.
In order to do that, we pipe down the event from the code
mirror instance to the source editor.

Differential Revision: https://phabricator.services.mozilla.com/D2710
2018-08-07 14:01:55 +00:00
James Teh 0711d113aa Bug 1480958: Don't treat the filter bar in the Web Console as live content for accessibility. r=nchevobbe
Because the console output area is marked as aria-live and the filter bar is inside this area, it inherits the aria-live attribute.
For screen reader users, this causes spurious speaking of typed characters when typing in the filter box.
Worse, it causes spurious speaking of numbers as the number of messages suppressed by various filters changes, resulting in an intolerable user experience.

Differential Revision: https://phabricator.services.mozilla.com/D2816
2018-08-07 06:37:32 +00:00
Julian Descottes de5cde2836 Bug 1480384 - Remove unused theme option for autocomplete-popup;r=nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D2666
2018-08-02 15:05:50 +00:00
Nicolas Chevobbe 767d3664e3 Bug 1478435 - Apply photon-styling to autocomplete popup; r=nchevobbe.
This removes the border-radius from the autocomplete popup (and
its items) and refines the spacing.
Since we have more padding for the autocomplete items, we need
to adjust the xOffset when showing the popup.
The yOffset of the webconsole autocomplete is tweaked a bit so
we see its border; the xOffset of the markup search input is also
tweaked to consider the left padding we use to display the search
icon in the input.

MozReview-Commit-ID: JyLySLBUgGy
2018-07-26 09:08:10 +02:00
Nicolas Chevobbe 782cafd9e4 Bug 1136299 - Move the console input in-line with the logs;r=bgrins.
MozReview-Commit-ID: CvmhJrFqCM
2018-07-23 07:01:02 +02:00
Nicolas Chevobbe e6d7e7ebde Bug 1478410 - Fix split console close in codeMirror jsterm; r=bgrins.
This patch removes the <kbd>Esc</kbd> handler from codeMirror
to put it on the jsterm-container. This prevent the interference
from codeMirror when we don't need to handle the event (i.e. it
should bubbles up to the toolbox where the split console state
is managed).
The webconsole_split test is run with both old and
new jsterm.

MozReview-Commit-ID: BaLyj4wSdmv
2018-07-25 18:26:27 +02:00
Nicolas Chevobbe 203e384fd0 Bug 1478366 - Add a recordTelemetryEvent function to serviceContainer; r=miker.
This then can be used directly in the console, or passed to reps
and ObjectInspector so it can be called from there.

MozReview-Commit-ID: uQOiGuYbJK
2018-07-25 13:54:27 +02:00
Nicolas Chevobbe 9e1f6ccfe7 Bug 1470103 - Fix autocomplete popup sizing issue in the console; r=jdescottes.
The popup was properly sized (and positionned), if it was previously closed,
which could led to layout issues when changing the autocomplete popup (e.g.
by typing a ".").
We now always call openPopup when there's items in the popup so it's always
properly sized.
I'm expecting some performance overhead here, but I'm working on another bug
that should make the popup faster.
A test is added to make sure we do resize the popup as needed.

MozReview-Commit-ID: K7dOllMrq0b
2018-07-18 15:14:29 +02:00
Jan Odvarko 01ca5dc6e2 Bug 1465352 - Clean up history reducer state; r=nchevobbe
MozReview-Commit-ID: LgWQ5fe7WXJ
2018-07-19 14:26:34 +02:00
Brian Grinstead 902ea7f169 Bug 1469341 - Remove the XUL wrapper document for the Browser Console;r=nchevobbe
MozReview-Commit-ID: KCZ6u5byQuO
2018-07-18 07:23:22 -07:00
Nicolas Chevobbe 1a63bc9c91 Bug 1473923 - Autocomplete console commands; r=yulia.
MozReview-Commit-ID: LpbIzheFmeT
2018-07-13 08:54:23 +02:00
Cosmin Sabou 214425133c Backed out changeset 7f8cd8745c66 (bug 1473923) for devtools failures on browser_jsterm_autocomplete_commands. CLOSED TREE 2018-07-18 22:32:24 +03:00
Nicolas Chevobbe efad89943d Bug 1473923 - Autocomplete console commands; r=yulia.
MozReview-Commit-ID: LpbIzheFmeT
2018-07-13 08:54:23 +02:00
Nicolas Chevobbe 08588ba98f Bug 1475165 - Do not reverse completion results in webconsole; r=Honza.
The autocompletion results were flipped in order to have them in reverse
order since the popup was displayed at the top of the input.
We do not want to do that anymore because of two reasons:
- I couldn't find any example in the wild doing the same thing, thus
we were making the user switch their habit to use it
- Bug 1136299 will make it so that the popup could be displayed either
at the top or at the bottom of the caret. We shouldn't have different
sorting for those different cases as it would make the popup even
harder to use.

MozReview-Commit-ID: CAzsKIaeKgV
2018-07-13 17:06:49 +02:00
Brian Grinstead fe5dffb412 Bug 1456852 - Programatically create the edit menu in the browser console input;r=nchevobbe
This allows us to open the context menu directly from webconsole.html when it's
running as a top level window. Ultimately, I'd like to not have to use special
handling in the console - all top-level windows should get the edit menu working
automatically for HTML inputs - but this lets us prove it out as a first consumer.

MozReview-Commit-ID: BYisQDtXWe4
2018-07-17 11:55:49 -07:00
Nicolas Chevobbe 058268ab81 Bug 1472080 - Make Enter always autocomplete the selected result; r=bgrins.
This patch ensure that we have a consistent behavior when
the autocomplete popup is open and the user hit Enter.
We remove the autocompletePopupNavigated property which
is now useless.
We also make sure that we always show the popup when we
have at least one result (previously we needed to have
2 results to make it visible). This is again for
consistency sake and making it more obvious for the
user what will happen when hitting Enter or Tab.
Tests are modified to reflect these new behaviors.

MozReview-Commit-ID: 8QgoeU6DNk6
2018-07-17 09:32:30 +02:00
Nicolas Chevobbe c5949ecbf9 Bug 1463674 - Enable autocompletion popup in codeMirror JsTerm; r=bgrins.
This patch translates old key handlers to codeMirror ones.

MozReview-Commit-ID: FGJehgGaBGI
2018-07-05 16:22:45 +02:00
Nicolas Chevobbe 54a2bcc177 Bug 1463674 - Refactor char and chevron width measurement; r=bgrins.
Create a separate function to measure the chevron width, and make
the function that measure the char width pure by only returning
the width.
The assignment to internal properties (_inputCharWidth, _chevronWidth),
is now done in componentDidMount which simplify reading this code.

MozReview-Commit-ID: FitY97Y03Sg
2018-07-05 16:40:03 +02:00
Mantaroh Yoshinaga 17e843bc86 Bug 1463357 - Add tooltip to the console button of split console and sidebar. r=nchevobbe
This patch add tooltip to close buttons of webconsole.

MozReview-Commit-ID: Elw0aGbn9k5
2018-07-12 13:11:55 +09:00
yulia 672e329511 Bug 1472673 - fix windows screenshot file test, add more console screenshot command tests; r=nchevobbe
MozReview-Commit-ID: 7P4l5PNjYwV
2018-07-09 14:34:06 +02:00
Nicolas Chevobbe 9ad854e0a8 Bug 1474236 - Remove defer usage in JsTerm.js; r=Honza.
This patch removes defer usage and now relies on async function.
Functions that was using callbacks are also moved to async, since
the callback only purpose was to resolve the deferred promise.

MozReview-Commit-ID: 3Y7cDrS1fkm
2018-07-09 08:59:14 +02:00
Brian Grinstead 7b852ac57d Bug 1472161 - Enter tabs in console when not at an autocomplete location;r=nchevobbe
This also allows Tab / Shift+Tab to unfocus the input if it is empty.

MozReview-Commit-ID: C8u5GTzvA8Z
2018-07-09 09:11:04 -07:00
Nicolas Chevobbe a4ebadf89a Bug 1472606 - Enable self-xss protection on CodeMirror JsTerm; r=Honza.
Event handlers needed to be added to the codeMirror editor in order
to enable the self-XSS protection that we have on the console.

MozReview-Commit-ID: IIMhhUb5Qj1
2018-07-02 08:40:46 +02:00
Nicolas Chevobbe 95f755531f Bug 1419081 - Cmd/Ctrl + click should put object in the sidebar; r=Honza.
In order to do that, we pass an onCmdCtrlClick to the ObjectInspector.
We also extract the dispatching of the SHOW_OBJECT_IN_SIDEBAR action to
its own function so it can be called directly with a grip.
browser_webconsole_object_in_sidebar is renamed and repurposed to test
this specific behavior, since there's already a test checking the context
menu way (browser_webconsole_context_menu_object_in_sidebar.js).

MozReview-Commit-ID: GCF1wFPWTH
2018-04-19 10:54:36 +02:00
yulia 27398cfcc4 Bug 1464461 - implement screenshot command in console panel; r=nchevobbe,ochameau
MozReview-Commit-ID: 8MDZglPqTz9
2018-06-04 17:46:48 +02:00
Cosmin Sabou 2d74169dce Backed out 4 changesets (bug 1464461) for Talos damp failures on webconsole/objectexpand.js. CLOSED TREE
Backed out changeset 001370fe21e3 (bug 1464461)
Backed out changeset 014fa1322e94 (bug 1464461)
Backed out changeset 50f7f633bb7d (bug 1464461)
Backed out changeset 6c9488ed5ebd (bug 1464461)
2018-07-03 15:28:03 +03:00