/*
    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 "JSDocument.h"

#include "Attr.h"
#include "CDATASection.h"
#include "CSSMutableStyleDeclaration.h"
#include "CSSStyleDeclaration.h"
#include "Comment.h"
#include "DOMImplementation.h"
#include "DOMSelection.h"
#include "DOMWindow.h"
#include "Document.h"
#include "DocumentFragment.h"
#include "DocumentType.h"
#include "Element.h"
#include "EntityReference.h"
#include "Event.h"
#include "EventListener.h"
#include "Frame.h"
#include "HTMLCollection.h"
#include "HTMLElement.h"
#include "HTMLHeadElement.h"
#include "JSAttr.h"
#include "JSCDATASection.h"
#include "JSCSSStyleDeclaration.h"
#include "JSCanvasRenderingContext2D.h"
#include "JSComment.h"
#include "JSCustomXPathNSResolver.h"
#include "JSDOMGlobalObject.h"
#include "JSDOMImplementation.h"
#include "JSDOMSelection.h"
#include "JSDOMWindow.h"
#include "JSDocumentFragment.h"
#include "JSDocumentType.h"
#include "JSElement.h"
#include "JSEntityReference.h"
#include "JSEvent.h"
#include "JSEventListener.h"
#include "JSHTMLCollection.h"
#include "JSHTMLElement.h"
#include "JSHTMLHeadElement.h"
#include "JSNode.h"
#include "JSNodeFilter.h"
#include "JSNodeIterator.h"
#include "JSNodeList.h"
#include "JSProcessingInstruction.h"
#include "JSRange.h"
#include "JSStyleSheetList.h"
#include "JSText.h"
#include "JSTreeWalker.h"
#include "JSXPathExpression.h"
#include "JSXPathNSResolver.h"
#include "JSXPathResult.h"
#include "KURL.h"
#include "NameNodeList.h"
#include "Node.h"
#include "NodeFilter.h"
#include "NodeIterator.h"
#include "NodeList.h"
#include "PlatformString.h"
#include "ProcessingInstruction.h"
#include "Range.h"
#include "StyleSheetList.h"
#include "Text.h"
#include "TreeWalker.h"
#include "XPathExpression.h"
#include "XPathNSResolver.h"
#include "XPathResult.h"
#include <runtime/Error.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

ASSERT_CLASS_FITS_IN_CELL(JSDocument);

/* Hash table */

