/* 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 "JSLocation.h" #include #include "JSLocationCustom.h" #include "KURL.h" #include "Location.h" #include #include using namespace JSC; namespace WebCore { ASSERT_CLASS_FITS_IN_CELL(JSLocation) /* Hash table */ static const HashTableValue JSLocationTableValues[9] = { { "href", DontDelete, (intptr_t)jsLocationHref, (intptr_t)setJSLocationHref }, { "protocol", DontDelete, (intptr_t)jsLocationProtocol, (intptr_t)setJSLocationProtocol }, { "host", DontDelete, (intptr_t)jsLocationHost, (intptr_t)setJSLocationHost }, { "hostname", DontDelete, (intptr_t)jsLocationHostname, (intptr_t)setJSLocationHostname }, { "port", DontDelete, (intptr_t)jsLocationPort, (intptr_t)setJSLocationPort }, { "pathname", DontDelete, (intptr_t)jsLocationPathname, (intptr_t)setJSLocationPathname }, { "search", DontDelete, (intptr_t)jsLocationSearch, (intptr_t)setJSLocationSearch }, { "hash", DontDelete, (intptr_t)jsLocationHash, (intptr_t)setJSLocationHash }, { 0, 0, 0, 0 } }; static const HashTable JSLocationTable = #if ENABLE(PERFECT_HASH_SIZE) { 63, JSLocationTableValues, 0 }; #else { 19, 15, JSLocationTableValues, 0 }; #endif /* Hash table for prototype */ static const HashTableValue JSLocationPrototypeTableValues[5] = { { "assign", DontDelete|Function, (intptr_t)jsLocationPrototypeFunctionAssign, (intptr_t)1 }, { "replace", DontDelete|Function, (intptr_t)jsLocationPrototypeFunctionReplace, (intptr_t)1 }, { "reload", DontDelete|Function, (intptr_t)jsLocationPrototypeFunctionReload, (intptr_t)0 }, { "toString", DontDelete|DontEnum|Function, (intptr_t)jsLocationPrototypeFunctionToString, (intptr_t)0 }, { 0, 0, 0, 0 } }; static const HashTable JSLocationPrototypeTable = #if ENABLE(PERFECT_HASH_SIZE) { 15, JSLocationPrototypeTableValues, 0 }; #else { 9, 7, JSLocationPrototypeTableValues, 0 }; #endif const ClassInfo JSLocationPrototype::s_info = { "LocationPrototype", 0, &JSLocationPrototypeTable, 0 }; JSObject* JSLocationPrototype::self(ExecState* exec, JSGlobalObject* globalObject) { return getDOMPrototype(exec, globalObject); } bool JSLocationPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticFunctionSlot(exec, &JSLocationPrototypeTable, this, propertyName, slot); } const ClassInfo JSLocation::s_info = { "Location", 0, &JSLocationTable, 0 }; JSLocation::JSLocation(PassRefPtr structure, PassRefPtr impl) : DOMObject(structure) , m_impl(impl) { } JSLocation::~JSLocation() { forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get()); } JSObject* JSLocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { return new (exec) JSLocationPrototype(JSLocationPrototype::createStructure(globalObject->objectPrototype())); } bool JSLocation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { if (customGetOwnPropertySlot(exec, propertyName, slot)) return true; return getStaticValueSlot(exec, &JSLocationTable, this, propertyName, slot); } JSValuePtr jsLocationHref(ExecState* exec, const Identifier&, const PropertySlot& slot) { Location* imp = static_cast(static_cast(asObject(slot.slotBase()))->impl()); return jsString(exec, imp->href()); } JSValuePtr jsLocationProtocol(ExecState* exec, const Identifier&, const PropertySlot& slot) { Location* imp = static_cast(static_cast(asObject(slot.slotBase()))->impl()); return jsString(exec, imp->protocol()); } JSValuePtr jsLocationHost(ExecState* exec, const Identifier&, const PropertySlot& slot) { Location* imp = static_cast(static_cast(asObject(slot.slotBase()))->impl()); return jsString(exec, imp->host()); } JSValuePtr jsLocationHostname(ExecState* exec, const Identifier&, const PropertySlot& slot) { Location* imp = static_cast(static_cast(asObject(slot.slotBase()))->impl()); return jsString(exec, imp->hostname()); } JSValuePtr jsLocationPort(ExecState* exec, const Identifier&, const PropertySlot& slot) { Location* imp = static_cast(static_cast(asObject(slot.slotBase()))->impl()); return jsString(exec, imp->port()); } JSValuePtr jsLocationPathname(ExecState* exec, const Identifier&, const PropertySlot& slot) { Location* imp = static_cast(static_cast(asObject(slot.slotBase()))->impl()); return jsString(exec, imp->pathname()); } JSValuePtr jsLocationSearch(ExecState* exec, const Identifier&, const PropertySlot& slot) { Location* imp = static_cast(static_cast(asObject(slot.slotBase()))->impl()); return jsString(exec, imp->search()); } JSValuePtr jsLocationHash(ExecState* exec, const Identifier&, const PropertySlot& slot) { Location* imp = static_cast(static_cast(asObject(slot.slotBase()))->impl()); return jsString(exec, imp->hash()); } void JSLocation::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot) { if (customPut(exec, propertyName, value, slot)) return; lookupPut(exec, propertyName, value, &JSLocationTable, this, slot); } void setJSLocationHref(ExecState* exec, JSObject* thisObject, JSValuePtr value) { static_cast(thisObject)->setHref(exec, value); } void setJSLocationProtocol(ExecState* exec, JSObject* thisObject, JSValuePtr value) { static_cast(thisObject)->setProtocol(exec, value); } void setJSLocationHost(ExecState* exec, JSObject* thisObject, JSValuePtr value) { static_cast(thisObject)->setHost(exec, value); } void setJSLocationHostname(ExecState* exec, JSObject* thisObject, JSValuePtr value) { static_cast(thisObject)->setHostname(exec, value); } void setJSLocationPort(ExecState* exec, JSObject* thisObject, JSValuePtr value) { static_cast(thisObject)->setPort(exec, value); } void setJSLocationPathname(ExecState* exec, JSObject* thisObject, JSValuePtr value) { static_cast(thisObject)->setPathname(exec, value); } void setJSLocationSearch(ExecState* exec, JSObject* thisObject, JSValuePtr value) { static_cast(thisObject)->setSearch(exec, value); } void setJSLocationHash(ExecState* exec, JSObject* thisObject, JSValuePtr value) { static_cast(thisObject)->setHash(exec, value); } void JSLocation::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) { if (customGetPropertyNames(exec, propertyNames)) return; Base::getPropertyNames(exec, propertyNames); } JSValuePtr jsLocationPrototypeFunctionAssign(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args) { if (!thisValue->isObject(&JSLocation::s_info)) return throwError(exec, TypeError); JSLocation* castedThisObj = static_cast(asObject(thisValue)); return castedThisObj->assign(exec, args); } JSValuePtr jsLocationPrototypeFunctionReplace(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args) { if (!thisValue->isObject(&JSLocation::s_info)) return throwError(exec, TypeError); JSLocation* castedThisObj = static_cast(asObject(thisValue)); return castedThisObj->replace(exec, args); } JSValuePtr jsLocationPrototypeFunctionReload(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args) { if (!thisValue->isObject(&JSLocation::s_info)) return throwError(exec, TypeError); JSLocation* castedThisObj = static_cast(asObject(thisValue)); return castedThisObj->reload(exec, args); } JSValuePtr jsLocationPrototypeFunctionToString(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args) { if (!thisValue->isObject(&JSLocation::s_info)) return throwError(exec, TypeError); JSLocation* castedThisObj = static_cast(asObject(thisValue)); return castedThisObj->toString(exec, args); } JSC::JSValuePtr toJS(JSC::ExecState* exec, Location* object) { return getDOMObjectWrapper(exec, object); } Location* toLocation(JSC::JSValuePtr value) { return value->isObject(&JSLocation::s_info) ? static_cast(asObject(value))->impl() : 0; } }