Diff
Modified: trunk/LayoutTests/ChangeLog (93623 => 93624)
--- trunk/LayoutTests/ChangeLog 2011-08-23 19:27:32 UTC (rev 93623)
+++ trunk/LayoutTests/ChangeLog 2011-08-23 19:28:23 UTC (rev 93624)
@@ -1,3 +1,14 @@
+2011-08-23 Gavin Barraclough <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=55347
+ "name" and "message" enumerable on *Error.prototype
+
+ Reviewed by Sam Weinig.
+
+ * fast/js/exception-properties-expected.txt:
+ * fast/js/script-tests/exception-properties.js:
+ - Add tests for value of RangeError.__proto__.{name|message}
+
2011-08-23 Sheriff Bot <[email protected]>
Unreviewed, rolling out r93616.
Modified: trunk/LayoutTests/fast/js/exception-properties-expected.txt (93623 => 93624)
--- trunk/LayoutTests/fast/js/exception-properties-expected.txt 2011-08-23 19:27:32 UTC (rev 93623)
+++ trunk/LayoutTests/fast/js/exception-properties-expected.txt 2011-08-23 19:28:23 UTC (rev 93624)
@@ -5,6 +5,8 @@
PASS enumerableProperties(error) is []
PASS enumerableProperties(nativeError) is ["line", "sourceId", "sourceURL"]
+PASS Object.getPrototypeOf(nativeError).name is "RangeError"
+PASS Object.getPrototypeOf(nativeError).message is ""
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/js/script-tests/exception-properties.js (93623 => 93624)
--- trunk/LayoutTests/fast/js/script-tests/exception-properties.js 2011-08-23 19:27:32 UTC (rev 93623)
+++ trunk/LayoutTests/fast/js/script-tests/exception-properties.js 2011-08-23 19:28:23 UTC (rev 93624)
@@ -17,6 +17,9 @@
shouldBe('enumerableProperties(error)', '[]');
shouldBe('enumerableProperties(nativeError)', '["line", "sourceId", "sourceURL"]');
+
+ shouldBe('Object.getPrototypeOf(nativeError).name', '"RangeError"');
+ shouldBe('Object.getPrototypeOf(nativeError).message', '""');
}
successfullyParsed = true;
Modified: trunk/Source/_javascript_Core/ChangeLog (93623 => 93624)
--- trunk/Source/_javascript_Core/ChangeLog 2011-08-23 19:27:32 UTC (rev 93623)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-08-23 19:28:23 UTC (rev 93624)
@@ -1,3 +1,28 @@
+2011-08-23 Gavin Barraclough <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=55347
+ "name" and "message" enumerable on *Error.prototype
+
+ Reviewed by Sam Weinig.
+
+ The default value of a NativeErrorPrototype's message
+ property is "", not the name of the error.
+
+ * runtime/NativeErrorConstructor.cpp:
+ (JSC::NativeErrorConstructor::NativeErrorConstructor):
+ * runtime/NativeErrorConstructor.h:
+ (JSC::NativeErrorConstructor::create):
+ (JSC::NativeErrorConstructor::constructorBody):
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+ (JSC::NativeErrorPrototype::constructorBody):
+ * runtime/NativeErrorPrototype.h:
+ (JSC::NativeErrorPrototype::create):
+ * runtime/StringPrototype.cpp:
+ (JSC::StringPrototype::StringPrototype):
+ * runtime/StringPrototype.h:
+ (JSC::StringPrototype::create):
+
2011-08-23 Steve Block <[email protected]>
Remove last occurrences of PLATFORM(ANDROID)
Modified: trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.cpp (93623 => 93624)
--- trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.cpp 2011-08-23 19:27:32 UTC (rev 93623)
+++ trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.cpp 2011-08-23 19:28:23 UTC (rev 93624)
@@ -32,10 +32,10 @@
const ClassInfo NativeErrorConstructor::s_info = { "Function", &InternalFunction::s_info, 0, 0 };
-NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const UString& nameAndMessage)
- : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, nameAndMessage))
+NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const UString& name)
+ : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, name))
{
- constructorBody(exec, globalObject, prototypeStructure, nameAndMessage);
+ constructorBody(exec, globalObject, prototypeStructure, name);
}
void NativeErrorConstructor::visitChildren(SlotVisitor& visitor)
Modified: trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.h (93623 => 93624)
--- trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.h 2011-08-23 19:27:32 UTC (rev 93623)
+++ trunk/Source/_javascript_Core/runtime/NativeErrorConstructor.h 2011-08-23 19:28:23 UTC (rev 93624)
@@ -34,9 +34,9 @@
public:
typedef InternalFunction Base;
- static NativeErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const UString& nameAndMessage)
+ static NativeErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const UString& name)
{
- return new (allocateCell<NativeErrorConstructor>(*exec->heap())) NativeErrorConstructor(exec, globalObject, structure, prototypeStructure, nameAndMessage);
+ return new (allocateCell<NativeErrorConstructor>(*exec->heap())) NativeErrorConstructor(exec, globalObject, structure, prototypeStructure, name);
}
static const ClassInfo s_info;
@@ -49,11 +49,11 @@
Structure* errorStructure() { return m_errorStructure.get(); }
protected:
- void constructorBody(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const UString& nameAndMessage)
+ void constructorBody(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const UString& name)
{
ASSERT(inherits(&s_info));
- NativeErrorPrototype* prototype = NativeErrorPrototype::create(exec, globalObject, prototypeStructure, nameAndMessage, this);
+ NativeErrorPrototype* prototype = NativeErrorPrototype::create(exec, globalObject, prototypeStructure, name, this);
putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
putDirect(exec->globalData(), exec->propertyNames().prototype, prototype, DontDelete | ReadOnly | DontEnum);
Modified: trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.cpp (93623 => 93624)
--- trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.cpp 2011-08-23 19:27:32 UTC (rev 93623)
+++ trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.cpp 2011-08-23 19:28:23 UTC (rev 93624)
@@ -30,16 +30,16 @@
ASSERT_CLASS_FITS_IN_CELL(NativeErrorPrototype);
-NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& nameAndMessage, NativeErrorConstructor* constructor)
+NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& name, NativeErrorConstructor* constructor)
: ErrorPrototype(exec, globalObject, structure)
{
- constructorBody(exec, nameAndMessage, constructor);
+ constructorBody(exec, name, constructor);
}
-inline void NativeErrorPrototype::constructorBody(ExecState* exec, const UString& nameAndMessage, NativeErrorConstructor* constructor)
+inline void NativeErrorPrototype::constructorBody(ExecState* exec, const UString& name, NativeErrorConstructor* constructor)
{
- putDirect(exec->globalData(), exec->propertyNames().name, jsString(exec, nameAndMessage), DontEnum);
- putDirect(exec->globalData(), exec->propertyNames().message, jsString(exec, nameAndMessage), DontEnum);
+ putDirect(exec->globalData(), exec->propertyNames().name, jsString(exec, name), DontEnum);
+ putDirect(exec->globalData(), exec->propertyNames().message, jsEmptyString(exec), DontEnum);
putDirect(exec->globalData(), exec->propertyNames().constructor, constructor, DontEnum);
}
Modified: trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.h (93623 => 93624)
--- trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.h 2011-08-23 19:27:32 UTC (rev 93623)
+++ trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.h 2011-08-23 19:28:23 UTC (rev 93624)
@@ -33,13 +33,13 @@
public:
typedef ErrorPrototype Base;
- static NativeErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& nameAndMessage, NativeErrorConstructor* constructor)
+ static NativeErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& name, NativeErrorConstructor* constructor)
{
- return new (allocateCell<NativeErrorPrototype>(*exec->heap())) NativeErrorPrototype(exec, globalObject, structure, nameAndMessage, constructor);
+ return new (allocateCell<NativeErrorPrototype>(*exec->heap())) NativeErrorPrototype(exec, globalObject, structure, name, constructor);
}
protected:
- void constructorBody(ExecState*, const UString& nameAndMessage, NativeErrorConstructor*);
+ void constructorBody(ExecState*, const UString& name, NativeErrorConstructor*);
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (93623 => 93624)
--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp 2011-08-23 19:27:32 UTC (rev 93623)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp 2011-08-23 19:28:23 UTC (rev 93624)
@@ -131,8 +131,8 @@
*/
// ECMA 15.5.4
-StringPrototype::StringPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSString* nameAndMessage)
- : StringObject(exec->globalData(), structure, nameAndMessage)
+StringPrototype::StringPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSString* string)
+ : StringObject(exec->globalData(), structure, string)
{
ASSERT(inherits(&s_info));
Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.h (93623 => 93624)
--- trunk/Source/_javascript_Core/runtime/StringPrototype.h 2011-08-23 19:27:32 UTC (rev 93623)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.h 2011-08-23 19:28:23 UTC (rev 93624)
@@ -36,8 +36,7 @@
static StringPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
{
- JSString* nameAndMessage = jsEmptyString(exec);
- return new (allocateCell<StringPrototype>(*exec->heap())) StringPrototype(exec, globalObject, structure, nameAndMessage);
+ return new (allocateCell<StringPrototype>(*exec->heap())) StringPrototype(exec, globalObject, structure, jsEmptyString(exec));
}
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);