Ignore:
Timestamp:
Jan 6, 2018, 4:15:21 PM (7 years ago)
Author:
Yusuke Suzuki
Message:

Object.getOwnPropertyNames includes "arguments" and "caller" for bound functions
https://bugs.webkit.org/show_bug.cgi?id=181321

Reviewed by Saam Barati.

JSTests:

  • stress/bound-function-does-not-have-caller-and-arguments.js: Added.

(shouldBe):
(testFunction):

  • test262.yaml:

Source/JavaScriptCore:

According to ECMA262 16.2[1], functions created using the bind method must not have
"caller" and "arguments" own properties.

[1]: https://tc39.github.io/ecma262/#sec-forbidden-extensions

  • runtime/JSBoundFunction.cpp:

(JSC::JSBoundFunction::finishCreation):

LayoutTests:

  • inspector/model/remote-object-get-properties-expected.txt:
  • inspector/runtime/getProperties-expected.txt:
  • js/script-tests/strict-throw-type-error.js:
  • js/strict-throw-type-error-expected.txt:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSBoundFunction.cpp

    r224309 r226489  
    226226    Base::finishCreation(vm, executable, length, name);
    227227    ASSERT(inherits(vm, info()));
    228 
    229     putDirectNonIndexAccessor(vm, vm.propertyNames->arguments, globalObject()->throwTypeErrorArgumentsCalleeAndCallerGetterSetter(), PropertyAttribute::DontDelete | PropertyAttribute::DontEnum | PropertyAttribute::Accessor);
    230     putDirectNonIndexAccessor(vm, vm.propertyNames->caller, globalObject()->throwTypeErrorArgumentsCalleeAndCallerGetterSetter(), PropertyAttribute::DontDelete | PropertyAttribute::DontEnum | PropertyAttribute::Accessor);
    231228}
    232229
Note: See TracChangeset for help on using the changeset viewer.