Bug 543976 - Clean up Maemo defines. r=ted
authorDoug Turner <dougt@dougt.org>
Tue, 09 Feb 2010 11:02:11 -0800
changeset 38014 7bd24f6b3faf160b45e276f62ee4e49e8da63b89
parent 38013 bb7f5fa01db7f571ae3adb61b34aa2c63392bddd
child 38015 edbd3823dceb5ddb8cb16722fb98f34d571787e5
push idunknown
push userunknown
push dateunknown
reviewersted
bugs543976
milestone1.9.3a2pre
Bug 543976 - Clean up Maemo defines. r=ted
config/autoconf.mk.in
config/system-headers
configure.in
content/canvas/src/Makefile.in
content/canvas/src/nsGLPbufferEGL.cpp
content/events/src/nsEventStateManager.h
docshell/build/Makefile.in
js/src/config/system-headers
layout/generic/nsObjectFrame.cpp
modules/plugin/base/public/npapi.h
modules/plugin/base/public/nsPluginNativeWindow.h
modules/plugin/base/src/nsNPAPIPlugin.cpp
modules/plugin/base/src/nsNPAPIPluginInstance.cpp
modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp
toolkit/components/downloads/src/nsDownloadManager.cpp
toolkit/library/Makefile.in
toolkit/xre/nsNativeAppSupportUnix.cpp
uriloader/exthandler/Makefile.in
uriloader/exthandler/nsDBusHandlerApp.cpp
uriloader/exthandler/unix/nsGNOMERegistry.cpp
uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
uriloader/exthandler/unix/nsMIMEInfoUnix.h
uriloader/exthandler/unix/nsOSHelperAppService.cpp
widget/src/gtk2/Makefile.in
widget/src/gtk2/mozcontainer.h
widget/src/gtk2/nsFilePicker.cpp
widget/src/gtk2/nsLookAndFeel.cpp
widget/src/gtk2/nsWindow.cpp
xpcom/base/nsMemoryImpl.cpp
xpcom/base/nsSystemInfo.cpp
xpcom/build/Makefile.in
xpcom/io/Makefile.in
xpcom/io/SpecialSystemDirectory.cpp
xpcom/io/nsLocalFileUnix.cpp
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -618,25 +618,19 @@ WINCE_SDK_DIR   = @WINCE_SDK_DIR@
 OGLES_SDK_DIR   = @OGLES_SDK_DIR@
 
 WINCE_WINDOWS_MOBILE = @WINCE_WINDOWS_MOBILE@
 
 HAS_OGLES = @HAS_OGLES@
 
 MOZ_DISTRIBUTION_ID = @MOZ_DISTRIBUTION_ID@
 
-NS_OSSO 	= @NS_OSSO@
-MOZ_PLATFORM_HILDON = @MOZ_PLATFORM_HILDON@
-
-LIBHILDONMIME_CFLAGS	= @LIBHILDONMIME_CFLAGS@
-LIBHILDONMIME_LIBS	= @LIBHILDONMIME_LIBS@
-LIBOSSO_CFLAGS 	= @LIBOSSO_CFLAGS@
-LIBOSSO_LIBS 	= @LIBOSSO_LIBS@
-LIBHILDONFM_CFLAGS	= @LIBHILDONFM_CFLAGS@
-LIBHILDONFM_LIBS	= @LIBHILDONFM_LIBS@
+MOZ_PLATFORM_MAEMO = @MOZ_PLATFORM_MAEMO@
+MOZ_PLATFORM_MAEMO_CFLAGS	= @MOZ_PLATFORM_MAEMO_CFLAGS@
+MOZ_PLATFORM_MAEMO_LIBS 	= @MOZ_PLATFORM_MAEMO_LIBS@
 
 MOZ_ENABLE_LIBCONIC = @MOZ_ENABLE_LIBCONIC@
 LIBCONIC_CFLAGS     = @LIBCONIC_CFLAGS@
 LIBCONIC_LIBS       = @LIBCONIC_LIBS@
 
 MACOS_SDK_DIR	= @MACOS_SDK_DIR@
 NEXT_ROOT	= @NEXT_ROOT@
 GCC_VERSION	= @GCC_VERSION@
--- a/config/system-headers
+++ b/config/system-headers
@@ -1004,22 +1004,20 @@ libsn/sn-monitor.h
 libsn/sn-util.h
 #endif
 #if MOZ_NATIVE_HUNSPELL==1
 hunspell.hxx
 #endif
 #if MOZ_NATIVE_BZ2==1
 bzlib.h
 #endif
-#ifdef MOZ_PLATFORM_HILDON
+#if (MOZ_PLATFORM_MAEMO == 5)
 hildon-uri.h
 hildon-mime.h
 hildon-file-chooser-dialog.h
-#endif
-#ifdef NS_OSSO
 libosso.h
 osso-mem.h
 #endif
 #ifdef MOZ_ENABLE_GIO
 gio/gio.h
 #endif
 #ifdef MOZ_ENABLE_LIBCONIC
 conic/conicconnection.h
--- a/configure.in
+++ b/configure.in
@@ -6403,57 +6403,88 @@ if test "$MOZ_ENABLE_LIBCONIC"; then
     AC_DEFINE(MOZ_ENABLE_LIBCONIC)
 fi
 
 AC_SUBST(MOZ_ENABLE_LIBCONIC)
 AC_SUBST(LIBCONIC_CFLAGS)
 AC_SUBST(LIBCONIC_LIBS)
  
 dnl ========================================================
