Bug 505525 again. Third time lucky? r=KaiRo,mcsmurf
--- a/suite/app-config.mk
+++ b/suite/app-config.mk
@@ -33,16 +33,24 @@
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
MOZ_SUITE = 1
DEFINES += -DMOZ_SUITE=1
+# On trunk we need to link the windows shell service into seamonkey.exe
+ifdef BUILD_STATIC_LIBS
+ifndef MOZILLA_1_9_1_BRANCH
+BUILD_STATIC_SHELL = 1
+DEFINES += -DBUILD_STATIC_SHELL=1
+endif
+endif
+
# Make the whole tree rebuild if app-config.mk changes
# Use MOZ_BUILD_APP to make life easy
ifeq (,$(wildcard $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk))
#Fail if normal means of finding app-config.mk does not work
$(error Somehow we got included but we can't find ourselves...)
else
GLOBAL_DEPS += $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk
endif
--- a/suite/build/nsSuiteModule.cpp
+++ b/suite/build/nsSuiteModule.cpp
@@ -45,44 +45,50 @@
#include "nsLocalSearchService.h"
#include "nsIGenericFactory.h"
#include "nsRDFCID.h"
#include "nsBookmarksService.h"
#include "nsFeedSniffer.h"
#if defined(XP_WIN)
#include "nsUrlWidget.h"
+#if !defined(BUILD_STATIC_SHELL)
#include "nsWindowsShellService.h"
#endif
+#endif
/////////////////////////////////////////////////////////////////////////////
#if defined(XP_WIN)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUrlWidget, Init)
+#if !defined(BUILD_STATIC_SHELL)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowsShellService, Init)
+#endif
#endif // Windows
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSuiteDirectoryProvider)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsProfileMigrator)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSeamonkeyProfileMigrator)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsThunderbirdProfileMigrator)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(LocalSearchDataSource, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(InternetSearchDataSource, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsBookmarksService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFeedSniffer)
/////////////////////////////////////////////////////////////////////////////
static const nsModuleComponentInfo components[] = {
#ifdef XP_WIN
{ NS_IURLWIDGET_CLASSNAME, NS_IURLWIDGET_CID,
NS_IURLWIDGET_CONTRACTID, nsUrlWidgetConstructor },
+#if !defined(BUILD_STATIC_SHELL)
{ "SeaMonkey Windows Integration",
NS_SUITEWININTEGRATION_CID,
NS_SUITEWININTEGRATION_CONTRACTID,
nsWindowsShellServiceConstructor },
+#endif
#endif // XP_WIN
{ "nsSuiteDirectoryProvider",
NS_SUITEDIRECTORYPROVIDER_CID,
NS_SUITEDIRECTORYPROVIDER_CONTRACTID,
nsSuiteDirectoryProviderConstructor,
nsSuiteDirectoryProvider::Register,
nsSuiteDirectoryProvider::Unregister },
@@ -139,9 +145,9 @@ static const nsModuleComponentInfo compo
{ "Feed Sniffer",
NS_FEEDSNIFFER_CID,
NS_FEEDSNIFFER_CONTRACTID,
nsFeedSnifferConstructor,
nsFeedSniffer::Register }
};
-NS_IMPL_NSGETMODULE(SuiteModule, components)
+NS_IMPL_NSGETMODULE(nsSuiteModule, components)
--- a/suite/shell/src/Makefile.in
+++ b/suite/shell/src/Makefile.in
@@ -28,16 +28,22 @@ ifeq ($(OS_ARCH),WINNT)
CPPSRCS = nsWindowsShellService.cpp
OS_LIBS += $(call EXPAND_LIBNAME,ole32 version uuid shell32)
EXTRA_COMPONENTS = nsSetDefault.js
endif
ifdef CPPSRCS
LIBRARY_NAME = shellservice_s
+ifdef BUILD_STATIC_SHELL
+MOZILLA_INTERNAL_API = 1
+EXPORT_LIBRARY = 1
+IS_COMPONENT = 1
+MODULE_NAME = nsSuiteShellModule
+endif
endif
ifdef MOZ_MAIL_NEWS
DEFINES += -DMOZ_MAIL_NEWS
endif
include $(topsrcdir)/config/rules.mk
--- a/suite/shell/src/nsWindowsShellService.cpp
+++ b/suite/shell/src/nsWindowsShellService.cpp
@@ -61,16 +61,21 @@
#include "nsIStringBundle.h"
#include "nsIServiceManager.h"
#include "nsServiceManagerUtils.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "nsCOMPtr.h"
#include <mbstring.h>
+#include "nsIGenericFactory.h"
+
+#ifdef MOZILLA_INTERNAL_API
+#define CaseInsensitiveCompare nsCaseInsensitiveStringComparator()
+#endif
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0600
#define INITGUID
#include <shlobj.h>
@@ -87,19 +92,17 @@
#define REG_FAILED(val) \
(val != ERROR_SUCCESS)
NS_IMPL_ISUPPORTS1(nsWindowsShellService, nsIShellService)
static nsresult
OpenKeyForReading(HKEY aKeyRoot, const PRUnichar* aKeyName, HKEY* aKey)
{
- const nsString &flatName = PromiseFlatString(aKeyName);
-
- DWORD res = ::RegOpenKeyExW(aKeyRoot, flatName.get(), 0, KEY_READ, aKey);
+ DWORD res = ::RegOpenKeyExW(aKeyRoot, aKeyName, 0, KEY_READ, aKey);
switch (res) {
case ERROR_SUCCESS:
break;
case ERROR_ACCESS_DENIED:
return NS_ERROR_FILE_ACCESS_DENIED;
case ERROR_FILE_NOT_FOUND:
return NS_ERROR_NOT_AVAILABLE;
}
@@ -818,8 +821,20 @@ nsWindowsShellService::SetDesktopBackgro
(backColor.Length() + 1) * sizeof(PRUnichar));
}
// Close the key we opened.
::RegCloseKey(key);
return NS_OK;
}
+#ifdef BUILD_STATIC_SHELL
+NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowsShellService, Init)
+
+static const nsModuleComponentInfo components[] = {
+ { "SeaMonkey Windows Integration",
+ NS_SUITEWININTEGRATION_CID,
+ NS_SUITEWININTEGRATION_CONTRACTID,
+ nsWindowsShellServiceConstructor },
+};
+
+NS_IMPL_NSGETMODULE(nsSuiteShellModule, components)
+#endif
--- a/suite/shell/src/nsWindowsShellService.h
+++ b/suite/shell/src/nsWindowsShellService.h
@@ -34,17 +34,17 @@
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nscore.h"
#include "nsIShellService.h"
-#include "nsStringAPI.h"
+#include "nsStringGlue.h"
#include <windows.h>
#define NS_SUITEWININTEGRATION_CONTRACTID "@mozilla.org/suite/shell-service;1"
#define NS_SUITEWININTEGRATION_CID \
{0x39b688ec, 0xe308, 0x49e5, {0xbe, 0x6b, 0x28, 0xdc, 0x7f, 0xcd, 0x61, 0x54}}