WebCore/generated/JSXPathResult.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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(XPATH)
       
    24 
       
    25 #include "JSXPathResult.h"
       
    26 
       
    27 #include "JSNode.h"
       
    28 #include "KURL.h"
       
    29 #include "Node.h"
       
    30 #include "XPathResult.h"
       
    31 #include <runtime/Error.h>
       
    32 #include <runtime/JSNumberCell.h>
       
    33 #include <runtime/JSString.h>
       
    34 #include <wtf/GetPtr.h>
       
    35 
       
    36 using namespace JSC;
       
    37 
       
    38 namespace WebCore {
       
    39 
       
    40 ASSERT_CLASS_FITS_IN_CELL(JSXPathResult);
       
    41 
       
    42 /* Hash table */
       
    43 #if ENABLE(JIT)
       
    44 #define THUNK_GENERATOR(generator) , generator
       
    45 #else
       
    46 #define THUNK_GENERATOR(generator)
       
    47 #endif
       
    48 
       
    49 static const HashTableValue JSXPathResultTableValues[9] =
       
    50 {
       
    51     { "resultType", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultResultType), (intptr_t)0 THUNK_GENERATOR(0) },
       
    52     { "numberValue", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultNumberValue), (intptr_t)0 THUNK_GENERATOR(0) },
       
    53     { "stringValue", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultStringValue), (intptr_t)0 THUNK_GENERATOR(0) },
       
    54     { "booleanValue", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultBooleanValue), (intptr_t)0 THUNK_GENERATOR(0) },
       
    55     { "singleNodeValue", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultSingleNodeValue), (intptr_t)0 THUNK_GENERATOR(0) },
       
    56     { "invalidIteratorState", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultInvalidIteratorState), (intptr_t)0 THUNK_GENERATOR(0) },
       
    57     { "snapshotLength", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultSnapshotLength), (intptr_t)0 THUNK_GENERATOR(0) },
       
    58     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    59     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    60 };
       
    61 
       
    62 #undef THUNK_GENERATOR
       
    63 static JSC_CONST_HASHTABLE HashTable JSXPathResultTable = { 18, 15, JSXPathResultTableValues, 0 };
       
    64 /* Hash table for constructor */
       
    65 #if ENABLE(JIT)
       
    66 #define THUNK_GENERATOR(generator) , generator
       
    67 #else
       
    68 #define THUNK_GENERATOR(generator)
       
    69 #endif
       
    70 
       
    71 static const HashTableValue JSXPathResultConstructorTableValues[11] =
       
    72 {
       
    73     { "ANY_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultANY_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    74     { "NUMBER_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultNUMBER_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    75     { "STRING_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultSTRING_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    76     { "BOOLEAN_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultBOOLEAN_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    77     { "UNORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultUNORDERED_NODE_ITERATOR_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    78     { "ORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultORDERED_NODE_ITERATOR_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    79     { "UNORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultUNORDERED_NODE_SNAPSHOT_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    80     { "ORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultORDERED_NODE_SNAPSHOT_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    81     { "ANY_UNORDERED_NODE_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultANY_UNORDERED_NODE_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    82     { "FIRST_ORDERED_NODE_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultFIRST_ORDERED_NODE_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    83     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    84 };
       
    85 
       
    86 #undef THUNK_GENERATOR
       
    87 static JSC_CONST_HASHTABLE HashTable JSXPathResultConstructorTable = { 33, 31, JSXPathResultConstructorTableValues, 0 };
       
    88 
       
    89 COMPILE_ASSERT(0 == XPathResult::ANY_TYPE, XPathResultEnumANY_TYPEIsWrongUseDontCheckEnums);
       
    90 COMPILE_ASSERT(1 == XPathResult::NUMBER_TYPE, XPathResultEnumNUMBER_TYPEIsWrongUseDontCheckEnums);
       
    91 COMPILE_ASSERT(2 == XPathResult::STRING_TYPE, XPathResultEnumSTRING_TYPEIsWrongUseDontCheckEnums);
       
    92 COMPILE_ASSERT(3 == XPathResult::BOOLEAN_TYPE, XPathResultEnumBOOLEAN_TYPEIsWrongUseDontCheckEnums);
       
    93 COMPILE_ASSERT(4 == XPathResult::UNORDERED_NODE_ITERATOR_TYPE, XPathResultEnumUNORDERED_NODE_ITERATOR_TYPEIsWrongUseDontCheckEnums);
       
    94 COMPILE_ASSERT(5 == XPathResult::ORDERED_NODE_ITERATOR_TYPE, XPathResultEnumORDERED_NODE_ITERATOR_TYPEIsWrongUseDontCheckEnums);
       
    95 COMPILE_ASSERT(6 == XPathResult::UNORDERED_NODE_SNAPSHOT_TYPE, XPathResultEnumUNORDERED_NODE_SNAPSHOT_TYPEIsWrongUseDontCheckEnums);
       
    96 COMPILE_ASSERT(7 == XPathResult::ORDERED_NODE_SNAPSHOT_TYPE, XPathResultEnumORDERED_NODE_SNAPSHOT_TYPEIsWrongUseDontCheckEnums);
       
    97 COMPILE_ASSERT(8 == XPathResult::ANY_UNORDERED_NODE_TYPE, XPathResultEnumANY_UNORDERED_NODE_TYPEIsWrongUseDontCheckEnums);
       
    98 COMPILE_ASSERT(9 == XPathResult::FIRST_ORDERED_NODE_TYPE, XPathResultEnumFIRST_ORDERED_NODE_TYPEIsWrongUseDontCheckEnums);
       
    99 
       
   100 class JSXPathResultConstructor : public DOMConstructorObject {
       
   101 public:
       
   102     JSXPathResultConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
   103 
       
   104     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
   105     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
   106     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
   107     static const JSC::ClassInfo s_info;
       
   108     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
   109     {
       
   110         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
   111     }
       
   112 protected:
       
   113     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
   114 };
       
   115 
       
   116 const ClassInfo JSXPathResultConstructor::s_info = { "XPathResultConstructor", 0, &JSXPathResultConstructorTable, 0 };
       
   117 
       
   118 JSXPathResultConstructor::JSXPathResultConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
   119     : DOMConstructorObject(JSXPathResultConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
   120 {
       
   121     putDirect(exec->propertyNames().prototype, JSXPathResultPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
   122 }
       
   123 
       
   124 bool JSXPathResultConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   125 {
       
   126     return getStaticValueSlot<JSXPathResultConstructor, DOMObject>(exec, &JSXPathResultConstructorTable, this, propertyName, slot);
       
   127 }
       
   128 
       
   129 bool JSXPathResultConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   130 {
       
   131     return getStaticValueDescriptor<JSXPathResultConstructor, DOMObject>(exec, &JSXPathResultConstructorTable, this, propertyName, descriptor);
       
   132 }
       
   133 
       
   134 /* Hash table for prototype */
       
   135 #if ENABLE(JIT)
       
   136 #define THUNK_GENERATOR(generator) , generator
       
   137 #else
       
   138 #define THUNK_GENERATOR(generator)
       
   139 #endif
       
   140 
       
   141 static const HashTableValue JSXPathResultPrototypeTableValues[13] =
       
   142 {
       
   143     { "ANY_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultANY_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   144     { "NUMBER_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultNUMBER_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   145     { "STRING_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultSTRING_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   146     { "BOOLEAN_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultBOOLEAN_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   147     { "UNORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultUNORDERED_NODE_ITERATOR_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   148     { "ORDERED_NODE_ITERATOR_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultORDERED_NODE_ITERATOR_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   149     { "UNORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultUNORDERED_NODE_SNAPSHOT_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   150     { "ORDERED_NODE_SNAPSHOT_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultORDERED_NODE_SNAPSHOT_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   151     { "ANY_UNORDERED_NODE_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultANY_UNORDERED_NODE_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   152     { "FIRST_ORDERED_NODE_TYPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathResultFIRST_ORDERED_NODE_TYPE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   153     { "iterateNext", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXPathResultPrototypeFunctionIterateNext), (intptr_t)0 THUNK_GENERATOR(0) },
       
   154     { "snapshotItem", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXPathResultPrototypeFunctionSnapshotItem), (intptr_t)1 THUNK_GENERATOR(0) },
       
   155     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   156 };
       
   157 
       
   158 #undef THUNK_GENERATOR
       
   159 static JSC_CONST_HASHTABLE HashTable JSXPathResultPrototypeTable = { 33, 31, JSXPathResultPrototypeTableValues, 0 };
       
   160 const ClassInfo JSXPathResultPrototype::s_info = { "XPathResultPrototype", 0, &JSXPathResultPrototypeTable, 0 };
       
   161 
       
   162 JSObject* JSXPathResultPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   163 {
       
   164     return getDOMPrototype<JSXPathResult>(exec, globalObject);
       
   165 }
       
   166 
       
   167 bool JSXPathResultPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   168 {
       
   169     return getStaticPropertySlot<JSXPathResultPrototype, JSObject>(exec, &JSXPathResultPrototypeTable, this, propertyName, slot);
       
   170 }
       
   171 
       
   172 bool JSXPathResultPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   173 {
       
   174     return getStaticPropertyDescriptor<JSXPathResultPrototype, JSObject>(exec, &JSXPathResultPrototypeTable, this, propertyName, descriptor);
       
   175 }
       
   176 
       
   177 const ClassInfo JSXPathResult::s_info = { "XPathResult", 0, &JSXPathResultTable, 0 };
       
   178 
       
   179 JSXPathResult::JSXPathResult(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<XPathResult> impl)
       
   180     : DOMObjectWithGlobalPointer(structure, globalObject)
       
   181     , m_impl(impl)
       
   182 {
       
   183 }
       
   184 
       
   185 JSXPathResult::~JSXPathResult()
       
   186 {
       
   187     forgetDOMObject(this, impl());
       
   188 }
       
   189 
       
   190 JSObject* JSXPathResult::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   191 {
       
   192     return new (exec) JSXPathResultPrototype(globalObject, JSXPathResultPrototype::createStructure(globalObject->objectPrototype()));
       
   193 }
       
   194 
       
   195 bool JSXPathResult::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   196 {
       
   197     return getStaticValueSlot<JSXPathResult, Base>(exec, &JSXPathResultTable, this, propertyName, slot);
       
   198 }
       
   199 
       
   200 bool JSXPathResult::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   201 {
       
   202     return getStaticValueDescriptor<JSXPathResult, Base>(exec, &JSXPathResultTable, this, propertyName, descriptor);
       
   203 }
       
   204 
       
   205 JSValue jsXPathResultResultType(ExecState* exec, JSValue slotBase, const Identifier&)
       
   206 {
       
   207     JSXPathResult* castedThis = static_cast<JSXPathResult*>(asObject(slotBase));
       
   208     UNUSED_PARAM(exec);
       
   209     XPathResult* imp = static_cast<XPathResult*>(castedThis->impl());
       
   210     JSValue result = jsNumber(exec, imp->resultType());
       
   211     return result;
       
   212 }
       
   213 
       
   214 JSValue jsXPathResultNumberValue(ExecState* exec, JSValue slotBase, const Identifier&)
       
   215 {
       
   216     JSXPathResult* castedThis = static_cast<JSXPathResult*>(asObject(slotBase));
       
   217     ExceptionCode ec = 0;
       
   218     XPathResult* imp = static_cast<XPathResult*>(castedThis->impl());
       
   219     JSC::JSValue result = jsNumber(exec, imp->numberValue(ec));
       
   220     setDOMException(exec, ec);
       
   221     return result;
       
   222 }
       
   223 
       
   224 JSValue jsXPathResultStringValue(ExecState* exec, JSValue slotBase, const Identifier&)
       
   225 {
       
   226     JSXPathResult* castedThis = static_cast<JSXPathResult*>(asObject(slotBase));
       
   227     ExceptionCode ec = 0;
       
   228     XPathResult* imp = static_cast<XPathResult*>(castedThis->impl());
       
   229     JSC::JSValue result = jsString(exec, imp->stringValue(ec));
       
   230     setDOMException(exec, ec);
       
   231     return result;
       
   232 }
       
   233 
       
   234 JSValue jsXPathResultBooleanValue(ExecState* exec, JSValue slotBase, const Identifier&)
       
   235 {
       
   236     JSXPathResult* castedThis = static_cast<JSXPathResult*>(asObject(slotBase));
       
   237     ExceptionCode ec = 0;
       
   238     XPathResult* imp = static_cast<XPathResult*>(castedThis->impl());
       
   239     JSC::JSValue result = jsBoolean(imp->booleanValue(ec));
       
   240     setDOMException(exec, ec);
       
   241     return result;
       
   242 }
       
   243 
       
   244 JSValue jsXPathResultSingleNodeValue(ExecState* exec, JSValue slotBase, const Identifier&)
       
   245 {
       
   246     JSXPathResult* castedThis = static_cast<JSXPathResult*>(asObject(slotBase));
       
   247     ExceptionCode ec = 0;
       
   248     XPathResult* imp = static_cast<XPathResult*>(castedThis->impl());
       
   249     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->singleNodeValue(ec)));
       
   250     setDOMException(exec, ec);
       
   251     return result;
       
   252 }
       
   253 
       
   254 JSValue jsXPathResultInvalidIteratorState(ExecState* exec, JSValue slotBase, const Identifier&)
       
   255 {
       
   256     JSXPathResult* castedThis = static_cast<JSXPathResult*>(asObject(slotBase));
       
   257     UNUSED_PARAM(exec);
       
   258     XPathResult* imp = static_cast<XPathResult*>(castedThis->impl());
       
   259     JSValue result = jsBoolean(imp->invalidIteratorState());
       
   260     return result;
       
   261 }
       
   262 
       
   263 JSValue jsXPathResultSnapshotLength(ExecState* exec, JSValue slotBase, const Identifier&)
       
   264 {
       
   265     JSXPathResult* castedThis = static_cast<JSXPathResult*>(asObject(slotBase));
       
   266     ExceptionCode ec = 0;
       
   267     XPathResult* imp = static_cast<XPathResult*>(castedThis->impl());
       
   268     JSC::JSValue result = jsNumber(exec, imp->snapshotLength(ec));
       
   269     setDOMException(exec, ec);
       
   270     return result;
       
   271 }
       
   272 
       
   273 JSValue jsXPathResultConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   274 {
       
   275     JSXPathResult* domObject = static_cast<JSXPathResult*>(asObject(slotBase));
       
   276     return JSXPathResult::getConstructor(exec, domObject->globalObject());
       
   277 }
       
   278 JSValue JSXPathResult::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   279 {
       
   280     return getDOMConstructor<JSXPathResultConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   281 }
       
   282 
       
   283 EncodedJSValue JSC_HOST_CALL jsXPathResultPrototypeFunctionIterateNext(ExecState* exec)
       
   284 {
       
   285     JSValue thisValue = exec->hostThisValue();
       
   286     if (!thisValue.inherits(&JSXPathResult::s_info))
       
   287         return throwVMTypeError(exec);
       
   288     JSXPathResult* castedThis = static_cast<JSXPathResult*>(asObject(thisValue));
       
   289     XPathResult* imp = static_cast<XPathResult*>(castedThis->impl());
       
   290     ExceptionCode ec = 0;
       
   291 
       
   292 
       
   293     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->iterateNext(ec)));
       
   294     setDOMException(exec, ec);
       
   295     return JSValue::encode(result);
       
   296 }
       
   297 
       
   298 EncodedJSValue JSC_HOST_CALL jsXPathResultPrototypeFunctionSnapshotItem(ExecState* exec)
       
   299 {
       
   300     JSValue thisValue = exec->hostThisValue();
       
   301     if (!thisValue.inherits(&JSXPathResult::s_info))
       
   302         return throwVMTypeError(exec);
       
   303     JSXPathResult* castedThis = static_cast<JSXPathResult*>(asObject(thisValue));
       
   304     XPathResult* imp = static_cast<XPathResult*>(castedThis->impl());
       
   305     ExceptionCode ec = 0;
       
   306     unsigned index = exec->argument(0).toInt32(exec);
       
   307 
       
   308 
       
   309     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->snapshotItem(index, ec)));
       
   310     setDOMException(exec, ec);
       
   311     return JSValue::encode(result);
       
   312 }
       
   313 
       
   314 // Constant getters
       
   315 
       
   316 JSValue jsXPathResultANY_TYPE(ExecState* exec, JSValue, const Identifier&)
       
   317 {
       
   318     return jsNumber(exec, static_cast<int>(0));
       
   319 }
       
   320 
       
   321 JSValue jsXPathResultNUMBER_TYPE(ExecState* exec, JSValue, const Identifier&)
       
   322 {
       
   323     return jsNumber(exec, static_cast<int>(1));
       
   324 }
       
   325 
       
   326 JSValue jsXPathResultSTRING_TYPE(ExecState* exec, JSValue, const Identifier&)
       
   327 {
       
   328     return jsNumber(exec, static_cast<int>(2));
       
   329 }
       
   330 
       
   331 JSValue jsXPathResultBOOLEAN_TYPE(ExecState* exec, JSValue, const Identifier&)
       
   332 {
       
   333     return jsNumber(exec, static_cast<int>(3));
       
   334 }
       
   335 
       
   336 JSValue jsXPathResultUNORDERED_NODE_ITERATOR_TYPE(ExecState* exec, JSValue, const Identifier&)
       
   337 {
       
   338     return jsNumber(exec, static_cast<int>(4));
       
   339 }
       
   340 
       
   341 JSValue jsXPathResultORDERED_NODE_ITERATOR_TYPE(ExecState* exec, JSValue, const Identifier&)
       
   342 {
       
   343     return jsNumber(exec, static_cast<int>(5));
       
   344 }
       
   345 
       
   346 JSValue jsXPathResultUNORDERED_NODE_SNAPSHOT_TYPE(ExecState* exec, JSValue, const Identifier&)
       
   347 {
       
   348     return jsNumber(exec, static_cast<int>(6));
       
   349 }
       
   350 
       
   351 JSValue jsXPathResultORDERED_NODE_SNAPSHOT_TYPE(ExecState* exec, JSValue, const Identifier&)
       
   352 {
       
   353     return jsNumber(exec, static_cast<int>(7));
       
   354 }
       
   355 
       
   356 JSValue jsXPathResultANY_UNORDERED_NODE_TYPE(ExecState* exec, JSValue, const Identifier&)
       
   357 {
       
   358     return jsNumber(exec, static_cast<int>(8));
       
   359 }
       
   360 
       
   361 JSValue jsXPathResultFIRST_ORDERED_NODE_TYPE(ExecState* exec, JSValue, const Identifier&)
       
   362 {
       
   363     return jsNumber(exec, static_cast<int>(9));
       
   364 }
       
   365 
       
   366 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, XPathResult* object)
       
   367 {
       
   368     return getDOMObjectWrapper<JSXPathResult>(exec, globalObject, object);
       
   369 }
       
   370 XPathResult* toXPathResult(JSC::JSValue value)
       
   371 {
       
   372     return value.inherits(&JSXPathResult::s_info) ? static_cast<JSXPathResult*>(asObject(value))->impl() : 0;
       
   373 }
       
   374 
       
   375 }
       
   376 
       
   377 #endif // ENABLE(XPATH)