Bug 496225 - Replace as many instances of MOZ_DISABLE_VISTA_SDK_REQUIREMENTS in comm-central as we can. r=Standard8
authorSiddharth Agarwal <sid.bugzilla@gmail.com>
Fri, 20 Aug 2010 14:28:02 +0530
changeset 6229 9359a13766259faaaef339fe86e751d56ae565f4
parent 6228 574ee823683ffcef19c3defe3daea53413d022f5
child 6230 b22f57815531067a617c951abbf69cd7ff7039a9
push idunknown
push userunknown
push dateunknown
reviewersStandard8
bugs496225
Bug 496225 - Replace as many instances of MOZ_DISABLE_VISTA_SDK_REQUIREMENTS in comm-central as we can. r=Standard8
mail/components/build/Makefile.in
mail/components/build/nsMailComps.cpp
mail/components/search/Makefile.in
mail/components/search/SearchIntegration.js
mail/components/search/WinSearchIntegration.js
mail/components/search/nsMailWinSearchHelper.cpp
mail/components/shell/nsMailWinIntegration.cpp
--- a/mail/components/build/Makefile.in
+++ b/mail/components/build/Makefile.in
@@ -65,36 +65,32 @@ endif
 
 LOCAL_INCLUDES = \
 	-I$(srcdir)/../migration/src \
 	-I$(srcdir)/../shell \
 	-I$(srcdir)/../history \
 	$(NULL)
 
 ifneq (,$(filter windows, $(MOZ_WIDGET_TOOLKIT)))
-ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
 LOCAL_INCLUDES += \
 	-I$(srcdir)/../search \
 	$(NULL)
 endif
-endif
 
 SHARED_LIBRARY_LIBS = \
 	../migration/src/$(LIB_PREFIX)profilemigration_s.$(LIB_SUFFIX) \
 	$(NULL)
 
 ifneq (,$(filter windows cocoa gtk2, $(MOZ_WIDGET_TOOLKIT)))
 SHARED_LIBRARY_LIBS += ../shell/$(LIB_PREFIX)shellservice_s.$(LIB_SUFFIX)
 endif
 
 ifneq (,$(filter windows, $(MOZ_WIDGET_TOOLKIT)))
-ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
 SHARED_LIBRARY_LIBS += ../search/$(LIB_PREFIX)winsearch_s.$(LIB_SUFFIX)
 endif
-endif
 
 ifndef MOZ_PLACES
 SHARED_LIBRARY_LIBS += ../history/$(LIB_PREFIX)mailhistory_s.$(LIB_SUFFIX)
 endif
 
 ifdef MOZILLA_INTERNAL_API
 EXTRA_DSO_LDOPTS += \
 	$(LIBXUL_DIST)/../modules/libreg/src/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
--- a/mail/components/build/nsMailComps.cpp
+++ b/mail/components/build/nsMailComps.cpp
@@ -83,34 +83,34 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsEudoraP
 #include "nsMailGNOMEIntegration.h"
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMailGNOMEIntegration, Init)
 #endif
 #ifdef XP_MACOSX
 #include "nsMailMacIntegration.h"
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMailMacIntegration)
 #endif
 
-#if defined(XP_WIN32) && !defined(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
+#if defined(XP_WIN32) && (MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN)
 #include "nsMailWinSearchHelper.h"
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMailWinSearchHelper, Init)
 #endif
 
 NS_DEFINE_NAMED_CID(NS_THUNDERBIRD_PROFILEIMPORT_CID);
 NS_DEFINE_NAMED_CID(NS_SEAMONKEYPROFILEMIGRATOR_CID);
 #ifndef XP_BEOS
 NS_DEFINE_NAMED_CID(NS_DOGBERTPROFILEMIGRATOR_CID);
 #endif
 
 #ifdef XP_WIN32
 NS_DEFINE_NAMED_CID(NS_OEXPRESSPROFILEMIGRATOR_CID);
 NS_DEFINE_NAMED_CID(NS_OUTLOOKPROFILEMIGRATOR_CID);
 NS_DEFINE_NAMED_CID(NS_MAILWININTEGRATION_CID);
-#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
+#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
 NS_DEFINE_NAMED_CID(NS_MAILWINSEARCHHELPER_CID);
-#endif // !MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
+#endif // MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
 #endif // !XP_WIN32
 
 #if defined (XP_WIN32) || defined (XP_MACOSX)
 NS_DEFINE_NAMED_CID(NS_EUDORAPROFILEMIGRATOR_CID);
 #endif
 
 #ifdef MOZ_WIDGET_GTK2
 NS_DEFINE_NAMED_CID(NS_MAILGNOMEINTEGRATION_CID);
