Open Bug 1543691 Opened 6 years ago Updated 3 years ago

Autocomplete doesn't unescape special characters

Categories

(DevTools :: Console, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: Oriol, Unassigned)

References

Details

Run this in the console:

var obj = {"a\\bc": 1};

Then, write obj["a\. Autocomplete suggests obj["a\\bc"], as expected.

But then write another backslash, obj["a\\. Now autocomplete doesn't suggest anything.

Delete that backslash and immediately write b (you need to be fast), obj["a\b. Now autocomplete suggests obj["a\bbc"]. Wut.

https://searchfox.org/mozilla-central/rev/69ace9da347adcc4a33c6fa3d8e074759b91068c/devtools/shared/webconsole/js-property-provider.js#399 just removes the initial quote and compares that with the properties. But this is not enough, string literals can contain escaped characters that need to be unescaped.

Another possibility would be calling wrapMatchesInQuotes for each property and compare the result, but this can be more expensive and won't match if the escaping was different (e.g. a newline can be escaped as \n, \x0a, \u000a, \u{a}).

Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.