static const HashTableValue JSDocumentTableValues[71] =
{
    { "doctype", DontDelete|ReadOnly, (intptr_t)jsDocumentDoctype, (intptr_t)0 },
    { "implementation", DontDelete|ReadOnly, (intptr_t)jsDocumentImplementation, (intptr_t)0 },
    { "documentElement", DontDelete|ReadOnly, (intptr_t)jsDocumentDocumentElement, (intptr_t)0 },
    { "inputEncoding", DontDelete|ReadOnly, (intptr_t)jsDocumentInputEncoding, (intptr_t)0 },
    { "xmlEncoding", DontDelete|ReadOnly, (intptr_t)jsDocumentXMLEncoding, (intptr_t)0 },
    { "xmlVersion", DontDelete, (intptr_t)jsDocumentXMLVersion, (intptr_t)setJSDocumentXMLVersion },
    { "xmlStandalone", DontDelete, (intptr_t)jsDocumentXMLStandalone, (intptr_t)setJSDocumentXMLStandalone },
    { "documentURI", DontDelete, (intptr_t)jsDocumentDocumentURI, (intptr_t)setJSDocumentDocumentURI },
    { "defaultView", DontDelete|ReadOnly, (intptr_t)jsDocumentDefaultView, (intptr_t)0 },
    { "styleSheets", DontDelete|ReadOnly, (intptr_t)jsDocumentStyleSheets, (intptr_t)0 },
    { "title", DontDelete, (intptr_t)jsDocumentTitle, (intptr_t)setJSDocumentTitle },
    { "referrer", DontDelete|ReadOnly, (intptr_t)jsDocumentReferrer, (intptr_t)0 },
    { "domain", DontDelete, (intptr_t)jsDocumentDomain, (intptr_t)setJSDocumentDomain },
    { "URL", DontDelete|ReadOnly, (intptr_t)jsDocumentURL, (intptr_t)0 },
    { "cookie", DontDelete, (intptr_t)jsDocumentCookie, (intptr_t)setJSDocumentCookie },
    { "body", DontDelete, (intptr_t)jsDocumentBody, (intptr_t)setJSDocumentBody },
    { "head", DontDelete|ReadOnly, (intptr_t)jsDocumentHead, (intptr_t)0 },
    { "images", DontDelete|ReadOnly, (intptr_t)jsDocumentImages, (intptr_t)0 },
    { "applets", DontDelete|ReadOnly, (intptr_t)jsDocumentApplets, (intptr_t)0 },
    { "links", DontDelete|ReadOnly, (intptr_t)jsDocumentLinks, (intptr_t)0 },
    { "forms", DontDelete|ReadOnly, (intptr_t)jsDocumentForms, (intptr_t)0 },
    { "anchors", DontDelete|ReadOnly, (intptr_t)jsDocumentAnchors, (intptr_t)0 },
    { "lastModified", DontDelete|ReadOnly, (intptr_t)jsDocumentLastModified, (intptr_t)0 },
    { "location", DontDelete, (intptr_t)jsDocumentLocation, (intptr_t)setJSDocumentLocation },
    { "charset", DontDelete, (intptr_t)jsDocumentCharset, (intptr_t)setJSDocumentCharset },
    { "defaultCharset", DontDelete|ReadOnly, (intptr_t)jsDocumentDefaultCharset, (intptr_t)0 },
    { "readyState", DontDelete|ReadOnly, (intptr_t)jsDocumentReadyState, (intptr_t)0 },
    { "characterSet", DontDelete|ReadOnly, (intptr_t)jsDocumentCharacterSet, (intptr_t)0 },
    { "preferredStylesheetSet", DontDelete|ReadOnly, (intptr_t)jsDocumentPreferredStylesheetSet, (intptr_t)0 },
    { "selectedStylesheetSet", DontDelete, (intptr_t)jsDocumentSelectedStylesheetSet, (intptr_t)setJSDocumentSelectedStylesheetSet },
    { "onabort", DontDelete|DontEnum, (intptr_t)jsDocumentOnabort, (intptr_t)setJSDocumentOnabort },
    { "onblur", DontDelete|DontEnum, (intptr_t)jsDocumentOnblur, (intptr_t)setJSDocumentOnblur },
    { "onchange", DontDelete|DontEnum, (intptr_t)jsDocumentOnchange, (intptr_t)setJSDocumentOnchange },
    { "onclick", DontDelete|DontEnum, (intptr_t)jsDocumentOnclick, (intptr_t)setJSDocumentOnclick },
    { "oncontextmenu", DontDelete|DontEnum, (intptr_t)jsDocumentOncontextmenu, (intptr_t)setJSDocumentOncontextmenu },
    { "ondblclick", DontDelete|DontEnum, (intptr_t)jsDocumentOndblclick, (intptr_t)setJSDocumentOndblclick },
    { "ondrag", DontDelete|DontEnum, (intptr_t)jsDocumentOndrag, (intptr_t)setJSDocumentOndrag },
    { "ondragend", DontDelete|DontEnum, (intptr_t)jsDocumentOndragend, (intptr_t)setJSDocumentOndragend },
    { "ondragenter", DontDelete|DontEnum, (intptr_t)jsDocumentOndragenter, (intptr_t)setJSDocumentOndragenter },
    { "ondragleave", DontDelete|DontEnum, (intptr_t)jsDocumentOndragleave, (intptr_t)setJSDocumentOndragleave },
    { "ondragover", DontDelete|DontEnum, (intptr_t)jsDocumentOndragover, (intptr_t)setJSDocumentOndragover },
    { "ondragstart", DontDelete|DontEnum, (intptr_t)jsDocumentOndragstart, (intptr_t)setJSDocumentOndragstart },
    { "ondrop", DontDelete|DontEnum, (intptr_t)jsDocumentOndrop, (intptr_t)setJSDocumentOndrop },
    { "onerror", DontDelete|DontEnum, (intptr_t)jsDocumentOnerror, (intptr_t)setJSDocumentOnerror },
    { "onfocus", DontDelete|DontEnum, (intptr_t)jsDocumentOnfocus, (intptr_t)setJSDocumentOnfocus },
    { "oninput", DontDelete|DontEnum, (intptr_t)jsDocumentOninput, (intptr_t)setJSDocumentOninput },
    { "oninvalid", DontDelete|DontEnum, (intptr_t)jsDocumentOninvalid, (intptr_t)setJSDocumentOninvalid },
    { "onkeydown", DontDelete|DontEnum, (intptr_t)jsDocumentOnkeydown, (intptr_t)setJSDocumentOnkeydown },
    { "onkeypress", DontDelete|DontEnum, (intptr_t)jsDocumentOnkeypress, (intptr_t)setJSDocumentOnkeypress },
    { "onkeyup", DontDelete|DontEnum, (intptr_t)jsDocumentOnkeyup, (intptr_t)setJSDocumentOnkeyup },
    { "onload", DontDelete|DontEnum, (intptr_t)jsDocumentOnload, (intptr_t)setJSDocumentOnload },
    { "onmousedown", DontDelete|DontEnum, (intptr_t)jsDocumentOnmousedown, (intptr_t)setJSDocumentOnmousedown },
    { "onmousemove", DontDelete|DontEnum, (intptr_t)jsDocumentOnmousemove, (intptr_t)setJSDocumentOnmousemove },
    { "onmouseout", DontDelete|DontEnum, (intptr_t)jsDocumentOnmouseout, (intptr_t)setJSDocumentOnmouseout },
    { "onmouseover", DontDelete|DontEnum, (intptr_t)jsDocumentOnmouseover, (intptr_t)setJSDocumentOnmouseover },
    { "onmouseup", DontDelete|DontEnum, (intptr_t)jsDocumentOnmouseup, (intptr_t)setJSDocumentOnmouseup },
    { "onmousewheel", DontDelete|DontEnum, (intptr_t)jsDocumentOnmousewheel, (intptr_t)setJSDocumentOnmousewheel },
    { "onscroll", DontDelete|DontEnum, (intptr_t)jsDocumentOnscroll, (intptr_t)setJSDocumentOnscroll },
    { "onselect", DontDelete|DontEnum, (intptr_t)jsDocumentOnselect, (intptr_t)setJSDocumentOnselect },
    { "onsubmit", DontDelete|DontEnum, (intptr_t)jsDocumentOnsubmit, (intptr_t)setJSDocumentOnsubmit },
    { "onbeforecut", DontDelete|DontEnum, (intptr_t)jsDocumentOnbeforecut, (intptr_t)setJSDocumentOnbeforecut },
    { "oncut", DontDelete|DontEnum, (intptr_t)jsDocumentOncut, (intptr_t)setJSDocumentOncut },
    { "onbeforecopy", DontDelete|DontEnum, (intptr_t)jsDocumentOnbeforecopy, (intptr_t)setJSDocumentOnbeforecopy },
    { "oncopy", DontDelete|DontEnum, (intptr_t)jsDocumentOncopy, (intptr_t)setJSDocumentOncopy },
    { "onbeforepaste", DontDelete|DontEnum, (intptr_t)jsDocumentOnbeforepaste, (intptr_t)setJSDocumentOnbeforepaste },
    { "onpaste", DontDelete|DontEnum, (intptr_t)jsDocumentOnpaste, (intptr_t)setJSDocumentOnpaste },
    { "onreset", DontDelete|DontEnum, (intptr_t)jsDocumentOnreset, (intptr_t)setJSDocumentOnreset },
    { "onsearch", DontDelete|DontEnum, (intptr_t)jsDocumentOnsearch, (intptr_t)setJSDocumentOnsearch },
    { "onselectstart", DontDelete|DontEnum, (intptr_t)jsDocumentOnselectstart, (intptr_t)setJSDocumentOnselectstart },
    { "constructor", DontEnum|ReadOnly, (intptr_t)jsDocumentConstructor, (intptr_t)0 },
    { 0, 0, 0, 0 }
};

