diff --git a/configure.in b/configure.in index 601d214e44ad..c1deed16e420 100644 --- a/configure.in +++ b/configure.in @@ -4575,7 +4575,6 @@ case "$target_os" in if test -z "$GNU_CC"; then XPC_IDISPATCH_SUPPORT=1 MOZ_NO_ACTIVEX_SUPPORT= - MOZ_ACTIVEX_SCRIPTING_SUPPORT=1 fi ;; esac @@ -6074,11 +6073,11 @@ MOZ_ARG_DISABLE_BOOL(activex, MOZ_NO_ACTIVEX_SUPPORT= ) AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT) -MOZ_ARG_DISABLE_BOOL(activex-scripting, -[ --disable-activex-scripting - Disable building of ActiveX scripting support (win32)], - MOZ_ACTIVEX_SCRIPTING_SUPPORT=, - MOZ_ACTIVEX_SCRIPTING_SUPPORT=1) +MOZ_ARG_ENABLE_BOOL(activex-scripting, +[ --enable-activex-scripting + Enable building of ActiveX scripting support (win32)], + MOZ_ACTIVEX_SCRIPTING_SUPPORT=1, + MOZ_ACTIVEX_SCRIPTING_SUPPORT=) AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT) if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT"; diff --git a/embedding/browser/Makefile.in b/embedding/browser/Makefile.in index 72130b61e64e..5a9fdfe0bf2b 100644 --- a/embedding/browser/Makefile.in +++ b/embedding/browser/Makefile.in @@ -45,7 +45,7 @@ include $(DEPTH)/config/autoconf.mk DIRS = webBrowser build -ifeq ($(OS_ARCH),WINNT) +ifneq (,$(filter $(OS_ARCH),WINNT WINCE)) ifndef MOZ_NO_ACTIVEX_SUPPORT TOOL_DIRS += activex/src endif diff --git a/embedding/browser/activex/src/common/ControlEventSink.cpp b/embedding/browser/activex/src/common/ControlEventSink.cpp index 33c1eec71d6d..59ef0805dafa 100644 --- a/embedding/browser/activex/src/common/ControlEventSink.cpp +++ b/embedding/browser/activex/src/common/ControlEventSink.cpp @@ -168,7 +168,7 @@ HRESULT CControlEventSink::SubscribeToEvents(IUnknown *pControl) DWORD dwCookie = 0; if (!ccp || FAILED(ccp->FindConnectionPoint(m_EventIID, &cp)) || - FAILED(cp->Advise(this, &m_dwEventCookie))) + FAILED(cp->Advise(this, &dwCookie))) { return E_FAIL; } diff --git a/embedding/browser/activex/src/common/ControlSite.cpp b/embedding/browser/activex/src/common/ControlSite.cpp index 521a56462859..4476e3b5fe0b 100644 --- a/embedding/browser/activex/src/common/ControlSite.cpp +++ b/embedding/browser/activex/src/common/ControlSite.cpp @@ -60,6 +60,7 @@ public: BOOL CDefaultControlSiteSecurityPolicy::ClassImplementsCategory(const CLSID &clsid, const CATID &catid, BOOL &bClassExists) { +#ifndef WINCE bClassExists = FALSE; // Test if there is a CLSID entry. If there isn't then obviously @@ -116,6 +117,8 @@ CDefaultControlSiteSecurityPolicy::ClassImplementsCategory(const CLSID &clsid, c return TRUE; } } +#endif + return FALSE; } @@ -477,14 +480,14 @@ HRESULT CControlSite::Attach(HWND hwndParent, const RECT &rcPos, IUnknown *pInit m_spIOleInPlaceObject = m_spObject; m_spIOleInPlaceObjectWindowless = m_spObject; - m_spIOleInPlaceObject->SetObjectRects(&m_rcObjectPos, &m_rcObjectPos); - // In-place activate the object if (m_bVisibleAtRuntime) { DoVerb(OLEIVERB_INPLACEACTIVATE); } + m_spIOleInPlaceObject->SetObjectRects(&m_rcObjectPos, &m_rcObjectPos); + // For those objects which haven't had their client site set yet, // it's done here. if (!m_bSetClientSiteFirst) @@ -1273,7 +1276,9 @@ HRESULT STDMETHODCALLTYPE CControlSite::TransformCoords(/* [out][in] */ POINTL _ } HDC hdc = ::GetDC(m_hWndParent); +#ifndef WINCE ::SetMapMode(hdc, MM_HIMETRIC); +#endif POINT rgptConvert[2]; rgptConvert[0].x = 0; rgptConvert[0].y = 0; @@ -1282,7 +1287,9 @@ HRESULT STDMETHODCALLTYPE CControlSite::TransformCoords(/* [out][in] */ POINTL _ { rgptConvert[1].x = pPtlHimetric->x; rgptConvert[1].y = pPtlHimetric->y; +#ifndef WINCE ::LPtoDP(hdc, rgptConvert, 2); +#endif if (dwFlags & XFORMCOORDS_SIZE) { pPtfContainer->x = (float)(rgptConvert[1].x - rgptConvert[0].x); @@ -1302,7 +1309,9 @@ HRESULT STDMETHODCALLTYPE CControlSite::TransformCoords(/* [out][in] */ POINTL _ { rgptConvert[1].x = (int)(pPtfContainer->x); rgptConvert[1].y = (int)(pPtfContainer->y); +#ifndef WINCE ::DPtoLP(hdc, rgptConvert, 2); +#endif if (dwFlags & XFORMCOORDS_SIZE) { pPtlHimetric->x = rgptConvert[1].x - rgptConvert[0].x; diff --git a/embedding/browser/activex/src/common/IWebBrowserImpl.h b/embedding/browser/activex/src/common/IWebBrowserImpl.h index a9ca1f9042a8..b3f40bee8f38 100644 --- a/embedding/browser/activex/src/common/IWebBrowserImpl.h +++ b/embedding/browser/activex/src/common/IWebBrowserImpl.h @@ -41,6 +41,9 @@ #include +/* this is all kinds of awesome; SHANDLE_PTR is in some basetsd.h but not others */ +typedef long SHANDLE_PTR; + #include "nsIWebNavigation.h" #include "nsIPrefBranch.h" #include "nsIPrefLocalizedString.h" diff --git a/embedding/browser/activex/src/common/StdAfx.h b/embedding/browser/activex/src/common/StdAfx.h index 68dd21263c3c..3129013af25e 100644 --- a/embedding/browser/activex/src/common/StdAfx.h +++ b/embedding/browser/activex/src/common/StdAfx.h @@ -89,6 +89,30 @@ #pragma conform(forScope, push, atlhack, off) #endif +#ifdef WINCE +/* atlbase.h on WINCE has a bug, in that it tries to use + * GetProcAddress with a wide string, when that is explicitly not + * supported. So we use C++ to overload that here, and implement + * something that works. + */ +#include +static FARPROC GetProcAddressA(HMODULE hMod, wchar_t *procName) { + FARPROC ret = NULL; + int len = wcslen(procName); + char *s = new char[len + 1]; + + for (int i = 0; i < len; i++) { + s[i] = (char) procName[i]; + } + s[len-1] = 0; + + ret = ::GetProcAddress(hMod, s); + delete [] s; + + return ret; +} +#endif + #include //You may derive a class from CComModule and use it if you want to override diff --git a/embedding/browser/activex/src/plugin/LegacyPlugin.cpp b/embedding/browser/activex/src/plugin/LegacyPlugin.cpp index 9ed5896a20e9..9e1062ca2631 100644 --- a/embedding/browser/activex/src/plugin/LegacyPlugin.cpp +++ b/embedding/browser/activex/src/plugin/LegacyPlugin.cpp @@ -443,6 +443,8 @@ WillHandleCLSID(const CLSID &clsid, PluginInstanceData *pData) PRBool classExists = PR_FALSE; nsCOMPtr uri; MozAxPlugin::GetCurrentLocation(pData->pPluginInstance, getter_AddRefs(uri)); + + JSAutoRequest req(cx); MozAxAutoPushJSContext autoContext(cx, uri); dispSupport->IsClassSafeToHost(cx, cid, PR_TRUE, &classExists, &isSafe); if (classExists && !isSafe) @@ -557,7 +559,26 @@ CreateControl(const CLSID &clsid, PluginInstanceData *pData, PropertyList &pl, L PRBool hostSafeControlsOnly; PRBool downloadControlsIfMissing; #if defined(MOZ_ACTIVEX_PLUGIN_XPCONNECT) && defined(XPC_IDISPATCH_SUPPORT) +#ifdef MOZ_FLASH_ACTIVEX_PATCH + GUID flashGUID; + ::CLSIDFromString(_T("{D27CDB6E-AE6D-11CF-96B8-444553540000}"), &flashGUID); + + // HACK: Allow anything but downloading for the wrapped Flash control. + PRUint32 hostingFlags; + if (clsid == flashGUID) + { + hostingFlags = (nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_SAFE_OBJECTS | + nsIActiveXSecurityPolicy::HOSTING_FLAGS_SCRIPT_SAFE_OBJECTS | + nsIActiveXSecurityPolicy::HOSTING_FLAGS_SCRIPT_ALL_OBJECTS | + nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_ALL_OBJECTS); + } + else + { + hostingFlags = MozAxPlugin::PrefGetHostingFlags(); + } +#else PRUint32 hostingFlags = MozAxPlugin::PrefGetHostingFlags(); +#endif if (hostingFlags & nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_SAFE_OBJECTS && !(hostingFlags & nsIActiveXSecurityPolicy::HOSTING_FLAGS_HOST_ALL_OBJECTS)) { @@ -786,7 +807,7 @@ NewControl(const char *pluginType, char szCLSID[kCLSIDLen]; if (strlen(argv[i]) < sizeof(szCLSID)) { - if (strnicmp(argv[i], "CLSID:", 6) == 0) + if (_strnicmp(argv[i], "CLSID:", 6) == 0) { _snprintf(szCLSID, kCLSIDLen - 1, "{%s}", argv[i]+6); } @@ -844,7 +865,7 @@ NewControl(const char *pluginType, else { CComBSTR paramName; - if (strnicmp(argn[i], "PARAM_", 6) == 0) + if (_strnicmp(argn[i], "PARAM_", 6) == 0) { paramName = argn[i] + 6; } @@ -933,6 +954,8 @@ NPError NPP_New(NPMIMEType pluginType, MozAxPlugin::AddRef(); #endif + CoInitializeEx(NULL, COINIT_MULTITHREADED); + NPError rv = NPERR_GENERIC_ERROR; /* if (strcmp(pluginType, MIME_OLEOBJECT1) == 0 || strcmp(pluginType, MIME_OLEOBJECT2) == 0) */ @@ -951,6 +974,7 @@ NPError NPP_New(NPMIMEType pluginType, #ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT MozAxPlugin::Release(); #endif + CoUninitialize(); return rv; } @@ -1014,6 +1038,8 @@ NPP_Destroy(NPP instance, NPSavedData** save) instance->pdata = 0; + CoUninitialize(); + return NPERR_NO_ERROR; } diff --git a/embedding/browser/activex/src/plugin/Makefile.in b/embedding/browser/activex/src/plugin/Makefile.in index 0ba0210e9e7b..603f18cce526 100644 --- a/embedding/browser/activex/src/plugin/Makefile.in +++ b/embedding/browser/activex/src/plugin/Makefile.in @@ -47,7 +47,17 @@ include $(DEPTH)/config/autoconf.mk MODULE = npmozax LIBRARY_NAME = npmozax + +ifdef WINCE +MOZ_FLASH_ACTIVEX_PATCH = 1 +endif + +ifdef MOZ_FLASH_ACTIVEX_PATCH +RESFILE = MozActiveX-flash.res +else RESFILE = MozActiveX.res +endif + DEFFILE = npmozax.def GRE_MODULE = 1 @@ -93,7 +103,7 @@ MOZ_ACTIVEX_PLUGIN_XPCONNECT = 1 # XPConnect support in (Netscape 6.1+/Mozilla) # Uncomment this line to install the plugin & policy -# MOZ_USE_ACTIVEX_PLUGIN = 1 +MOZ_USE_ACTIVEX_PLUGIN = 1 # Settings will also be read from this supplemental file if it exists -include $(srcdir)/plugin.mk @@ -146,6 +156,21 @@ ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT LOCAL_INCLUDES += -I$(XPIDL_GEN_DIR) endif +ifdef WINCE +OS_LIBS += \ + coredll.lib \ + ole32.lib \ + oleaut32.lib \ + uuid.lib \ + ceshell.lib \ + corelibc.lib \ + atls.lib \ + atlce400.lib \ + urlmon.lib \ + libcmt.lib \ + comsuppw.lib \ + $(NULL) +else OS_LIBS += \ comdlg32.lib \ ole32.lib \ @@ -153,6 +178,7 @@ OS_LIBS += \ uuid.lib \ shell32.lib \ $(NULL) +endif ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT DEFINES += -DMOZ_ACTIVEX_PLUGIN_LIVECONNECT -DXPCOM_GLUE @@ -166,6 +192,10 @@ ifdef XPC_IDISPATCH_SUPPORT DEFINES += -DXPC_IDISPATCH_SUPPORT endif +ifdef MOZ_FLASH_ACTIVEX_PATCH +DEFINES += -DMOZ_FLASH_ACTIVEX_PATCH +endif + EXTRA_DSO_LDOPTS = \ $(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ $(MOZ_COMPONENT_LIBS) \ @@ -212,8 +242,8 @@ install-typelib: $(XPIDL_GEN_DIR)/nsIMozAxPlugin.xpt install-securitypolicy: nsAxSecurityPolicy.js $(INSTALL) $< $(DIST)/bin/components -install-prefs: activex.js - $(INSTALL) $< $(DIST)/bin/defaults/pref +install-prefs: activex.js $(FLASHLITE_PREFS_JS) + $(INSTALL) $^ $(DIST)/bin/defaults/pref ifdef MOZ_USE_ACTIVEX_PLUGIN libs:: install-plugin install-prefs diff --git a/embedding/browser/activex/src/plugin/MozActiveX-flash.rc b/embedding/browser/activex/src/plugin/MozActiveX-flash.rc new file mode 100644 index 000000000000..325363582ad4 --- /dev/null +++ b/embedding/browser/activex/src/plugin/MozActiveX-flash.rc @@ -0,0 +1,130 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" +#if OSARCH != WINCE +#include "winresrc.h" +#else +#include +#include +#include +#endif + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,4 + PRODUCTVERSION 1,0,0,4 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "\0" + VALUE "FileDescription", "Shockwave Flash 9.0 r83\0" + VALUE "FileExtents", "*.ocx|*.ocx|*.swf|*.flv\0" + VALUE "FileOpenName", "ActiveX (*.ocx)|ActiveX (*.ocx)|Adobe Flash Movie (*.swf)|Adobe Flash Video (*.flv)\0" + VALUE "FileVersion", "9, 0, 83, 0\0" + VALUE "InternalName", "NPMOZAX\0" + VALUE "LegalCopyright", "Copyright 1999, 2009\0" + VALUE "LegalTrademarks", "\0" + VALUE "MIMEType", "application/x-oleobject|application/oleobject|application/x-shockwave-flash|application/x-shockwave-flash\0" + VALUE "OriginalFilename", "NPMOZAX.DLL\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Shockwave Flash\0" + VALUE "ProductVersion", "9, 0, 83, 0\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // !_MAC + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/embedding/browser/activex/src/plugin/MozActiveX.cpp b/embedding/browser/activex/src/plugin/MozActiveX.cpp index b2d34ca85a3b..e3da4ebd2d78 100644 --- a/embedding/browser/activex/src/plugin/MozActiveX.cpp +++ b/embedding/browser/activex/src/plugin/MozActiveX.cpp @@ -51,8 +51,9 @@ CComModule _Module; BEGIN_OBJECT_MAP(ObjectMap) END_OBJECT_MAP() -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +#if 0 +BOOL WINAPI +DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { if (dwReason == DLL_PROCESS_ATTACH) { @@ -65,3 +66,4 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) } return TRUE; // ok } +#endif diff --git a/embedding/browser/activex/src/plugin/MozActiveX.rc b/embedding/browser/activex/src/plugin/MozActiveX.rc index 825ae9abe70c..e0f562e7de31 100644 --- a/embedding/browser/activex/src/plugin/MozActiveX.rc +++ b/embedding/browser/activex/src/plugin/MozActiveX.rc @@ -59,12 +59,12 @@ BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "Mozilla ActiveX control and plugin module\0" VALUE "FileExtents", "*.ocx|*.ocx\0" - VALUE "FileOpenName", "ActiveX (*.ocx)|ActiveX (*.ocx)\0" + VALUE "FileOpenName", "ActiveX (*.ocx)|ActiveX (*.ocx)|Adobe Flash Movie (*.swf)|Adobe Flash Movie (*.swf)\0" VALUE "FileVersion", "1, 0, 0, 4\0" VALUE "InternalName", "NPMOZAX\0" VALUE "LegalCopyright", "Copyright 1999\0" VALUE "LegalTrademarks", "\0" - VALUE "MIMEType", "application/x-oleobject|application/oleobject\0" + VALUE "MIMEType", "application/x-oleobject|application/oleobject|application/x-shockwave-flash|application/x-shockwave-flash\0" VALUE "OriginalFilename", "NPMOZAX.DLL\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "Mozilla ActiveX control and plugin support\0" diff --git a/embedding/browser/activex/src/plugin/StdAfx.h b/embedding/browser/activex/src/plugin/StdAfx.h index d8169eeeb213..0ab000b196e3 100644 --- a/embedding/browser/activex/src/plugin/StdAfx.h +++ b/embedding/browser/activex/src/plugin/StdAfx.h @@ -65,6 +65,30 @@ #pragma conform(forScope, push, atlhack, off) #endif +#ifdef WINCE +/* atlbase.h on WINCE has a bug, in that it tries to use + * GetProcAddress with a wide string, when that is explicitly not + * supported. So we use C++ to overload that here, and implement + * something that works. + */ +#include +static FARPROC GetProcAddressA(HMODULE hMod, wchar_t *procName) { + FARPROC ret = NULL; + int len = wcslen(procName); + char *s = new char[len + 1]; + + for (int i = 0; i < len; i++) { + s[i] = (char) procName[i]; + } + s[len-1] = 0; + + ret = ::GetProcAddress(hMod, s); + delete [] s; + + return ret; +} +#endif + #include //You may derive a class from CComModule and use it if you want to override //something, but do not change the name of _Module diff --git a/embedding/browser/activex/src/plugin/XPCDocument.cpp b/embedding/browser/activex/src/plugin/XPCDocument.cpp index 60f9c86a6b61..a92022db4bb5 100644 --- a/embedding/browser/activex/src/plugin/XPCDocument.cpp +++ b/embedding/browser/activex/src/plugin/XPCDocument.cpp @@ -57,6 +57,10 @@ // // Neither Visual C++ 6.0 or 7.0 ship with this interface. // +#ifdef WINCE +#define USE_HTIFACE +#endif + #ifdef USE_HTIFACE #include #endif @@ -939,7 +943,27 @@ public: mData(NULL), mUseTarget(NULL) { +#ifdef MOZ_FLASH_ACTIVEX_PATCH + // HACK+TODO: + // + // AddRef()ing here causes leaking the MozAxPlugin's + // PrefObserver() because IEDocument() itself leaks. + // CControlSite::Attach() adds references to this object that + // aren't countered; most likely in the + // DoVerb(OLEIVERB_INPLACEACTIVATE) call. Maybe it results in a + // circular reference but the rest of the problem happens inside + // ATL and COM, so good luck with that. + // + // Sadly, I have no time to debug the original problem + // throughoutly but leaking pref observers visibly causes XUL to + // crash upon exit. XUL tries to release the stale pref observer + // after npmozax.dll has long since been unloaded. Note that a + // callback to IEDocument after unloading npmozax.dll would also + // crash but that doesn't seem to happen after tearing down the + // plugin instance itself. -Simo +#else MozAxPlugin::AddRef(); +#endif } HRESULT Init(PluginInstanceData *pData) @@ -1009,7 +1033,11 @@ public: { mWindow->Release(); } +#ifdef MOZ_FLASH_ACTIVEX_PATCH + // HACK+TODO: See IEDocument::IEDocument() +#else MozAxPlugin::Release(); +#endif } BEGIN_COM_MAP(IEDocument) diff --git a/embedding/browser/activex/src/plugin/XPConnect.cpp b/embedding/browser/activex/src/plugin/XPConnect.cpp index 2b8e0f3d8429..3acea988f1c0 100644 --- a/embedding/browser/activex/src/plugin/XPConnect.cpp +++ b/embedding/browser/activex/src/plugin/XPConnect.cpp @@ -124,6 +124,11 @@ nsScriptablePeer::QueryInterface(const nsIID & aIID, void **aInstancePtr) return (*aInstancePtr) ? NS_OK : NS_NOINTERFACE; } +#ifdef WINCE +typedef _com_ptr_t<_com_IIID > IUnknownPtr; +typedef _com_ptr_t<_com_IIID > IDispatchPtr; +#endif + HRESULT nsScriptablePeer::GetIDispatch(IDispatch **pdisp) { @@ -378,7 +383,7 @@ nsScriptablePeer::ConvertVariants(VARIANT *aIn, nsIVariant **aOut) nsIComponentManager *pManager = nsnull; // A frozen interface, even in 1.0.x typedef nsresult (*Moz1XGetComponentManagerFunc)(nsIComponentManager* *result); Moz1XGetComponentManagerFunc compMgr = (Moz1XGetComponentManagerFunc) - ::GetProcAddress(hlib, "NS_GetComponentManager"); + ::GetProcAddress(hlib, "NS_GetComponentManager"); if (compMgr) { compMgr(&pManager); @@ -991,6 +996,21 @@ CLSID MozAxPlugin::GetCLSIDForType(const char *mimeType) return CLSID_NULL; } +#ifdef MOZ_FLASH_ACTIVEX_PATCH + // If the Flash activex control doesn't advertise the supported + // mimetypes correctly, we map Shockwave Flash manually to the + // appropriate CLSID of the ActiveX control here. + if (!strcmp(mimeType, "application/x-shockwave-flash")) + { + GUID guidValue; + + // The Flash CLSID + ::CLSIDFromString(_T("{D27CDB6E-AE6D-11CF-96B8-444553540000}"), &guidValue); + + return guidValue; + } +#endif + // Read the registry to see if there is a CLSID for an object to be associated with // this MIME type. USES_CONVERSION; diff --git a/js/src/xpconnect/src/XPCDispConvert.cpp b/js/src/xpconnect/src/XPCDispConvert.cpp index ed94fdf95741..87b9464b1e06 100644 --- a/js/src/xpconnect/src/XPCDispConvert.cpp +++ b/js/src/xpconnect/src/XPCDispConvert.cpp @@ -411,8 +411,12 @@ JSBool XPCDispConvert::COMArrayToJSArray(XPCCallContext& ccx, } else // This was maybe a VT_SAFEARRAY { +#ifndef WINCE if(FAILED(SafeArrayGetVartype(src.parray, &vartype))) return JS_FALSE; +#else + return JS_FALSE; +#endif } jsval val = JSVAL_NULL; AUTO_MARK_JSVAL(ccx, &val); diff --git a/js/src/xpconnect/src/nsDispatchSupport.cpp b/js/src/xpconnect/src/nsDispatchSupport.cpp index 4dbecc5bcc41..1c006572614d 100644 --- a/js/src/xpconnect/src/nsDispatchSupport.cpp +++ b/js/src/xpconnect/src/nsDispatchSupport.cpp @@ -64,16 +64,17 @@ ClassIsListed(HKEY hkeyRoot, const TCHAR *szKey, const CLSID &clsid, PRBool &lis do { USES_CONVERSION; TCHAR szCLSID[64]; - const DWORD kBufLength = sizeof(szCLSID) / sizeof(szCLSID[0]); + DWORD kBufLength = sizeof(szCLSID) / sizeof(szCLSID[0]); + DWORD len = kBufLength; memset(szCLSID, 0, sizeof(szCLSID)); - if(::RegEnumKey(keyList, i, szCLSID, kBufLength) != ERROR_SUCCESS) + if(::RegEnumKeyEx(keyList, i, szCLSID, &len, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) { // End of list break; } ++i; listIsEmpty = PR_FALSE; - szCLSID[kBufLength - 1] = TCHAR('\0'); + szCLSID[len - 1] = TCHAR('\0'); CLSID clsidToCompare = GUID_NULL; if(SUCCEEDED(::CLSIDFromString(T2OLE(szCLSID), &clsidToCompare)) && ::IsEqualCLSID(clsid, clsidToCompare)) @@ -113,6 +114,7 @@ ClassExists(const CLSID &clsid) static PRBool ClassImplementsCategory(const CLSID &clsid, const CATID &catid, PRBool &bClassExists) { +#ifndef WINCE bClassExists = ClassExists(clsid); // Non existent classes won't implement any category... if(!bClassExists) @@ -139,6 +141,7 @@ ClassImplementsCategory(const CLSID &clsid, const CATID &catid, PRBool &bClassEx if(::IsEqualCATID(catid, catidNext)) return PR_TRUE; // Match } +#endif return PR_FALSE; } diff --git a/js/src/xpconnect/src/xpcprivate.h b/js/src/xpconnect/src/xpcprivate.h index d5ffb46b984f..7a9638a65048 100644 --- a/js/src/xpconnect/src/xpcprivate.h +++ b/js/src/xpconnect/src/xpcprivate.h @@ -135,6 +135,16 @@ #ifdef XPC_IDISPATCH_SUPPORT // This goop was added because of EXCEPINFO in ThrowCOMError // This include is here, because it needs to occur before the undefines below +#ifdef WINCE +/* atlbase.h on WINCE has a bug, in that it tries to use + * GetProcAddress with a wide string, when that is explicitly not + * supported. So we use C++ to overload that here, and implement + * something that works. + */ +#include +static FARPROC GetProcAddressA(HMODULE hMod, wchar_t *procName); +#endif /* WINCE */ + #include #include "oaidl.h" // Nasty MS defines @@ -4157,6 +4167,27 @@ XPC_SOW_WrapObject(JSContext *cx, JSObject *parent, jsval v, jsval *vp); #ifdef XPC_IDISPATCH_SUPPORT + +#ifdef WINCE +/* defined static near the top here */ +FARPROC GetProcAddressA(HMODULE hMod, wchar_t *procName) { + FARPROC ret = NULL; + int len = wcslen(procName); + char *s = new char[len + 1]; + + for (int i = 0; i < len; i++) { + s[i] = (char) procName[i]; + } + s[len-1] = 0; + + ret = ::GetProcAddress(hMod, s); + delete [] s; + + return ret; +} +#endif /* WINCE */ + + // IDispatch specific classes #include "XPCDispPrivate.h" #endif diff --git a/js/src/xpconnect/src/xpcthrower.cpp b/js/src/xpconnect/src/xpcthrower.cpp index 5c8d25375b30..3ee85b9c5786 100644 --- a/js/src/xpconnect/src/xpcthrower.cpp +++ b/js/src/xpconnect/src/xpcthrower.cpp @@ -352,6 +352,7 @@ XPCThrower::ThrowCOMError(JSContext* cx, unsigned long COMErrorCode, if(!nsXPCException::NameAndFormatForNSResult(rv, nsnull, &format)) format = ""; msg = format; +#ifndef WINCE if(exception) { msg += static_cast @@ -392,7 +393,13 @@ XPCThrower::ThrowCOMError(JSContext* cx, unsigned long COMErrorCode, msg.AppendInt(static_cast(COMErrorCode), 16); } } - + +#else + // No error object, so just report the result + msg += "COM Error Result = "; + msg.AppendInt(static_cast(COMErrorCode), 16); +#endif + XPCThrower::BuildAndThrowException(cx, rv, msg.get()); } diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 4c01a7b7cd86..7271d9d9c6d9 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -266,6 +266,7 @@ endif endif # WINNT ifeq ($(OS_ARCH),WINCE) EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME, aygshell uuid ole32 oleaut32 Ws2 ddraw) +EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME, ceosutil libcmt comsuppw) ifdef WINCE_WINDOWS_MOBILE EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME, cellcore) endif