Closed Bug 975167 Opened 6 years ago Closed 6 years ago

Traceback in autocompletion while debugging

Categories

(DevTools :: Console, defect)

26 Branch
defect
Not set

Tracking

(firefox29 fixed, firefox30 fixed)

RESOLVED FIXED
Firefox 30
Tracking Status
firefox29 --- fixed
firefox30 --- fixed

People

(Reporter: canuckistani, Assigned: msucan)

References

Details

Attachments

(1 file)

STR:

1. go to any bugzilla bug, for example this one
2. open the debugger, go to comments.js and put a breakpoint on line 53 ( in toggle_all_comments() )
3. open the split console and type in this:

var x = [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]]

4. try to get completion on one of the nested arrays, eg

x[0].

I get these tracebacks:

error occurred while processing 'autocomplete: TypeError: aName is not an identifier
Stack: DebuggerEnvironmentSupport.getProperty@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/toolkit/webconsole/utils.js:1046
getExactMatch_impl@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/toolkit/webconsole/utils.js:978
getVariableInEnvironment@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/toolkit/webconsole/utils.js:884
JSPropertyProvider@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/toolkit/webconsole/utils.js:827
WCA_onAutocomplete@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/main.js -> resource://gre/modules/devtools/server/actors/webconsole.js:732
DSC_onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/main.js:1023
LDT_send/<@resource://gre/modules/devtools/dbg-client.jsm -> resource://gre/modules/devtools/server/transport.js:258
makeInfallible/<@resource://gre/modules/devtools/DevToolsUtils.jsm -> resource://gre/modules/devtools/DevToolsUtils.js:80
Line: 1046, column: 0


onPacket threw an exception: Error: Server did not specify an actor, dropping packet: {"error":"unknownError","message":"error occurred while processing 'autocomplete: TypeError: aName is not an identifier\nStack: DebuggerEnvironmentSupport.getProperty@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/toolkit/webconsole/utils.js:1046\ngetExactMatch_impl@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/toolkit/webconsole/utils.js:978\ngetVariableInEnvironment@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/toolkit/webconsole/utils.js:884\nJSPropertyProvider@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/toolkit/webconsole/utils.js:827\nWCA_onAutocomplete@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/main.js -> resource://gre/modules/devtools/server/actors/webconsole.js:732\nDSC_onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/main.js:1024\nLDT_send/<@resource://gre/modules/devtools/dbg-client.jsm -> resource://gre/modules/devtools/server/transport.js:258\nmakeInfallible/<@resource://gre/modules/devtools/DevToolsUtils.jsm -> resource://gre/modules/devtools/DevToolsUtils.js:80\nLine: 1046, column: 0"}
Stack: DebuggerClient.prototype.onPacket/<@resource://gre/modules/devtools/dbg-client.jsm:655
resolve@resource://gre/modules/commonjs/sdk/core/promise.js:118
then@resource://gre/modules/commonjs/sdk/core/promise.js:43
then@resource://gre/modules/commonjs/sdk/core/promise.js:153
DebuggerClient.prototype.onPacket@resource://gre/modules/devtools/dbg-client.jsm:705
LDT_send/<@resource://gre/modules/devtools/dbg-client.jsm -> resource://gre/modules/devtools/server/transport.js:258
makeInfallible/<@resource://gre/modules/devtools/DevToolsUtils.jsm -> resource://gre/modules/devtools/DevToolsUtils.js:80
Line: 655, column: 0
Attached patch bug975167-1.diffSplinter Review
The problem is we try getVariable() with aName set to 'foo[whatever]'. We do not parse the string, we just split on '.', thus aName is an invalid identifier. We should, in the future, support at least array indexes.

Try push: https://tbpl.mozilla.org/?tree=Try&rev=ef7246501a15
Assignee: nobody → mihai.sucan
Status: NEW → ASSIGNED
Attachment #8379922 - Flags: review?(past)
Comment on attachment 8379922 [details] [diff] [review]
bug975167-1.diff

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

OK, let's just make sure a followup is filed for autocompleting array indexes.
Attachment #8379922 - Flags: review?(past) → review+
(In reply to Panos Astithas [:past] from comment #2)
> Comment on attachment 8379922 [details] [diff] [review]
> bug975167-1.diff
> 
> Review of attachment 8379922 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> OK, let's just make sure a followup is filed for autocompleting array
> indexes.

Thanks! We already have bug 943586 for that issue.
Duplicate of this bug: 976042
Landed: https://hg.mozilla.org/integration/fx-team/rev/4aecbfc2da19
Whiteboard: [fixed-in-fx-team]
OS: Mac OS X → All
Hardware: x86 → All
Comment on attachment 8379922 [details] [diff] [review]
bug975167-1.diff

[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 842682.
User impact if declined: the console stops working if you try to use array indexes or if you try to access properties using the obj['propName'] notation, while debugging a script.
Testing completed (on m-c, etc.): landed in fx-team, a test is included, and a green try push.
Risk to taking this patch (and alternatives if risky): minimal, it's just a try-catch around a debugger API call.
String or IDL/UUID changes made by this patch: none.
Attachment #8379922 - Flags: approval-mozilla-aurora?
I will approve it once it reached m-c. thanks.
https://hg.mozilla.org/mozilla-central/rev/4aecbfc2da19
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 30
Attachment #8379922 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Duplicate of this bug: 978170
Duplicate of this bug: 982459
QA Whiteboard: [qa-]
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.