static JSC_CONST_HASHTABLE HashTable JSDocumentTable =
#if ENABLE(PERFECT_HASH_SIZE)
    { 2047, JSDocumentTableValues, 0 };
#else
    { 260, 255, JSDocumentTableValues, 0 };
#endif

/* Hash table for constructor */

static const HashTableValue JSDocumentConstructorTableValues[1] =
{
    { 0, 0, 0, 0 }
};

static JSC_CONST_HASHTABLE HashTable JSDocumentConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
    { 0, JSDocumentConstructorTableValues, 0 };
#else
    { 1, 0, JSDocumentConstructorTableValues, 0 };
#endif

class JSDocumentConstructor : public DOMConstructorObject {
public:
    JSDocumentConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
        : DOMConstructorObject(JSDocumentConstructor::createStructure(globalObject->objectPrototype()), globalObject)
    {
        putDirect(exec->propertyNames().prototype, JSDocumentPrototype::self(exec, globalObject), None);
    }
    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
    virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
    virtual const ClassInfo* classInfo() const { return &s_info; }
    static const ClassInfo s_info;

    static PassRefPtr<Structure> createStructure(JSValue proto) 
    { 
        return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); 
    }
    
protected:
    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags;
};

const ClassInfo JSDocumentConstructor::s_info = { "DocumentConstructor", 0, &JSDocumentConstructorTable, 0 };

bool JSDocumentConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSDocumentConstructor, DOMObject>(exec, &JSDocumentConstructorTable, this, propertyName, slot);
}

bool JSDocumentConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticValueDescriptor<JSDocumentConstructor, DOMObject>(exec, &JSDocumentConstructorTable, this, propertyName, descriptor);
}

/* Hash table for prototype */

static const HashTableValue JSDocumentPrototypeTableValues[38] =
{
    { "createElement", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateElement, (intptr_t)1 },
    { "createDocumentFragment", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateDocumentFragment, (intptr_t)0 },
    { "createTextNode", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateTextNode, (intptr_t)1 },
    { "createComment", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateComment, (intptr_t)1 },
    { "createCDATASection", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateCDATASection, (intptr_t)1 },
    { "createProcessingInstruction", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateProcessingInstruction, (intptr_t)2 },
    { "createAttribute", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateAttribute, (intptr_t)1 },
    { "createEntityReference", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateEntityReference, (intptr_t)1 },
    { "getElementsByTagName", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionGetElementsByTagName, (intptr_t)1 },
    { "importNode", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionImportNode, (intptr_t)2 },
    { "createElementNS", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateElementNS, (intptr_t)2 },
    { "createAttributeNS", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateAttributeNS, (intptr_t)2 },
    { "getElementsByTagNameNS", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionGetElementsByTagNameNS, (intptr_t)2 },
    { "getElementById", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionGetElementById, (intptr_t)1 },
    { "adoptNode", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionAdoptNode, (intptr_t)1 },
    { "createEvent", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateEvent, (intptr_t)1 },
    { "createRange", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateRange, (intptr_t)0 },
    { "createNodeIterator", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateNodeIterator, (intptr_t)4 },
    { "createTreeWalker", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateTreeWalker, (intptr_t)4 },
    { "getOverrideStyle", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionGetOverrideStyle, (intptr_t)2 },
    { "createExpression", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateExpression, (intptr_t)2 },
    { "createNSResolver", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCreateNSResolver, (intptr_t)1 },
    { "evaluate", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionEvaluate, (intptr_t)5 },
    { "execCommand", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionExecCommand, (intptr_t)3 },
    { "queryCommandEnabled", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionQueryCommandEnabled, (intptr_t)1 },
    { "queryCommandIndeterm", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionQueryCommandIndeterm, (intptr_t)1 },
    { "queryCommandState", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionQueryCommandState, (intptr_t)1 },
    { "queryCommandSupported", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionQueryCommandSupported, (intptr_t)1 },
    { "queryCommandValue", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionQueryCommandValue, (intptr_t)1 },
    { "getElementsByName", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionGetElementsByName, (intptr_t)1 },
    { "elementFromPoint", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionElementFromPoint, (intptr_t)2 },
    { "caretRangeFromPoint", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionCaretRangeFromPoint, (intptr_t)2 },
    { "getSelection", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionGetSelection, (intptr_t)0 },
    { "getCSSCanvasContext", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionGetCSSCanvasContext, (intptr_t)4 },
    { "getElementsByClassName", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionGetElementsByClassName, (intptr_t)1 },
    { "querySelector", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionQuerySelector, (intptr_t)1 },
    { "querySelectorAll", DontDelete|Function, (intptr_t)jsDocumentPrototypeFunctionQuerySelectorAll, (intptr_t)1 },
    { 0, 0, 0, 0 }
};

