*/
#include "APICast.h"
+#include "Error.h"
#include "JSCallbackFunction.h"
#include "JSClassRef.h"
#include "JSGlobalObject.h"
+2008-07-04 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Dan Bernstein.
+
+ Split Error and GetterSetter out of JSObject.h.
+
+ * API/JSCallbackObjectFunctions.h:
+ * GNUmakefile.am:
+ * JavaScriptCore.pri:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * JavaScriptCoreSources.bkl:
+ * kjs/AllInOneFile.cpp:
+ * kjs/ClassInfo.h: Copied from JavaScriptCore/kjs/JSObject.h.
+ * kjs/Error.cpp: Copied from JavaScriptCore/kjs/JSObject.cpp.
+ * kjs/Error.h: Copied from JavaScriptCore/kjs/JSObject.h.
+ * kjs/GetterSetter.cpp:
+ * kjs/GetterSetter.h: Copied from JavaScriptCore/kjs/JSObject.h.
+ * kjs/JSObject.cpp:
+ * kjs/JSObject.h:
+ * kjs/nodes.h:
+
2008-07-04 Simon Hausmann <hausmann@webkit.org>
Fix the Wx build, added TreeProfile.cpp to the build.
JavaScriptCore/kjs/DatePrototype.cpp \
JavaScriptCore/kjs/debugger.cpp \
JavaScriptCore/kjs/dtoa.cpp \
+ JavaScriptCore/kjs/Error.cpp \
JavaScriptCore/kjs/ErrorConstructor.cpp \
JavaScriptCore/kjs/ErrorInstance.cpp \
JavaScriptCore/kjs/ErrorPrototype.cpp \
kjs/DatePrototype.cpp \
kjs/DebuggerCallFrame.cpp \
kjs/dtoa.cpp \
+ kjs/Error.cpp \
kjs/ErrorConstructor.cpp \
kjs/ErrorInstance.cpp \
kjs/ErrorPrototype.cpp \
RelativePath="..\..\kjs\BooleanPrototype.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\kjs\ClassInfo.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\kjs\collector.cpp"\r
>\r
RelativePath="..\..\kjs\dtoa.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\kjs\Error.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\kjs\Error.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\kjs\ErrorConstructor.cpp"\r
>\r
RelativePath="..\..\kjs\GetterSetter.cpp"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\kjs\GetterSetter.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\kjs\identifier.cpp"\r
>\r
BC2680C80E16D4E900A06E92 /* ObjectPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectPrototype.cpp; sourceTree = "<group>"; };
BC2680C90E16D4E900A06E92 /* ObjectPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectPrototype.h; sourceTree = "<group>"; };
BC2680E60E16D52300A06E92 /* NumberConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberConstructor.lut.h; sourceTree = "<group>"; };
+ BC337BDE0E1AF0B80076918A /* GetterSetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetterSetter.h; sourceTree = "<group>"; };
+ BC337BE20E1AF4410076918A /* Error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Error.h; sourceTree = "<group>"; };
+ BC337BEA0E1B00CB0076918A /* Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Error.cpp; sourceTree = "<group>"; };
+ BC337D760E1B6EB90076918A /* ClassInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassInfo.h; sourceTree = "<group>"; };
BC7952060E15E8A800A898AB /* ArrayConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayConstructor.cpp; sourceTree = "<group>"; };
BC7952070E15E8A800A898AB /* ArrayConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayConstructor.h; sourceTree = "<group>"; };
BC7952320E15EB5600A898AB /* BooleanConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BooleanConstructor.cpp; sourceTree = "<group>"; };
BC7952340E15EB5600A898AB /* BooleanPrototype.cpp */,
BC7952350E15EB5600A898AB /* BooleanPrototype.h */,
145C507F0D9DF63B0088F6B9 /* CallData.h */,
+ BC337D760E1B6EB90076918A /* ClassInfo.h */,
F692A8520255597D01FF60F7 /* collector.cpp */,
F692A8530255597D01FF60F7 /* collector.h */,
5DBD18A90C54018700C15EAE /* CollectorHeapIntrospector.cpp */,
D21202290AD4310C00ED79B6 /* DateMath.h */,
651F6412039D5B5F0078395C /* dtoa.cpp */,
651F6413039D5B5F0078395C /* dtoa.h */,
+ BC337BEA0E1B00CB0076918A /* Error.cpp */,
+ BC337BE20E1AF4410076918A /* Error.h */,
BC02E9040E1839DB000F9297 /* ErrorConstructor.cpp */,
BC02E9050E1839DB000F9297 /* ErrorConstructor.h */,
BC02E98A0E183E38000F9297 /* ErrorInstance.cpp */,
F692A85D0255597D01FF60F7 /* FunctionPrototype.h */,
933A3499038AE7C6008635CE /* grammar.y */,
BC02E9B80E184545000F9297 /* GetterSetter.cpp */,
+ BC337BDE0E1AF0B80076918A /* GetterSetter.h */,
933A349D038AE80F008635CE /* identifier.cpp */,
933A349A038AE7C6008635CE /* identifier.h */,
E178636C0D9BEEC300D74E75 /* InitializeThreading.cpp */,
kjs/debugger.cpp
kjs/DebuggerCallFrame.cpp
kjs/dtoa.cpp
+ kjs/Error.cpp
kjs/ErrorConstructor.cpp
kjs/ErrorInstance.cpp
kjs/ErrorPrototype.cpp
#include "nodes.cpp"
#include "nodes2string.cpp"
#include "JSObject.cpp"
+#include "Error.cpp"
#include "JSGlobalObject.cpp"
#include "ObjectConstructor.cpp"
#include "ObjectPrototype.cpp"
--- /dev/null
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ClassInfo_h
+#define ClassInfo_h
+
+#include "ExecState.h"
+
+namespace KJS {
+
+ struct HashEntry;
+ struct HashTable;
+
+ /**
+ * Class Information
+ */
+ struct ClassInfo {
+ /**
+ * A string denoting the class name. Example: "Window".
+ */
+ const char* className;
+ /**
+ * Pointer to the class information of the base class.
+ * 0L if there is none.
+ */
+ const ClassInfo* parentClass;
+ /**
+ * Static hash-table of properties.
+ * For classes that can be used from multiple threads, it is accessed via a getter function that would typically return a pointer to thread-specific value.
+ */
+ const HashTable* propHashTable(ExecState* exec) const
+ {
+ if (classPropHashTableGetterFunction)
+ return classPropHashTableGetterFunction(exec);
+ return staticPropHashTable;
+ }
+
+ const HashTable* staticPropHashTable;
+ typedef const HashTable* (*ClassPropHashTableGetterFunction)(ExecState*);
+ const ClassPropHashTableGetterFunction classPropHashTableGetterFunction;
+ };
+
+} // namespace KJS
+
+#endif // ClassInfo_h
--- /dev/null
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Eric Seidel (eric@webkit.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "Error.h"
+
+#include "ConstructData.h"
+#include "ErrorConstructor.h"
+#include "JSGlobalObject.h"
+#include "JSObject.h"
+#include "NativeErrorConstructor.h"
+
+namespace KJS {
+
+JSObject* Error::create(ExecState* exec, ErrorType errtype, const UString& message,
+ int lineno, int sourceId, const UString& sourceURL)
+{
+ JSObject* cons;
+ const char* name;
+ switch (errtype) {
+ case EvalError:
+ cons = exec->lexicalGlobalObject()->evalErrorConstructor();
+ name = "Evaluation error";
+ break;
+ case RangeError:
+ cons = exec->lexicalGlobalObject()->rangeErrorConstructor();
+ name = "Range error";
+ break;
+ case ReferenceError:
+ cons = exec->lexicalGlobalObject()->referenceErrorConstructor();
+ name = "Reference error";
+ break;
+ case SyntaxError:
+ cons = exec->lexicalGlobalObject()->syntaxErrorConstructor();
+ name = "Syntax error";
+ break;
+ case TypeError:
+ cons = exec->lexicalGlobalObject()->typeErrorConstructor();
+ name = "Type error";
+ break;
+ case URIError:
+ cons = exec->lexicalGlobalObject()->URIErrorConstructor();
+ name = "URI error";
+ break;
+ default:
+ cons = exec->lexicalGlobalObject()->errorConstructor();
+ name = "Error";
+ break;
+ }
+
+ ArgList args;
+ if (message.isEmpty())
+ args.append(jsString(exec, name));
+ else
+ args.append(jsString(exec, message));
+ ConstructData constructData;
+ ConstructType constructType = cons->getConstructData(constructData);
+ JSObject* err = construct(exec, cons, constructType, constructData, args);
+
+ if (lineno != -1)
+ err->put(exec, Identifier(exec, "line"), jsNumber(exec, lineno));
+ if (sourceId != -1)
+ err->put(exec, Identifier(exec, "sourceId"), jsNumber(exec, sourceId));
+
+ if(!sourceURL.isNull())
+ err->put(exec, Identifier(exec, "sourceURL"), jsString(exec, sourceURL));
+
+ return err;
+}
+
+JSObject *Error::create(ExecState *exec, ErrorType type, const char *message)
+{
+ return create(exec, type, message, -1, -1, NULL);
+}
+
+JSObject *throwError(ExecState *exec, ErrorType type)
+{
+ JSObject *error = Error::create(exec, type, UString(), -1, -1, NULL);
+ exec->setException(error);
+ return error;
+}
+
+JSObject *throwError(ExecState *exec, ErrorType type, const UString &message)
+{
+ JSObject *error = Error::create(exec, type, message, -1, -1, NULL);
+ exec->setException(error);
+ return error;
+}
+
+JSObject *throwError(ExecState *exec, ErrorType type, const char *message)
+{
+ JSObject *error = Error::create(exec, type, message, -1, -1, NULL);
+ exec->setException(error);
+ return error;
+}
+
+JSObject *throwError(ExecState *exec, ErrorType type, const UString &message, int line, int sourceId, const UString &sourceURL)
+{
+ JSObject *error = Error::create(exec, type, message, line, sourceId, sourceURL);
+ exec->setException(error);
+ return error;
+}
+
+} // namespace KJS
--- /dev/null
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Error_h
+#define Error_h
+
+namespace KJS {
+
+ class ExecState;
+ class JSObject;
+ class UString;
+
+ /**
+ * Types of Native Errors available. For custom errors, GeneralError
+ * should be used.
+ */
+ enum ErrorType { GeneralError = 0,
+ EvalError = 1,
+ RangeError = 2,
+ ReferenceError = 3,
+ SyntaxError = 4,
+ TypeError = 5,
+ URIError = 6};
+
+ /**
+ * @short Factory methods for error objects.
+ */
+ class Error {
+ public:
+ /**
+ * Factory method for error objects.
+ *
+ * @param exec The current execution state
+ * @param errtype Type of error.
+ * @param message Optional error message.
+ * @param lineNumber Optional line number.
+ * @param sourceId Optional source id.
+ * @param sourceURL Optional source URL.
+ */
+ static JSObject *create(ExecState *, ErrorType, const UString &message, int lineNumber, int sourceId, const UString &sourceURL);
+ static JSObject *create(ExecState *, ErrorType, const char *message);
+ };
+
+JSObject *throwError(ExecState *, ErrorType, const UString &message, int lineNumber, int sourceId, const UString &sourceURL);
+JSObject *throwError(ExecState *, ErrorType, const UString &message);
+JSObject *throwError(ExecState *, ErrorType, const char *message);
+JSObject *throwError(ExecState *, ErrorType);
+
+} // namespace KJS
+
+#endif // Error_h
*/
#include "config.h"
-#include "JSObject.h"
+#include "GetterSetter.h"
#include <wtf/Assertions.h>
return jsNull()->toObject(exec);
}
-}
+} // namespace KJS
--- /dev/null
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GetterSetter_h
+#define GetterSetter_h
+
+#include "JSCell.h"
+
+namespace KJS {
+
+ class JSObject;
+
+ // This is an internal value object which stores getter and setter functions
+ // for a property.
+ class GetterSetter : public JSCell {
+ public:
+ JSType type() const { return GetterSetterType; }
+
+ GetterSetter() : m_getter(0), m_setter(0) { }
+
+ virtual void mark();
+
+ JSObject* getter() const { return m_getter; }
+ void setGetter(JSObject* getter) { m_getter = getter; }
+ JSObject* setter() const { return m_setter; }
+ void setSetter(JSObject* setter) { m_setter = setter; }
+
+ private:
+ virtual JSValue* toPrimitive(ExecState*, JSType preferred) const;
+ virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*& value);
+ virtual bool toBoolean(ExecState*) const;
+ virtual double toNumber(ExecState*) const;
+ virtual UString toString(ExecState*) const;
+ virtual JSObject* toObject(ExecState*) const;
+
+ JSObject* m_getter;
+ JSObject* m_setter;
+ };
+
+} // namespace KJS
+
+#endif // GetterSetter_h
-// -*- c-basic-offset: 2 -*-
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2001 Peter Kelly (pmk@post.com)
#include "DatePrototype.h"
#include "ErrorConstructor.h"
+#include "GetterSetter.h"
#include "JSGlobalObject.h"
#include "NativeErrorConstructor.h"
#include "ObjectPrototype.h"
namespace KJS {
-// ------------------------------ JSObject ------------------------------------
-
void JSObject::mark()
{
JSCell::mark();
slot.setUndefined();
}
-// ------------------------------ Error ----------------------------------------
-
-JSObject* Error::create(ExecState* exec, ErrorType errtype, const UString& message,
- int lineno, int sourceId, const UString& sourceURL)
-{
- JSObject* cons;
- const char* name;
- switch (errtype) {
- case EvalError:
- cons = exec->lexicalGlobalObject()->evalErrorConstructor();
- name = "Evaluation error";
- break;
- case RangeError:
- cons = exec->lexicalGlobalObject()->rangeErrorConstructor();
- name = "Range error";
- break;
- case ReferenceError:
- cons = exec->lexicalGlobalObject()->referenceErrorConstructor();
- name = "Reference error";
- break;
- case SyntaxError:
- cons = exec->lexicalGlobalObject()->syntaxErrorConstructor();
- name = "Syntax error";
- break;
- case TypeError:
- cons = exec->lexicalGlobalObject()->typeErrorConstructor();
- name = "Type error";
- break;
- case URIError:
- cons = exec->lexicalGlobalObject()->URIErrorConstructor();
- name = "URI error";
- break;
- default:
- cons = exec->lexicalGlobalObject()->errorConstructor();
- name = "Error";
- break;
- }
-
- ArgList args;
- if (message.isEmpty())
- args.append(jsString(exec, name));
- else
- args.append(jsString(exec, message));
- ConstructData constructData;
- ConstructType constructType = cons->getConstructData(constructData);
- JSObject* err = construct(exec, cons, constructType, constructData, args);
-
- if (lineno != -1)
- err->put(exec, Identifier(exec, "line"), jsNumber(exec, lineno));
- if (sourceId != -1)
- err->put(exec, Identifier(exec, "sourceId"), jsNumber(exec, sourceId));
-
- if(!sourceURL.isNull())
- err->put(exec, Identifier(exec, "sourceURL"), jsString(exec, sourceURL));
-
- return err;
-}
-
-JSObject *Error::create(ExecState *exec, ErrorType type, const char *message)
-{
- return create(exec, type, message, -1, -1, NULL);
-}
-
-JSObject *throwError(ExecState *exec, ErrorType type)
-{
- JSObject *error = Error::create(exec, type, UString(), -1, -1, NULL);
- exec->setException(error);
- return error;
-}
-
-JSObject *throwError(ExecState *exec, ErrorType type, const UString &message)
-{
- JSObject *error = Error::create(exec, type, message, -1, -1, NULL);
- exec->setException(error);
- return error;
-}
-
-JSObject *throwError(ExecState *exec, ErrorType type, const char *message)
-{
- JSObject *error = Error::create(exec, type, message, -1, -1, NULL);
- exec->setException(error);
- return error;
-}
-
-JSObject *throwError(ExecState *exec, ErrorType type, const UString &message, int line, int sourceId, const UString &sourceURL)
-{
- JSObject *error = Error::create(exec, type, message, line, sourceId, sourceURL);
- exec->setException(error);
- return error;
-}
-
JSObject* constructEmptyObject(ExecState* exec)
{
return new (exec) JSObject(exec->lexicalGlobalObject()->objectPrototype());
-// -*- c-basic-offset: 2 -*-
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2001 Peter Kelly (pmk@post.com)
*
*/
-#ifndef KJS_OBJECT_H
-#define KJS_OBJECT_H
+#ifndef JSObject_h
+#define JSObject_h
+#include "ClassInfo.h"
#include "CommonIdentifiers.h"
#include "ExecState.h"
#include "JSNumberCell.h"
class InternalFunction;
class PropertyNameArray;
-
struct HashEntry;
struct HashTable;
Function = 1 << 4, // property is a function - only used by static hashtables
IsGetterSetter = 1 << 5 }; // property is a getter or setter
- /**
- * Class Information
- */
- struct ClassInfo {
- /**
- * A string denoting the class name. Example: "Window".
- */
- const char* className;
- /**
- * Pointer to the class information of the base class.
- * 0L if there is none.
- */
- const ClassInfo* parentClass;
- /**
- * Static hash-table of properties.
- * For classes that can be used from multiple threads, it is accessed via a getter function that would typically return a pointer to thread-specific value.
- */
- const HashTable* propHashTable(ExecState* exec) const
- {
- if (classPropHashTableGetterFunction)
- return classPropHashTableGetterFunction(exec);
- return staticPropHashTable;
- }
-
- const HashTable* staticPropHashTable;
- typedef const HashTable* (*ClassPropHashTableGetterFunction)(ExecState*);
- const ClassPropHashTableGetterFunction classPropHashTableGetterFunction;
- };
-
- // This is an internal value object which stores getter and setter functions
- // for a property.
- class GetterSetter : public JSCell {
- public:
- JSType type() const { return GetterSetterType; }
-
- GetterSetter() : m_getter(0), m_setter(0) { }
-
- virtual void mark();
-
- JSObject* getter() const { return m_getter; }
- void setGetter(JSObject* getter) { m_getter = getter; }
- JSObject* setter() const { return m_setter; }
- void setSetter(JSObject* setter) { m_setter = setter; }
-
- private:
- virtual JSValue* toPrimitive(ExecState*, JSType preferred) const;
- virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*& value);
- virtual bool toBoolean(ExecState*) const;
- virtual double toNumber(ExecState*) const;
- virtual UString toString(ExecState*) const;
- virtual JSObject* toObject(ExecState*) const;
-
- JSObject* m_getter;
- JSObject* m_setter;
- };
-
class JSObject : public JSCell {
public:
/**
JSValue *_proto;
};
- JSObject* constructEmptyObject(ExecState*);
-
- /**
- * Types of Native Errors available. For custom errors, GeneralError
- * should be used.
- */
- enum ErrorType { GeneralError = 0,
- EvalError = 1,
- RangeError = 2,
- ReferenceError = 3,
- SyntaxError = 4,
- TypeError = 5,
- URIError = 6};
-
- /**
- * @short Factory methods for error objects.
- */
- class Error {
- public:
- /**
- * Factory method for error objects.
- *
- * @param exec The current execution state
- * @param errtype Type of error.
- * @param message Optional error message.
- * @param lineNumber Optional line number.
- * @param sourceId Optional source id.
- * @param sourceURL Optional source URL.
- */
- static JSObject *create(ExecState *, ErrorType, const UString &message, int lineNumber, int sourceId, const UString &sourceURL);
- static JSObject *create(ExecState *, ErrorType, const char *message);
- };
-
-JSObject *throwError(ExecState *, ErrorType, const UString &message, int lineNumber, int sourceId, const UString &sourceURL);
-JSObject *throwError(ExecState *, ErrorType, const UString &message);
-JSObject *throwError(ExecState *, ErrorType, const char *message);
-JSObject *throwError(ExecState *, ErrorType);
+ JSObject* constructEmptyObject(ExecState*);
inline JSObject::JSObject(JSValue* proto)
: _proto(proto)
asCell()->put(exec, propertyName, value);
}
-} // namespace
+} // namespace KJS
-#endif // KJS_OBJECT_H
+#endif // JSObject_h
#ifndef NODES_H_
#define NODES_H_
+#include "Error.h"
#include "JSString.h"
#include "LabelStack.h"
#include "Opcode.h"
+2008-07-04 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Dan Bernstein.
+
+ * JSObject.h: Rename the header guard as it now conflicts with the
+ JSObject in JavaScriptCore.
+
2008-07-01 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef JSObject_h
-#define JSObject_h
+#ifndef JSGlue_JSObject_h
+#define JSGlue_JSObject_h
#include "JSBase.h"
#include "JSUtils.h"
int fDataType;
};
-#endif
+#endif // JSGlue_JSObject_h
+2008-07-04 Sam Weinig <sam@webkit.org>
+
+ Rubber-stamped by Dan Bernstein.
+
+ Split Error and GetterSetter out of JSObject.h.
+
+ * ForwardingHeaders/kjs/Error.h: Added.
+ * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
+ * bindings/js/JSClipboardCustom.cpp:
+ * bindings/js/JSDOMWindowBase.cpp:
+ * bindings/js/JSEventTargetBase.cpp:
+ * bindings/js/JSHTMLDocumentCustom.cpp:
+ * bindings/js/JSXMLHttpRequestCustom.cpp:
+ * bindings/scripts/CodeGeneratorJS.pm:
+ * bridge/NP_jsobject.cpp:
+ * bridge/jni/jni_instance.cpp:
+ * bridge/jni/jni_runtime.cpp:
+ * bridge/objc/objc_instance.mm:
+ * bridge/objc/objc_runtime.mm:
+ * bridge/objc/objc_utility.h:
+ * bridge/runtime_array.cpp:
+ * bridge/runtime_method.cpp:
+ * bridge/runtime_object.cpp:
+
2008-07-04 David D. Kilzer <ddkilzer@webkit.org>
Bug 15290: REGRESSION (r14184-r14216): Duplicate DOCTYPE definitions when saving files as webarchives
--- /dev/null
+#include <JavaScriptCore/Error.h>
#include "JSHTMLCanvasElement.h"
#include "JSHTMLImageElement.h"
#include "JSImageData.h"
+#include <kjs/Error.h>
using namespace KJS;
#include "PlatformString.h"
#include "StringHash.h"
#include <kjs/ArrayPrototype.h>
+#include <kjs/Error.h>
#include <wtf/HashSet.h>
using namespace KJS;
#include "PluginInfoStore.h"
#include "RenderView.h"
#include "ScheduledAction.h"
+#include "ScriptController.h"
#include "SecurityOrigin.h"
#include "Settings.h"
#include "WindowFeatures.h"
#include "htmlediting.h"
-#include "ScriptController.h"
+#include <kjs/Error.h>
#include <kjs/JSLock.h>
#include <wtf/AlwaysInline.h>
#include <wtf/MathExtras.h>
#include "JSEventTargetBase.h"
#include "JSDOMWindow.h"
-#include "JSEventTargetNode.h"
#include "JSEventListener.h"
+#include "JSEventTargetNode.h"
+#include <kjs/Error.h>
#if ENABLE(SVG)
#include "JSSVGElementInstance.h"
#include "JSDOMWindowCustom.h"
#include "JSDOMWindowShell.h"
#include "JSHTMLCollection.h"
+#include <kjs/Error.h>
using namespace KJS;
#include "JSEvent.h"
#include "JSEventListener.h"
#include "XMLHttpRequest.h"
+#include <kjs/Error.h>
using namespace KJS;
push(@implContent, "JSValue* ${functionName}(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)\n");
push(@implContent, "{\n");
+ $implKJSInclude{"Error.h"} = 1;
+
if ($interfaceName eq "DOMWindow") {
push(@implContent, " $className* castedThisObj = toJSDOMWindow(thisValue);\n");
push(@implContent, " if (!castedThisObj)\n");
#include "NP_jsobject.h"
+#include "PlatformString.h"
+#include "c_utility.h"
+#include "npruntime_impl.h"
+#include "npruntime_priv.h"
+#include "runtime_root.h"
+#include <kjs/Error.h>
#include <kjs/JSGlobalObject.h>
#include <kjs/JSLock.h>
#include <kjs/PropertyNameArray.h>
-#include "c_utility.h"
#include <kjs/completion.h>
#include <kjs/interpreter.h>
-#include "PlatformString.h"
-#include "npruntime_impl.h"
-#include "npruntime_priv.h"
-#include "runtime_root.h"
using WebCore::String;
using namespace KJS;
#include "jni_utility.h"
#include "runtime_object.h"
#include "runtime_root.h"
+#include <kjs/Error.h>
#include <kjs/JSLock.h>
#ifdef NDEBUG
#include "runtime_array.h"
#include "runtime_object.h"
#include "runtime_root.h"
+#include <kjs/Error.h>
#include <kjs/JSLock.h>
#ifdef NDEBUG
#import "FoundationExtras.h"
#import "WebScriptObject.h"
+#include <kjs/Error.h>
#include <kjs/JSLock.h>
#include <wtf/Assertions.h>
#include "config.h"
#include "objc_runtime.h"
+#include "WebScriptObject.h"
#include "objc_instance.h"
#include "runtime_array.h"
#include "runtime_object.h"
-#include "WebScriptObject.h"
+#include <kjs/Error.h>
#include <kjs/JSLock.h>
#include <wtf/RetainPtr.h>
#include <CoreFoundation/CoreFoundation.h>
-#include <kjs/JSObject.h>
#include "objc_header.h"
+#include <kjs/Error.h>
+#include <kjs/JSObject.h>
#ifdef __OBJC__
@class NSString;
#include "runtime_array.h"
#include <kjs/ArrayPrototype.h>
+#include <kjs/Error.h>
using namespace KJS;
#include "config.h"
#include "runtime_method.h"
-#include <kjs/JSGlobalObject.h>
#include "runtime_object.h"
+#include <kjs/Error.h>
+#include <kjs/JSGlobalObject.h>
namespace KJS {
#include "runtime_method.h"
#include "runtime_root.h"
+#include <kjs/Error.h>
using namespace KJS;
using namespace Bindings;