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(GEOLOCATION) |
24 | |
25 | #include "JSPositionError.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConvertNumbers.h" |
30 | #include "JSDOMConvertStrings.h" |
31 | #include "JSDOMExceptionHandling.h" |
32 | #include "JSDOMWrapperCache.h" |
33 | #include "ScriptExecutionContext.h" |
34 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
35 | #include <JavaScriptCore/JSCInlines.h> |
36 | #include <wtf/GetPtr.h> |
37 | #include <wtf/PointerPreparations.h> |
38 | #include <wtf/URL.h> |
39 | |
40 | |
41 | namespace WebCore { |
42 | using namespace JSC; |
43 | |
44 | // Attributes |
45 | |
46 | JSC::EncodedJSValue jsPositionErrorCode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
47 | JSC::EncodedJSValue jsPositionErrorMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
48 | |
49 | class JSPositionErrorPrototype : public JSC::JSNonFinalObject { |
50 | public: |
51 | using Base = JSC::JSNonFinalObject; |
52 | static JSPositionErrorPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
53 | { |
54 | JSPositionErrorPrototype* ptr = new (NotNull, JSC::allocateCell<JSPositionErrorPrototype>(vm.heap)) JSPositionErrorPrototype(vm, globalObject, structure); |
55 | ptr->finishCreation(vm); |
56 | return ptr; |
57 | } |
58 | |
59 | DECLARE_INFO; |
60 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
61 | { |
62 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
63 | } |
64 | |
65 | private: |
66 | JSPositionErrorPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
67 | : JSC::JSNonFinalObject(vm, structure) |
68 | { |
69 | } |
70 | |
71 | void finishCreation(JSC::VM&); |
72 | }; |
73 | |
74 | /* Hash table for prototype */ |
75 | |
76 | static const HashTableValue JSPositionErrorPrototypeTableValues[] = |
77 | { |
78 | { "code" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPositionErrorCode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
79 | { "message" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPositionErrorMessage), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
80 | { "PERMISSION_DENIED" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
81 | { "POSITION_UNAVAILABLE" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
82 | { "TIMEOUT" , JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
83 | }; |
84 | |
85 | const ClassInfo JSPositionErrorPrototype::s_info = { "PositionErrorPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPositionErrorPrototype) }; |
86 | |
87 | void JSPositionErrorPrototype::finishCreation(VM& vm) |
88 | { |
89 | Base::finishCreation(vm); |
90 | reifyStaticProperties(vm, JSPositionError::info(), JSPositionErrorPrototypeTableValues, *this); |
91 | } |
92 | |
93 | const ClassInfo JSPositionError::s_info = { "PositionError" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPositionError) }; |
94 | |
95 | JSPositionError::JSPositionError(Structure* structure, JSDOMGlobalObject& globalObject, Ref<PositionError>&& impl) |
96 | : JSDOMWrapper<PositionError>(structure, globalObject, WTFMove(impl)) |
97 | { |
98 | } |
99 | |
100 | void JSPositionError::finishCreation(VM& vm) |
101 | { |
102 | Base::finishCreation(vm); |
103 | ASSERT(inherits(vm, info())); |
104 | |
105 | } |
106 | |
107 | JSObject* JSPositionError::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
108 | { |
109 | return JSPositionErrorPrototype::create(vm, &globalObject, JSPositionErrorPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
110 | } |
111 | |
112 | JSObject* JSPositionError::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
113 | { |
114 | return getDOMPrototype<JSPositionError>(vm, globalObject); |
115 | } |
116 | |
117 | void JSPositionError::destroy(JSC::JSCell* cell) |
118 | { |
119 | JSPositionError* thisObject = static_cast<JSPositionError*>(cell); |
120 | thisObject->JSPositionError::~JSPositionError(); |
121 | } |
122 | |
123 | template<> inline JSPositionError* IDLAttribute<JSPositionError>::cast(ExecState& state, EncodedJSValue thisValue) |
124 | { |
125 | return jsDynamicCast<JSPositionError*>(state.vm(), JSValue::decode(thisValue)); |
126 | } |
127 | |
128 | static inline JSValue jsPositionErrorCodeGetter(ExecState& state, JSPositionError& thisObject, ThrowScope& throwScope) |
129 | { |
130 | UNUSED_PARAM(throwScope); |
131 | UNUSED_PARAM(state); |
132 | auto& impl = thisObject.wrapped(); |
133 | JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.code()); |
134 | return result; |
135 | } |
136 | |
137 | EncodedJSValue jsPositionErrorCode(ExecState* state, EncodedJSValue thisValue, PropertyName) |
138 | { |
139 | return IDLAttribute<JSPositionError>::get<jsPositionErrorCodeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "code" ); |
140 | } |
141 | |
142 | static inline JSValue jsPositionErrorMessageGetter(ExecState& state, JSPositionError& thisObject, ThrowScope& throwScope) |
143 | { |
144 | UNUSED_PARAM(throwScope); |
145 | UNUSED_PARAM(state); |
146 | auto& impl = thisObject.wrapped(); |
147 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.message()); |
148 | return result; |
149 | } |
150 | |
151 | EncodedJSValue jsPositionErrorMessage(ExecState* state, EncodedJSValue thisValue, PropertyName) |
152 | { |
153 | return IDLAttribute<JSPositionError>::get<jsPositionErrorMessageGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "message" ); |
154 | } |
155 | |
156 | void JSPositionError::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
157 | { |
158 | auto* thisObject = jsCast<JSPositionError*>(cell); |
159 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
160 | if (thisObject->scriptExecutionContext()) |
161 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
162 | Base::heapSnapshot(cell, builder); |
163 | } |
164 | |
165 | bool JSPositionErrorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
166 | { |
167 | UNUSED_PARAM(handle); |
168 | UNUSED_PARAM(visitor); |
169 | UNUSED_PARAM(reason); |
170 | return false; |
171 | } |
172 | |
173 | void JSPositionErrorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
174 | { |
175 | auto* jsPositionError = static_cast<JSPositionError*>(handle.slot()->asCell()); |
176 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
177 | uncacheWrapper(world, &jsPositionError->wrapped(), jsPositionError); |
178 | } |
179 | |
180 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<PositionError>&& impl) |
181 | { |
182 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
183 | // attribute. You should remove that attribute. If the class has subclasses |
184 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
185 | // attribute to PositionError. |
186 | static_assert(!std::is_polymorphic<PositionError>::value, "PositionError is polymorphic but the IDL claims it is not" ); |
187 | return createWrapper<PositionError>(globalObject, WTFMove(impl)); |
188 | } |
189 | |
190 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, PositionError& impl) |
191 | { |
192 | return wrap(state, globalObject, impl); |
193 | } |
194 | |
195 | PositionError* JSPositionError::toWrapped(JSC::VM& vm, JSC::JSValue value) |
196 | { |
197 | if (auto* wrapper = jsDynamicCast<JSPositionError*>(vm, value)) |
198 | return &wrapper->wrapped(); |
199 | return nullptr; |
200 | } |
201 | |
202 | } |
203 | |
204 | #endif // ENABLE(GEOLOCATION) |
205 | |