static JSC_CONST_HASHTABLE HashTable JSDocumentPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
    { 511, JSDocumentPrototypeTableValues, 0 };
#else
    { 135, 127, JSDocumentPrototypeTableValues, 0 };
#endif

const ClassInfo JSDocumentPrototype::s_info = { "DocumentPrototype", 0, &JSDocumentPrototypeTable, 0 };

JSObject* JSDocumentPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMPrototype<JSDocument>(exec, globalObject);
}

bool JSDocumentPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticFunctionSlot<JSObject>(exec, &JSDocumentPrototypeTable, this, propertyName, slot);
}

bool JSDocumentPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticFunctionDescriptor<JSObject>(exec, &JSDocumentPrototypeTable, this, propertyName, descriptor);
}

const ClassInfo JSDocument::s_info = { "Document", &JSNode::s_info, &JSDocumentTable, 0 };

JSDocument::JSDocument(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Document> impl)
    : JSNode(structure, globalObject, impl)
{
}

JSDocument::~JSDocument()
{
    forgetDOMObject(*Heap::heap(this)->globalData(), static_cast<Document*>(impl()));
}

JSObject* JSDocument::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
    return new (exec) JSDocumentPrototype(JSDocumentPrototype::createStructure(JSNodePrototype::self(exec, globalObject)));
}

JSValue jsDocumentDoctype(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->doctype()));
}

JSValue jsDocumentImplementation(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->implementation()));
}

JSValue jsDocumentDocumentElement(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->documentElement()));
}

JSValue jsDocumentInputEncoding(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsStringOrNull(exec, imp->inputEncoding());
}

JSValue jsDocumentXMLEncoding(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsStringOrNull(exec, imp->xmlEncoding());
}

JSValue jsDocumentXMLVersion(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsStringOrNull(exec, imp->xmlVersion());
}

JSValue jsDocumentXMLStandalone(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsBoolean(imp->xmlStandalone());
}

JSValue jsDocumentDocumentURI(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsStringOrNull(exec, imp->documentURI());
}

JSValue jsDocumentDefaultView(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->defaultView()));
}

JSValue jsDocumentStyleSheets(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->styleSheets()));
}

JSValue jsDocumentTitle(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsString(exec, imp->title());
}

JSValue jsDocumentReferrer(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsString(exec, imp->referrer());
}

JSValue jsDocumentDomain(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsString(exec, imp->domain());
}

JSValue jsDocumentURL(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsString(exec, imp->url());
}

JSValue jsDocumentCookie(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsString(exec, imp->cookie());
}

JSValue jsDocumentBody(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->body()));
}

JSValue jsDocumentHead(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->head()));
}

JSValue jsDocumentImages(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->images()));
}

JSValue jsDocumentApplets(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->applets()));
}

JSValue jsDocumentLinks(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->links()));
}

JSValue jsDocumentForms(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->forms()));
}

JSValue jsDocumentAnchors(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->anchors()));
}

JSValue jsDocumentLastModified(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsString(exec, imp->lastModified());
}

JSValue jsDocumentLocation(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    return castedThis->location(exec);
}

JSValue jsDocumentCharset(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsStringOrUndefined(exec, imp->charset());
}

JSValue jsDocumentDefaultCharset(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsStringOrUndefined(exec, imp->defaultCharset());
}

JSValue jsDocumentReadyState(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsStringOrUndefined(exec, imp->readyState());
}

JSValue jsDocumentCharacterSet(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsStringOrNull(exec, imp->characterSet());
}

JSValue jsDocumentPreferredStylesheetSet(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsStringOrNull(exec, imp->preferredStylesheetSet());
}

JSValue jsDocumentSelectedStylesheetSet(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    return jsStringOrNull(exec, imp->selectedStylesheetSet());
}

