|
1 /* |
|
2 This file is part of the WebKit open source project. |
|
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
|
4 |
|
5 This library is free software; you can redistribute it and/or |
|
6 modify it under the terms of the GNU Library General Public |
|
7 License as published by the Free Software Foundation; either |
|
8 version 2 of the License, or (at your option) any later version. |
|
9 |
|
10 This library is distributed in the hope that it will be useful, |
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 Library General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU Library General Public License |
|
16 along with this library; see the file COPYING.LIB. If not, write to |
|
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
18 Boston, MA 02110-1301, USA. |
|
19 */ |
|
20 |
|
21 #include "config.h" |
|
22 |
|
23 #if ENABLE(WORKERS) |
|
24 |
|
25 #include "JSErrorEvent.h" |
|
26 |
|
27 #include "ErrorEvent.h" |
|
28 #include "KURL.h" |
|
29 #include <runtime/Error.h> |
|
30 #include <runtime/JSNumberCell.h> |
|
31 #include <runtime/JSString.h> |
|
32 #include <wtf/GetPtr.h> |
|
33 |
|
34 using namespace JSC; |
|
35 |
|
36 namespace WebCore { |
|
37 |
|
38 ASSERT_CLASS_FITS_IN_CELL(JSErrorEvent); |
|
39 |
|
40 /* Hash table */ |
|
41 #if ENABLE(JIT) |
|
42 #define THUNK_GENERATOR(generator) , generator |
|
43 #else |
|
44 #define THUNK_GENERATOR(generator) |
|
45 #endif |
|
46 |
|
47 static const HashTableValue JSErrorEventTableValues[5] = |
|
48 { |
|
49 { "message", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsErrorEventMessage), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { "filename", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsErrorEventFilename), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { "lineno", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsErrorEventLineno), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsErrorEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
54 }; |
|
55 |
|
56 #undef THUNK_GENERATOR |
|
57 static JSC_CONST_HASHTABLE HashTable JSErrorEventTable = { 9, 7, JSErrorEventTableValues, 0 }; |
|
58 /* Hash table for constructor */ |
|
59 #if ENABLE(JIT) |
|
60 #define THUNK_GENERATOR(generator) , generator |
|
61 #else |
|
62 #define THUNK_GENERATOR(generator) |
|
63 #endif |
|
64 |
|
65 static const HashTableValue JSErrorEventConstructorTableValues[1] = |
|
66 { |
|
67 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
68 }; |
|
69 |
|
70 #undef THUNK_GENERATOR |
|
71 static JSC_CONST_HASHTABLE HashTable JSErrorEventConstructorTable = { 1, 0, JSErrorEventConstructorTableValues, 0 }; |
|
72 class JSErrorEventConstructor : public DOMConstructorObject { |
|
73 public: |
|
74 JSErrorEventConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
75 |
|
76 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
77 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
78 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
79 static const JSC::ClassInfo s_info; |
|
80 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
81 { |
|
82 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
83 } |
|
84 protected: |
|
85 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
86 }; |
|
87 |
|
88 const ClassInfo JSErrorEventConstructor::s_info = { "ErrorEventConstructor", 0, &JSErrorEventConstructorTable, 0 }; |
|
89 |
|
90 JSErrorEventConstructor::JSErrorEventConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
91 : DOMConstructorObject(JSErrorEventConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
92 { |
|
93 putDirect(exec->propertyNames().prototype, JSErrorEventPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
94 } |
|
95 |
|
96 bool JSErrorEventConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
97 { |
|
98 return getStaticValueSlot<JSErrorEventConstructor, DOMObject>(exec, &JSErrorEventConstructorTable, this, propertyName, slot); |
|
99 } |
|
100 |
|
101 bool JSErrorEventConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
102 { |
|
103 return getStaticValueDescriptor<JSErrorEventConstructor, DOMObject>(exec, &JSErrorEventConstructorTable, this, propertyName, descriptor); |
|
104 } |
|
105 |
|
106 /* Hash table for prototype */ |
|
107 #if ENABLE(JIT) |
|
108 #define THUNK_GENERATOR(generator) , generator |
|
109 #else |
|
110 #define THUNK_GENERATOR(generator) |
|
111 #endif |
|
112 |
|
113 static const HashTableValue JSErrorEventPrototypeTableValues[2] = |
|
114 { |
|
115 { "initErrorEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsErrorEventPrototypeFunctionInitErrorEvent), (intptr_t)6 THUNK_GENERATOR(0) }, |
|
116 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
117 }; |
|
118 |
|
119 #undef THUNK_GENERATOR |
|
120 static JSC_CONST_HASHTABLE HashTable JSErrorEventPrototypeTable = { 2, 1, JSErrorEventPrototypeTableValues, 0 }; |
|
121 static const HashTable* getJSErrorEventPrototypeTable(ExecState* exec) |
|
122 { |
|
123 return getHashTableForGlobalData(exec->globalData(), &JSErrorEventPrototypeTable); |
|
124 } |
|
125 const ClassInfo JSErrorEventPrototype::s_info = { "ErrorEventPrototype", 0, 0, getJSErrorEventPrototypeTable }; |
|
126 |
|
127 JSObject* JSErrorEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
128 { |
|
129 return getDOMPrototype<JSErrorEvent>(exec, globalObject); |
|
130 } |
|
131 |
|
132 bool JSErrorEventPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
133 { |
|
134 return getStaticFunctionSlot<JSObject>(exec, getJSErrorEventPrototypeTable(exec), this, propertyName, slot); |
|
135 } |
|
136 |
|
137 bool JSErrorEventPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
138 { |
|
139 return getStaticFunctionDescriptor<JSObject>(exec, getJSErrorEventPrototypeTable(exec), this, propertyName, descriptor); |
|
140 } |
|
141 |
|
142 static const HashTable* getJSErrorEventTable(ExecState* exec) |
|
143 { |
|
144 return getHashTableForGlobalData(exec->globalData(), &JSErrorEventTable); |
|
145 } |
|
146 const ClassInfo JSErrorEvent::s_info = { "ErrorEvent", &JSEvent::s_info, 0, getJSErrorEventTable }; |
|
147 |
|
148 JSErrorEvent::JSErrorEvent(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<ErrorEvent> impl) |
|
149 : JSEvent(structure, globalObject, impl) |
|
150 { |
|
151 } |
|
152 |
|
153 JSObject* JSErrorEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
154 { |
|
155 return new (exec) JSErrorEventPrototype(globalObject, JSErrorEventPrototype::createStructure(JSEventPrototype::self(exec, globalObject))); |
|
156 } |
|
157 |
|
158 bool JSErrorEvent::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
159 { |
|
160 return getStaticValueSlot<JSErrorEvent, Base>(exec, getJSErrorEventTable(exec), this, propertyName, slot); |
|
161 } |
|
162 |
|
163 bool JSErrorEvent::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
164 { |
|
165 return getStaticValueDescriptor<JSErrorEvent, Base>(exec, getJSErrorEventTable(exec), this, propertyName, descriptor); |
|
166 } |
|
167 |
|
168 JSValue jsErrorEventMessage(ExecState* exec, JSValue slotBase, const Identifier&) |
|
169 { |
|
170 JSErrorEvent* castedThis = static_cast<JSErrorEvent*>(asObject(slotBase)); |
|
171 UNUSED_PARAM(exec); |
|
172 ErrorEvent* imp = static_cast<ErrorEvent*>(castedThis->impl()); |
|
173 JSValue result = jsString(exec, imp->message()); |
|
174 return result; |
|
175 } |
|
176 |
|
177 JSValue jsErrorEventFilename(ExecState* exec, JSValue slotBase, const Identifier&) |
|
178 { |
|
179 JSErrorEvent* castedThis = static_cast<JSErrorEvent*>(asObject(slotBase)); |
|
180 UNUSED_PARAM(exec); |
|
181 ErrorEvent* imp = static_cast<ErrorEvent*>(castedThis->impl()); |
|
182 JSValue result = jsString(exec, imp->filename()); |
|
183 return result; |
|
184 } |
|
185 |
|
186 JSValue jsErrorEventLineno(ExecState* exec, JSValue slotBase, const Identifier&) |
|
187 { |
|
188 JSErrorEvent* castedThis = static_cast<JSErrorEvent*>(asObject(slotBase)); |
|
189 UNUSED_PARAM(exec); |
|
190 ErrorEvent* imp = static_cast<ErrorEvent*>(castedThis->impl()); |
|
191 JSValue result = jsNumber(exec, imp->lineno()); |
|
192 return result; |
|
193 } |
|
194 |
|
195 JSValue jsErrorEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
196 { |
|
197 JSErrorEvent* domObject = static_cast<JSErrorEvent*>(asObject(slotBase)); |
|
198 return JSErrorEvent::getConstructor(exec, domObject->globalObject()); |
|
199 } |
|
200 JSValue JSErrorEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
201 { |
|
202 return getDOMConstructor<JSErrorEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
203 } |
|
204 |
|
205 EncodedJSValue JSC_HOST_CALL jsErrorEventPrototypeFunctionInitErrorEvent(ExecState* exec) |
|
206 { |
|
207 JSValue thisValue = exec->hostThisValue(); |
|
208 if (!thisValue.inherits(&JSErrorEvent::s_info)) |
|
209 return throwVMTypeError(exec); |
|
210 JSErrorEvent* castedThis = static_cast<JSErrorEvent*>(asObject(thisValue)); |
|
211 ErrorEvent* imp = static_cast<ErrorEvent*>(castedThis->impl()); |
|
212 const String& typeArg = ustringToString(exec->argument(0).toString(exec)); |
|
213 bool canBubbleArg = exec->argument(1).toBoolean(exec); |
|
214 bool cancelableArg = exec->argument(2).toBoolean(exec); |
|
215 const String& messageArg = ustringToString(exec->argument(3).toString(exec)); |
|
216 const String& filenameArg = ustringToString(exec->argument(4).toString(exec)); |
|
217 unsigned linenoArg = exec->argument(5).toInt32(exec); |
|
218 |
|
219 imp->initErrorEvent(typeArg, canBubbleArg, cancelableArg, messageArg, filenameArg, linenoArg); |
|
220 return JSValue::encode(jsUndefined()); |
|
221 } |
|
222 |
|
223 |
|
224 } |
|
225 |
|
226 #endif // ENABLE(WORKERS) |