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

Method DeleteCookie

cpp/iedriver/CookieManager.cpp:207–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207bool CookieManager::DeleteCookie(const std::string& url,
208 const BrowserCookie& cookie) {
209 std::wstring wide_url = StringUtilities::ToWString(url);
210 CComPtr<IUri> uri_pointer;
211 ::CreateUri(wide_url.c_str(), Uri_CREATE_ALLOW_RELATIVE, 0, &uri_pointer);
212
213 CComBSTR host_bstr;
214 uri_pointer->GetHost(&host_bstr);
215 std::wstring wide_domain = host_bstr;
216
217 CComBSTR path_bstr;
218 uri_pointer->GetPath(&path_bstr);
219 std::wstring wide_path = path_bstr;
220
221 std::string domain = StringUtilities::ToString(wide_domain);
222 std::string path = StringUtilities::ToString(wide_path);
223
224 // N.B., We can hard-code the value and expiration time, since
225 // we are deleting the cookie. So the value will be "deleted",
226 // and the expiration time will be 1000 milliseconds after the
227 // zero date (or Thu 1 Jan 1970 00:00:01 GMT).
228 BrowserCookie recursive_cookie = cookie.Copy();
229 recursive_cookie.set_domain(domain);
230 recursive_cookie.set_path(path);
231 recursive_cookie.set_value("deleted");
232 recursive_cookie.set_expiration_time(1000);
233 return this->RecursivelyDeleteCookie(url, recursive_cookie);
234}
235
236bool CookieManager::RecursivelyDeleteCookie(const std::string& url,
237 const BrowserCookie& cookie) {

Callers 2

ExecuteInternalMethod · 0.45
ExecuteInternalMethod · 0.45

Calls 7

GetPathMethod · 0.80
set_domainMethod · 0.80
set_pathMethod · 0.80
set_valueMethod · 0.80
set_expiration_timeMethod · 0.80
CopyMethod · 0.45

Tested by

no test coverage detected