JSValue jsDocumentOnabort(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onabort()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnblur(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onblur()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnchange(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onchange()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnclick(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onclick()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOncontextmenu(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->oncontextmenu()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOndblclick(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->ondblclick()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOndrag(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->ondrag()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOndragend(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->ondragend()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOndragenter(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->ondragenter()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOndragleave(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->ondragleave()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOndragover(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->ondragover()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOndragstart(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->ondragstart()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOndrop(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->ondrop()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnerror(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onerror()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnfocus(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onfocus()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOninput(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->oninput()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOninvalid(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->oninvalid()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnkeydown(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onkeydown()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnkeypress(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onkeypress()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnkeyup(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onkeyup()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnload(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onload()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnmousedown(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onmousedown()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnmousemove(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onmousemove()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnmouseout(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onmouseout()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnmouseover(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onmouseover()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnmouseup(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onmouseup()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnmousewheel(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onmousewheel()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnscroll(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onscroll()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnselect(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onselect()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnsubmit(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onsubmit()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnbeforecut(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onbeforecut()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOncut(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->oncut()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnbeforecopy(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onbeforecopy()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOncopy(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->oncopy()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnbeforepaste(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onbeforepaste()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnpaste(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onpaste()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnreset(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onreset()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnsearch(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onsearch()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentOnselectstart(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* castedThis = static_cast<JSDocument*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(castedThis->impl());
    if (EventListener* listener = imp->onselectstart()) {
        if (JSObject* jsFunction = listener->jsFunction(imp))
            return jsFunction;
    }
    return jsNull();
}

JSValue jsDocumentConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSDocument* domObject = static_cast<JSDocument*>(asObject(slot.slotBase()));
    return JSDocument::getConstructor(exec, domObject->globalObject());
}
void JSDocument::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
{
    lookupPut<JSDocument, Base>(exec, propertyName, value, &JSDocumentTable, this, slot);
}

void setJSDocumentXMLVersion(ExecState* exec, JSObject* thisObject, JSValue value)
{
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    ExceptionCode ec = 0;
    imp->setXMLVersion(valueToStringWithNullCheck(exec, value), ec);
    setDOMException(exec, ec);
}

void setJSDocumentXMLStandalone(ExecState* exec, JSObject* thisObject, JSValue value)
{
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    ExceptionCode ec = 0;
    imp->setXMLStandalone(value.toBoolean(exec), ec);
    setDOMException(exec, ec);
}

void setJSDocumentDocumentURI(ExecState* exec, JSObject* thisObject, JSValue value)
{
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    imp->setDocumentURI(valueToStringWithNullCheck(exec, value));
}

void setJSDocumentTitle(ExecState* exec, JSObject* thisObject, JSValue value)
{
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    imp->setTitle(valueToStringWithNullCheck(exec, value));
}

void setJSDocumentDomain(ExecState* exec, JSObject* thisObject, JSValue value)
{
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    ExceptionCode ec = 0;
    imp->setDomain(valueToStringWithNullCheck(exec, value), ec);
    setDOMException(exec, ec);
}

void setJSDocumentCookie(ExecState* exec, JSObject* thisObject, JSValue value)
{
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    imp->setCookie(valueToStringWithNullCheck(exec, value));
}

void setJSDocumentBody(ExecState* exec, JSObject* thisObject, JSValue value)
{
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    ExceptionCode ec = 0;
    imp->setBody(toHTMLElement(value), ec);
    setDOMException(exec, ec);
}

void setJSDocumentLocation(ExecState* exec, JSObject* thisObject, JSValue value)
{
    static_cast<JSDocument*>(thisObject)->setLocation(exec, value);
}

void setJSDocumentCharset(ExecState* exec, JSObject* thisObject, JSValue value)
{
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    imp->setCharset(valueToStringWithNullCheck(exec, value));
}

void setJSDocumentSelectedStylesheetSet(ExecState* exec, JSObject* thisObject, JSValue value)
{
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    imp->setSelectedStylesheetSet(valueToStringWithNullCheck(exec, value));
}

void setJSDocumentOnabort(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnabort(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnblur(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnblur(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnchange(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnchange(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnclick(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnclick(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOncontextmenu(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOncontextmenu(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOndblclick(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOndblclick(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOndrag(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOndrag(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOndragend(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOndragend(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOndragenter(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOndragenter(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOndragleave(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOndragleave(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOndragover(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOndragover(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOndragstart(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOndragstart(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOndrop(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOndrop(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnerror(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnerror(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnfocus(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnfocus(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOninput(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOninput(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOninvalid(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOninvalid(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnkeydown(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnkeydown(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnkeypress(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnkeypress(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnkeyup(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnkeyup(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnload(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnload(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnmousedown(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnmousedown(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnmousemove(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnmousemove(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnmouseout(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnmouseout(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnmouseover(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnmouseover(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnmouseup(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnmouseup(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnmousewheel(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnmousewheel(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnscroll(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnscroll(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnselect(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnselect(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnsubmit(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnsubmit(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnbeforecut(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnbeforecut(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOncut(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOncut(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnbeforecopy(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnbeforecopy(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOncopy(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOncopy(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnbeforepaste(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnbeforepaste(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnpaste(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnpaste(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnreset(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnreset(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnsearch(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnsearch(globalObject->createJSAttributeEventListener(value));
}

void setJSDocumentOnselectstart(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    Document* imp = static_cast<Document*>(static_cast<JSDocument*>(thisObject)->impl());
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext());
    if (!globalObject)
        return;
    imp->setOnselectstart(globalObject->createJSAttributeEventListener(value));
}

JSValue JSDocument::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMConstructor<JSDocumentConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateElement(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& tagName = valueToStringWithNullCheck(exec, args.at(0));


    JSC::JSValue result = toJSNewlyCreated(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createElement(tagName, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateDocumentFragment(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createDocumentFragment()));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateTextNode(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& data = args.at(0).toString(exec);


    JSC::JSValue result = toJSNewlyCreated(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createTextNode(data)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateComment(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& data = args.at(0).toString(exec);


    JSC::JSValue result = toJSNewlyCreated(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createComment(data)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateCDATASection(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& data = args.at(0).toString(exec);


    JSC::JSValue result = toJSNewlyCreated(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createCDATASection(data, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateProcessingInstruction(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& target = args.at(0).toString(exec);
    const UString& data = args.at(1).toString(exec);


    JSC::JSValue result = toJSNewlyCreated(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createProcessingInstruction(target, data, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateAttribute(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& name = args.at(0).toString(exec);


    JSC::JSValue result = toJSNewlyCreated(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createAttribute(name, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateEntityReference(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& name = args.at(0).toString(exec);


    JSC::JSValue result = toJSNewlyCreated(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createEntityReference(name, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionGetElementsByTagName(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& tagname = args.at(0).toString(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->getElementsByTagName(tagname)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionImportNode(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    Node* importedNode = toNode(args.at(0));
    bool deep = args.at(1).toBoolean(exec);


    JSC::JSValue result = toJSNewlyCreated(exec, castedThisObj->globalObject(), WTF::getPtr(imp->importNode(importedNode, deep, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateElementNS(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& namespaceURI = valueToStringWithNullCheck(exec, args.at(0));
    const UString& qualifiedName = valueToStringWithNullCheck(exec, args.at(1));


    JSC::JSValue result = toJSNewlyCreated(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createElementNS(namespaceURI, qualifiedName, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateAttributeNS(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& namespaceURI = valueToStringWithNullCheck(exec, args.at(0));
    const UString& qualifiedName = valueToStringWithNullCheck(exec, args.at(1));


    JSC::JSValue result = toJSNewlyCreated(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createAttributeNS(namespaceURI, qualifiedName, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionGetElementsByTagNameNS(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& namespaceURI = valueToStringWithNullCheck(exec, args.at(0));
    const UString& localName = args.at(1).toString(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->getElementsByTagNameNS(namespaceURI, localName)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionGetElementById(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& elementId = args.at(0).toString(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->getElementById(elementId)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionAdoptNode(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    Node* source = toNode(args.at(0));


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->adoptNode(source, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateEvent(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& eventType = args.at(0).toString(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createEvent(eventType, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateRange(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createRange()));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateNodeIterator(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    Node* root = toNode(args.at(0));
    unsigned whatToShow = args.at(1).toInt32(exec);
    RefPtr<NodeFilter> filter = toNodeFilter(args.at(2));
    bool expandEntityReferences = args.at(3).toBoolean(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createNodeIterator(root, whatToShow, filter.get(), expandEntityReferences, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateTreeWalker(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    Node* root = toNode(args.at(0));
    unsigned whatToShow = args.at(1).toInt32(exec);
    RefPtr<NodeFilter> filter = toNodeFilter(args.at(2));
    bool expandEntityReferences = args.at(3).toBoolean(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createTreeWalker(root, whatToShow, filter.get(), expandEntityReferences, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionGetOverrideStyle(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    Element* element = toElement(args.at(0));
    const UString& pseudoElement = args.at(1).toString(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->getOverrideStyle(element, pseudoElement)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateExpression(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& expression = args.at(0).toString(exec);
    RefPtr<XPathNSResolver> customResolver;
    XPathNSResolver* resolver = toXPathNSResolver(args.at(1));
    if (!resolver) {
        customResolver = JSCustomXPathNSResolver::create(exec, args.at(1));
        if (exec->hadException())
            return jsUndefined();
        resolver = customResolver.get();
    }


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createExpression(expression, resolver, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCreateNSResolver(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    Node* nodeResolver = toNode(args.at(0));


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createNSResolver(nodeResolver)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionEvaluate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& expression = args.at(0).toString(exec);
    Node* contextNode = toNode(args.at(1));
    RefPtr<XPathNSResolver> customResolver;
    XPathNSResolver* resolver = toXPathNSResolver(args.at(2));
    if (!resolver) {
        customResolver = JSCustomXPathNSResolver::create(exec, args.at(2));
        if (exec->hadException())
            return jsUndefined();
        resolver = customResolver.get();
    }
    unsigned short type = args.at(3).toInt32(exec);
    XPathResult* inResult = toXPathResult(args.at(4));


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->evaluate(expression, contextNode, resolver, type, inResult, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionExecCommand(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& command = args.at(0).toString(exec);
    bool userInterface = args.at(1).toBoolean(exec);
    const UString& value = valueToStringWithUndefinedOrNullCheck(exec, args.at(2));


    JSC::JSValue result = jsBoolean(imp->execCommand(command, userInterface, value));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionQueryCommandEnabled(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& command = args.at(0).toString(exec);


    JSC::JSValue result = jsBoolean(imp->queryCommandEnabled(command));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionQueryCommandIndeterm(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& command = args.at(0).toString(exec);


    JSC::JSValue result = jsBoolean(imp->queryCommandIndeterm(command));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionQueryCommandState(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& command = args.at(0).toString(exec);


    JSC::JSValue result = jsBoolean(imp->queryCommandState(command));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionQueryCommandSupported(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& command = args.at(0).toString(exec);


    JSC::JSValue result = jsBoolean(imp->queryCommandSupported(command));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionQueryCommandValue(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& command = args.at(0).toString(exec);


    JSC::JSValue result = jsStringOrFalse(exec, imp->queryCommandValue(command));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionGetElementsByName(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& elementName = args.at(0).toString(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->getElementsByName(elementName)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionElementFromPoint(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    int x = args.at(0).toInt32(exec);
    int y = args.at(1).toInt32(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->elementFromPoint(x, y)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionCaretRangeFromPoint(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    int x = args.at(0).toInt32(exec);
    int y = args.at(1).toInt32(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->caretRangeFromPoint(x, y)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionGetSelection(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->getSelection()));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionGetCSSCanvasContext(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& contextId = args.at(0).toString(exec);
    const UString& name = args.at(1).toString(exec);
    int width = args.at(2).toInt32(exec);
    int height = args.at(3).toInt32(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->getCSSCanvasContext(contextId, name, width, height)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionGetElementsByClassName(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    const UString& tagname = args.at(0).toString(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->getElementsByClassName(tagname)));
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionQuerySelector(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& selectors = args.at(0).toString(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->querySelector(selectors, ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue JSC_HOST_CALL jsDocumentPrototypeFunctionQuerySelectorAll(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSDocument::s_info))
        return throwError(exec, TypeError);
    JSDocument* castedThisObj = static_cast<JSDocument*>(asObject(thisValue));
    Document* imp = static_cast<Document*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    const UString& selectors = args.at(0).toString(exec);


    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->querySelectorAll(selectors, ec)));
    setDOMException(exec, ec);
    return result;
}

Document* toDocument(JSC::JSValue value)
{
    return value.inherits(&JSDocument::s_info) ? static_cast<JSDocument*>(asObject(value))->impl() : 0;
}

}
