Diff
Modified: trunk/LayoutTests/ChangeLog (198468 => 198469)
--- trunk/LayoutTests/ChangeLog 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/LayoutTests/ChangeLog 2016-03-19 18:13:42 UTC (rev 198469)
@@ -1,3 +1,20 @@
+2016-03-19 Mark Lam <[email protected]>
+
+ ES6 spec requires that ErrorPrototype not be an Error object.
+ https://bugs.webkit.org/show_bug.cgi?id=155680
+
+ Reviewed by Michael Saboff.
+
+ Updated the appropriate tests to expect the toString() value of Error.prototype
+ to now be "[object Object]" instead of "[object Error]". Also rebased the test
+ results accordingly.
+
+ * fast/dom/DOMException/prototype-object-expected.txt:
+ * fast/dom/DOMException/prototype-object.html:
+ * js/dom/native-error-prototype-expected.txt:
+ * js/dom/script-tests/native-error-prototype.js:
+ * sputnik/Conformance/15_Native_Objects/15.11_Error/15.11.4/S15.11.4_A2.html:
+
2016-03-18 Daniel Bates <[email protected]>
Update AutoFill button in input fields
Modified: trunk/LayoutTests/fast/dom/DOMException/prototype-object-expected.txt (198468 => 198469)
--- trunk/LayoutTests/fast/dom/DOMException/prototype-object-expected.txt 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/LayoutTests/fast/dom/DOMException/prototype-object-expected.txt 2016-03-19 18:13:42 UTC (rev 198469)
@@ -6,7 +6,7 @@
PASS e.toString() is "Error: HierarchyRequestError: DOM Exception 3"
PASS Object.prototype.toString.call(e) is "[object DOMException]"
PASS Object.prototype.toString.call(e.__proto__) is "[object DOMExceptionPrototype]"
-PASS Object.prototype.toString.call(e.__proto__.__proto__) is "[object Error]"
+PASS Object.prototype.toString.call(e.__proto__.__proto__) is "[object Object]"
PASS e.constructor.toString() is "function DOMException() {\n [native code]\n}"
PASS e instanceof DOMException is true
PASS e instanceof Error is true
Modified: trunk/LayoutTests/fast/dom/DOMException/prototype-object.html (198468 => 198469)
--- trunk/LayoutTests/fast/dom/DOMException/prototype-object.html 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/LayoutTests/fast/dom/DOMException/prototype-object.html 2016-03-19 18:13:42 UTC (rev 198469)
@@ -15,7 +15,7 @@
shouldBeEqualToString("e.toString()", "Error: HierarchyRequestError: DOM Exception 3");
shouldBeEqualToString("Object.prototype.toString.call(e)", "[object DOMException]");
shouldBeEqualToString("Object.prototype.toString.call(e.__proto__)", "[object DOMExceptionPrototype]");
-shouldBeEqualToString("Object.prototype.toString.call(e.__proto__.__proto__)", "[object Error]");
+shouldBeEqualToString("Object.prototype.toString.call(e.__proto__.__proto__)", "[object Object]");
shouldBeEqualToString("e.constructor.toString()", "function DOMException() {\n [native code]\n}");
shouldBeTrue("e instanceof DOMException");
shouldBeTrue("e instanceof Error");
Modified: trunk/LayoutTests/js/dom/native-error-prototype-expected.txt (198468 => 198469)
--- trunk/LayoutTests/js/dom/native-error-prototype-expected.txt 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/LayoutTests/js/dom/native-error-prototype-expected.txt 2016-03-19 18:13:42 UTC (rev 198469)
@@ -3,8 +3,8 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ({}).toString.call(Error.prototype) is "[object Error]"
-PASS ({}).toString.call(RangeError.prototype) is "[object Error]"
+PASS ({}).toString.call(Error.prototype) is "[object Object]"
+PASS ({}).toString.call(RangeError.prototype) is "[object Object]"
PASS err.toString() is "message"
PASS err.hasOwnProperty('message') is false
PASS err.hasOwnProperty('message') is false
Modified: trunk/LayoutTests/js/dom/script-tests/native-error-prototype.js (198468 => 198469)
--- trunk/LayoutTests/js/dom/script-tests/native-error-prototype.js 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/LayoutTests/js/dom/script-tests/native-error-prototype.js 2016-03-19 18:13:42 UTC (rev 198469)
@@ -2,8 +2,8 @@
'This is a test case for bugs <a href="" <a href="" and <a href=""
);
-shouldBe("({}).toString.call(Error.prototype)", '"[object Error]"');
-shouldBe("({}).toString.call(RangeError.prototype)", '"[object Error]"');
+shouldBe("({}).toString.call(Error.prototype)", '"[object Object]"');
+shouldBe("({}).toString.call(RangeError.prototype)", '"[object Object]"');
var err = new Error("message");
err.name = "";
Modified: trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.11_Error/15.11.4/S15.11.4_A2.html (198468 => 198469)
--- trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.11_Error/15.11.4/S15.11.4_A2.html 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.11_Error/15.11.4/S15.11.4_A2.html 2016-03-19 18:13:42 UTC (rev 198469)
@@ -77,8 +77,8 @@
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
-if (__tostr !== "[object Error]") {
- testFailed('#1: Error.prototype.toString=Object.prototype.toString; __tostr = Error.prototype.toString(); __tostr === "[object Error]". Actual: '+__tostr );
+if (__tostr !== "[object Object]") {
+ testFailed('#1: Error.prototype.toString=Object.prototype.toString; __tostr = Error.prototype.toString(); __tostr === "[object Object]". Actual: '+__tostr );
}
//
//////////////////////////////////////////////////////////////////////////////
Modified: trunk/Source/_javascript_Core/ChangeLog (198468 => 198469)
--- trunk/Source/_javascript_Core/ChangeLog 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-03-19 18:13:42 UTC (rev 198469)
@@ -1,3 +1,39 @@
+2016-03-19 Mark Lam <[email protected]>
+
+ ES6 spec requires that ErrorPrototype not be an Error object.
+ https://bugs.webkit.org/show_bug.cgi?id=155680
+
+ Reviewed by Michael Saboff.
+
+ The ES6 spec states that Error.prototype should not be an instance of Error:
+ https://tc39.github.io/ecma262/#sec-properties-of-the-error-prototype-object
+
+ "The Error prototype object is an ordinary object. It is not an Error instance
+ and does not have an [[ErrorData]] internal slot."
+
+ This patch changes ErrorPrototype to conform to the above specification.
+
+ * runtime/ErrorConstructor.cpp:
+ (JSC::ErrorConstructor::finishCreation):
+ * runtime/ErrorPrototype.cpp:
+ (JSC::ErrorPrototype::ErrorPrototype):
+ (JSC::ErrorPrototype::finishCreation):
+ (JSC::ErrorPrototype::getOwnPropertySlot):
+ * runtime/ErrorPrototype.h:
+ (JSC::ErrorPrototype::create):
+
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::finishCreation):
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ (JSC::NativeErrorPrototype::finishCreation):
+ * runtime/NativeErrorPrototype.h:
+ (JSC::NativeErrorPrototype::create):
+ - updated to no longer need a JSGlobalObject argument.
+
+ * tests/es6/miscellaneous_built-in_prototypes_are_not_instances.js:
+ - updated to match the kangax version of this test.
+
2016-03-18 Benjamin Poulain <[email protected]>
[JSC] Limit DFG's Validate symbols to its compilation unit
Modified: trunk/Source/_javascript_Core/runtime/ErrorConstructor.cpp (198468 => 198469)
--- trunk/Source/_javascript_Core/runtime/ErrorConstructor.cpp 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/Source/_javascript_Core/runtime/ErrorConstructor.cpp 2016-03-19 18:13:42 UTC (rev 198469)
@@ -40,7 +40,7 @@
void ErrorConstructor::finishCreation(VM& vm, ErrorPrototype* errorPrototype)
{
- Base::finishCreation(vm, errorPrototype->classInfo()->className);
+ Base::finishCreation(vm, ASCIILiteral("Error"));
// ECMA 15.11.3.1 Error.prototype
putDirectWithoutTransition(vm, vm.propertyNames->prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontDelete | ReadOnly | DontEnum);
Modified: trunk/Source/_javascript_Core/runtime/ErrorPrototype.cpp (198468 => 198469)
--- trunk/Source/_javascript_Core/runtime/ErrorPrototype.cpp 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/Source/_javascript_Core/runtime/ErrorPrototype.cpp 2016-03-19 18:13:42 UTC (rev 198469)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999-2000 Harri Porten ([email protected])
- * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2008, 2016 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -41,7 +41,7 @@
namespace JSC {
-const ClassInfo ErrorPrototype::s_info = { "Error", &ErrorInstance::s_info, &errorPrototypeTable, CREATE_METHOD_TABLE(ErrorPrototype) };
+const ClassInfo ErrorPrototype::s_info = { "Object", &Base::s_info, &errorPrototypeTable, CREATE_METHOD_TABLE(ErrorPrototype) };
/* Source for ErrorPrototype.lut.h
@begin errorPrototypeTable
@@ -50,15 +50,16 @@
*/
ErrorPrototype::ErrorPrototype(VM& vm, Structure* structure)
- : ErrorInstance(vm, structure)
+ : JSNonFinalObject(vm, structure)
{
}
-void ErrorPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
+void ErrorPrototype::finishCreation(VM& vm)
{
- Base::finishCreation(globalObject->globalExec(), vm, "");
+ Base::finishCreation(vm);
ASSERT(inherits(info()));
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("Error"))), DontEnum);
+ putDirect(vm, vm.propertyNames->message, jsEmptyString(&vm), DontEnum);
}
bool ErrorPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)
Modified: trunk/Source/_javascript_Core/runtime/ErrorPrototype.h (198468 => 198469)
--- trunk/Source/_javascript_Core/runtime/ErrorPrototype.h 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/Source/_javascript_Core/runtime/ErrorPrototype.h 2016-03-19 18:13:42 UTC (rev 198469)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999-2000 Harri Porten ([email protected])
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2016 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,21 +21,21 @@
#ifndef ErrorPrototype_h
#define ErrorPrototype_h
-#include "ErrorInstance.h"
+#include "JSObject.h"
namespace JSC {
class ObjectPrototype;
-class ErrorPrototype : public ErrorInstance {
+class ErrorPrototype : public JSNonFinalObject {
public:
- typedef ErrorInstance Base;
+ typedef JSNonFinalObject Base;
static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;
- static ErrorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
+ static ErrorPrototype* create(VM& vm, JSGlobalObject*, Structure* structure)
{
ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(vm.heap)) ErrorPrototype(vm, structure);
- prototype->finishCreation(vm, globalObject);
+ prototype->finishCreation(vm);
return prototype;
}
@@ -48,7 +48,7 @@
protected:
ErrorPrototype(VM&, Structure*);
- void finishCreation(VM&, JSGlobalObject*);
+ void finishCreation(VM&);
private:
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
Modified: trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.cpp (198468 => 198469)
--- trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.cpp 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.cpp 2016-03-19 18:13:42 UTC (rev 198469)
@@ -43,7 +43,7 @@
Base::finishCreation(vm, name);
ASSERT(inherits(info()));
- NativeErrorPrototype* prototype = NativeErrorPrototype::create(vm, globalObject, prototypeStructure, name, this);
+ NativeErrorPrototype* prototype = NativeErrorPrototype::create(vm, prototypeStructure, name, this);
putDirect(vm, vm.propertyNames->length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
putDirect(vm, vm.propertyNames->prototype, prototype, DontDelete | ReadOnly | DontEnum);
Modified: trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.cpp (198468 => 198469)
--- trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.cpp 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.cpp 2016-03-19 18:13:42 UTC (rev 198469)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999-2000 Harri Porten ([email protected])
- * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2008, 2016 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -33,9 +33,9 @@
{
}
-void NativeErrorPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject, const WTF::String& nameAndMessage, NativeErrorConstructor* constructor)
+void NativeErrorPrototype::finishCreation(VM& vm, const WTF::String& nameAndMessage, NativeErrorConstructor* constructor)
{
- Base::finishCreation(vm, globalObject);
+ Base::finishCreation(vm);
putDirect(vm, vm.propertyNames->name, jsString(&vm, nameAndMessage), DontEnum);
putDirect(vm, vm.propertyNames->message, jsEmptyString(&vm), DontEnum);
putDirect(vm, vm.propertyNames->constructor, constructor, DontEnum);
Modified: trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.h (198468 => 198469)
--- trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.h 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.h 2016-03-19 18:13:42 UTC (rev 198469)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999-2000 Harri Porten ([email protected])
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2016 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -34,15 +34,15 @@
public:
typedef ErrorPrototype Base;
- static NativeErrorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, const String& name, NativeErrorConstructor* constructor)
+ static NativeErrorPrototype* create(VM& vm, Structure* structure, const String& name, NativeErrorConstructor* constructor)
{
NativeErrorPrototype* prototype = new (NotNull, allocateCell<NativeErrorPrototype>(vm.heap)) NativeErrorPrototype(vm, structure);
- prototype->finishCreation(vm, globalObject, name, constructor);
+ prototype->finishCreation(vm, name, constructor);
return prototype;
}
protected:
- void finishCreation(VM&, JSGlobalObject*, const String& nameAndMessage, NativeErrorConstructor*);
+ void finishCreation(VM&, const String& nameAndMessage, NativeErrorConstructor*);
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/tests/es6/miscellaneous_built-in_prototypes_are_not_instances.js (198468 => 198469)
--- trunk/Source/_javascript_Core/tests/es6/miscellaneous_built-in_prototypes_are_not_instances.js 2016-03-19 07:17:41 UTC (rev 198468)
+++ trunk/Source/_javascript_Core/tests/es6/miscellaneous_built-in_prototypes_are_not_instances.js 2016-03-19 18:13:42 UTC (rev 198469)
@@ -6,6 +6,13 @@
try {
Date.prototype.valueOf(); return false;
} catch(e) {}
+
+if (![Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError].every(function (E) {
+ return Object.prototype.toString.call(E.prototype) === '[object Object]';
+})) {
+ return false;
+}
+
return true;
}