-dnl = Hildon and OSSO checks
-dnl ========================================================
-PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
-                  MOZ_PLATFORM_HILDON=1,
-                  MOZ_PLATFORM_HILDON=)
-if test $MOZ_PLATFORM_HILDON; then
-   AC_DEFINE(MOZ_PLATFORM_HILDON)
-   X11_COMPOSITED_PLUGINS="yes"
-fi
-AC_SUBST(LIBHILDONMIME_CFLAGS)
-AC_SUBST(LIBHILDONMIME_LIBS)
-
-if test "$X11_COMPOSITED_PLUGINS" = "yes"; then
-    dnl if we have Xcomposite we should also have Xdamage and Xfixes
-    AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
-                     [AC_MSG_ERROR([Couldn't find X11/extentsions/Xdamage.h which is required for composited plugins.])])
-    AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
-                 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
-fi
-AC_SUBST(XCOMPOSITE_LIBS)
-
-PKG_CHECK_MODULES(LIBOSSO,libosso,
-                  NS_OSSO=1,
-                  NS_OSSO=)
-
-if test $NS_OSSO; then
-    if test -z "$MOZ_ENABLE_DBUS"; then
-        AC_MSG_ERROR([DBus is required when building for OSSO])
-    fi
-    AC_DEFINE(NS_OSSO)
-    MOZ_GFX_OPTIMIZE_MOBILE=1
-    MOZ_WEBGL_GLX=
-fi
-AC_SUBST(LIBOSSO_CFLAGS)
-AC_SUBST(LIBOSSO_LIBS)
-
-PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2,
-                  NS_HILDONFM=1,
-                  NS_HILDONFM=)
-AC_SUBST(LIBHILDONFM_CFLAGS)
-AC_SUBST(LIBHILDONFM_LIBS)
+dnl = Maemo checks
+dnl ========================================================
+
+MAEMO_SDK_TARGET_VER=-1
+
+MOZ_ARG_WITH_STRING(maemo-version,
+[  --with-maemo-version=MAEMO_SDK_TARGET_VER
+                        Maemo SDK Version],
+  MAEMO_SDK_TARGET_VER=$withval)
+
+case "$MAEMO_SDK_TARGET_VER" in
+5)
+    MOZ_PLATFORM_MAEMO=5
+    ;;
+
+6)
+    MOZ_PLATFORM_MAEMO=6
+    ;;
+
+-1)
+    dnl We aren't compiling for Maemo, move on.
+    ;;
+*)
+    AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
+    ;;
+esac
+
+if test $MOZ_PLATFORM_MAEMO; then
+   AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
+
+   if test -z "$MOZ_ENABLE_DBUS"; then
+       AC_MSG_ERROR([DBus is required when building for Maemo])
+   fi
+   
+   MOZ_GFX_OPTIMIZE_MOBILE=1
+   MOZ_WEBGL_GLX=
+
+   if test $MOZ_PLATFORM_MAEMO = 5; then
+      dnl if we have Xcomposite we should also have Xdamage and Xfixes
+      AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
+                       [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
+      AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
+                   [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
+
+      AC_SUBST(XCOMPOSITE_LIBS)
+
+      PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
+      MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
+      MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
+      if test -z "$_LIB_FOUND"; then
+         AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
+      fi
+
+
+      PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
+      MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
+      MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
+      if test -z "$_LIB_FOUND"; then
+         AC_MSG_ERROR([LibOSSO is required when building for Maemo])
+      fi
+
+      PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
+      MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
+      MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
+      if test -z "$_LIB_FOUND"; then
+         AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
+      fi
+   fi
+
+   AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
+   AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
+fi
 
 dnl ========================================================
 dnl = faststripe theme
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(faststripe,
 [  --enable-faststripe  Use faststripe theme],
     MOZ_THEME_FASTSTRIPE=1,
     MOZ_THEME_FASTSTRIPE= )
@@ -8013,19 +8044,17 @@ AC_SUBST(RCFLAGS)
 AC_SUBST(WINDRES)
 AC_SUBST(IMPLIB)
 AC_SUBST(FILTER)
 AC_SUBST(BIN_FLAGS)
 AC_SUBST(NS_USE_NATIVE)
 AC_SUBST(MOZ_WIDGET_TOOLKIT)
 AC_SUBST(MOZ_UPDATE_XTERM)
 AC_SUBST(MINIMO)
-AC_SUBST(MOZ_PLATFORM_HILDON)
-AC_SUBST(NS_OSSO)
-AC_SUBST(NS_MAEMO_LOCATION)
+AC_SUBST(MOZ_PLATFORM_MAEMO)
 AC_SUBST(MOZ_AUTH_EXTENSION)
 AC_SUBST(MOZ_MATHML)
 AC_SUBST(MOZ_PERMISSIONS)
 AC_SUBST(MOZ_XTF)
 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
 AC_SUBST(MOZ_PREF_EXTENSIONS)
 AC_SUBST(MOZ_SVG)
 AC_SUBST(MOZ_SMIL)
--- a/content/canvas/src/Makefile.in
+++ b/content/canvas/src/Makefile.in
@@ -54,26 +54,25 @@ CPPSRCS	= \
 	CanvasUtils.cpp \
 	nsCanvasRenderingContext2D.cpp \
 	$(NULL)
 
 # Canvas 3D Pieces
 
 ifdef MOZ_WEBGL
 
-ifeq (1_1,$(MOZ_X11)_$(NS_OSSO))
+ifdef MOZ_X11
+ifdef MOZ_PLATFORM_MAEMO
 WEBGL_PLATFORM = EGL
 DEFINES += -DUSE_GLES2
-endif
-
-ifeq (1_,$(MOZ_X11)_$(NS_OSSO))
+else
 WEBGL_PLATFORM = GLX
 EXTRA_DSO_LIBS += X11
 endif
-
+endif
 
 ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
 ifdef WINCE
 WEBGL_PLATFORM = EGL
 DEFINES += -DUSE_GLES2
 else
 WEBGL_PLATFORM = WGL
 endif
--- a/content/canvas/src/nsGLPbufferEGL.cpp
+++ b/content/canvas/src/nsGLPbufferEGL.cpp
@@ -158,17 +158,17 @@ nsGLPbufferEGL::nsGLPbufferEGL()
 #define GLES2_LIB "/usr/lib/libGLESv2.so"
 #endif
 
 PRBool
 nsGLPbufferEGL::Init(mozilla::WebGLContext *priv)
 {
     mPriv = priv;
 
-#ifdef NS_OSSO
+#ifdef MOZ_PLATFORM_MAEMO
     // Maemo has missing DSO dependencies on their OpenGL libraries;
     // so ensure that the prerequisite libs are loaded in the process
     // before loading GL.  An alternate approach is to use LD_PRELOAD.
 
     // We'll just leak these libs; pvr_um.so seems to have been
     // present on an older OS image, and now pvr2d.so is used.
     PRLibSpec lspec;
     lspec.type = PR_LibSpec_Pathname;
@@ -194,17 +194,17 @@ nsGLPbufferEGL::Init(mozilla::WebGLConte
 
     if (!gEGLWrap.fInitialize(mDisplay, NULL, NULL)) {
         LogMessage("egl init failed");
         return PR_FALSE;
     }
 
     gEGLWrap.fBindAPI (EGL_OPENGL_ES_API);
 
-#if defined(MOZ_X11) && defined(NS_OSSO)
+#if defined(MOZ_X11) && defined(MOZ_PLATFORM_MAEMO)
     EGLint attribs[] = {
         EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
         EGL_SURFACE_TYPE, EGL_PIXMAP_BIT,
         EGL_RED_SIZE, 3,
         EGL_GREEN_SIZE, 3,
         EGL_BLUE_SIZE, 3,
         EGL_ALPHA_SIZE, 3,
         EGL_DEPTH_SIZE, 1,
@@ -472,16 +472,16 @@ nsGLPbufferEGL::SwapBuffers()
     unsigned char *src = mThebesSurface->Data();
     Premultiply(src, len);
 #endif
 }
 
 gfxASurface*
 nsGLPbufferEGL::ThebesSurface()
 {
-#if defined(MOZ_X11) && defined(NS_OSSO)
+#if defined(MOZ_X11) && defined(MOZ_PLATFORM_MAEMO)
     if (getenv("IMAGE"))
         return mThebesSurface;
     return mXlibSurface;
 #elif defined(WINCE)
     return mThebesSurface;
 #endif
 }
--- a/content/events/src/nsEventStateManager.h
+++ b/content/events/src/nsEventStateManager.h
@@ -58,19 +58,19 @@
 class nsIPresShell;
 class nsIDocShell;
 class nsIDocShellTreeNode;
 class nsIDocShellTreeItem;
 class imgIContainer;
 class nsDOMDataTransfer;
 
 // mac uses click-hold context menus, a holdover from 4.x
-// touch screens (like hildon) could use this also, 
+// touch screens (like maemo) could use this also, 
 // perhaps we should move to NS_TOUCHSCREEN
-#if defined(XP_MACOSX) || defined(MOZ_PLATFORM_HILDON)
+#if defined(XP_MACOSX) || defined(MOZ_PLATFORM_MAEMO)
 #define CLICK_HOLD_CONTEXT_MENUS 1
 #endif
 
 
 /*
  * Event listener manager
  */
 
--- a/docshell/build/Makefile.in
+++ b/docshell/build/Makefile.in
@@ -110,11 +110,11 @@ endif
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 EXTRA_DSO_LDOPTS	+= $(TK_LIBS)
 endif
 
 ifdef MOZ_ENABLE_DBUS
  EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS)
 endif
 
-ifdef MOZ_PLATFORM_HILDON
-EXTRA_DSO_LDOPTS += $(LIBHILDONMIME_LIBS)
+ifdef MOZ_PLATFORM_MAEMO
+EXTRA_DSO_LDOPTS += $(MOZ_PLATFORM_MAEMO_LIBS)
 endif
--- a/js/src/config/system-headers
+++ b/js/src/config/system-headers
@@ -1004,22 +1004,20 @@ libsn/sn-monitor.h
 libsn/sn-util.h
 #endif
 #if MOZ_NATIVE_HUNSPELL==1
 hunspell.hxx
 #endif
 #if MOZ_NATIVE_BZ2==1
 bzlib.h
 #endif
-#ifdef MOZ_PLATFORM_HILDON
+#if (MOZ_PLATFORM_MAEMO == 5)
 hildon-uri.h
 hildon-mime.h
 hildon-file-chooser-dialog.h
-#endif
-#ifdef NS_OSSO
 libosso.h
 osso-mem.h
 #endif
 #ifdef MOZ_ENABLE_GIO
 gio/gio.h
 #endif
 #ifdef MOZ_ENABLE_LIBCONIC
 conic/conicconnection.h
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -168,17 +168,17 @@ static NS_DEFINE_CID(kAppShellCID, NS_AP
 #ifdef MOZ_X11
 #include <X11/Xlib.h>
 /* X headers suck */
 enum { XKeyPress = KeyPress };
 #ifdef KeyPress
 #undef KeyPress
 #endif
 
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
 #define MOZ_COMPOSITED_PLUGINS 1
 
 #include "gfxXlibSurface.h"
 
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 #include <X11/extensions/XShm.h>
 #include <sys/ipc.h>
@@ -411,17 +411,17 @@ public:
 #endif
   }
 
   PRBool MatchPluginName(const char *aPluginName)
   {
     return strncmp(GetPluginName(), aPluginName, strlen(aPluginName)) == 0;
   }
 
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
   nsresult SetAbsoluteScreenPosition(nsIDOMElement* element,
                                      nsIDOMClientRect* position,
                                      nsIDOMClientRect* clip);
 #endif
 
 private:
   void FixUpURLS(const nsString &name, nsAString &value);
 
@@ -506,17 +506,17 @@ private:
   private:
     NPWindow* mWindow;
     nsIPluginInstance* mInstance;
     const nsIntSize& mPluginSize;
     const nsIntRect& mDirtyRect;
   };
 #endif
 
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
 
   // On hildon, we attempt to use NPImageExpose which allows us faster
   // painting.
 
   // used to keep track of how big our buffer is.
   nsIntSize mPluginSize;
 
   // The absolute position on the screen to draw to.
@@ -1220,17 +1220,17 @@ nsObjectFrame::ComputeWidgetGeometry(con
   }
 }
 
 nsresult
 nsObjectFrame::SetAbsoluteScreenPosition(nsIDOMElement* element,
                                          nsIDOMClientRect* position,
                                          nsIDOMClientRect* clip)
 {
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
   if (!mInstanceOwner)
     return NS_ERROR_NOT_AVAILABLE;
   return mInstanceOwner->SetAbsoluteScreenPosition(element, position, clip);
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }
 
@@ -2132,17 +2132,17 @@ GetMIMEType(nsIPluginInstance *aPluginIn
   }
   return "";
 }
 #endif
 
 static PRBool
 DoDelayedStop(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
 {
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO==5)
   // Don't delay stop on Maemo/Hildon (bug 530739).
   if (aDelayedStop && aInstanceOwner->MatchPluginName("Shockwave Flash"))
     return PR_FALSE;
 #endif
 
   // Don't delay stopping QuickTime (bug 425157), Flip4Mac (bug 426524),
   // XStandard (bug 430219), CMISS Zinc (bug 429604).
   if (aDelayedStop
@@ -2450,17 +2450,17 @@ nsPluginInstanceOwner::nsPluginInstanceO
   mCachedAttrParamNames = nsnull;
   mCachedAttrParamValues = nsnull;
   mDestroyWidget = PR_FALSE;
 
 #ifdef MOZ_COMPOSITED_PLUGINS
   mLastPoint = nsIntPoint(0,0);
 #endif
 
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
   mPluginSize = nsIntSize(0,0);
   mXlibSurfGC = None;
   mBlitWindow = nsnull;
   mSharedXImage = nsnull;
   mSharedSegmentInfo.shmaddr = nsnull;
 #endif
 
 #ifdef XP_MACOSX
@@ -2520,17 +2520,17 @@ nsPluginInstanceOwner::~nsPluginInstance
     ph->DeletePluginNativeWindow(mPluginWindow);
     mPluginWindow = nsnull;
   }
 
   if (mInstance) {
     mInstance->InvalidateOwner();
   }
 
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
   ReleaseXShm();
 #endif
 }
 
 /*
  * nsISupports Implementation
  */
 
