If argument to Error is undefined, message is not set
Reviewed by Sam Weinig.
Source/JavaScriptCore:
Per section 15.11.1.1 of the spec.
* runtime/ErrorInstance.h:
(JSC::ErrorInstance::create):
(JSC::ErrorInstance::finishCreation):
LayoutTests:
Added test case.
* fast/js/native-error-prototype-expected.txt:
* fast/js/script-tests/native-error-prototype.js:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@103924
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-02 Gavin Barraclough <barraclough@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=75452
+ If argument to Error is undefined, message is not set
+
+ Reviewed by Sam Weinig.
+
+ Added test case.
+
+ * fast/js/native-error-prototype-expected.txt:
+ * fast/js/script-tests/native-error-prototype.js:
+
2012-01-02 Gavin Barraclough <barraclough@apple.com>
ES5 prohibits parseInt from supporting octal
-This is a test case for bug 55346 and bug 70889.
+This is a test case for bugs 55346, 70889, and 75452.
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 err.toString() is "message"
+PASS err.hasOwnProperty('message') is false
+PASS err.hasOwnProperty('message') is false
PASS successfullyParsed is true
TEST COMPLETE
description(
-'This is a test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=55346">bug 55346</a> and <a href="https://bugs.webkit.org/show_bug.cgi?id=70889">bug 70889</a>.'
+'This is a test case for bugs <a href="https://bugs.webkit.org/show_bug.cgi?id=55346">55346</a>, <a href="https://bugs.webkit.org/show_bug.cgi?id=70889">70889</a>, and <a href="https://bugs.webkit.org/show_bug.cgi?id=75452">75452</a>.'
);
shouldBe("({}).toString.call(Error.prototype)", '"[object Error]"');
var err = new Error("message");
err.name = "";
shouldBe("err.toString()", '"message"');
+
+var err = new Error();
+shouldBeFalse("err.hasOwnProperty('message')");
+
+var err = new Error(undefined);
+shouldBeFalse("err.hasOwnProperty('message')");
+2012-01-02 Gavin Barraclough <barraclough@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=75452
+ If argument to Error is undefined, message is not set
+
+ Reviewed by Sam Weinig.
+
+ Per section 15.11.1.1 of the spec.
+
+ * runtime/ErrorInstance.h:
+ (JSC::ErrorInstance::create):
+ (JSC::ErrorInstance::finishCreation):
+
2012-01-02 Gavin Barraclough <barraclough@apple.com>
ES5 prohibits parseInt from supporting octal
{
if (message.isUndefined()) {
ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(*exec->heap())) ErrorInstance(exec->globalData(), structure);
- instance->finishCreation(exec->globalData(), UString("", 0));
+ instance->finishCreation(exec->globalData(), UString());
return instance;
}
return create(exec->globalData(), structure, message.toString(exec));
{
Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
- putDirect(globalData, globalData.propertyNames->message, jsString(&globalData, message), DontEnum);
+ if (!message.isNull())
+ putDirect(globalData, globalData.propertyNames->message, jsString(&globalData, message), DontEnum);
}
bool m_appendSourceToMessage;