Closed Bug 1137281 Opened 10 years ago Closed 7 years ago

JavaScript Debugger no longer shows "" (empty string) keys on objects

Categories

(DevTools :: Debugger, defect, P2)

36 Branch
x86_64
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: derek.p.moore, Assigned: tromey)

References

Details

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Build ID: 20150220131007 Steps to reproduce: I have an object that can have an empty string key ("") added to it. Actual results: When I open the Debugger and hover over the variable a pop-up hover window shows only '> __proto__: Object' and it does not show the empty string key with its assigned Array. This happens in Firefox 35 and Firefox 36. In Firefox 35 I used to be able to click the "Watch" link in the pop-up to more completely inspect the object, where I could see the "" (empty string) key; but as of Firefox 36 even the "Watch expressions" sidebar omits the empty string key and its assigned value. Expected results: In the pop-up window inspector I should see: '> "": Array[n] > __proto__: Object' and I should be able to expand the empty string key to inspect its assigned value. Likewise, I should be able to watch the variable in the sidebar and also inspect all of its values.
PS: Now I have to resort to using the Console to inspect the object by typing in its name and hitting enter, where I see: Object { : Array[1] } instead of the old and more reasonable: Object { "": Array[1] } In these representations both "Object" and "Array" are links, clicking the Object link opens an object inspector side pane where the empty string key and its value is missing. Clicking the Array link lets me inspect the value of the array. Mozilla's JS Debugger should double-quote object keys that contain characters that cannot be unquoted according to JS syntax. E.g., this is what happens in the console: < obj = {"": 123, thing: 456, "other-thing": 789}; > Object { : 123, thing: 456, other-thing: 789 } but this is what should really happen: < obj = {"": 123, thing: 456, "other-thing": 789}; > Object { "": 123, thing: 456, "other-thing": 789 }
Severity: normal → blocker
Component: Untriaged → Developer Tools: Debugger
Reducing the severity of this; it is not a blocker for using the debugger generally, but we will fix this.
Severity: blocker → major
If the \p regexp proposal ever passes, then full correctness here would be easy to implement. See https://github.com/tc39/proposal-regexp-unicode-property-escapes/issues A nice page about the problem: https://mathiasbynens.be/notes/javascript-properties One simple way forward that wouldn't require unicode data, would be to quote most things except "words", aka /^\w+$/
I have a fix (no test yet) for this in reps, but I still need to see whether this requires a separate fix in object-inspector and perhaps variables view.
It did require a change in object-inspector. I'm probably not going to bother with variables view.
Assignee: nobody → ttromey
Step 1 is here: https://github.com/devtools-html/reps/pull/102 Step 2 will be bumping the version of reps. Step 3 will be the change to object-inspector.
(In reply to Tom Tromey :tromey from comment #5) > It did require a change in object-inspector. > I'm probably not going to bother with variables view. Thanks for addressing this! This is a long time coming for a such a small gotcha, I really appreciate your efforts! But, if the Variables View needs the fix, why not address it? Any way I can help?
(In reply to Derek Moore from comment #8) > Thanks for addressing this! This is a long time coming for a such a small > gotcha, I really appreciate your efforts! Thank you. I'm sorry this fell through the cracks. > But, if the Variables View needs the fix, why not address it? Any way I can > help? We're trying to eliminate the variables view in favor of the new "object inspector". See bug 1308566. I think this bug is best addressed via that route, so we don't spend time fixing a module we want to remove.
Depends on: 1308566
I thought it would work after the latest bundle drop but I see now that the patch wasn't included there. It should work after the next one though.
Assuming it will land this quarter, so P2.
Priority: -- → P2
This is working now.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.