-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assignment of global variables deleted by their RHS in strict mode is permitted #2093
Comments
See also #467, though in this case the right answer is clearer, I think. |
leobalter
added a commit
to leobalter/ecma262
that referenced
this issue
Jul 14, 2020
In PutValue, verify if the Reference is still preserved in its base in Strict Mode. Ref tc39#2093
leobalter
added a commit
to leobalter/ecma262
that referenced
this issue
Jul 14, 2020
leobalter
added a commit
to leobalter/ecma262
that referenced
this issue
Jul 14, 2020
In PutValue, verify if the Reference is still preserved in its base in Strict Mode. Ref tc39#2093
leobalter
added a commit
to leobalter/ecma262
that referenced
this issue
Jul 14, 2020
leobalter
added a commit
to leobalter/ecma262
that referenced
this issue
Jul 30, 2020
In PutValue, verify if the Reference is still preserved in its base in Strict Mode. Ref tc39#2093
leobalter
added a commit
to leobalter/ecma262
that referenced
this issue
Jul 30, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(Copying from bugzilla; see discussion in esdiscuss.)
In short, it is possible to have a Reference to a global variable or object-environment-record property which has been deleted. Normally, bare assignments to undeclared variables in strict mode cause ReferenceErrors. However, calling PutValue on a reference to a global variable which has been deleted since the reference was created does not throw a ReferenceError in strict mode, even though, at the time of writing, that variable does not exist.
This circumvents a protection which strict mode is intended to provide.
For example, in
the
x =
goes through PutValue, which in step 5 performsIsUnresolvableReference
, which returnsfalse
because the Reference was resolvable when it was created. Hence no error is thrown.However, Firefox, Chrome, and Safari all throw for the above code, in violation of the spec.
I would regard this as a (normative) bug in the spec.
The text was updated successfully, but these errors were encountered: