haikuwebkit/LayoutTests/js/prototype-assignment-expect...

5 lines
48 B
Plaintext
Raw Permalink Normal View History

Introduce the concept of Immutable Prototype Exotic Objects to comply with the spec. https://bugs.webkit.org/show_bug.cgi?id=165227 <rdar://problem/29442665> Reviewed by Saam Barati. JSTests: * stress/get-from-scope-dynamic-onto-proxy.js: - Updated error message. * stress/proxy-dont-infinite-loop.js: Removed. * stress/proxy-json-path.js: Removed. * stress/rest-parameter-allocation-elimination-watchpoints-6.js: Removed. - Removed these tests because the issue they are testing relies on being able to set Object.prototype.__proto__ to something else (which is now not possible). Source/JavaScriptCore: * runtime/JSObject.cpp: (JSC::JSObject::setPrototypeWithCycleCheck): - This is where we check for immutable prototype exotic objects and refuse to set the prototype if needed. See https://tc39.github.io/ecma262/#sec-immutable-prototype-exotic-objects. * runtime/JSTypeInfo.h: (JSC::TypeInfo::isImmutablePrototypeExoticObject): * runtime/Structure.h: - Add flag for declaring immutable prototype exotic objects. * runtime/ObjectPrototype.h: - Declare that Object.prototype is an immutable prototype exotic object. See https://tc39.github.io/ecma262/#sec-properties-of-the-object-prototype-object. * runtime/ObjectConstructor.cpp: (JSC::objectConstructorSetPrototypeOf): - Use better error messages. Source/WebCore: Make all objects in window.__proto__'s prototype chain immutable prototype exotic objects. This gives us roughly equivalent behavior to other browsers. Firefox's behavior differ slightly in that Firefox will fail any attempted assignment their __proto__, while the immutable prototype exotic objects will only fail if the assignment is of a different value. See https://tc39.github.io/ecma262/#sec-immutable-prototype-exotic-objects. Chrome differs in that assignment to window.__proto__ is also handled like an immutable prototype exotic object. Instead we adhere to the current HTML spec that says that the assignment should fail unconditionally. See https://html.spec.whatwg.org/#the-windowproxy-exotic-object and https://html.spec.whatwg.org/#windowproxy-setprototypeof. If the HTML spec is changed to make the WindowProxy and Location objects into immutable prototype exotic objects later, we can update to match the spec then. Test: js/prototype-assignment.html * bindings/js/JSDOMWindowProperties.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GeneratePrototypeDeclaration): * bindings/scripts/IDLAttributes.txt: * dom/EventTarget.idl: * page/DOMWindow.idl: LayoutTests: The new prototype-assignment.js test is currently only enabled for LLInt only run in the JSC tests until webkit.org/b/165401 is fixed. * TestExpectations: - Skip js/prototype-assignment.html for now until webkit.org/b/165401 is fixed. * http/tests/security/window-named-valueOf-expected.txt: * js/dom/proxy-is-not-allowed-in-global-prototype-chain-expected.txt: * js/dom/proxy-is-not-allowed-in-global-prototype-chain.html: - Updated error messages. * js/prototype-assignment-expected.txt: Added. * js/prototype-assignment.html: Added. * js/script-tests/prototype-assignment.js: Added. (else): (reportError): (shouldEqual): (shouldThrow): (stringify): (makeTestID): (doInternalSetPrototypeOf): (ordinarySetPrototypeOf): (setImmutablePrototype): (windowProxySetPrototypeOf): (initSetterExpectation): (throwIfNoExceptionPending): (objectSetPrototypeOf): (setUnderscoreProto): (reflectSetPrototypeOf): (newObjectProto.toString): (this.testObject.targets.push.value): (this.testProxy.targets.push.setPrototypeOf): (Symbol): (test): (runTests): * js/setPrototypeOf-expected.txt: Canonical link: https://commits.webkit.org/183091@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209424 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-12-06 22:43:16 +00:00
PASS successfullyParsed is true
TEST COMPLETE