@@ -2732,17 +2732,17 @@ NS_IMETHODIMP nsPluginInstanceOwner::Get
   return NS_OK;
 }
 
 NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect)
 {
   if (!mObjectFrame || !invalidRect || !mWidgetVisible)
     return NS_ERROR_FAILURE;
 
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
   PRBool simpleImageRender = PR_FALSE;
   mInstance->GetValueFromPlugin(NPPVpluginWindowlessLocalBool,
                                 &simpleImageRender);
   if (simpleImageRender) {  
     NativeImageDraw(invalidRect);
     return NS_OK;
   }
 #endif
@@ -4866,17 +4866,17 @@ void nsPluginInstanceOwner::Paint(const 
 #if defined(MOZ_X11) || defined(MOZ_DFB)
 void nsPluginInstanceOwner::Paint(gfxContext* aContext,
                                   const gfxRect& aFrameRect,
                                   const gfxRect& aDirtyRect)
 {
   if (!mInstance || !mObjectFrame)
     return;
 
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
   // through to be able to paint the context passed in.  This allows
   // us to handle plugins that do not self invalidate (slowly, but
   // accurately), and it allows us to reduce flicker.
   PRBool simpleImageRender = PR_FALSE;
   mInstance->GetValueFromPlugin(NPPVpluginWindowlessLocalBool,
                                 &simpleImageRender);
   if (simpleImageRender) {
     gfxMatrix matrix = aContext->CurrentMatrix();
@@ -4955,17 +4955,17 @@ DepthOfVisual(const Screen* screen, cons
     }
   }
 
   NS_ERROR("Visual not on Screen.");
   return 0;
 }
 #endif
 
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
 
 static GdkWindow* GetClosestWindow(nsIDOMElement *element)
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(element);
   nsIFrame* frame = content->GetPrimaryFrame();
   if (!frame)
     return nsnull;
 
@@ -5646,17 +5646,17 @@ NS_IMETHODIMP nsPluginInstanceOwner::Cre
   return rv;
 }
 
 void nsPluginInstanceOwner::SetPluginHost(nsIPluginHost* aHost)
 {
   mPluginHost = aHost;
 }
 
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
 PRBool nsPluginInstanceOwner::UpdateVisibility(PRBool aVisible)
 {
   // NOTE: Death grip must be held by caller.
   if (!mInstance)
     return PR_TRUE;
 
   PRBool handled;
   NPEvent pluginEvent;
@@ -5810,17 +5810,17 @@ void nsPluginInstanceOwner::FixUpURLS(co
     nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
     nsAutoString newURL;
     NS_MakeAbsoluteURI(newURL, value, baseURI);
     if (!newURL.IsEmpty())
       value = newURL;
   }
 }
 
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
 nsresult
 nsPluginInstanceOwner::SetAbsoluteScreenPosition(nsIDOMElement* element,
                                                  nsIDOMClientRect* position,
                                                  nsIDOMClientRect* clip)
 {
   if (!element || !position || !clip)
     return NS_ERROR_FAILURE;
   
--- a/modules/plugin/base/public/npapi.h
+++ b/modules/plugin/base/public/npapi.h
@@ -333,17 +333,17 @@ typedef enum {
 
 #ifdef XP_MACOSX
   /* Used for negotiating drawing models */
   , NPPVpluginDrawingModel = 1000
   /* Used for negotiating event models */
   , NPPVpluginEventModel = 1001
 #endif
 
-#ifdef MOZ_PLATFORM_HILDON
+#if (MOZ_PLATFORM_MAEMO == 5)
   , NPPVpluginWindowlessLocalBool = 2002
 #endif
 } NPPVariable;
 
 /*
  * List of variable names for which NPN_GetValue is implemented by Mozilla
  */
 typedef enum {
@@ -378,17 +378,17 @@ typedef enum {
   , NPNVsupportsQuickDrawBool = 2000
 #endif
   , NPNVsupportsCoreGraphicsBool = 2001
 #ifndef NP_NO_CARBON
   , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
 #endif
   , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */
 #endif
-#ifdef MOZ_PLATFORM_HILDON
+#if (MOZ_PLATFORM_MAEMO == 5)
   , NPNVSupportsWindowlessLocal = 2002
 #endif
 } NPNVariable;
 
 typedef enum {
   NPNURLVCookie = 501,
   NPNURLVProxy
 } NPNURLVariable;
--- a/modules/plugin/base/public/nsPluginNativeWindow.h
+++ b/modules/plugin/base/public/nsPluginNativeWindow.h
@@ -98,17 +98,17 @@ public:
     if (aPluginInstance)
       aPluginInstance->SetWindow(this);
     else if (mPluginInstance)
       mPluginInstance->SetWindow(nsnull);
 
     SetPluginInstance(aPluginInstance);
     return NS_OK;
   }
-#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_WIDGET_GTK2)
+#if (MOZ_PLATFORM_MAEMO == 5)
 #define MOZ_COMPOSITED_PLUGINS
 #endif
 #ifdef MOZ_COMPOSITED_PLUGINS
   /* XXX: we use this to leak the socket widget out from nsPlugNativeWindowGtk2
      so that Renderer::NativeDraw() in nsObjectFrame.cpp can draw the widget.
      I don't currently know a better way to do this... */
   void *mPlugWindow;
 #endif
--- a/modules/plugin/base/src/nsNPAPIPlugin.cpp
+++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp
@@ -2134,17 +2134,17 @@ NPError NP_CALLBACK
       PRBool enabled;
       pbs->GetPrivateBrowsingEnabled(&enabled);
       *(NPBool*)result = (NPBool)enabled;
       return NPERR_NO_ERROR;
     }
     return NPERR_GENERIC_ERROR;
   }
 
