| /* |
| This file is part of the WebKit open source project. |
| This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
| |
| 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 "JSXPathResult.h" |
| |
| #include "ExceptionCode.h" |
| #include "JSDOMBinding.h" |
| #include "JSDOMConstructor.h" |
| #include "JSDOMConvert.h" |
| #include "JSNode.h" |
| #include "Node.h" |
| #include "URL.h" |
| #include <runtime/Error.h> |
| #include <runtime/FunctionPrototype.h> |
| #include <runtime/JSString.h> |
| #include <wtf/GetPtr.h> |
| |
| using namespace JSC; |
| |
| namespace WebCore { |
| |
| // Functions |
| |
| JSC::EncodedJSValue JSC_HOST_CALL jsXPathResultPrototypeFunctionIterateNext(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsXPathResultPrototypeFunctionSnapshotItem(JSC::ExecState*); |
| |
| // Attributes |
| |
| JSC::EncodedJSValue jsXPathResultResultType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsXPathResultNumberValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsXPathResultStringValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsXPathResultBooleanValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsXPathResultSingleNodeValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsXPathResultInvalidIteratorState(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsXPathResultSnapshotLength(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsXPathResultConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSXPathResultConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| |
| class JSXPathResultPrototype : public JSC::JSNonFinalObject { |
| public: |
| typedef JSC::JSNonFinalObject Base; |
| static JSXPathResultPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSXPathResultPrototype* ptr = new (NotNull, JSC::allocateCell<JSXPathResultPrototype>(vm.heap)) JSXPathResultPrototype(vm, globalObject, structure); |
| ptr->finishCreation(vm); |
| return ptr; |
| } |
| |
| DECLARE_INFO; |
| static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| { |
| return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| } |
| |
| private: |
| JSXPathResultPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| |
| typedef JSDOMConstructorNotConstructable<JSXPathResult> JSXPathResultConstructor; |
| |
| /* Hash table for constructor */ |
| |
| static const HashTableValue JSXPathResultConstructorTableValues[] = |
| { |
| { "ANY_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
| { "NUMBER_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
| { "STRING_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
| { "BOOLEAN_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
| { "UNORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(4) } }, |
| { "ORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(5) } }, |
| { "UNORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(6) } }, |
| { "ORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(7) } }, |
| { "ANY_UNORDERED_NODE_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(8) } }, |
| { "FIRST_ORDERED_NODE_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(9) } }, |
| }; |
| |
| static_assert(XPathResult::ANY_TYPE == 0, "ANY_TYPE in XPathResult does not match value from IDL"); |
| static_assert(XPathResult::NUMBER_TYPE == 1, "NUMBER_TYPE in XPathResult does not match value from IDL"); |
| static_assert(XPathResult::STRING_TYPE == 2, "STRING_TYPE in XPathResult does not match value from IDL"); |
| static_assert(XPathResult::BOOLEAN_TYPE == 3, "BOOLEAN_TYPE in XPathResult does not match value from IDL"); |
| static_assert(XPathResult::UNORDERED_NODE_ITERATOR_TYPE == 4, "UNORDERED_NODE_ITERATOR_TYPE in XPathResult does not match value from IDL"); |
| static_assert(XPathResult::ORDERED_NODE_ITERATOR_TYPE == 5, "ORDERED_NODE_ITERATOR_TYPE in XPathResult does not match value from IDL"); |
| static_assert(XPathResult::UNORDERED_NODE_SNAPSHOT_TYPE == 6, "UNORDERED_NODE_SNAPSHOT_TYPE in XPathResult does not match value from IDL"); |
| static_assert(XPathResult::ORDERED_NODE_SNAPSHOT_TYPE == 7, "ORDERED_NODE_SNAPSHOT_TYPE in XPathResult does not match value from IDL"); |
| static_assert(XPathResult::ANY_UNORDERED_NODE_TYPE == 8, "ANY_UNORDERED_NODE_TYPE in XPathResult does not match value from IDL"); |
| static_assert(XPathResult::FIRST_ORDERED_NODE_TYPE == 9, "FIRST_ORDERED_NODE_TYPE in XPathResult does not match value from IDL"); |
| |
| template<> JSValue JSXPathResultConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| UNUSED_PARAM(vm); |
| return globalObject.functionPrototype(); |
| } |
| |
| template<> void JSXPathResultConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->prototype, JSXPathResult::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("XPathResult"))), ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum); |
| reifyStaticProperties(vm, JSXPathResultConstructorTableValues, *this); |
| } |
| |
| template<> const ClassInfo JSXPathResultConstructor::s_info = { "XPathResult", &Base::s_info, 0, CREATE_METHOD_TABLE(JSXPathResultConstructor) }; |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSXPathResultPrototypeTableValues[] = |
| { |
| { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSXPathResultConstructor) } }, |
| { "resultType", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultResultType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "numberValue", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultNumberValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "stringValue", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultStringValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "booleanValue", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultBooleanValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "singleNodeValue", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultSingleNodeValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "invalidIteratorState", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultInvalidIteratorState), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "snapshotLength", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultSnapshotLength), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "iterateNext", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsXPathResultPrototypeFunctionIterateNext), (intptr_t) (0) } }, |
| { "snapshotItem", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsXPathResultPrototypeFunctionSnapshotItem), (intptr_t) (0) } }, |
| { "ANY_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
| { "NUMBER_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
| { "STRING_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
| { "BOOLEAN_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(3) } }, |
| { "UNORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(4) } }, |
| { "ORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(5) } }, |
| { "UNORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(6) } }, |
| { "ORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(7) } }, |
| { "ANY_UNORDERED_NODE_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(8) } }, |
| { "FIRST_ORDERED_NODE_TYPE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(9) } }, |
| }; |
| |
| const ClassInfo JSXPathResultPrototype::s_info = { "XPathResultPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSXPathResultPrototype) }; |
| |
| void JSXPathResultPrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSXPathResultPrototypeTableValues, *this); |
| } |
| |
| const ClassInfo JSXPathResult::s_info = { "XPathResult", &Base::s_info, 0, CREATE_METHOD_TABLE(JSXPathResult) }; |
| |
| JSXPathResult::JSXPathResult(Structure* structure, JSDOMGlobalObject& globalObject, Ref<XPathResult>&& impl) |
| : JSDOMWrapper<XPathResult>(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| JSObject* JSXPathResult::createPrototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return JSXPathResultPrototype::create(vm, globalObject, JSXPathResultPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); |
| } |
| |
| JSObject* JSXPathResult::prototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSXPathResult>(vm, globalObject); |
| } |
| |
| void JSXPathResult::destroy(JSC::JSCell* cell) |
| { |
| JSXPathResult* thisObject = static_cast<JSXPathResult*>(cell); |
| thisObject->JSXPathResult::~JSXPathResult(); |
| } |
| |
| EncodedJSValue jsXPathResultResultType(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSXPathResult*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "XPathResult", "resultType"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.resultType()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsXPathResultNumberValue(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSXPathResult*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "XPathResult", "numberValue"); |
| } |
| ExceptionCode ec = 0; |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.numberValue(ec)); |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsXPathResultStringValue(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSXPathResult*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "XPathResult", "stringValue"); |
| } |
| ExceptionCode ec = 0; |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.stringValue(ec)); |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsXPathResultBooleanValue(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSXPathResult*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "XPathResult", "booleanValue"); |
| } |
| ExceptionCode ec = 0; |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsBoolean(impl.booleanValue(ec)); |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsXPathResultSingleNodeValue(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSXPathResult*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "XPathResult", "singleNodeValue"); |
| } |
| ExceptionCode ec = 0; |
| auto& impl = castedThis->wrapped(); |
| JSValue result = toJS(state, castedThis->globalObject(), impl.singleNodeValue(ec)); |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsXPathResultInvalidIteratorState(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSXPathResult*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "XPathResult", "invalidIteratorState"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsBoolean(impl.invalidIteratorState()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsXPathResultSnapshotLength(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSXPathResult*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "XPathResult", "snapshotLength"); |
| } |
| ExceptionCode ec = 0; |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.snapshotLength(ec)); |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsXPathResultConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSXPathResultPrototype* domObject = jsDynamicCast<JSXPathResultPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) |
| return throwVMTypeError(state, throwScope); |
| return JSValue::encode(JSXPathResult::getConstructor(state->vm(), domObject->globalObject())); |
| } |
| |
| bool setJSXPathResultConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSValue value = JSValue::decode(encodedValue); |
| JSXPathResultPrototype* domObject = jsDynamicCast<JSXPathResultPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) { |
| throwVMTypeError(state, throwScope); |
| return false; |
| } |
| // Shadowing a built-in constructor |
| return domObject->putDirect(state->vm(), state->propertyNames().constructor, value); |
| } |
| |
| JSValue JSXPathResult::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSXPathResultConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsXPathResultPrototypeFunctionIterateNext(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSXPathResult*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "XPathResult", "iterateNext"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSXPathResult::info()); |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| JSValue result = toJS(state, castedThis->globalObject(), impl.iterateNext(ec)); |
| |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsXPathResultPrototypeFunctionSnapshotItem(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSXPathResult*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "XPathResult", "snapshotItem"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSXPathResult::info()); |
| auto& impl = castedThis->wrapped(); |
| ExceptionCode ec = 0; |
| auto index = convert<uint32_t>(*state, state->argument(0), NormalConversion); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| JSValue result = toJS(state, castedThis->globalObject(), impl.snapshotItem(WTFMove(index), ec)); |
| |
| setDOMException(state, throwScope, ec); |
| return JSValue::encode(result); |
| } |
| |
| void JSXPathResult::visitChildren(JSCell* cell, SlotVisitor& visitor) |
| { |
| auto* thisObject = jsCast<JSXPathResult*>(cell); |
| ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
| Base::visitChildren(thisObject, visitor); |
| thisObject->visitAdditionalChildren(visitor); |
| } |
| |
| bool JSXPathResultOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) |
| { |
| UNUSED_PARAM(handle); |
| UNUSED_PARAM(visitor); |
| return false; |
| } |
| |
| void JSXPathResultOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| { |
| auto* jsXPathResult = jsCast<JSXPathResult*>(handle.slot()->asCell()); |
| auto& world = *static_cast<DOMWrapperWorld*>(context); |
| uncacheWrapper(world, &jsXPathResult->wrapped(), jsXPathResult); |
| } |
| |
| JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<XPathResult>&& impl) |
| { |
| #if COMPILER(CLANG) |
| // If you hit this failure the interface definition has the ImplementationLacksVTable |
| // attribute. You should remove that attribute. If the class has subclasses |
| // that may be passed through this toJS() function you should use the SkipVTableValidation |
| // attribute to XPathResult. |
| static_assert(!__is_polymorphic(XPathResult), "XPathResult is polymorphic but the IDL claims it is not"); |
| #endif |
| return createWrapper<XPathResult>(globalObject, WTFMove(impl)); |
| } |
| |
| JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, XPathResult& impl) |
| { |
| return wrap(state, globalObject, impl); |
| } |
| |
| XPathResult* JSXPathResult::toWrapped(JSC::JSValue value) |
| { |
| if (auto* wrapper = jsDynamicCast<JSXPathResult*>(value)) |
| return &wrapper->wrapped(); |
| return nullptr; |
| } |
| |
| } |