Skip to content

Commit c269a83

Browse files
committed
Fixing passing per-process proxy settings to new windows
Fixes issue #8112.
1 parent 36a412e commit c269a83

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

cpp/iedriver/IECommandExecutor.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,16 @@ LRESULT IECommandExecutor::OnBrowserNewWindow(UINT uMsg,
257257
return 1;
258258
}
259259
BrowserHandle new_window_wrapper(new Browser(browser, NULL, this->m_hWnd));
260-
// TODO: This is a big assumption that this will work. We need a test case
261-
// to validate that it will or won't.
262-
SHANDLE_PTR hwnd;
263-
browser->get_HWND(&hwnd);
264-
this->proxy_manager_->SetProxySettings(reinterpret_cast<HWND>(hwnd));
260+
// It is acceptable to set the proxy settings here, as the newly-created
261+
// browser window has not yet been navigated to any page. Only after the
262+
// interface has been marshaled back across the thread boundary to the
263+
// NewWindow3 event handler will the navigation begin, which ensures that
264+
// even the initial navigation will get captured by the proxy, if one is
265+
// set.
266+
// N.B. DocumentHost::GetBrowserWindowHandle returns the tab window handle
267+
// for IE 7 and above, and the top-level window for IE6. This is the window
268+
// required for setting the proxy settings.
269+
this->proxy_manager_->SetProxySettings(new_window_wrapper->GetBrowserWindowHandle());
265270
this->AddManagedBrowser(new_window_wrapper);
266271
LPSTREAM* stream = reinterpret_cast<LPSTREAM*>(lParam);
267272
HRESULT hr = ::CoMarshalInterThreadInterfaceInStream(IID_IWebBrowser2,

cpp/iedriverserver/CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ available via the project downloads page. Changes in "revision" field indicate
99
private releases checked into the prebuilts directory of the source tree, but
1010
not made generally available on the downloads page.
1111

12+
v2.44.0.4
13+
=========
14+
* Fixed passing per-process proxy settings to new windows. Fixes issue #8112.
15+
1216
v2.44.0.3
1317
=========
1418
* Fixed finding elements by XPath for IE 9 where document mode is less than
0 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
1 KB
Binary file not shown.

0 commit comments

Comments
 (0)