@@ -129,19 +129,19 @@ const mozilla::Module::CIDEntry kMailCID
   { &kNS_SEAMONKEYPROFILEMIGRATOR_CID, false, NULL, nsSeamonkeyProfileMigratorConstructor },
 #if !defined(XP_BEOS)
   { &kNS_DOGBERTPROFILEMIGRATOR_CID, false, NULL, nsDogbertProfileMigratorConstructor },
 #endif
 #ifdef XP_WIN32
   { &kNS_OEXPRESSPROFILEMIGRATOR_CID, false, NULL, nsOEProfileMigratorConstructor },
   { &kNS_OUTLOOKPROFILEMIGRATOR_CID, false, NULL, nsOutlookProfileMigratorConstructor },
   { &kNS_MAILWININTEGRATION_CID, false, NULL, nsWindowsShellServiceConstructor },
-#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
+#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
   { &kNS_MAILWINSEARCHHELPER_CID, false, NULL, nsMailWinSearchHelperConstructor },
-#endif // !MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
+#endif // MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
 #endif // !XP_WIN32
 #if defined (XP_WIN32) || defined (XP_MACOSX)
   { &kNS_EUDORAPROFILEMIGRATOR_CID, false, NULL, nsEudoraProfileMigratorConstructor },
 #endif
 #ifdef MOZ_WIDGET_GTK2
   { &kNS_MAILGNOMEINTEGRATION_CID, false, NULL, nsMailGNOMEIntegrationConstructor },
 #endif
 #ifdef XP_MACOSX
@@ -158,19 +158,19 @@ const mozilla::Module::ContractIDEntry k
   { NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "seamonkey", &kNS_SEAMONKEYPROFILEMIGRATOR_CID },
 #if !defined(XP_BEOS)
   { NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "dogbert", &kNS_DOGBERTPROFILEMIGRATOR_CID },
 #endif
 #ifdef XP_WIN32
   { NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "oexpress", &kNS_OEXPRESSPROFILEMIGRATOR_CID },
   { NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "outlook", &kNS_OUTLOOKPROFILEMIGRATOR_CID },
   { "@mozilla.org/mail/shell-service;1", &kNS_MAILWININTEGRATION_CID },
-#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
+#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
   { "@mozilla.org/mail/windows-search-helper;1", &kNS_MAILWINSEARCHHELPER_CID },
-#endif // !MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
+#endif // MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
 #endif // !XP_WIN32
 #if defined (XP_WIN32) || defined (XP_MACOSX)
   { NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "eudora", &kNS_EUDORAPROFILEMIGRATOR_CID },
 #endif
 #ifdef MOZ_WIDGET_GTK2
   { "@mozilla.org/mail/shell-service;1", &kNS_MAILGNOMEINTEGRATION_CID },
 #endif
 #ifdef XP_MACOSX
--- a/mail/components/search/Makefile.in
+++ b/mail/components/search/Makefile.in
@@ -61,17 +61,16 @@ endif
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 EXTRA_PP_JS_MODULES += \
   SpotlightIntegration.js \
   $(NULL)
 endif
 
 # If on Windows, build Windows Search integration
 ifneq (,$(filter windows, $(MOZ_WIDGET_TOOLKIT)))
-ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
 MODULE = mailwinsearch
 LIBRARY_NAME = winsearch_s
 MODULE_NAME = nsMailWinSearchHelperModule
 ifdef BUILD_STATIC_LIBS
 MOZILLA_INTERNAL_API = 1
 else
 ifneq ($(MOZ_WIDGET_TOOLKIT), gtk2)
 MOZILLA_INTERNAL_API = 1
@@ -87,11 +86,10 @@ DIRS += public
 
 # Windows Search component
 EXTRA_PP_JS_MODULES += \
   WinSearchIntegration.js \
   $(NULL)
 
 FORCE_STATIC_LIB = 1
 endif
-endif
 
 include $(topsrcdir)/config/rules.mk
--- a/mail/components/search/SearchIntegration.js
+++ b/mail/components/search/SearchIntegration.js
@@ -33,23 +33,17 @@
  * 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 ***** */
 
 var EXPORTED_SYMBOLS = ["SearchIntegration"];
 
 #ifdef XP_WIN
