EncodedJSValue JSC_HOST_CALL regExpProtoFuncSearch(ExecState* exec) { JSValue thisValue = exec->thisValue(); if (!thisValue.inherits(RegExpObject::info())) return throwVMTypeError(exec); RegExp* regExp = asRegExpObject(thisValue)->regExp(); JSString* string = exec->argument(0).toString(exec); String s = string->value(exec); if (exec->hadException()) return JSValue::encode(jsUndefined()); RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor(); MatchResult result = regExpConstructor->performMatch(exec->vm(), regExp, string, s, 0); return JSValue::encode(result ? jsNumber(result.start) : jsNumber(-1)); }
EncodedJSValue jsDedicatedWorkerGlobalScopeOnmessage(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName) { JSDedicatedWorkerGlobalScope* castedThis = jsDynamicCast<JSDedicatedWorkerGlobalScope*>(JSValue::decode(thisValue)); UNUSED_PARAM(slotBase); if (!castedThis) return throwVMTypeError(exec); UNUSED_PARAM(exec); DedicatedWorkerGlobalScope& impl = castedThis->impl(); if (EventListener* listener = impl.onmessage()) { if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { if (JSObject* jsFunction = jsListener->jsFunction(&impl)) return JSValue::encode(jsFunction); } } return JSValue::encode(jsNull()); }
EncodedJSValue JSC_HOST_CALL jsMediaListPrototypeFunctionDeleteMedium(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSMediaList::s_info)) return throwVMTypeError(exec); JSMediaList* castedThis = static_cast<JSMediaList*>(asObject(thisValue)); MediaList* imp = static_cast<MediaList*>(castedThis->impl()); ExceptionCode ec = 0; const String& oldMedium(ustringToString(exec->argument(0).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); imp->deleteMedium(oldMedium, ec); setDOMException(exec, ec); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsHTMLObjectElementPrototypeFunctionGetSVGDocument(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSHTMLObjectElement::s_info)) return throwVMTypeError(exec); JSHTMLObjectElement* castedThis = static_cast<JSHTMLObjectElement*>(asObject(thisValue)); HTMLObjectElement* imp = static_cast<HTMLObjectElement*>(castedThis->impl()); ExceptionCode ec = 0; if (!checkNodeSecurity(exec, imp->getSVGDocument(ec))) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getSVGDocument(ec))); setDOMException(exec, ec); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsDOMPluginArrayPrototypeFunctionNamedItem(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSDOMPluginArray::s_info)) return throwVMTypeError(exec); JSDOMPluginArray* castedThis = static_cast<JSDOMPluginArray*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMPluginArray::s_info); DOMPluginArray* imp = static_cast<DOMPluginArray*>(castedThis->impl()); const String& name(ustringToString(exec->argument(0).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->namedItem(name))); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionRemoveEventListener(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestEventTarget::s_info)) return throwVMTypeError(exec); JSTestEventTarget* castedThis = static_cast<JSTestEventTarget*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestEventTarget::s_info); TestEventTarget* impl = static_cast<TestEventTarget*>(castedThis->impl()); if (exec->argumentCount() < 2) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsTestCustomNamedGetterPrototypeFunctionAnotherFunction(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestCustomNamedGetter::s_info)) return throwVMTypeError(exec); JSTestCustomNamedGetter* castedThis = jsCast<JSTestCustomNamedGetter*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestCustomNamedGetter::s_info); TestCustomNamedGetter* impl = static_cast<TestCustomNamedGetter*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); const String& str(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl->anotherFunction(str); return JSValue::encode(jsUndefined()); }
void setJSCSSRuleCssText(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue) { JSValue value = JSValue::decode(encodedValue); UNUSED_PARAM(exec); JSCSSRule* castedThis = jsDynamicCast<JSCSSRule*>(JSValue::decode(thisValue)); if (!castedThis) { throwVMTypeError(exec); return; } CSSRule& impl = castedThis->impl(); ExceptionCode ec = 0; const String& nativeValue(valueToStringWithNullCheck(exec, value)); if (exec->hadException()) return; impl.setCssText(nativeValue, ec); setDOMException(exec, ec); }
EncodedJSValue JSC_HOST_CALL jsClientRectListPrototypeFunctionItem(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSClientRectList::s_info)) return throwVMTypeError(exec); JSClientRectList* castedThis = static_cast<JSClientRectList*>(asObject(thisValue)); ClientRectList* imp = static_cast<ClientRectList*>(castedThis->impl()); int index = exec->argument(0).toInt32(exec); if (index < 0) { setDOMException(exec, INDEX_SIZE_ERR); return JSValue::encode(jsUndefined()); } JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->item(index))); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsDOMNamedFlowCollectionPrototypeFunctionItem(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSDOMNamedFlowCollection* castedThis = jsDynamicCast<JSDOMNamedFlowCollection*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMNamedFlowCollection::info()); DOMNamedFlowCollection& impl = castedThis->impl(); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); unsigned index(toUInt32(exec, exec->argument(0), NormalConversion)); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.item(index))); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsNodeIteratorPrototypeFunctionPreviousNode(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSNodeIterator::s_info)) return throwVMTypeError(exec); JSNodeIterator* castedThis = static_cast<JSNodeIterator*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNodeIterator::s_info); NodeIterator* imp = static_cast<NodeIterator*>(castedThis->impl()); ExceptionCode ec = 0; JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->previousNode(exec, ec))); setDOMException(exec, ec); if (exec->hadException()) return JSValue::encode(jsUndefined()); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsAudioBufferSourceNodePrototypeFunctionNoteOff(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSAudioBufferSourceNode::s_info)) return throwVMTypeError(exec); JSAudioBufferSourceNode* castedThis = static_cast<JSAudioBufferSourceNode*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSAudioBufferSourceNode::s_info); AudioBufferSourceNode* imp = static_cast<AudioBufferSourceNode*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); float when(exec->argument(0).toFloat(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); imp->noteOff(when); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionTimeEnd(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSConsole::s_info)) return throwVMTypeError(exec); JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); Console* imp = static_cast<Console*>(castedThis->impl()); RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1)); size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1; RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize)); const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); imp->timeEnd(title, scriptArguments, callStack); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsNamedNodeMapPrototypeFunctionSetNamedItemNS(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSNamedNodeMap::s_info)) return throwVMTypeError(exec); JSNamedNodeMap* castedThis = static_cast<JSNamedNodeMap*>(asObject(thisValue)); NamedNodeMap* imp = static_cast<NamedNodeMap*>(castedThis->impl()); ExceptionCode ec = 0; Node* node(toNode(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->setNamedItemNS(node, ec))); setDOMException(exec, ec); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsSVGDocumentPrototypeFunctionCreateEvent(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSSVGDocument::s_info)) return throwVMTypeError(exec); JSSVGDocument* castedThis = static_cast<JSSVGDocument*>(asObject(thisValue)); SVGDocument* imp = static_cast<SVGDocument*>(castedThis->impl()); ExceptionCode ec = 0; const String& eventType(ustringToString(exec->argument(0).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createEvent(eventType, ec))); setDOMException(exec, ec); return JSValue::encode(result); }
static EncodedJSValue JSC_HOST_CALL constructPromise(ExecState* exec) { VM& vm = exec->vm(); auto scope = DECLARE_THROW_SCOPE(vm); JSGlobalObject* globalObject = exec->jsCallee()->globalObject(); JSValue newTarget = exec->newTarget(); if (newTarget.isUndefined()) return throwVMTypeError(exec, scope); Structure* promiseStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->promiseStructure()); RETURN_IF_EXCEPTION(scope, encodedJSValue()); JSPromise* promise = JSPromise::create(vm, promiseStructure); promise->initialize(exec, globalObject, exec->argument(0)); return JSValue::encode(promise); }
EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionAssert(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSConsole::s_info)) return throwVMTypeError(exec); JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); Console* imp = static_cast<Console*>(castedThis->impl()); RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1)); size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1; RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize)); bool condition(exec->argument(0).toBoolean(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); imp->assertCondition(condition, scriptArguments, callStack); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsHTMLKeygenElementPrototypeFunctionSetCustomValidity(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSHTMLKeygenElement::s_info)) return throwVMTypeError(exec); JSHTMLKeygenElement* castedThis = static_cast<JSHTMLKeygenElement*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHTMLKeygenElement::s_info); HTMLKeygenElement* imp = static_cast<HTMLKeygenElement*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); const String& error(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); imp->setCustomValidity(error); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsFloat64ArrayPrototypeFunctionFoo(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSFloat64Array::s_info)) return throwVMTypeError(exec); JSFloat64Array* castedThis = jsCast<JSFloat64Array*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSFloat64Array::s_info); Float64Array* impl = static_cast<Float64Array*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); Float32Array* array(toFloat32Array(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->foo(array))); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsDOMImplementationPrototypeFunctionCreateDocument(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSDOMImplementation::s_info)) return throwVMTypeError(exec); JSDOMImplementation* castedThis = static_cast<JSDOMImplementation*>(asObject(thisValue)); DOMImplementation* imp = static_cast<DOMImplementation*>(castedThis->impl()); ExceptionCode ec = 0; const String& namespaceURI = valueToStringWithNullCheck(exec, exec->argument(0)); const String& qualifiedName = valueToStringWithNullCheck(exec, exec->argument(1)); DocumentType* doctype = toDocumentType(exec->argument(2)); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createDocument(namespaceURI, qualifiedName, doctype, ec))); setDOMException(exec, ec); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionRemoveProperty(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info)) return throwVMTypeError(exec); JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue)); CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); ExceptionCode ec = 0; const String& propertyName(ustringToString(exec->argument(0).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = jsStringOrNull(exec, imp->removeProperty(propertyName, ec)); setDOMException(exec, ec); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsNodeFilterPrototypeFunctionAcceptNode(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSNodeFilter::s_info)) return throwVMTypeError(exec); JSNodeFilter* castedThis = static_cast<JSNodeFilter*>(asObject(thisValue)); NodeFilter* imp = static_cast<NodeFilter*>(castedThis->impl()); Node* n(toNode(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = jsNumber(imp->acceptNode(exec, n)); if (exec->hadException()) return JSValue::encode(jsUndefined()); return JSValue::encode(result); }
EncodedJSValue jsTestInterfaceSupplementalNode(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName) { JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue)); UNUSED_PARAM(slotBase); if (!castedThis) { if (jsDynamicCast<JSTestInterfacePrototype*>(slotBase)) { ScriptExecutionContext* scriptExecutionContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); scriptExecutionContext->addConsoleMessage(MessageSource::JS, MessageLevel::Error, String("Deprecated attempt to access property 'supplementalNode' on a non-TestInterface object.")); return JSValue::encode(jsUndefined()); } return throwVMTypeError(exec); } UNUSED_PARAM(exec); TestInterface& impl = castedThis->impl(); JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(TestSupplemental::supplementalNode(&impl))); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsXPathResultPrototypeFunctionSnapshotItem(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSXPathResult::s_info)) return throwVMTypeError(exec); JSXPathResult* castedThis = static_cast<JSXPathResult*>(asObject(thisValue)); XPathResult* imp = static_cast<XPathResult*>(castedThis->impl()); ExceptionCode ec = 0; unsigned index(exec->argument(0).toUInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->snapshotItem(index, ec))); setDOMException(exec, ec); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsDOMNamedFlowCollectionPrototypeFunctionNamedItem(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSDOMNamedFlowCollection* castedThis = jsDynamicCast<JSDOMNamedFlowCollection*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSDOMNamedFlowCollection::info()); DOMNamedFlowCollection& impl = castedThis->impl(); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); const String& name(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.namedItem(name))); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsIDBDatabasePrototypeFunctionDispatchEvent(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSIDBDatabase::s_info)) return throwVMTypeError(exec); JSIDBDatabase* castedThis = static_cast<JSIDBDatabase*>(asObject(thisValue)); IDBDatabase* imp = static_cast<IDBDatabase*>(castedThis->impl()); ExceptionCode ec = 0; Event* evt(toEvent(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec)); setDOMException(exec, ec); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsSVGFEMorphologyElementPrototypeFunctionSetRadius(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSSVGFEMorphologyElement* castedThis = jsDynamicCast<JSSVGFEMorphologyElement*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGFEMorphologyElement::info()); SVGFEMorphologyElement& impl = castedThis->impl(); float radiusX(exec->argument(0).toFloat(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); float radiusY(exec->argument(1).toFloat(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl.setRadius(radiusX, radiusY); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&DateInstance::s_info)) return throwVMTypeError(exec); DateInstance* thisDateObj = asDateInstance(thisValue); const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) return JSValue::encode(jsNontrivialString(exec, "Invalid Date")); DateConversionBuffer date; DateConversionBuffer time; formatDateUTCVariant(*gregorianDateTime, date); formatTimeUTC(*gregorianDateTime, time); return JSValue::encode(jsMakeNontrivialString(exec, date, " ", time)); }
EncodedJSValue JSC_HOST_CALL jsSVGFilterElementPrototypeFunctionSetFilterRes(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSSVGFilterElement* castedThis = jsDynamicCast<JSSVGFilterElement*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGFilterElement::info()); SVGFilterElement& impl = castedThis->impl(); unsigned filterResX(toUInt32(exec, exec->argument(0), NormalConversion)); if (exec->hadException()) return JSValue::encode(jsUndefined()); unsigned filterResY(toUInt32(exec, exec->argument(1), NormalConversion)); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl.setFilterRes(filterResX, filterResY); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsDOMTokenListPrototypeFunctionToggle(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSDOMTokenList::s_info)) return throwVMTypeError(exec); JSDOMTokenList* castedThis = static_cast<JSDOMTokenList*>(asObject(thisValue)); DOMTokenList* imp = static_cast<DOMTokenList*>(castedThis->impl()); ExceptionCode ec = 0; const String& token(ustringToString(exec->argument(0).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = jsBoolean(imp->toggle(token, ec)); setDOMException(exec, ec); return JSValue::encode(result); }