Diff
Modified: trunk/LayoutTests/ChangeLog (88558 => 88559)
--- trunk/LayoutTests/ChangeLog 2011-06-10 20:29:33 UTC (rev 88558)
+++ trunk/LayoutTests/ChangeLog 2011-06-10 20:33:27 UTC (rev 88559)
@@ -1,3 +1,21 @@
+2011-06-10 Gavin Barraclough <[email protected]>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=55347
+ "name" and "message" enumerable on *Error.prototype
+
+ This arises from chapter 15 of the spec:
+ "Every other property described in this clause has the attributes
+ { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }
+ unless otherwise specified."
+ Standardized properties are not enumerable.
+
+ * fast/js/exception-properties-expected.txt: Added.
+ * fast/js/exception-properties.html: Added.
+ * fast/js/script-tests/exception-properties.js: Added.
+ (enumerableProperties):
+
2011-06-10 Dimitri Glazkov <[email protected]>
[Chromium] Update expectations after r88555.
Added: trunk/LayoutTests/fast/js/exception-properties-expected.txt (0 => 88559)
--- trunk/LayoutTests/fast/js/exception-properties-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/js/exception-properties-expected.txt 2011-06-10 20:33:27 UTC (rev 88559)
@@ -0,0 +1,11 @@
+Test for correct properties on Error objects.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS enumerableProperties(error) is []
+PASS enumerableProperties(nativeError) is ["line", "sourceId", "sourceURL"]
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/js/exception-properties.html (0 => 88559)
--- trunk/LayoutTests/fast/js/exception-properties.html (rev 0)
+++ trunk/LayoutTests/fast/js/exception-properties.html 2011-06-10 20:33:27 UTC (rev 88559)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/js/script-tests/exception-properties.js (0 => 88559)
--- trunk/LayoutTests/fast/js/script-tests/exception-properties.js (rev 0)
+++ trunk/LayoutTests/fast/js/script-tests/exception-properties.js 2011-06-10 20:33:27 UTC (rev 88559)
@@ -0,0 +1,22 @@
+description("Test for correct properties on Error objects.");
+
+function enumerableProperties(object)
+{
+ var result = [];
+ for (var i in object)
+ result.push(i);
+ return result;
+}
+
+try {
+ // generate a RangeError.
+ [].length = -1;
+} catch (rangeError) {
+ var nativeError = rangeError;
+ var error = new Error("message");
+
+ shouldBe('enumerableProperties(error)', '[]');
+ shouldBe('enumerableProperties(nativeError)', '["line", "sourceId", "sourceURL"]');
+}
+
+successfullyParsed = true;
Modified: trunk/Source/_javascript_Core/ChangeLog (88558 => 88559)
--- trunk/Source/_javascript_Core/ChangeLog 2011-06-10 20:29:33 UTC (rev 88558)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-06-10 20:33:27 UTC (rev 88559)
@@ -1,3 +1,21 @@
+2011-06-10 Gavin Barraclough <[email protected]>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=55347
+ "name" and "message" enumerable on *Error.prototype
+
+ This arises from chapter 15 of the spec:
+ "Every other property described in this clause has the attributes
+ { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }
+ unless otherwise specified."
+ Standardized properties are not enumerable.
+
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * runtime/NativeErrorPrototype.cpp:
+ (JSC::NativeErrorPrototype::NativeErrorPrototype):
+
2011-06-09 Geoffrey Garen <[email protected]>
Build fix: Corrected header spelling.
Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp (88558 => 88559)
--- trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp 2011-06-10 20:29:33 UTC (rev 88558)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp 2011-06-10 20:33:27 UTC (rev 88559)
@@ -30,7 +30,7 @@
, m_appendSourceToMessage(false)
{
ASSERT(inherits(&s_info));
- putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, ""));
+ putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, ""), DontEnum);
}
ErrorInstance::ErrorInstance(JSGlobalData* globalData, Structure* structure, const UString& message)
@@ -38,7 +38,7 @@
, m_appendSourceToMessage(false)
{
ASSERT(inherits(&s_info));
- putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, message));
+ putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, message), DontEnum);
}
ErrorInstance* ErrorInstance::create(JSGlobalData* globalData, Structure* structure, const UString& message)
Modified: trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.cpp (88558 => 88559)
--- trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.cpp 2011-06-10 20:29:33 UTC (rev 88558)
+++ trunk/Source/_javascript_Core/runtime/NativeErrorPrototype.cpp 2011-06-10 20:33:27 UTC (rev 88559)
@@ -34,8 +34,8 @@
NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& nameAndMessage, NativeErrorConstructor* constructor)
: JSObjectWithGlobalObject(globalObject, structure)
{
- putDirect(exec->globalData(), exec->propertyNames().name, jsString(exec, nameAndMessage), 0);
- putDirect(exec->globalData(), exec->propertyNames().message, jsString(exec, nameAndMessage), 0);
+ 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().constructor, constructor, DontEnum);
}