-
-#ifdef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
-// Set SearchIntegration to null, as we don't have it
-var SearchIntegration = null;
-#else
 Components.utils.import("resource:///modules/WinSearchIntegration.js");
-#endif
 
 #else
 
 #ifdef XP_MACOSX
 Components.utils.import("resource:///modules/SpotlightIntegration.js");
 
 #else
 // Set SearchIntegration to null, as we don't have it
--- a/mail/components/search/WinSearchIntegration.js
+++ b/mail/components/search/WinSearchIntegration.js
@@ -45,16 +45,21 @@ const CRLF="\r\n";
 
 /**
  * Required to access the 64-bit registry, even though we're probably a 32-bit
  * program
  */
 const ACCESS_WOW64_64KEY = 0x0100;
 
 /**
+ * The contract ID for the helper service.
+ */
+const WINSEARCHHELPER_CONTRACTID = "@mozilla.org/mail/windows-search-helper;1";
+
+/**
  * All the registry keys required for integration
  */
 const gRegKeys =
 [
   // This is the property handler
   {
     root: Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE,
     key: "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\PropertySystem\\PropertyHandlers\\.wdseml",
@@ -107,17 +112,17 @@ let SearchIntegration =
   /// The Windows Search pref base
   _prefBase: "mail.winsearch.",
 
   /// Helper (native) component
   __winSearchHelper: null,
   get _winSearchHelper()
   {
     if (!this.__winSearchHelper)
-      this.__winSearchHelper = Cc["@mozilla.org/mail/windows-search-helper;1"]
+      this.__winSearchHelper = Cc[WINSEARCHHELPER_CONTRACTID]
                                  .getService(Ci.nsIMailWinSearchHelper);
     return this.__winSearchHelper;
   },
 
   /// Whether the folders are already in the crawl scope
   get _foldersInCrawlScope()
   {
     return this._winSearchHelper.foldersInCrawlScope;
@@ -164,16 +169,24 @@ let SearchIntegration =
   _getFolderForSearchPath: function winsearch_get_folder_for_search_path(aDir)
   {
     return MailUtils.getFolderForFileInProfile(aDir);
   },
 
   _init: function winsearch_init()
   {
     this._initLogging();
+    // If the helper service isn't present, we weren't compiled with the needed
+    // support. Mark ourselves null and return
+    if (!(WINSEARCHHELPER_CONTRACTID in Cc))
+    {
+      SearchIntegration = null;
+      return;
+    }
+
     // We're currently only enabled on Vista and above
     let sysInfo = Cc["@mozilla.org/system-info;1"]
                     .getService(Ci.nsIPropertyBag2);
     let windowsVersion = sysInfo.getProperty("version");
     if (parseFloat(windowsVersion) < 6)
     {
       this._log.fatal("Windows version " + windowsVersion + " < 6.0");
       this.osVersionTooLow = true;
--- a/mail/components/search/nsMailWinSearchHelper.cpp
+++ b/mail/components/search/nsMailWinSearchHelper.cpp
@@ -30,16 +30,18 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * 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 ***** */
 
+#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
+
 #include "nsMailWinSearchHelper.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsAutoPtr.h"
 #include "nsMemory.h"
 #include "nsStringGlue.h"
 #include "nsISimpleEnumerator.h"
 
 #ifdef _WIN32_WINNT
@@ -296,8 +298,10 @@ NS_IMETHODIMP nsMailWinSearchHelper::Run
       if (!GetExitCodeProcess(executeInfo.hProcess, &dwRet))
         dwRet = GetLastError();
   }
   else
     return NS_ERROR_ABORT;
 
   return SUCCEEDED(HRESULT_FROM_WIN32(dwRet)) ? NS_OK : NS_ERROR_FAILURE;
 }
+
+#endif // MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
--- a/mail/components/shell/nsMailWinIntegration.cpp
+++ b/mail/components/shell/nsMailWinIntegration.cpp
@@ -313,17 +313,17 @@ nsWindowsShellService::TestForDefault(SE
   }  // for each registry key we want to look at
 
   return isDefault;
 }
 
 PRBool
 nsWindowsShellService::IsDefaultClientVista(PRUint16 aApps, PRBool* aIsDefaultClient)
 {
-#if !defined(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
+#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
   IApplicationAssociationRegistration* pAAR;
 
   HRESULT hr = CoCreateInstance (CLSID_ApplicationAssociationRegistration,
                                  NULL,
                                  CLSCTX_INPROC,
                                  IID_IApplicationAssociationRegistration,
                                  (void**)&pAAR);