-#ifdef MOZ_PLATFORM_HILDON
+#if (MOZ_PLATFORM_MAEMO == 5)
   case NPNVSupportsWindowlessLocal: {
     *(NPBool*)result = PR_TRUE;
     return NPERR_NO_ERROR;
   }
 #endif
 
 #ifdef XP_MACOSX
   case NPNVpluginDrawingModel: {
@@ -2272,17 +2272,17 @@ NPError NP_CALLBACK
       // NPERR_NO_ERROR here to conform to other browsers' behavior on OS X
       // (e.g. Safari and Opera).
       return NPERR_NO_ERROR;
 #else
       NPBool bWindowless = (result == nsnull);
       return inst->SetWindowless(bWindowless);
 #endif
     }
-#ifdef MOZ_PLATFORM_HILDON
+#if (MOZ_PLATFORM_MAEMO == 5)
     case NPPVpluginWindowlessLocalBool: {
       NPBool bWindowlessLocal = (result != nsnull);
       return inst->SetWindowlessLocal(bWindowlessLocal);
     }
 #endif
     case NPPVpluginTransparentBool: {
       NPBool bTransparent = (result != nsnull);
       return inst->SetTransparent(bTransparent);
--- a/modules/plugin/base/src/nsNPAPIPluginInstance.cpp
+++ b/modules/plugin/base/src/nsNPAPIPluginInstance.cpp
@@ -1387,17 +1387,17 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Han
     mCurrentPluginEvent = nsnull;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, void* value)
 {
-#ifdef MOZ_PLATFORM_HILDON
+#if (MOZ_PLATFORM_MAEMO == 5)
   // The maemo flash plugin does not remember this.  It sets the
   // value, but doesn't support the get value.
   if (variable == NPPVpluginWindowlessLocalBool) {
     *(NPBool*)value = mWindowlessLocal;
     return NS_OK;
   }
 #endif
   nsresult  res = NS_OK;
--- a/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp
+++ b/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp
@@ -44,17 +44,17 @@
 
 #include "nsDebug.h"
 #include "nsPluginNativeWindow.h"
 #include "npapi.h"
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 #include <gdk/gdk.h>
 
-#ifdef MOZ_PLATFORM_HILDON
+#if (MOZ_PLATFORM_MAEMO == 5)
 #define MOZ_COMPOSITED_PLUGINS
 #endif
 
 #ifdef MOZ_COMPOSITED_PLUGINS
 extern "C" {
 #include <X11/extensions/Xdamage.h>
 #include <X11/extensions/Xcomposite.h>
 }
--- a/toolkit/components/downloads/src/nsDownloadManager.cpp
+++ b/toolkit/components/downloads/src/nsDownloadManager.cpp
@@ -1165,17 +1165,17 @@ nsDownloadManager::GetDefaultDownloadsDi
     rv = downloadDir->Exists(&exists);
     NS_ENSURE_SUCCESS(rv, rv);
     if (!exists) {
       rv = downloadDir->Create(nsIFile::DIRECTORY_TYPE, 0755);
       NS_ENSURE_SUCCESS(rv, rv);
     }
   }
 #elif defined(XP_UNIX)
-#if defined(NS_OSSO)
+#if defined(MOZ_PLATFORM_MAEMO)
     // As maemo does not follow the XDG "standard" (as usually desktop
     // Linux distros do) neither has a working $HOME/Desktop folder
     // for us to fallback into, "$HOME/MyDocs/.documents/" is the folder
     // we found most apropriate to be the default target folder for downloads
     // on the platform.
     rv = dirService->Get(NS_UNIX_XDG_DOCUMENTS_DIR,
                          NS_GET_IID(nsILocalFile),
                          getter_AddRefs(downloadDir));
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -192,28 +192,24 @@ EXTRA_DSO_LDOPTS += \
 	-framework Carbon \
 	-framework CoreAudio \
 	-framework AudioToolbox \
 	-framework AudioUnit \
 	$(NULL)
 endif
 endif
 
-ifdef MOZ_PLATFORM_HILDON
-EXTRA_DSO_LDOPTS += $(LIBHILDONMIME_LIBS) $(LIBHILDONFM_LIBS)
+ifdef MOZ_PLATFORM_MAEMO
+EXTRA_DSO_LDOPTS += $(MOZ_PLATFORM_MAEMO_LIBS)
 endif 
 
 ifdef MOZ_ENABLE_LIBCONIC
 EXTRA_DSO_LDOPTS += $(LIBCONIC_LIBS)
 endif
 
-ifdef NS_OSSO
-EXTRA_DSO_LDOPTS += $(LIBOSSO_LIBS)
-endif
-
 ifdef MOZ_ENABLE_DBUS
 EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS)
 endif
 
 ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
 EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(XEXT_LIBS) $(XCOMPOSITE_LIBS) $(MOZ_PANGO_LIBS) $(MOZ_GTK2_LIBS) $(XT_LIBS) -lgthread-2.0
 EXTRA_DSO_LDOPTS += $(FT2_LIBS)
 endif
--- a/toolkit/xre/nsNativeAppSupportUnix.cpp
+++ b/toolkit/xre/nsNativeAppSupportUnix.cpp
@@ -54,17 +54,17 @@
 #include "nsIWindowMediator.h"
 #include "nsIDOMWindowInternal.h"
 
 #include <stdlib.h>
 #include <glib.h>
 #include <glib-object.h>
 #include <gtk/gtk.h>
 
-#ifdef NS_OSSO
+#ifdef MOZ_PLATFORM_MAEMO
 struct DBusMessage;  /* libosso.h references internals of dbus */
 
 #include <dbus/dbus.h>
 #include <dbus/dbus-protocol.h>
 #include <libosso.h>
 #endif
 
 #define MIN_GTK_MAJOR_VERSION 2
@@ -152,28 +152,28 @@ void die_cb(GnomeClient *client, gpointe
 
 class nsNativeAppSupportUnix : public nsNativeAppSupportBase
 {
 public:
   NS_IMETHOD Start(PRBool* aRetVal);
   NS_IMETHOD Stop(PRBool *aResult);
 
 private:
-#ifdef NS_OSSO
+#ifdef MOZ_PLATFORM_MAEMO
   osso_context_t *m_osso_context;    
   /* A note about why we need to have m_hw_state:
      the osso hardware callback does not tell us what changed, just
      that something has changed.  We need to keep track of state so
      that we can determine what has changed.
   */  
   osso_hw_state_t m_hw_state;
 #endif
 };
 
-#ifdef NS_OSSO
+#ifdef MOZ_PLATFORM_MAEMO
 
 static void OssoDisplayCallback(osso_display_state_t state, gpointer data)
 {
   nsCOMPtr<nsIObserverService> os = do_GetService("@mozilla.org/observer-service;1");
   if (!os)
       return;
  
   if (state == OSSO_DISPLAY_ON)
@@ -304,17 +304,17 @@ nsNativeAppSupportUnix::Start(PRBool *aR
                      gtk_minor_version,
                      MIN_GTK_MAJOR_VERSION,
                      MIN_GTK_MINOR_VERSION);
     gtk_dialog_run(GTK_DIALOG(versionErrDialog));
     gtk_widget_destroy(versionErrDialog);
     exit(0);
   }
 
-#ifdef NS_OSSO
+#ifdef MOZ_PLATFORM_MAEMO
   /* zero state out. */
   memset(&m_hw_state, 0, sizeof(osso_hw_state_t));
 
   /* Initialize maemo application
      
      The initalization name will be of the form "Vendor.Name".
      If a Vendor isn't given, then we will just use "Name".
      
@@ -449,17 +449,17 @@ nsNativeAppSupportUnix::Start(PRBool *aR
 }
 
 NS_IMETHODIMP
 nsNativeAppSupportUnix::Stop(PRBool *aResult)
 {
   NS_ENSURE_ARG(aResult);
   *aResult = PR_TRUE;
 
-#ifdef NS_OSSO
+#ifdef MOZ_PLATFORM_MAEMO
   if (m_osso_context) {
     osso_hw_unset_event_cb(m_osso_context, nsnull);
     osso_rpc_unset_default_cb_f(m_osso_context, OssoDbusCallback, nsnull);
     osso_deinitialize(m_osso_context);
     m_osso_context = nsnull;
   }
 #endif
   return NS_OK;
--- a/uriloader/exthandler/Makefile.in
+++ b/uriloader/exthandler/Makefile.in
@@ -130,17 +130,17 @@ CPPSRCS	= \
 	$(NULL)
 
 ifdef MOZ_ENABLE_DBUS
 CPPSRCS += nsDBusHandlerApp.cpp
 LOCAL_INCLUDES   += $(TK_CFLAGS) $(MOZ_DBUS_GLIB_CFLAGS)
 EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS)
 endif
 
-ifdef MOZ_PLATFORM_HILDON
+ifdef MOZ_PLATFORM_MAEMO
 ifdef MOZ_ENABLE_GNOMEVFS
 LOCAL_INCLUDES   += $(MOZ_GNOMEVFS_CFLAGS)
 EXTRA_DSO_LDOPTS += $(MOZ_GNOMEVFS_LIBS)
 endif
 ifdef MOZ_ENABLE_GIO
 LOCAL_INCLUDES   += $(MOZ_GIO_CFLAGS)
 EXTRA_DSO_LDOPTS += $(MOZ_GIO_LIBS)
 endif
--- a/uriloader/exthandler/nsDBusHandlerApp.cpp
+++ b/uriloader/exthandler/nsDBusHandlerApp.cpp
@@ -39,17 +39,17 @@
 
 #include  <dbus/dbus.h>
 #include "nsDBusHandlerApp.h"
 #include "nsIURI.h"
 #include "nsIGenericFactory.h"
 #include "nsIClassInfoImpl.h"
 #include "nsCOMPtr.h"
 
-#ifdef NS_OSSO
+#if (MOZ_PLATFORM_MAEMO == 5)
 #include <libosso.h>
 
 #define APP_LAUNCH_BANNER_SERVICE           "com.nokia.hildon-desktop"
 #define APP_LAUNCH_BANNER_METHOD_INTERFACE  "com.nokia.hildon.hdwm.startupnotification"
 #define APP_LAUNCH_BANNER_METHOD_PATH       "/com/nokia/hildon/hdwm"
 #define APP_LAUNCH_BANNER_METHOD            "starting"
 #endif
 
@@ -152,17 +152,17 @@ nsDBusHandlerApp::LaunchWithURI(nsIURI *
   
   DBusMessageIter iter;
   dbus_message_iter_init_append(msg, &iter);
   dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &uri);
   
   if (dbus_connection_send(connection, msg, NULL)) {
     dbus_connection_flush(connection);
     dbus_message_unref(msg);
-#ifdef NS_OSSO
+#if (MOZ_PLATFORM_MAEMO == 5)
     msg = dbus_message_new_method_call (APP_LAUNCH_BANNER_SERVICE,
                                         APP_LAUNCH_BANNER_METHOD_PATH,
                                         APP_LAUNCH_BANNER_METHOD_INTERFACE,
                                         APP_LAUNCH_BANNER_METHOD);
     
     if (msg) {
       const char* service = mService.get();
       if (dbus_message_append_args(msg,
--- a/uriloader/exthandler/unix/nsGNOMERegistry.cpp
+++ b/uriloader/exthandler/unix/nsGNOMERegistry.cpp
@@ -48,17 +48,17 @@
 #include "nsIGnomeVFSService.h"
 #include "nsIGIOService.h"
 
 #ifdef MOZ_WIDGET_GTK2
 #include <glib.h>
 #include <glib-object.h>
 #endif
 
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
 #include <libintl.h>
 #endif
 
 /* static */ PRBool
 nsGNOMERegistry::HandlerExists(const char *aProtocolScheme)
 {
   nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
   if (!gconf)
@@ -187,17 +187,17 @@ nsGNOMERegistry::GetFromType(const nsACS
   mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description));
 
   nsCAutoString name;
   if (giovfs)
     gioHandlerApp->GetName(name);
   else 
     gnomeHandlerApp->GetName(name);
 
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
   // On Maemo/Hildon, GetName ends up calling gnome_vfs_mime_application_get_name,
   // which happens to return a non-localized message-id for the application. To
   // get the localized name for the application, we have to call dgettext with 
   // the default maemo domain-name to try and translate the string into the operating 
   // system's native language.
   const char kDefaultTextDomain [] = "maemo-af-desktop";
   nsCAutoString realName (dgettext(kDefaultTextDomain, PromiseFlatCString(name).get()));
   mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(realName));
--- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
+++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
@@ -32,17 +32,17 @@
  * 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 defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS)
+#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
 #include <glib.h>
 #include <hildon-uri.h>
 #include <hildon-mime.h>
 #include <libosso.h>
 #endif
 
 #include "nsMIMEInfoUnix.h"
 #include "nsGNOMERegistry.h"
@@ -52,17 +52,17 @@
 #ifdef MOZ_ENABLE_DBUS
 #include "nsDBusHandlerApp.h"
 #endif
 
 nsresult
 nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
 {
   nsresult rv = nsGNOMERegistry::LoadURL(aURI);
-#if defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS)
+#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
   if (NS_FAILED(rv)){
     HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull);
     if (action) {
       nsCAutoString spec;
       aURI->GetAsciiSpec(spec);
       if (hildon_uri_open(spec.get(), action, nsnull))
         rv = NS_OK;
       hildon_uri_action_unref(action);
@@ -85,17 +85,17 @@ nsMIMEInfoUnix::GetHasDefaultHandler(PRB
     }
   }
   if (mimeInfo)
     *_retval = PR_TRUE;
 
   if (*_retval)
     return NS_OK;
 
-#if defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS)
+#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
   HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull);
   if (action) {
     *_retval = PR_TRUE;
     hildon_uri_action_unref(action);
     return NS_OK;
   }
 #endif
 
@@ -104,17 +104,17 @@ nsMIMEInfoUnix::GetHasDefaultHandler(PRB
 }
 
 nsresult
 nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile *aFile)
 {
   nsCAutoString nativePath;
   aFile->GetNativePath(nativePath);
 
-#if defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS)
+#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
   if(NS_SUCCEEDED(LaunchDefaultWithDBus(PromiseFlatCString(nativePath).get())))
     return NS_OK;
 #endif
 
   nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
   nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
   if (giovfs) {
     nsCOMPtr<nsIGIOMimeApp> app;
@@ -145,17 +145,17 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
   }
 
   if (!mDefaultApplication)
     return NS_ERROR_FILE_NOT_FOUND;
 
   return LaunchWithIProcess(mDefaultApplication, nativePath);
 }
 
-#if defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS)
+#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
 
 /* This method tries to launch the associated default handler for the given 
  * mime/file via hildon specific APIs (in this case hildon_mime_open_file* 
  * which are essetially wrappers to the DBUS mime_open method). 
  */
 
 nsresult
 nsMIMEInfoUnix::LaunchDefaultWithDBus(const char *aFilePath)
--- a/uriloader/exthandler/unix/nsMIMEInfoUnix.h
+++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.h
@@ -52,15 +52,15 @@ public:
   static PRBool HandlerExists(const char *aProtocolScheme);
 
 protected:
   NS_IMETHOD GetHasDefaultHandler(PRBool *_retval);
 
   virtual NS_HIDDEN_(nsresult) LoadUriInternal(nsIURI *aURI);
 
   virtual NS_HIDDEN_(nsresult) LaunchDefaultWithFile(nsIFile *aFile);
-#if defined (MOZ_PLATFORM_HILDON) && defined (MOZ_ENABLE_GNOMEVFS)
+#if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS)
   nsresult LaunchDefaultWithDBus(const char *aFilePath);
   NS_IMETHOD GetPossibleApplicationHandlers(nsIMutableArray * *aPossibleAppHandlers);
 #endif
 };
 
 #endif // nsMIMEInfoUnix_h_
--- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
+++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
@@ -1206,17 +1206,17 @@ nsresult nsOSHelperAppService::OSProtoco
 {
   LOG(("-- nsOSHelperAppService::OSProtocolHandlerExists for '%s'\n",
        aProtocolScheme));
   *aHandlerExists = PR_FALSE;
 
 #ifdef MOZ_WIDGET_GTK2
   // Check the GConf registry for a protocol handler
   *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme);
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
   *aHandlerExists = nsMIMEInfoUnix::HandlerExists(aProtocolScheme);
 #endif
 #endif
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval)
--- a/widget/src/gtk2/Makefile.in
+++ b/widget/src/gtk2/Makefile.in
@@ -113,17 +113,17 @@ EXTRA_DSO_LDOPTS += \
 		$(XLDFLAGS) \
 		$(XLIBS) \
 		$(XEXT_LIBS) \
 		$(XCOMPOSITE_LIBS) \
 		$(MOZ_GTK2_LIBS) \
 		$(QCMS_LIBS) \
 		$(NULL)
 
-ifdef MOZ_PLATFORM_HILDON
+ifdef MOZ_PLATFORM_MAEMO
 ifdef MOZ_ENABLE_GCONF
 EXTRA_DSO_LDOPTS += $(MOZ_GCONF_LIBS)
 endif
 endif
 
 ifdef MOZ_X11
 EXTRA_DSO_LDOPTS += -lgtkxtbin -lXrender
 endif
@@ -140,17 +140,17 @@ CPPSRCS		+= nsNativeThemeGTK.cpp
 DEFINES		+= -DNATIVE_THEME_SUPPORT
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 CFLAGS          += $(MOZ_GTK2_CFLAGS) $(MOZ_STARTUP_NOTIFICATION_CFLAGS)
 CXXFLAGS        += $(MOZ_CAIRO_CFLAGS) $(MOZ_GTK2_CFLAGS) $(MOZ_STARTUP_NOTIFICATION_CFLAGS)
 
-ifdef MOZ_PLATFORM_HILDON
+ifdef MOZ_PLATFORM_MAEMO
 ifdef MOZ_ENABLE_GCONF
 CXXFLAGS += $(MOZ_GCONF_CFLAGS)
 endif
 endif
 
 DEFINES         += -DUSE_XIM
 DEFINES		+= -DCAIRO_GFX
 
--- a/widget/src/gtk2/mozcontainer.h
+++ b/widget/src/gtk2/mozcontainer.h
@@ -79,17 +79,17 @@ extern "C" {
 #define MOZ_CONTAINER_TYPE            (moz_container_get_type())
 #define MOZ_CONTAINER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOZ_CONTAINER_TYPE, MozContainer))
 #define MOZ_CONTAINER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MOZ_CONTAINER_TYPE, MozContainerClass))
 #define IS_MOZ_CONTAINER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOZ_CONTAINER_TYPE))
 #define IS_MOZ_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOZ_CONTAINER_TYPE))
 #define MOZ_CONAINTER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZ_CONTAINER_TYPE, MozContainerClass))
 
 #if (GTK_CHECK_VERSION(2, 12, 0) || \
-    (GTK_CHECK_VERSION(2, 10, 0) && defined(MOZ_PLATFORM_HILDON)))
+    (GTK_CHECK_VERSION(2, 10, 0) && defined(MOZ_PLATFORM_MAEMO)))
 #define HAVE_GTK_MOTION_HINTS
 #endif
 
 typedef struct _MozContainer      MozContainer;
 typedef struct _MozContainerClass MozContainerClass;
 
 struct _MozContainer
 {
--- a/widget/src/gtk2/nsFilePicker.cpp
+++ b/widget/src/gtk2/nsFilePicker.cpp
@@ -51,17 +51,17 @@
 #include "mozcontainer.h"
 
 #include "prmem.h"
 #include "prlink.h"
 
 #include "nsFilePicker.h"
 #include "nsAccessibilityHelper.h"
 
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
 #include <hildon-fm-2/hildon/hildon-file-chooser-dialog.h>
 #endif
 
 #define MAX_PREVIEW_SIZE 180
 
 nsILocalFile *nsFilePicker::mPrevDisplayDirectory = nsnull;
 
 // XXXdholbert -- this function is duplicated in nsPrintDialogGTK.cpp
@@ -428,17 +428,17 @@ nsFilePicker::Show(PRInt16 *aReturn)
   nsXPIDLCString title;
   title.Adopt(ToNewUTF8String(mTitle));
 
   GtkWindow *parent_widget = get_gtk_window_for_nsiwidget(mParentWidget);
 
   GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
   const gchar *accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE)
                                ? GTK_STOCK_SAVE : GTK_STOCK_OPEN;
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
   GtkWidget *file_chooser =
     hildon_file_chooser_dialog_new_with_properties(parent_widget,
                                                    "action", action,
                                                    "open-button-text", accept_button,
                                                    NULL);
   gtk_window_set_title(GTK_WINDOW(file_chooser), title);
 #else
   GtkWidget *file_chooser =
--- a/widget/src/gtk2/nsLookAndFeel.cpp
+++ b/widget/src/gtk2/nsLookAndFeel.cpp
@@ -38,17 +38,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsLookAndFeel.h"
 #include <gtk/gtk.h>
 
 #include "gtkdrawing.h"
 
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
 #include "nsIServiceManager.h"
 #include "nsIPropertyBag2.h"
 #include "nsLiteralString.h"
 #endif
 
 #define GDK_COLOR_TO_NS_RGB(c) \
     ((nscolor) NS_RGB(c.red>>8, c.green>>8, c.blue>>8))
 
@@ -577,26 +577,26 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(c
         break;
     case eMetric_DWMCompositor:
     case eMetric_WindowsClassic:
     case eMetric_WindowsDefaultTheme:
         aMetric = 0;
         res = NS_ERROR_NOT_IMPLEMENTED;
         break;
     case eMetric_TouchEnabled:
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
         // All Hildon devices are touch-enabled
         aMetric = 1;
 #else
         aMetric = 0;
         res = NS_ERROR_NOT_IMPLEMENTED;
 #endif
         break;
     case eMetric_MaemoClassic:
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
         {
             aMetric = 0;
             nsCOMPtr<nsIPropertyBag2> infoService(do_GetService("@mozilla.org/system-info;1"));
             if (infoService) {
                 nsCString deviceType;
                 nsresult rv = infoService->GetPropertyAsACString(NS_LITERAL_STRING("device"),
                                                                  deviceType);
                 if (NS_SUCCEEDED(rv)) {
--- a/widget/src/gtk2/nsWindow.cpp
+++ b/widget/src/gtk2/nsWindow.cpp
@@ -33,17 +33,17 @@
  * 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 ***** */
 
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
 #define MAEMO_CHANGES
 #endif
 
 #include "prlink.h"
 
 #include "nsWindow.h"
 #include "nsGTKToolkit.h"
 #include "nsIDeviceContext.h"
@@ -300,17 +300,17 @@ static PRBool                      gCons
 
 #ifdef USE_XIM
 
 static nsWindow    *gIMEFocusWindow = NULL;
 static GdkEventKey *gKeyEvent = NULL;
 static PRBool       gKeyEventCommitted = PR_FALSE;
 static PRBool       gKeyEventChanged = PR_FALSE;
 static PRBool       gIMESuppressCommit = PR_FALSE;
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
 static PRBool       gIMEVirtualKeyboardOpened = PR_FALSE;
 #endif
 
 static void IM_commit_cb              (GtkIMContext *aContext,
                                        const gchar *aString,
                                        nsWindow *aWindow);
 static void IM_commit_cb_internal     (const gchar *aString,
                                        nsWindow *aWindow);
@@ -3495,27 +3495,27 @@ nsWindow::OnVisibilityNotifyEvent(GtkWid
         if (mIsFullyObscured && mHasMappedToplevel) {
             // GDK_EXPOSE events have been ignored, so make sure GDK
             // doesn't think that the window has already been painted.
             gdk_window_invalidate_rect(mGdkWindow, NULL, FALSE);
         }
 
         mIsFullyObscured = PR_FALSE;
 
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
 #ifdef USE_XIM
         // In Hildon/Maemo, a browser window will get into 'patially visible' state wheneven an
         // autocomplete feature is dropped down (from urlbar or from an entry form completion),
         // and there are no much further ways for that to happen in the plaftorm. In such cases, if hildon
         // virtual keyboard is up, we can not grab focus to any dropdown list. Reason: nsWindow::EnsureGrabs()
         // calls gdk_pointer_grab() which grabs the pointer (usually a mouse) so that all events are passed
         // to this it until the pointer is ungrabbed.
         if(!gIMEVirtualKeyboardOpened)
 #endif // USE_XIM
-#endif // MOZ_PLATFORM_HILDON
+#endif // MOZ_PLATFORM_MAEMO
         // if we have to retry the grab, retry it.
         EnsureGrabs();
         break;
     default: // includes GDK_VISIBILITY_FULLY_OBSCURED
         mIsFullyObscured = PR_TRUE;
         break;
     }
 }
@@ -6848,17 +6848,17 @@ GtkIMContext*
 nsWindow::IMEGetContext()
 {
     return IM_get_input_context(this);
 }
 
 static PRBool
 IsIMEEnabledState(PRUint32 aState)
 {
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
     return aState == nsIWidget::IME_STATUS_ENABLED ||
            aState == nsIWidget::IME_STATUS_PLUGIN  ||
            aState == nsIWidget::IME_STATUS_PASSWORD;
 #else
     return aState == nsIWidget::IME_STATUS_ENABLED ||
            aState == nsIWidget::IME_STATUS_PLUGIN;
 #endif
 }
@@ -7056,17 +7056,17 @@ nsWindow::SetIMEEnabled(PRUint32 aState)
             focusedWin->IMELoseFocus();
         }
 
         mIMEData->mEnabled = aState;
 
         // Even when aState is not PR_TRUE, we need to set IME focus.
         // Because some IMs are updating the status bar of them in this time.
         focusedWin->IMESetFocus();
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
         if (mIMEData->mEnabled) {
             // It is not desired that the hildon's autocomplete mechanism displays
             // user previous entered passwds, so lets make completions invisible
             // in these cases.
             int mode;
             g_object_get (G_OBJECT(IMEGetContext()), "hildon-input-mode", &mode, NULL);
 
             if (mIMEData->mEnabled == nsIWidget::IME_STATUS_ENABLED ||
@@ -7432,17 +7432,17 @@ IM_get_input_context(nsWindow *aWindow)
         return nsnull;
     nsWindow::nsIMEData *data = aWindow->mIMEData;
     if (!data)
         return nsnull;
     if (data->mEnabled == nsIWidget::IME_STATUS_ENABLED ||
         data->mEnabled == nsIWidget::IME_STATUS_PLUGIN)
         return data->mContext;
     if (data->mEnabled == nsIWidget::IME_STATUS_PASSWORD)
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
         return data->mContext;
 #else
         return data->mSimpleContext;
 #endif
     return data->mDummyContext;
 }
 
 #endif
--- a/xpcom/base/nsMemoryImpl.cpp
+++ b/xpcom/base/nsMemoryImpl.cpp
@@ -52,17 +52,17 @@
 #include "nsAutoLock.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
 
 #if defined(XP_WIN)
 #include <windows.h>
 #endif
 
-#if defined (NS_OSSO)
+#if defined(MOZ_PLATFORM_MAEMO)
 #include <osso-mem.h>
 #include <fcntl.h>
 #include <unistd.h>
 static const char kHighMark[] = "/sys/kernel/high_watermark";
 #endif
 
 // Some platforms notify you when system memory is low, others do not.
 // In the case of those that do not, we want to post low memory
@@ -123,17 +123,17 @@ nsMemoryImpl::IsLowMemory(PRBool *result
     // Bug 525323 - GlobalMemoryStatus kills perf on WinCE.
     *result = PR_FALSE;
 #elif defined(XP_WIN)
     MEMORYSTATUSEX stat;
     stat.dwLength = sizeof stat;
     GlobalMemoryStatusEx(&stat);
     *result = (stat.ullAvailPageFile < kRequiredMemory) &&
         ((float)stat.ullAvailPageFile / stat.ullTotalPageFile) < 0.1;
-#elif defined(NS_OSSO)
+#elif defined(MOZ_PLATFORM_MAEMO)
     static int osso_highmark_fd = -1;
     if (osso_highmark_fd == -1) {
         osso_highmark_fd = open (kHighMark, O_RDONLY);
 
         if (osso_highmark_fd == -1) {
             NS_ERROR("can't find the osso highmark file");    
             *result = PR_FALSE;
             return NS_OK;
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -95,17 +95,17 @@ nsSystemInfo::Init()
       rv = SetPropertyAsACString(NS_ConvertASCIItoUTF16("secondaryLibrary"),
                                  nsDependentCString(gtkver));
       PR_smprintf_free(gtkver);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 #endif
 
 
-#ifdef MOZ_PLATFORM_HILDON
+#ifdef MOZ_PLATFORM_MAEMO
     char *  line = nsnull;
     size_t  len = 0;
     ssize_t read;
     FILE *fp = fopen ("/proc/component_version", "r");
     if (fp) {
       while ((read = getline(&line, &len, fp)) != -1) {
         if (line) {
           if (strstr(line, "RX-51")) {
--- a/xpcom/build/Makefile.in
+++ b/xpcom/build/Makefile.in
@@ -165,18 +165,18 @@ EXTRA_DSO_LDOPTS += \
 endif
 
 ifeq ($(OS_ARCH),BeOS)
 EXTRA_DSO_LDOPTS += -lbe
 endif
 
 ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
 EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
-ifdef MOZ_PLATFORM_HILDON
-EXTRA_DSO_LDOPTS += $(LIBHILDONMIME_LIBS)
+ifdef MOZ_PLATFORM_MAEMO
+EXTRA_DSO_LDOPTS += $(MOZ_PLATFORM_MAEMO_LIBS)
 endif
 endif
 
 ifdef HAVE_CLOCK_MONOTONIC
 EXTRA_DSO_LDOPTS += $(REALTIME_LIBS)
 endif
 
 ifeq ($(OS_ARCH),WINNT)
--- a/xpcom/io/Makefile.in
+++ b/xpcom/io/Makefile.in
@@ -194,13 +194,13 @@ DEFINES		+= -D_IMPL_NS_COM
 ifeq ($(OS_ARCH),Linux)
 ifneq (,$(findstring lib64,$(libdir)))
 DEFINES     += -DHAVE_USR_LIB64_DIR
 endif
 endif
 
 LOCAL_INCLUDES	= -I..
 
-ifdef MOZ_PLATFORM_HILDON
-CFLAGS          += $(MOZ_DBUS_GLIB_CFLAGS) $(LIBHILDONMIME_CFLAGS)
-CXXFLAGS        += $(MOZ_DBUS_GLIB_CFLAGS) $(LIBHILDONMIME_CFLAGS)
+ifeq ($(MOZ_PLATFORM_MAEMO), 5)
+CFLAGS          += $(MOZ_DBUS_GLIB_CFLAGS) $(MOZ_PLATFORM_MAEMO_CFLAGS)
+CXXFLAGS        += $(MOZ_DBUS_GLIB_CFLAGS) $(MOZ_PLATFORM_MAEMO_CFLAGS)
 endif
 
--- a/xpcom/io/SpecialSystemDirectory.cpp
+++ b/xpcom/io/SpecialSystemDirectory.cpp
@@ -485,17 +485,17 @@ GetUnixXDGUserDirectory(SystemDirectorie
         // for the XDG desktop dir, fall back to HOME/Desktop
         // (for historical compatibility)
         rv = GetUnixHomeDir(getter_AddRefs(file));
         if (NS_FAILED(rv))
             return rv;
 
         rv = file->AppendNative(NS_LITERAL_CSTRING("Desktop"));
     }
-#if defined(NS_OSSO)
+#if defined(MOZ_PLATFORM_MAEMO)
     // "MYDOCSDIR" is exported to point to "/home/user/MyDocs" in maemo.
     else if (Unix_XDG_Documents == aSystemDirectory) {
 
         char *myDocs = PR_GetEnv("MYDOCSDIR");
         if (!myDocs || !*myDocs)
             return NS_ERROR_FAILURE;
 
         rv = NS_NewNativeLocalFile(nsDependentCString(myDocs), PR_TRUE,
--- a/xpcom/io/nsLocalFileUnix.cpp
+++ b/xpcom/io/nsLocalFileUnix.cpp
@@ -87,17 +87,17 @@
 #include "nsISimpleEnumerator.h"
 #include "nsITimelineService.h"
 
 #ifdef MOZ_WIDGET_GTK2
 #include "nsIGIOService.h"
 #include "nsIGnomeVFSService.h"
 #endif
 
-#ifdef MOZ_PLATFORM_HILDON
+#if (MOZ_PLATFORM_MAEMO == 5)
 #include <glib.h>
 #include <hildon-uri.h>
 #include <hildon-mime.h>
 #include <libosso.h>
 #endif
 
 #include "nsNativeCharsetUtils.h"
 #include "nsTraceRefcntImpl.h"
@@ -1741,17 +1741,17 @@ nsLocalFile::Reveal()
     return NS_ERROR_FAILURE;
 #endif
 }
 
 NS_IMETHODIMP
 nsLocalFile::Launch()
 {
 #ifdef MOZ_WIDGET_GTK2
-#ifdef MOZ_PLATFORM_HILDON
+#if (MOZ_PLATFORM_MAEMO==5)
     const PRInt32 kHILDON_SUCCESS = 1;
     DBusError err;
     dbus_error_init(&err);
 
     DBusConnection *connection = dbus_bus_get(DBUS_BUS_SESSION, &err);
     if (dbus_error_is_set(&err)) {
       dbus_error_free(&err);
       return NS_ERROR_FAILURE;