Commit 719af72b authored by barraclough@apple.com's avatar barraclough@apple.com

NativeError.prototype objects have [[Class]] of "Object" but should be "Error"

https://bugs.webkit.org/show_bug.cgi?id=55346

Reviewed by Sam Weinig.

Source/JavaScriptCore: 

* runtime/ErrorPrototype.cpp:
(JSC::ErrorPrototype::ErrorPrototype):
    - Switch to putDirect since we're not the only ones tranitioning this Structure now.
* runtime/NativeErrorPrototype.cpp:
(JSC::NativeErrorPrototype::NativeErrorPrototype):
* runtime/NativeErrorPrototype.h:
    - Switch base class to ErrorPrototype.

LayoutTests: 

Added test case.

* fast/js/native-error-prototype-expected.txt: Added.
* fast/js/native-error-prototype.html: Added.
* fast/js/script-tests/native-error-prototype.js: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@91116 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3c0b9007
2011-07-15 Gavin Barraclough <barraclough@apple.com>
NativeError.prototype objects have [[Class]] of "Object" but should be "Error"
https://bugs.webkit.org/show_bug.cgi?id=55346
Reviewed by Sam Weinig.
Added test case.
* fast/js/native-error-prototype-expected.txt: Added.
* fast/js/native-error-prototype.html: Added.
* fast/js/script-tests/native-error-prototype.js: Added.
2011-06-27 Adrienne Walker <enne@google.com>
Reviewed by Simon Fraser.
This is a test case for bug 55346.
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 successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="resources/js-test-style.css">
<script src="resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/native-error-prototype.js"></script>
<script src="resources/js-test-post.js"></script>
</body>
</html>
description(
'This is a test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=55346">bug 55346</a>.'
);
shouldBe("({}).toString.call(Error.prototype)", '"[object Error]"');
shouldBe("({}).toString.call(RangeError.prototype)", '"[object Error]"');
var successfullyParsed = true;
2011-07-15 Gavin Barraclough <barraclough@apple.com>
NativeError.prototype objects have [[Class]] of "Object" but should be "Error"
https://bugs.webkit.org/show_bug.cgi?id=55346
Reviewed by Sam Weinig.
* runtime/ErrorPrototype.cpp:
(JSC::ErrorPrototype::ErrorPrototype):
- Switch to putDirect since we're not the only ones tranitioning this Structure now.
* runtime/NativeErrorPrototype.cpp:
(JSC::NativeErrorPrototype::NativeErrorPrototype):
* runtime/NativeErrorPrototype.h:
- Switch base class to ErrorPrototype.
2011-07-15 Gavin Barraclough <barraclough@apple.com>
DFG JIT - Where arguments passed are integers, speculate this.
......
......@@ -53,7 +53,7 @@ ASSERT_CLASS_FITS_IN_CELL(ErrorPrototype);
ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
: ErrorInstance(&exec->globalData(), structure)
{
putDirectWithoutTransition(exec->globalData(), exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);
putDirect(exec->globalData(), exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);
ASSERT(inherits(&s_info));
putAnonymousValue(globalObject->globalData(), 0, globalObject);
......
......@@ -21,7 +21,6 @@
#include "config.h"
#include "NativeErrorPrototype.h"
#include "ErrorPrototype.h"
#include "JSGlobalObject.h"
#include "JSString.h"
#include "NativeErrorConstructor.h"
......@@ -32,7 +31,7 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(NativeErrorPrototype);
NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& nameAndMessage, NativeErrorConstructor* constructor)
: JSObjectWithGlobalObject(globalObject, structure)
: ErrorPrototype(exec, globalObject, structure)
{
putDirect(exec->globalData(), exec->propertyNames().name, jsString(exec, nameAndMessage), DontEnum);
putDirect(exec->globalData(), exec->propertyNames().message, jsString(exec, nameAndMessage), DontEnum);
......
......@@ -21,12 +21,12 @@
#ifndef NativeErrorPrototype_h
#define NativeErrorPrototype_h
#include "JSObjectWithGlobalObject.h"
#include "ErrorPrototype.h"
namespace JSC {
class NativeErrorConstructor;
class NativeErrorPrototype : public JSObjectWithGlobalObject {
class NativeErrorPrototype : public ErrorPrototype {
public:
NativeErrorPrototype(ExecState*, JSGlobalObject*, Structure*, const UString&, NativeErrorConstructor*);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment