Closed Bug 1218455 Opened 9 years ago Closed 8 years ago

'this' doesn't get autocompleted in console

Categories

(DevTools :: Console, defect)

defect
Not set
normal

Tracking

(firefox44 affected, firefox45 fixed)

VERIFIED FIXED
Firefox 45
Tracking Status
firefox44 --- affected
firefox45 --- fixed

People

(Reporter: bgrins, Assigned: bgrins)

References

(Blocks 1 open bug)

Details

(Whiteboard: [polish-backlog])

Attachments

(1 file)

STR:
Open console
Type 't'

Expected:
'this' is offered as a suggestion

Actual:
'this' is not offered as a suggestion
May as well block this on Bug 1217591, which is moving the autocompletion stuff into it's own file
Depends on: 1217591
Nick, the list is populated by the debugger api's getOwnPropertyNames: https://dxr.mozilla.org/mozilla-central/source/devtools/shared/webconsole/js-property-provider.js#485.  This doesn't return 'this' when getting the properties in an environment.

This may be technically right (I'm not sure), but for the user's sake I'd love if `this` was autocompleted, and subproperties on `this.` as well.  Any ideas how to tackle this?  Maybe it could be included from the debugger APIs, or we could to somehow shim it in the actor.
Flags: needinfo?(nfitzgerald)
`this` is not a property, it is its own special thing, so I don't think it belongs in `getOwnPropertyNames`.

Probably best to special case it in the property provider.
Flags: needinfo?(nfitzgerald)
Assignee: nobody → bgrinstead
Status: NEW → ASSIGNED
Bug 1218455 - Special case 'this' to include in console autocompletion;r=fitzgen
Attachment #8694492 - Flags: review?(nfitzgerald)
Comment on attachment 8694492 [details]
MozReview Request: Bug 1218455 - Special case 'this' to include in console autocompletion;r=fitzgen

https://reviewboard.mozilla.org/r/26777/#review24293

LGTM, one small question below.

::: devtools/shared/webconsole/js-property-provider.js:500
(Diff revision 1)
> +    // Include 'this' in results for the global object (in sorted order)

This seems to be unconditionally adding "this" to the properties, regardless whether the given object is a global, which seems counter to what the comment describes. I would expect this loop to be guarded by some kind of global check.
Attachment #8694492 - Flags: review?(nfitzgerald) → review+
(In reply to Nick Fitzgerald [:fitzgen] [⏰PST; UTC-8] from comment #5)
> ::: devtools/shared/webconsole/js-property-provider.js:500
> (Diff revision 1)
> > +    // Include 'this' in results for the global object (in sorted order)
> 
> This seems to be unconditionally adding "this" to the properties, regardless
> whether the given object is a global, which seems counter to what the
> comment describes. I would expect this loop to be guarded by some kind of
> global check.

We discussed this and decided to remove the note in the comment about global objects, since 'this' is manually removed from non-globals later on.
Blocks: 1207868
https://hg.mozilla.org/mozilla-central/rev/4f704aecb249
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 45
I have reproduced in Nightly 44.0a1 (2015-10-26) on windows 8.1(64 bit) from Comment #0.
Build Id:20151026030422
User Agent:Mozilla/5.0 (Windows NT 6.3; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0

This Bug is now verified as fixed on Latest Firefox developer edition 
Build ID: 20160115004002
User Agent:Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
This Bug is now verified as fixed on Latest Firefox 45.0 Beta 3 

User Agent:Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Status: RESOLVED → VERIFIED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.