Changeset 198469 in webkit
- Timestamp:
- Mar 19, 2016, 11:13:42 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r198467 r198469 1 2016-03-19 Mark Lam <mark.lam@apple.com> 2 3 ES6 spec requires that ErrorPrototype not be an Error object. 4 https://bugs.webkit.org/show_bug.cgi?id=155680 5 6 Reviewed by Michael Saboff. 7 8 Updated the appropriate tests to expect the toString() value of Error.prototype 9 to now be "[object Object]" instead of "[object Error]". Also rebased the test 10 results accordingly. 11 12 * fast/dom/DOMException/prototype-object-expected.txt: 13 * fast/dom/DOMException/prototype-object.html: 14 * js/dom/native-error-prototype-expected.txt: 15 * js/dom/script-tests/native-error-prototype.js: 16 * sputnik/Conformance/15_Native_Objects/15.11_Error/15.11.4/S15.11.4_A2.html: 17 1 18 2016-03-18 Daniel Bates <dabates@apple.com> 2 19 -
trunk/LayoutTests/fast/dom/DOMException/prototype-object-expected.txt
r196392 r198469 7 7 PASS Object.prototype.toString.call(e) is "[object DOMException]" 8 8 PASS Object.prototype.toString.call(e.__proto__) is "[object DOMExceptionPrototype]" 9 PASS Object.prototype.toString.call(e.__proto__.__proto__) is "[object Error]"9 PASS Object.prototype.toString.call(e.__proto__.__proto__) is "[object Object]" 10 10 PASS e.constructor.toString() is "function DOMException() {\n [native code]\n}" 11 11 PASS e instanceof DOMException is true -
trunk/LayoutTests/fast/dom/DOMException/prototype-object.html
r196392 r198469 16 16 shouldBeEqualToString("Object.prototype.toString.call(e)", "[object DOMException]"); 17 17 shouldBeEqualToString("Object.prototype.toString.call(e.__proto__)", "[object DOMExceptionPrototype]"); 18 shouldBeEqualToString("Object.prototype.toString.call(e.__proto__.__proto__)", "[object Error]");18 shouldBeEqualToString("Object.prototype.toString.call(e.__proto__.__proto__)", "[object Object]"); 19 19 shouldBeEqualToString("e.constructor.toString()", "function DOMException() {\n [native code]\n}"); 20 20 shouldBeTrue("e instanceof DOMException"); -
trunk/LayoutTests/js/dom/native-error-prototype-expected.txt
r156066 r198469 4 4 5 5 6 PASS ({}).toString.call(Error.prototype) is "[object Error]"7 PASS ({}).toString.call(RangeError.prototype) is "[object Error]"6 PASS ({}).toString.call(Error.prototype) is "[object Object]" 7 PASS ({}).toString.call(RangeError.prototype) is "[object Object]" 8 8 PASS err.toString() is "message" 9 9 PASS err.hasOwnProperty('message') is false -
trunk/LayoutTests/js/dom/script-tests/native-error-prototype.js
r156066 r198469 3 3 ); 4 4 5 shouldBe("({}).toString.call(Error.prototype)", '"[object Error]"');6 shouldBe("({}).toString.call(RangeError.prototype)", '"[object Error]"');5 shouldBe("({}).toString.call(Error.prototype)", '"[object Object]"'); 6 shouldBe("({}).toString.call(RangeError.prototype)", '"[object Object]"'); 7 7 8 8 var err = new Error("message"); -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.11_Error/15.11.4/S15.11.4_A2.html
r120489 r198469 78 78 ////////////////////////////////////////////////////////////////////////////// 79 79 //CHECK#1 80 if (__tostr !== "[object Error]") {81 testFailed('#1: Error.prototype.toString=Object.prototype.toString; __tostr = Error.prototype.toString(); __tostr === "[object Error]". Actual: '+__tostr );80 if (__tostr !== "[object Object]") { 81 testFailed('#1: Error.prototype.toString=Object.prototype.toString; __tostr = Error.prototype.toString(); __tostr === "[object Object]". Actual: '+__tostr ); 82 82 } 83 83 // -
trunk/Source/JavaScriptCore/ChangeLog
r198458 r198469 1 2016-03-19 Mark Lam <mark.lam@apple.com> 2 3 ES6 spec requires that ErrorPrototype not be an Error object. 4 https://bugs.webkit.org/show_bug.cgi?id=155680 5 6 Reviewed by Michael Saboff. 7 8 The ES6 spec states that Error.prototype should not be an instance of Error: 9 https://tc39.github.io/ecma262/#sec-properties-of-the-error-prototype-object 10 11 "The Error prototype object is an ordinary object. It is not an Error instance 12 and does not have an [[ErrorData]] internal slot." 13 14 This patch changes ErrorPrototype to conform to the above specification. 15 16 * runtime/ErrorConstructor.cpp: 17 (JSC::ErrorConstructor::finishCreation): 18 * runtime/ErrorPrototype.cpp: 19 (JSC::ErrorPrototype::ErrorPrototype): 20 (JSC::ErrorPrototype::finishCreation): 21 (JSC::ErrorPrototype::getOwnPropertySlot): 22 * runtime/ErrorPrototype.h: 23 (JSC::ErrorPrototype::create): 24 25 * runtime/NativeErrorConstructor.cpp: 26 (JSC::NativeErrorConstructor::finishCreation): 27 * runtime/NativeErrorPrototype.cpp: 28 (JSC::NativeErrorPrototype::NativeErrorPrototype): 29 (JSC::NativeErrorPrototype::finishCreation): 30 * runtime/NativeErrorPrototype.h: 31 (JSC::NativeErrorPrototype::create): 32 - updated to no longer need a JSGlobalObject argument. 33 34 * tests/es6/miscellaneous_built-in_prototypes_are_not_instances.js: 35 - updated to match the kangax version of this test. 36 1 37 2016-03-18 Benjamin Poulain <bpoulain@apple.com> 2 38 -
trunk/Source/JavaScriptCore/runtime/ErrorConstructor.cpp
r197614 r198469 41 41 void ErrorConstructor::finishCreation(VM& vm, ErrorPrototype* errorPrototype) 42 42 { 43 Base::finishCreation(vm, errorPrototype->classInfo()->className);43 Base::finishCreation(vm, ASCIILiteral("Error")); 44 44 // ECMA 15.11.3.1 Error.prototype 45 45 putDirectWithoutTransition(vm, vm.propertyNames->prototype, errorPrototype, DontEnum | DontDelete | ReadOnly); -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
r182495 r198469 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.3 * Copyright (C) 2003, 2008, 2016 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 42 42 namespace JSC { 43 43 44 const ClassInfo ErrorPrototype::s_info = { " Error", &ErrorInstance::s_info, &errorPrototypeTable, CREATE_METHOD_TABLE(ErrorPrototype) };44 const ClassInfo ErrorPrototype::s_info = { "Object", &Base::s_info, &errorPrototypeTable, CREATE_METHOD_TABLE(ErrorPrototype) }; 45 45 46 46 /* Source for ErrorPrototype.lut.h … … 51 51 52 52 ErrorPrototype::ErrorPrototype(VM& vm, Structure* structure) 53 : ErrorInstance(vm, structure)53 : JSNonFinalObject(vm, structure) 54 54 { 55 55 } 56 56 57 void ErrorPrototype::finishCreation(VM& vm , JSGlobalObject* globalObject)57 void ErrorPrototype::finishCreation(VM& vm) 58 58 { 59 Base::finishCreation( globalObject->globalExec(), vm, "");59 Base::finishCreation(vm); 60 60 ASSERT(inherits(info())); 61 61 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("Error"))), DontEnum); 62 putDirect(vm, vm.propertyNames->message, jsEmptyString(&vm), DontEnum); 62 63 } 63 64 -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.h
r182747 r198469 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2008 Apple Inc. All rights reserved.3 * Copyright (C) 2008, 2016 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 22 22 #define ErrorPrototype_h 23 23 24 #include " ErrorInstance.h"24 #include "JSObject.h" 25 25 26 26 namespace JSC { … … 28 28 class ObjectPrototype; 29 29 30 class ErrorPrototype : public ErrorInstance{30 class ErrorPrototype : public JSNonFinalObject { 31 31 public: 32 typedef ErrorInstanceBase;32 typedef JSNonFinalObject Base; 33 33 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot; 34 34 35 static ErrorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)35 static ErrorPrototype* create(VM& vm, JSGlobalObject*, Structure* structure) 36 36 { 37 37 ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(vm.heap)) ErrorPrototype(vm, structure); 38 prototype->finishCreation(vm , globalObject);38 prototype->finishCreation(vm); 39 39 return prototype; 40 40 } … … 49 49 protected: 50 50 ErrorPrototype(VM&, Structure*); 51 void finishCreation(VM& , JSGlobalObject*);51 void finishCreation(VM&); 52 52 53 53 private: -
trunk/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
r197614 r198469 44 44 ASSERT(inherits(info())); 45 45 46 NativeErrorPrototype* prototype = NativeErrorPrototype::create(vm, globalObject,prototypeStructure, name, this);46 NativeErrorPrototype* prototype = NativeErrorPrototype::create(vm, prototypeStructure, name, this); 47 47 48 48 putDirect(vm, vm.propertyNames->length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5 -
trunk/Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp
r163844 r198469 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.3 * Copyright (C) 2003, 2008, 2016 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 34 34 } 35 35 36 void NativeErrorPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject,const WTF::String& nameAndMessage, NativeErrorConstructor* constructor)36 void NativeErrorPrototype::finishCreation(VM& vm, const WTF::String& nameAndMessage, NativeErrorConstructor* constructor) 37 37 { 38 Base::finishCreation(vm , globalObject);38 Base::finishCreation(vm); 39 39 putDirect(vm, vm.propertyNames->name, jsString(&vm, nameAndMessage), DontEnum); 40 40 putDirect(vm, vm.propertyNames->message, jsEmptyString(&vm), DontEnum); -
trunk/Source/JavaScriptCore/runtime/NativeErrorPrototype.h
r173269 r198469 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2008 Apple Inc. All rights reserved.3 * Copyright (C) 2008, 2016 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 35 35 typedef ErrorPrototype Base; 36 36 37 static NativeErrorPrototype* create(VM& vm, JSGlobalObject* globalObject,Structure* structure, const String& name, NativeErrorConstructor* constructor)37 static NativeErrorPrototype* create(VM& vm, Structure* structure, const String& name, NativeErrorConstructor* constructor) 38 38 { 39 39 NativeErrorPrototype* prototype = new (NotNull, allocateCell<NativeErrorPrototype>(vm.heap)) NativeErrorPrototype(vm, structure); 40 prototype->finishCreation(vm, globalObject,name, constructor);40 prototype->finishCreation(vm, name, constructor); 41 41 return prototype; 42 42 } 43 43 44 44 protected: 45 void finishCreation(VM&, JSGlobalObject*,const String& nameAndMessage, NativeErrorConstructor*);45 void finishCreation(VM&, const String& nameAndMessage, NativeErrorConstructor*); 46 46 }; 47 47 -
trunk/Source/JavaScriptCore/tests/es6/miscellaneous_built-in_prototypes_are_not_instances.js
r189333 r198469 7 7 Date.prototype.valueOf(); return false; 8 8 } catch(e) {} 9 10 if (![Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError].every(function (E) { 11 return Object.prototype.toString.call(E.prototype) === '[object Object]'; 12 })) { 13 return false; 14 } 15 9 16 return true; 10 17
Note:
See TracChangeset
for help on using the changeset viewer.