Allow using XMLHTTP ActiveX object with custom scheme handlers

Fix the problem of the access-denied error when using a 'new
window.ActiveXObject("Microsoft.XMLHTTP")' to access URIs from custom
WebView scheme handler of the Internet Explorer WebView.

The solution here is to implement PARSE_SECURITY_URL and
PARSE_SECURITY_DOMAIN in ParseUrl of the IInternetProtocolInfo interface
of the Internet Explorer Control.

The direct implementation of VirtualProtocol::QueryInterface() instead
of using IMPLEMENT_IUNKNOWN_METHODS works, but is not nice. The better
approach would be probably enhancing ADD_RAW_IID to support multiple
inheritance.

Closes #17893.
This commit is contained in:
michael
2020-07-19 14:25:37 +02:00
committed by Vadim Zeitlin
parent 2e51076159
commit 6023925ef6
3 changed files with 188 additions and 2 deletions

View File

@@ -73,7 +73,7 @@ public:
wxDECLARE_NO_COPY_CLASS(wxWebViewIEImpl);
};
class VirtualProtocol : public wxIInternetProtocol
class VirtualProtocol : public wxIInternetProtocol, public wxIInternetProtocolInfo
{
protected:
wxIInternetProtocolSink* m_protocolSink;
@@ -114,6 +114,27 @@ public:
ULARGE_INTEGER* WXUNUSED(plibNewPosition)) wxOVERRIDE
{ return E_FAIL; }
HRESULT STDMETHODCALLTYPE UnlockRequest() wxOVERRIDE { return S_OK; }
//IInternetProtocolInfo
HRESULT STDMETHODCALLTYPE CombineUrl(
LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl,
DWORD dwCombineFlags, LPWSTR pwzResult,
DWORD cchResult, DWORD *pcchResult,
DWORD dwReserved) wxOVERRIDE;
HRESULT STDMETHODCALLTYPE ParseUrl(
LPCWSTR pwzUrl, PARSEACTION ParseAction,
DWORD dwParseFlags, LPWSTR pwzResult,
DWORD cchResult, DWORD *pcchResult,
DWORD dwReserved) wxOVERRIDE;
HRESULT STDMETHODCALLTYPE CompareUrl(
LPCWSTR pwzUrl1,
LPCWSTR pwzUrl2,
DWORD dwCompareFlags) wxOVERRIDE;
HRESULT STDMETHODCALLTYPE QueryInfo(
LPCWSTR pwzUrl, QUERYOPTION OueryOption,
DWORD dwQueryFlags, LPVOID pBuffer,
DWORD cbBuffer, DWORD *pcbBuf,
DWORD dwReserved) wxOVERRIDE;
};
class ClassFactory : public IClassFactory

View File

@@ -136,6 +136,38 @@ public:
DWORD dwReserved) = 0;
};
class wxIInternetProtocolInfo : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE ParseUrl(LPCWSTR pwzUrl,
PARSEACTION ParseAction,
DWORD dwParseFlags,
LPWSTR pwzResult,
DWORD cchResult,
DWORD *pcchResult,
DWORD dwReserved) = 0;
virtual HRESULT STDMETHODCALLTYPE CombineUrl(LPCWSTR pwzBaseUrl,
LPCWSTR pwzRelativeUrl,
DWORD dwCombineFlags,
LPWSTR pwzResult,
DWORD cchResult,
DWORD *pcchResult,
DWORD dwReserved) = 0;
virtual HRESULT STDMETHODCALLTYPE CompareUrl(LPCWSTR pwzUrl1,
LPCWSTR pwzUrl2,
DWORD dwCompareFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE QueryInfo(LPCWSTR pwzUrl,
QUERYOPTION OueryOption,
DWORD dwQueryFlags,
LPVOID pBuffer,
DWORD cbBuffer,
DWORD *pcbBuf,
DWORD dwReserved) = 0;
};
/* end of urlmon.h */
/* mshtmhst.h */