[Webkit-unassigned] [Bug 147071] New: In strict mode, `Object.keys(arguments)` includes "length"

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jul 18 15:09:29 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=147071

            Bug ID: 147071
           Summary: In strict mode, `Object.keys(arguments)` includes
                    "length"
    Classification: Unclassified
           Product: WebKit
           Version: 528+ (Nightly build)
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ljharb at gmail.com
                CC: darin at apple.com, fpizlo at apple.com,
                    utatane.tea at gmail.com
        Depends on: 146510

Given this JS:
```
var argsSloppy = (function () { return arguments; }(1,2,3));
var argsStrict = (function () { 'use strict'; return arguments; }(1,2,3));

assert(!Object.prototype.propertyIsEnumerable(argsSloppy, 'length'));
assert(!Object.prototype.propertyIsEnumerable(argsStrict, 'length'));

assert(Object.keys(argsSloppy).length === Object.keys(argsStrict).length); // fails
assert(Object.keys(argsSloppy).indexOf('length') === -1)
assert(Object.keys(argsStrict).indexOf('length') === -1); // fails
```

Even though `length` is non-enumerable on both arguments objects, `Object.keys` returns "length" for the one created in strict mode.

Additionally, in the inspector, both look different - the sloppy one looks nice and pretty; the strict one doesn't.

This is not broken in Safari, but it is in the latest WebKit Nightly.

Note that it's a type error to do `argsStrict.callee` but not `argsSloppy.callee` - I suspect this is implementation difference between the two modes is the cause of this bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150718/26762cba/attachment.html>


More information about the webkit-unassigned mailing list