void V8HTMLAllCollection::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>& info) { if (info.Length() < 1) return; HTMLAllCollection* impl = V8HTMLAllCollection::toImpl(info.Holder()); Node& ownerNode = impl->ownerNode(); UseCounter::countIfNotPrivateScript(info.GetIsolate(), ownerNode.document(), UseCounter::DocumentAllLegacyCall); if (info.Length() == 1) { v8SetReturnValue(info, getItem(impl, info[0], info)); return; } // If there is a second argument it is the index of the item we want. TOSTRING_VOID(V8StringResource<>, name, info[0]); v8::Local<v8::Uint32> index; if (!info[1]->ToArrayIndex(info.GetIsolate()->GetCurrentContext()).ToLocal(&index)) return; if (Node* node = impl->namedItemWithIndex(name, index->Value())) { v8SetReturnValueFast(info, node, impl); return; } }
void V8HTMLAllCollection::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>& info) { if (info.Length() < 1) return; HTMLAllCollection* imp = V8HTMLAllCollection::toNative(info.Holder()); Node* ownerNode = imp->ownerNode(); ASSERT(ownerNode); UseCounter::count(ownerNode->document(), UseCounter::DocumentAllLegacyCall); if (info.Length() == 1) { v8SetReturnValue(info, getItem(imp, info[0], info)); return; } // If there is a second argument it is the index of the item we want. V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); v8::Local<v8::Uint32> index = info[1]->ToArrayIndex(); if (index.IsEmpty()) return; if (Node* node = imp->namedItemWithIndex(name, index->Uint32Value())) { v8SetReturnValueFast(info, node, imp); return; } }