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 | #include "JSXPathNSResolver.h" |
23 | |
24 | #include "JSDOMBinding.h" |
25 | #include "JSDOMConvertNullable.h" |
26 | #include "JSDOMConvertStrings.h" |
27 | #include "JSDOMExceptionHandling.h" |
28 | #include "JSDOMOperation.h" |
29 | #include "JSDOMWrapperCache.h" |
30 | #include "ScriptExecutionContext.h" |
31 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
32 | #include <JavaScriptCore/JSCInlines.h> |
33 | #include <wtf/GetPtr.h> |
34 | #include <wtf/PointerPreparations.h> |
35 | #include <wtf/URL.h> |
36 | |
37 | |
38 | namespace WebCore { |
39 | using namespace JSC; |
40 | |
41 | // Functions |
42 | |
43 | JSC::EncodedJSValue JSC_HOST_CALL jsXPathNSResolverPrototypeFunctionLookupNamespaceURI(JSC::ExecState*); |
44 | |
45 | class JSXPathNSResolverPrototype : public JSC::JSNonFinalObject { |
46 | public: |
47 | using Base = JSC::JSNonFinalObject; |
48 | static JSXPathNSResolverPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
49 | { |
50 | JSXPathNSResolverPrototype* ptr = new (NotNull, JSC::allocateCell<JSXPathNSResolverPrototype>(vm.heap)) JSXPathNSResolverPrototype(vm, globalObject, structure); |
51 | ptr->finishCreation(vm); |
52 | return ptr; |
53 | } |
54 | |
55 | DECLARE_INFO; |
56 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
57 | { |
58 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
59 | } |
60 | |
61 | private: |
62 | JSXPathNSResolverPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
63 | : JSC::JSNonFinalObject(vm, structure) |
64 | { |
65 | } |
66 | |
67 | void finishCreation(JSC::VM&); |
68 | }; |
69 | |
70 | /* Hash table for prototype */ |
71 | |
72 | static const HashTableValue JSXPathNSResolverPrototypeTableValues[] = |
73 | { |
74 | { "lookupNamespaceURI" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsXPathNSResolverPrototypeFunctionLookupNamespaceURI), (intptr_t) (0) } }, |
75 | }; |
76 | |
77 | const ClassInfo JSXPathNSResolverPrototype::s_info = { "XPathNSResolverPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSXPathNSResolverPrototype) }; |
78 | |
79 | void JSXPathNSResolverPrototype::finishCreation(VM& vm) |
80 | { |
81 | Base::finishCreation(vm); |
82 | reifyStaticProperties(vm, JSXPathNSResolver::info(), JSXPathNSResolverPrototypeTableValues, *this); |
83 | } |
84 | |
85 | const ClassInfo JSXPathNSResolver::s_info = { "XPathNSResolver" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSXPathNSResolver) }; |
86 | |
87 | JSXPathNSResolver::JSXPathNSResolver(Structure* structure, JSDOMGlobalObject& globalObject, Ref<XPathNSResolver>&& impl) |
88 | : JSDOMWrapper<XPathNSResolver>(structure, globalObject, WTFMove(impl)) |
89 | { |
90 | } |
91 | |
92 | void JSXPathNSResolver::finishCreation(VM& vm) |
93 | { |
94 | Base::finishCreation(vm); |
95 | ASSERT(inherits(vm, info())); |
96 | |
97 | } |
98 | |
99 | JSObject* JSXPathNSResolver::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
100 | { |
101 | return JSXPathNSResolverPrototype::create(vm, &globalObject, JSXPathNSResolverPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
102 | } |
103 | |
104 | JSObject* JSXPathNSResolver::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
105 | { |
106 | return getDOMPrototype<JSXPathNSResolver>(vm, globalObject); |
107 | } |
108 | |
109 | void JSXPathNSResolver::destroy(JSC::JSCell* cell) |
110 | { |
111 | JSXPathNSResolver* thisObject = static_cast<JSXPathNSResolver*>(cell); |
112 | thisObject->JSXPathNSResolver::~JSXPathNSResolver(); |
113 | } |
114 | |
115 | template<> inline JSXPathNSResolver* IDLOperation<JSXPathNSResolver>::cast(ExecState& state) |
116 | { |
117 | return jsDynamicCast<JSXPathNSResolver*>(state.vm(), state.thisValue()); |
118 | } |
119 | |
120 | static inline JSC::EncodedJSValue jsXPathNSResolverPrototypeFunctionLookupNamespaceURIBody(JSC::ExecState* state, typename IDLOperation<JSXPathNSResolver>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
121 | { |
122 | UNUSED_PARAM(state); |
123 | UNUSED_PARAM(throwScope); |
124 | auto& impl = castedThis->wrapped(); |
125 | auto prefix = convert<IDLDOMString>(*state, state->argument(0)); |
126 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
127 | return JSValue::encode(toJS<IDLNullable<IDLDOMString>>(*state, impl.lookupNamespaceURI(WTFMove(prefix)))); |
128 | } |
129 | |
130 | EncodedJSValue JSC_HOST_CALL jsXPathNSResolverPrototypeFunctionLookupNamespaceURI(ExecState* state) |
131 | { |
132 | return IDLOperation<JSXPathNSResolver>::call<jsXPathNSResolverPrototypeFunctionLookupNamespaceURIBody>(*state, "lookupNamespaceURI" ); |
133 | } |
134 | |
135 | void JSXPathNSResolver::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
136 | { |
137 | auto* thisObject = jsCast<JSXPathNSResolver*>(cell); |
138 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
139 | if (thisObject->scriptExecutionContext()) |
140 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
141 | Base::heapSnapshot(cell, builder); |
142 | } |
143 | |
144 | bool JSXPathNSResolverOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
145 | { |
146 | UNUSED_PARAM(handle); |
147 | UNUSED_PARAM(visitor); |
148 | UNUSED_PARAM(reason); |
149 | return false; |
150 | } |
151 | |
152 | void JSXPathNSResolverOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
153 | { |
154 | auto* jsXPathNSResolver = static_cast<JSXPathNSResolver*>(handle.slot()->asCell()); |
155 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
156 | uncacheWrapper(world, &jsXPathNSResolver->wrapped(), jsXPathNSResolver); |
157 | } |
158 | |
159 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<XPathNSResolver>&& impl) |
160 | { |
161 | return createWrapper<XPathNSResolver>(globalObject, WTFMove(impl)); |
162 | } |
163 | |
164 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, XPathNSResolver& impl) |
165 | { |
166 | return wrap(state, globalObject, impl); |
167 | } |
168 | |
169 | |
170 | } |
171 | |