variable name unusable after Uncaught TypeError
Reported by
aivier...@gmail.com,
Jun 13 2016
|
||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.63 Safari/537.36 OPR/38.0.2220.29
Steps to reproduce the problem:
1. Open F12 Developer Tool
2. Type 'let ws = WeakSet()', you will see "Uncaught TypeError: Constructor WeakSet requires 'new'(…)"
3. Then, try modify code and run it again, type 'let ws = new WeakSet()', But you will get "Uncaught TypeError: Identifier 'ws' has already been declared(…)"
4.Already been declared? Try this: 'ws = new WeakSet()', unfortunately, you will get "Uncaught ReferenceError: ws is not defined(…)"
5.What? Why it say already been declared just now? Try: 'window.hasOwnProperty('ws')' get 'false'
What is the expected behavior?
Variable name can use after throw error
What went wrong?
Variable name can't use again, V8 throw already been declared, but can't assign any thing to it, and get false from hasOwnProperty
Did this work before? N/A
Chrome version: 53.0.2766.0 Channel: canary
OS Version: 10.0
Flash Version: Shockwave Flash 21.0 r0
,
Jun 13 2016
Protip: don't use let/const in the Console. See https://bugzilla.mozilla.org/show_bug.cgi?id=1233734#c1
,
Jun 13 2016
It looks like Firefox has the same issue, and the first comment in the bug from comment #2 makes it sound like this is an expected consequence of the language. CCing relevant folks to see if there's something we can/should do about it.
,
Jun 21 2016
,
Jun 21 2016
As mkwst says, this is an expected consequence of the language, unfortunately. There have been several bugs reported by users to several browsers about this issue. I'd rather not introduce separate language modes like Firefox has, and instead address this at TC39 if we think it is something that should be pursued.
,
Jul 29 2016
closing as per comment #5 |
||||
►
Sign in to add a comment |
||||
Comment 1 by aivier...@gmail.com
, Jun 13 2016