MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / HasSelfReferences

Method HasSelfReferences

cpp/iedriver/VariantUtilities.cpp:142–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142bool VariantUtilities::HasSelfReferences(VARIANT current_object,
143 std::vector<IDispatch*>* visited) {
144 int status_code = WD_SUCCESS;
145 bool has_self_references = false;
146 if (VariantIsArray(current_object) || VariantIsObject(current_object)) {
147 std::vector<std::wstring> property_names;
148 if (VariantIsArray(current_object)) {
149 long length = 0;
150 status_code = GetArrayLength(current_object.pdispVal, &length);
151 for (long index = 0; index < length; ++index) {
152 std::wstring index_string = std::to_wstring(static_cast<long long>(index));
153 property_names.push_back(index_string);
154 }
155 } else {
156 status_code = GetPropertyNameList(current_object.pdispVal,
157 &property_names);
158 }
159
160 visited->push_back(current_object.pdispVal);
161 for (size_t i = 0; i < property_names.size(); ++i) {
162 CComVariant property_value;
163 GetVariantObjectPropertyValue(current_object.pdispVal,
164 property_names[i],
165 &property_value);
166 if (VariantIsIDispatch(property_value)) {
167 for (size_t i = 0; i < visited->size(); ++i) {
168 CComPtr<IDispatch> visited_dispatch((*visited)[i]);
169 if (visited_dispatch.IsEqualObject(property_value.pdispVal)) {
170 return true;
171 }
172 }
173 has_self_references = has_self_references || HasSelfReferences(property_value, visited);
174 if (has_self_references) {
175 break;
176 }
177 }
178 }
179 visited->pop_back();
180 }
181 return has_self_references;
182}
183
184int VariantUtilities::ConvertVariantToJsonValue(IElementManager* element_manager,
185 VARIANT variant_value,

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected