Closed Bug 1143279 Opened 9 years ago Closed 7 years ago

TypeError#toString() round-trips strings using single quotes from named function but double quotes from IIFE

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: cpeterson, Unassigned)

References

Details

If the TypeError is thrown from the top-level or a named function, the exception string uses single quotes. If thrown from an IIFE, the exception string uses double quotes.

Is this a dupe of WONTFIX'd bug 346898?

let o = {}; o[`1.1`].random_prop;
TypeError: o['1.1'] is undefined

function f() { let o = {}; o[`1.1`].random_prop; }
f()
TypeError: o['1.1'] is undefined

(function() { let o = {}; o[`1.1`].random_prop; })()
TypeError: o["1.1"] is undefined
Summary: TypeError#toString() round-trips strings using single from named function but double quotes from IIFE → TypeError#toString() round-trips strings using single quotes from named function but double quotes from IIFE
No longer reproducible, therefore resolving as WFM.


js> let o = {}; o[`1.1`].random_prop;
typein:1:13 TypeError: o["1.1"] is undefined
Stack:
  @typein:1:13
js> function f() { let o = {}; o[`1.1`].random_prop; } f()
typein:2:28 TypeError: o["1.1"] is undefined
Stack:
  f@typein:2:28
  @typein:2:61
js> (function() { let o = {}; o[`1.1`].random_prop; })()
typein:3:27 TypeError: o["1.1"] is undefined
Stack:
  @typein:3:27
  @typein:3:2
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.