ES6: Strict mode functions shouldn't expose "arguments" or "caller" through Reflect.ownKeys

RESOLVED INVALID

Status

()

Core
JavaScript Engine
RESOLVED INVALID
2 years ago
2 years ago

People

(Reporter: WeirdAl, Unassigned)

Tracking

(Blocks: 1 bug, {reproducible, testcase})

Trunk
reproducible, testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

2 years ago
<script>
"use strict"
function A() {}
</script>
<script>
function B() {}
</script>
<script>
window.onload = function() {
  let a = Reflect.ownKeys(A);
  let b = Reflect.ownKeys(B);
  document.getElementById("output").value = (a.includes("arguments") === b.includes("arguments"));
}
</script>

Mozilla Firefox reports true because both A and B have "arguments" among their own keys.  Google Chrome and V8 report false because A does not have "arguments" among its own keys.  More specifically, "arguments" and "caller" have their [[Enumerable]] attribute set to false.

Per discussion on the es-discuss mailing list (thread posted via URL field), Google Chrome is probably correct here.  What I didn't notice then is that the rule was also in ES6:
http://www.ecma-international.org/ecma-262/6.0/#sec-forbidden-extensions

I'm filing as UNCO because I'm relying on someone else's interpretation of the specifications, and they are pretty dense.

Comment 1

2 years ago
This bug is invalid.

> Mozilla Firefox reports true because both A and B have "arguments" among their own keys.

No. Mozilla Firefox reports true because neither A nor B have "arguments" among their own keys.
(Reporter)

Comment 2

2 years ago
Doh!  There's my morning idiocy for the day.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.