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

Method OpenNewBrowserWindow

cpp/iedriver/IECommandExecutor.cpp:1392–1427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1390}
1391
1392std::string IECommandExecutor::OpenNewBrowserWindow(const std::wstring& url) {
1393 LOG(TRACE) << "Entering IECommandExecutor::OpenNewBrowserWindow";
1394 bool is_protected_mode_url = ::IEIsProtectedModeURL(url.c_str()) == S_OK;
1395 if (url.find(L"about:blank") == 0) {
1396 // Special-case URLs starting with about:blank, so that the new window
1397 // is in the same Protected Mode zone as the current window from which
1398 // it's being opened.
1399 BrowserHandle current_browser;
1400 this->GetCurrentBrowser(&current_browser);
1401 is_protected_mode_url = current_browser->IsProtectedMode();
1402 }
1403 CComPtr<IWebBrowser2> browser = this->factory_->CreateBrowser(is_protected_mode_url);
1404 if (browser == NULL) {
1405 // No browser was created, so we have to bail early.
1406 // Check the log for the HRESULT why.
1407 return "";
1408 }
1409 LOG(DEBUG) << "New browser window was opened.";
1410 BrowserHandle new_window_wrapper(new Browser(browser,
1411 NULL,
1412 this->m_hWnd,
1413 this->is_edge_chromium_));
1414 // It is acceptable to set the proxy settings here, as the newly-created
1415 // browser window has not yet been navigated to any page. Only after the
1416 // interface has been marshaled back across the thread boundary to the
1417 // NewWindow3 event handler will the navigation begin, which ensures that
1418 // even the initial navigation will get captured by the proxy, if one is
1419 // set. Likewise, the cookie manager needs to have its window handle
1420 // properly set to a non-NULL value so that windows messages are routed
1421 // to the correct window.
1422 // N.B. DocumentHost::GetBrowserWindowHandle returns the tab window handle
1423 // for IE 7 and above, and the top-level window for IE6. This is the window
1424 // required for setting the proxy settings.
1425 this->AddManagedBrowser(new_window_wrapper);
1426 return new_window_wrapper->browser_id();
1427}
1428
1429std::string IECommandExecutor::OpenNewBrowserTab(const std::wstring& url) {
1430 LOG(TRACE) << "Entering IECommandExecutor::OpenNewBrowserTab";

Callers 1

Calls 7

GetCurrentBrowserMethod · 0.95
AddManagedBrowserMethod · 0.95
findMethod · 0.80
IsProtectedModeMethod · 0.80
CreateBrowserMethod · 0.80
browser_idMethod · 0.80
LOGClass · 0.50

Tested by

no test coverage detected