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

Method SendGetCookieMessage

cpp/iedriver/CookieManager.cpp:405–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405std::wstring CookieManager::SendGetCookieMessage(const std::wstring& url,
406 const unsigned int message,
407 HookProcessor* hook) {
408 LOG(TRACE) << "Entering CookieManager::SendGetCookieMessage";
409 hook->PushData(url);
410
411 // Since the named pipe server has to wait for the named pipe client
412 // injected into the browser to connect to it before reading the data,
413 // and since SendMessage is synchronous, we need to send the message
414 // from a different thread to avoid a deadlock.
415 CookieSendMessageInfo info;
416 info.window_handle = this->window_handle_;
417 info.message = message;
418 unsigned int thread_id = 0;
419 HANDLE thread_handle = reinterpret_cast<HANDLE>(_beginthreadex(NULL,
420 0,
421 &CookieManager::ThreadProc,
422 reinterpret_cast<void*>(&info),
423 0,
424 &thread_id));
425 if (thread_handle != NULL) {
426 ::CloseHandle(thread_handle);
427 } else {
428 LOGERR(DEBUG) << "Unable to create thread";
429 }
430 std::vector<char> buffer(0);
431 int bytes = hook->PullData(&buffer);
432 std::wstring cookies = reinterpret_cast<const wchar_t*>(&buffer[0]);
433 return cookies;
434}
435
436unsigned int WINAPI CookieManager::ThreadProc(LPVOID lpParameter) {
437 LOG(TRACE) << "Entering CookieManager::ThreadProc";

Callers 1

GetCookiesMethod · 0.95

Calls 3

PushDataMethod · 0.80
PullDataMethod · 0.80
LOGClass · 0.50

Tested by

no test coverage detected