Closed Bug 967468 Opened 6 years ago Closed 6 years ago

The autocompletion popup deletes some of the suggestions

Categories

(DevTools :: Console, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 33

People

(Reporter: petruta.rasa, Assigned: sjakthol)

Details

Attachments

(1 file, 1 obsolete file)

Reproducible on:
Fx 27RC (BuildID: 20140127194636)
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
latest Aurora (BuildID: 20140203004003)
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
latest Nightly (BuildID: 20140203030203)
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0

Steps to reproduce:
1. Open the Web Console
2. Start typing in the bottom bar and expect the autocompletion pop up suggestions (eg "document.all.__d" gives two options defineGetter and defineSetter)
3. Continue typing (eg "document.all.__de")

Expected results: 
The suggestions are displayed until they are selected.

Actual results: 
In some cases the options given are deleted, the pop up disappears.
Other cases: document.DOCUMENT_PO, print.__lo

Notes:
1. This issue is a regression:
Last good revision: 76a944fa6b25 (2013-08-02)
First bad revision: d0edf8086809 (2013-08-03)
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?romchange=76a944fa6b25&tochan
ge=d0edf8086809

2. Reproducible on Mac OSX 10.9 and Ubuntu 32-bit.
Component: Developer Tools → Developer Tools: Console
Here's a patch that fixes the issue with a test case.

The problem was that console didn't consider prefix underscores as a valid characters in property names when it was constructing a prefix filter for cached entries but the server actor returned them correctly. For example when writing 'document.all.__d' the results came directly from the server but for term 'document.all.__de' the results were from a local cache of previous results. Due to the invalid prefix filter (it was 'de' instead of '__de') no cached entry matched the results.

The same thing happens with properties that start with '$$' so I decided to fix that case too.
Attachment #8416905 - Flags: review?(rcampbell)
Comment on attachment 8416905 [details] [diff] [review]
webconsole-fix-autocompletion-filtering-with-special-chars.patch

Review of attachment 8416905 [details] [diff] [review]:
-----------------------------------------------------------------

looks good. Just a minor comment update required.

::: browser/devtools/webconsole/webconsole.js
@@ +4288,5 @@
>  
>      if (this._autocompleteQuery && input.startsWith(this._autocompleteQuery)) {
>        let filterBy = input;
>        // Find the last non-alphanumeric if exists.
> +      let lastNonAlpha = input.match(/[^a-zA-Z0-9_$][a-zA-Z0-9_$]*$/);

I would update the comment to say something like,

// Find the last non-alphanumeric other than _ or $ if it exists.
Attachment #8416905 - Flags: review?(rcampbell) → review+
Here's a patch with the suggested comment fix.
Attachment #8416905 - Attachment is obsolete: true
The Try run is looking good. I or one of my cohorts will push this to fx-team soon :)
Keywords: checkin-needed
https://hg.mozilla.org/integration/fx-team/rev/759429576b4b
Flags: in-testsuite+
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/759429576b4b
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 33
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.