diff options
Diffstat (limited to 'o3d/plugin/npapi_host_control')
4 files changed, 20 insertions, 13 deletions
diff --git a/o3d/plugin/npapi_host_control/build.scons b/o3d/plugin/npapi_host_control/build.scons index 74597a6..a53383f 100644 --- a/o3d/plugin/npapi_host_control/build.scons +++ b/o3d/plugin/npapi_host_control/build.scons @@ -44,6 +44,9 @@ env.Append( 'win', '$SCONSTRUCT_DIR/plugin/npapi_host_control/win', ], + LIBS = [ + 'wininet', + ], LINKFLAGS = [ '/DEF:$SCONSTRUCT_DIR/plugin/npapi_host_control/win/npapi_host_control.def' ], diff --git a/o3d/plugin/npapi_host_control/win/np_browser_proxy.cc b/o3d/plugin/npapi_host_control/win/np_browser_proxy.cc index 8d93be9..968e71e 100644 --- a/o3d/plugin/npapi_host_control/win/np_browser_proxy.cc +++ b/o3d/plugin/npapi_host_control/win/np_browser_proxy.cc @@ -50,20 +50,20 @@ namespace { // Helper routine that invokes the host-control stream request function. NPError OpenURL(NPBrowserProxy* browser_proxy, - const char *szURL, - const char *szTarget, - void *pNotifyData) { + const char *url, + const char *target, + void *notify_data) { CHostControl* host_control = browser_proxy->GetHostingControl(); USES_CONVERSION; - HRESULT hr = host_control->OpenUrlStream(A2CW(szURL), pNotifyData); + HRESULT hr = host_control->OpenUrlStream(A2CW(url), notify_data); return SUCCEEDED(hr) ? NPERR_NO_ERROR : NPERR_GENERIC_ERROR; } } // unnamed namespace NPNetscapeFuncs NPBrowserProxy::kNetscapeFunctions = { sizeof(kNetscapeFunctions), - NP_VERSION_MAJOR << 8 | NP_VERSION_MINOR, + NPVERS_HAS_NPOBJECT_ENUM, NPN_GetURL, NPN_PostURL, NPN_RequestRead, diff --git a/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc b/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc index 449e6b7..8fb2ca3 100644 --- a/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc +++ b/o3d/plugin/npapi_host_control/win/np_plugin_proxy.cc @@ -279,13 +279,7 @@ bool NPPluginProxy::Init(NPBrowserProxy* browser_proxy, } ATLASSERT(np_object); - HRESULT hr = NPObjectProxy::CreateInstance(&scriptable_object_); - ATLASSERT(SUCCEEDED(hr)); - - scriptable_object_->SetBrowserProxy(browser_proxy_); - scriptable_object_->SetHostedObject(np_object); - - browser_proxy_->RegisterNPObjectProxy(np_object, scriptable_object_); + scriptable_object_ = browser_proxy_->GetDispatchObject(np_object); NPBrowserProxy::GetBrowserFunctions()->releaseobject(np_object); diff --git a/o3d/plugin/npapi_host_control/win/stream_operation.cc b/o3d/plugin/npapi_host_control/win/stream_operation.cc index 31f1c5c..599c93d 100644 --- a/o3d/plugin/npapi_host_control/win/stream_operation.cc +++ b/o3d/plugin/npapi_host_control/win/stream_operation.cc @@ -38,6 +38,7 @@ * * ***** END LICENSE BLOCK ***** */ +#include <wininet.h> #include "plugin/npapi_host_control/win/stream_operation.h" #include "plugin/npapi_host_control/win/host_control.h" @@ -488,6 +489,16 @@ HRESULT STDMETHODCALLTYPE StreamOperation::OnObjectAvailable(REFIID riid, HRESULT StreamOperation::OpenURL(NPPluginProxy *owning_plugin, const wchar_t *url, void *notify_data) { + // Validate the URL. If the URL is invalid there is no need to create a new + // thread only to have it immediately fail. + HRESULT hr; + URL_COMPONENTS components = { sizeof(URL_COMPONENTS) }; + if (!InternetCrackUrl(url, 0, 0, &components)) + return E_INVALIDARG; + if (components.nScheme == INTERNET_SCHEME_UNKNOWN) { + return E_INVALIDARG; + } + // The StreamOperation instance is created with a ref-count of zero, // so we explicitly attach a CComPtr to the object to boost the count, and // manage the lifetime of the object. @@ -507,7 +518,6 @@ HRESULT StreamOperation::OpenURL(NPPluginProxy *owning_plugin, stream_object->SetOwner(owning_plugin); CString full_path; - HRESULT hr; if (FAILED(hr = ConstructFullURLPath(*stream_object, base_url_moniker, &full_path))) { |