ES6: Implement Object.setPrototypeOf
https://bugs.webkit.org/show_bug.cgi?id=145202
Patch by Joseph Pecoraro <Joseph Pecoraro> on 2015-05-20
Reviewed by Darin Adler.
Source/JavaScriptCore:
- runtime/JSGlobalObjectFunctions.h:
- runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncProtoSetter):
(JSC::checkProtoSetterAccessAllowed):
Extract a helper to share this code between proto setter and setPrototypeOf.
- runtime/ObjectConstructor.cpp:
(JSC::objectConstructorSetPrototypeOf):
Implementation is very similiar to proto setter.
LayoutTests:
- http/tests/security/cross-frame-access-object-setPrototypeOf-expected.txt: Added.
- http/tests/security/cross-frame-access-object-setPrototypeOf.html: Added.
- http/tests/security/resources/cross-frame-iframe-for-object-setPrototypeOf-test.html: Added.
Test covering cross origin restriction behavior.
- js/Object-getOwnPropertyNames-expected.txt:
- js/script-tests/Object-getOwnPropertyNames.js:
Updated for the new exposed property.
- js/cyclic-prototypes-expected.txt:
- js/script-tests/cyclic-prototypes.js:
Extend this test to include setPrototypeOf cyclic checks.
Note that setPrototypeOf can still change the prototype
where proto cannot.
- js/prototypes-expected.txt:
- js/script-tests/prototypes.js:
Extend this test to cover more types previously overlooked.
- js/script-tests/setPrototypeOf.js: Added.
(debugEval):
(getObjectDescriptions.myFunction):
(getObjectDescriptions):
- js/setPrototypeOf-expected.txt: Added.
- js/setPrototypeOf.html: Added.
Test coverage for all the different object / prototype combinations.
This is modeled after the other browser tests with coverage of a
few more basic functionality tests and object types.