Make --disable-ipc work... mac-ppc now builds by default.
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 20 Jul 2009 15:04:52 -0400
changeset 35802 489e7d993d34fa70ff0ad6e15233d4db220ac95f
parent 35801 bcde8acb9783adb6e804ee2d0e2f1620b5230502
child 35803 d4ac42d442759b0375abb7695f35424056074c40
push idunknown
push userunknown
push dateunknown
milestone1.9.2a1pre
Make --disable-ipc work... mac-ppc now builds by default.
configure.in
content/base/src/nsFrameLoader.cpp
content/base/src/nsFrameLoader.h
dom/Makefile.in
dom/plugins/Makefile.in
ipc/chromium/chromium-config.mk
modules/plugin/base/src/nsNPAPIPlugin.cpp
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsEmbedFunctions.cpp
widget/src/xpwidgets/nsBaseAppShell.cpp
xpcom/build/nsXULAppAPI.h
--- a/configure.in
+++ b/configure.in
@@ -5328,16 +5328,20 @@ MOZ_ARG_DISABLE_BOOL(ipc,
 [  --disable-ipc           Disable IPC supports for tabs and plugins],
     MOZ_IPC=,
     MOZ_IPC=1)
 
 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
     AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
 fi
 
+if test -n "$MOZ_IPC"; then
+    AC_DEFINE(MOZ_IPC)
+fi
+
 AC_SUBST(MOZ_IPC)
 
 dnl ========================================================
 dnl = Disable plugin support
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(plugins,
 [  --disable-plugins       Disable plugins support],
     MOZ_PLUGINS=,
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -82,28 +82,30 @@
 #include "nsNetUtil.h"
 
 #include "nsGkAtoms.h"
 #include "nsINameSpaceManager.h"
 
 #include "nsThreadUtils.h"
 #include "nsIView.h"
 
+#ifdef MOZ_IPC
 #include "TabParent.h"
 
+using namespace mozilla;
+using namespace mozilla::tabs;
+#endif
+
 #ifdef MOZ_WIDGET_GTK2
 #include "mozcontainer.h"
 
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 #endif
 
-using namespace mozilla;
-using namespace mozilla::tabs;
-
 class nsAsyncDocShellDestroyer : public nsRunnable
 {
 public:
   nsAsyncDocShellDestroyer(nsIDocShell* aDocShell)
     : mDocShell(aDocShell)
   {
   }
 
@@ -204,26 +206,28 @@ nsFrameLoader::LoadURI(nsIURI* aURI)
   return rv;
 }
 
 nsresult
 nsFrameLoader::ReallyStartLoading()
 {
   NS_ENSURE_STATE(mURIToLoad && mOwnerContent && mOwnerContent->IsInDoc());
 
+#ifdef MOZ_IPC
   if (!mTriedNewProcess) {
     TryNewProcess();
     mTriedNewProcess = PR_TRUE;
   }
 
   if (mChildProcess) {
     // FIXME get error codes from child
     mChildProcess->LoadURL(mURIToLoad);
     return NS_OK;
   }
+#endif
   
   // Just to be safe, recheck uri.
   nsresult rv = CheckURILoad(mURIToLoad);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = EnsureDocShell();
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -1030,16 +1034,17 @@ nsFrameLoader::CheckForRecursiveLoad(nsI
     nsCOMPtr<nsIDocShellTreeItem> temp;
     temp.swap(parentAsItem);
     temp->GetSameTypeParent(getter_AddRefs(parentAsItem));
   }
 
   return NS_OK;
 }
 
+#ifdef MOZ_IPC
 PRBool
 nsFrameLoader::TryNewProcess()
 {
   if (PR_GetEnv("DISABLE_OOP_IFRAME")) {
       return PR_FALSE;
   }
 
   nsIDocument* doc = mOwnerContent->GetDocument();
@@ -1148,8 +1153,9 @@ nsFrameLoader::TryNewProcess()
   mChildProcess->Move(0, 0, alloc.width, alloc.height);
 
 #else
 #error TODO for this platform
 #endif
 
   return PR_TRUE;
 }
+#endif
--- a/content/base/src/nsFrameLoader.h
+++ b/content/base/src/nsFrameLoader.h
@@ -47,34 +47,39 @@
 #include "nsIDocShell.h"
 #include "nsStringFwd.h"
 #include "nsIFrameLoader.h"
 #include "nsIURI.h"
 #include "nsAutoPtr.h"
 
 class nsIContent;
 class nsIURI;
+
+#ifdef MOZ_IPC
 namespace mozilla {
   namespace tabs {
     class TabParent;
   }
 }
+#endif
 
 class nsFrameLoader : public nsIFrameLoader
 {
 public:
-  nsFrameLoader(nsIContent *aOwner) :
-    mOwnerContent(aOwner),
-    mDepthTooGreat(PR_FALSE),
-    mIsTopLevelContent(PR_FALSE),
-    mDestroyCalled(PR_FALSE),
-    mNeedsAsyncDestroy(PR_FALSE),
-    mInSwap(PR_FALSE),
-    mChildProcess(nsnull),
-    mTriedNewProcess(PR_FALSE)
+  nsFrameLoader(nsIContent *aOwner)
+    : mOwnerContent(aOwner)
+    , mDepthTooGreat(PR_FALSE)
+    , mIsTopLevelContent(PR_FALSE)
+    , mDestroyCalled(PR_FALSE) 
+    , mNeedsAsyncDestroy(PR_FALSE)
+    , mInSwap(PR_FALSE)
+#ifdef MOZ_IPC
+    , mChildProcess(nsnull)
+    , mTriedNewProcess(PR_FALSE)
+#endif
   {}
 
   ~nsFrameLoader() {
     mNeedsAsyncDestroy = PR_TRUE;
     nsFrameLoader::Destroy();
   }
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@@ -92,26 +97,30 @@ public:
                                nsRefPtr<nsFrameLoader>& aFirstToSwap,
                                nsRefPtr<nsFrameLoader>& aSecondToSwap);
 private:
 
   NS_HIDDEN_(nsresult) EnsureDocShell();
   NS_HIDDEN_(void) GetURL(nsString& aURL);
   nsresult CheckURILoad(nsIURI* aURI);
 
+#ifdef MOZ_IPC
   // True means new process started; nothing else to do
   PRBool TryNewProcess();
+#endif
 
   nsCOMPtr<nsIDocShell> mDocShell;
   nsCOMPtr<nsIURI> mURIToLoad;
   nsIContent *mOwnerContent; // WEAK
   PRPackedBool mDepthTooGreat : 1;
   PRPackedBool mIsTopLevelContent : 1;
   PRPackedBool mDestroyCalled : 1;
   PRPackedBool mNeedsAsyncDestroy : 1;
   PRPackedBool mInSwap : 1;
 
+#ifdef MOZ_IPC
   // XXX leaking
   mozilla::tabs::TabParent* mChildProcess;
   PRBool mTriedNewProcess;
+#endif
 };
 
 #endif
--- a/dom/Makefile.in
+++ b/dom/Makefile.in
@@ -74,21 +74,21 @@ ifdef MOZ_SMIL
 DIRS += interfaces/smil
 endif
 
 DIRS += \
   public/coreEvents \
   base \
   src \
   locales \
+  plugins \
   $(NULL)
 
 ifdef MOZ_IPC
 DIRS += \
-  plugins \
   ipc \
   $(NULL)
 endif
 
 ifdef ENABLE_TESTS
 DIRS += tests
 endif
 
--- a/dom/plugins/Makefile.in
+++ b/dom/plugins/Makefile.in
@@ -39,23 +39,27 @@ DEPTH = ../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = dom
 
-EXPORTS_NAMESPACES = mozilla mozilla/plugins
+EXPORTS_NAMESPACES = mozilla
 
 EXPORTS_mozilla =				\
   SharedLibrary.h				\
   SharedPRLibrary.h				\
   $(NULL)
 
+ifdef MOZ_IPC
+
+EXPORTS_NAMESPACES = mozilla mozilla/plugins
+
 EXPORTS_mozilla/plugins =			\
   NPAPIPluginChild.h				\
   NPAPIPluginParent.h				\
   NPPInstanceChild.h				\
   NPPInstanceParent.h				\
   PluginMessageUtils.h				\
   PluginProcessParent.h				\
   PluginThreadChild.h				\
@@ -73,16 +77,17 @@ CPPSRCS =					\
   NPAPIPluginParent.cpp				\
   NPPInstanceChild.cpp				\
   NPPInstanceParent.cpp				\
   PluginProcessParent.cpp			\
   PluginThreadChild.cpp				\
   $(NULL)
 
 LOCAL_INCLUDES =				\
-  -I$(topsrcdir)/ipc/chromium/			\
   -I$(topsrcdir)/modules/plugin/base/public/	\
   -I$(topsrcdir)/modules/plugin/base/src/	\
   $(NULL)
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
+endif
+
 include $(topsrcdir)/config/rules.mk
--- a/ipc/chromium/chromium-config.mk
+++ b/ipc/chromium/chromium-config.mk
@@ -41,16 +41,18 @@ endif
 ifdef CHROMIUM_CONFIG_INCLUDED
 $(error Must not include chromium-config.mk twice.)
 endif
 
 CHROMIUM_CONFIG_INCLUDED = 1
 
 EXTRA_DEPS += $(topsrcdir)/ipc/chromium/chromium-config.mk
 
+ifdef MOZ_IPC # {
+
 DEFINES += \
   -DEXCLUDE_SKIA_DEPENDENCIES \
   -DCHROMIUM_MOZILLA_BUILD \
   $(NULL)
 
 LOCAL_INCLUDES += \
   -I$(topsrcdir)/ipc/chromium/src \
   -I$(topsrcdir)/ipc/glue \
@@ -105,8 +107,10 @@ DEFINES += \
 OS_CXXFLAGS := $(filter-out -pedantic,$(OS_CXXFLAGS))
 
 # TODO support !GTK
 OS_CXXFLAGS += $(MOZ_GTK2_CFLAGS)
 OS_CFLAGS += $(MOZ_GTK2_CFLAGS)
 
 endif # }
 endif # }
+
+endif # }
\ No newline at end of file
--- a/modules/plugin/base/src/nsNPAPIPlugin.cpp
+++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp
@@ -84,20 +84,22 @@
 #include "gtk2xtbin.h"
 #endif
 
 #include "nsJSNPRuntime.h"
 #include "nsIHttpAuthManager.h"
 #include "nsICookieService.h"
 
 #include "mozilla/SharedPRLibrary.h"
+using mozilla::SharedPRLibrary;
+
+#ifdef MOZ_IPC
 #include "mozilla/plugins/NPAPIPluginParent.h"
-
-using mozilla::SharedPRLibrary;
 using mozilla::plugins::NPAPIPluginParent;
+#endif
 
 static PRLock *sPluginThreadAsyncCallLock = nsnull;
 static PRCList sPendingAsyncCalls = PR_INIT_STATIC_CLIST(&sPendingAsyncCalls);
 
 // POST/GET stream type
 enum eNPPStreamTypeInternal {
   eNPPStreamTypeInternal_Get,
   eNPPStreamTypeInternal_Post
@@ -300,19 +302,19 @@ nsNPAPIPlugin::nsNPAPIPlugin(NPPluginFun
                "callback version is less than NP version");
 
   fShutdownEntry = (NP_PLUGINSHUTDOWN)aLibrary->FindSymbol("NP_Shutdown");
 #elif defined(XP_MACOSX)
   NPPluginFuncs np_callbacks;
   memset((void*) &np_callbacks, 0, sizeof(np_callbacks));
   np_callbacks.size = sizeof(np_callbacks);
 
-  fShutdownEntry = (NP_PLUGINSHUTDOWN)PR_FindSymbol(aLibrary, "NP_Shutdown");
-  NP_GETENTRYPOINTS pfnGetEntryPoints = (NP_GETENTRYPOINTS)PR_FindSymbol(aLibrary, "NP_GetEntryPoints");
-  NP_PLUGININIT pfnInitialize = (NP_PLUGININIT)PR_FindSymbol(aLibrary, "NP_Initialize");
+  fShutdownEntry = (NP_PLUGINSHUTDOWN)aLibrary->FindSymbol("NP_Shutdown");
+  NP_GETENTRYPOINTS pfnGetEntryPoints = (NP_GETENTRYPOINTS)aLibrary->FindSymbol("NP_GetEntryPoints");
+  NP_PLUGININIT pfnInitialize = (NP_PLUGININIT)aLibrary->FindSymbol("NP_Initialize");
   if (!pfnGetEntryPoints || !pfnInitialize || !fShutdownEntry) {
     NS_WARNING("Not all necessary functions exposed by plugin, it will not load.");
     return;
   }
 
   // we call NP_Initialize before getting function pointers to match
   // WebKit's behavior. They implemented this first on Mac OS X.
   if (pfnInitialize(&(nsNPAPIPlugin::CALLBACKS)) != NPERR_NO_ERROR)
@@ -368,20 +370,24 @@ nsNPAPIPlugin::CreatePlugin(const char* 
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
   nsNPAPIPlugin *plptr;
 
   NPPluginFuncs callbacks;
   memset((void*) &callbacks, 0, sizeof(callbacks));
   callbacks.size = sizeof(callbacks);
 
   SharedLibrary* pluginLib;
+#ifdef MOZ_IPC
   if (PR_GetEnv("DISABLE_OOP_PLUGINS") || !aFilePath)
     pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
   else
     pluginLib = NPAPIPluginParent::LoadModule(aFilePath, aLibrary);
+#else
+  pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
+#endif
 
   NP_PLUGINSHUTDOWN pfnShutdown =
     (NP_PLUGINSHUTDOWN) pluginLib->FindFunctionSymbol("NP_Shutdown");
 
   // create the new plugin handler
   *aResult = plptr =
     new nsNPAPIPlugin(&callbacks, pluginLib, aLibrary, pfnShutdown);
 
@@ -409,20 +415,24 @@ nsNPAPIPlugin::CreatePlugin(const char* 
     return NS_ERROR_UNEXPECTED;
 
   // now copy function table back to nsNPAPIPlugin instance
   memcpy((void*) &(plptr->fCallbacks), (void*)&callbacks, sizeof(callbacks));
 #endif
 
 #ifdef XP_WIN
   SharedLibrary* pluginLib;
+#ifdef MOZ_IPC
   if (PR_GetEnv("DISABLE_OOP_PLUGINS") || !aFilePath)
     pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
   else
     pluginLib = NPAPIPluginParent::LoadModule(aFilePath, aLibrary);
+#else
+  pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
+#endif
 
   // Note: on Windows, we must use the fCallback because plugins may
   // change the function table. The Shockwave installer makes changes
   // in the table while running
   *aResult = new nsNPAPIPlugin(nsnull, pluginLib, aLibrary, nsnull);
 
   if (*aResult == NULL)
     return NS_ERROR_OUT_OF_MEMORY;
@@ -534,17 +544,26 @@ nsNPAPIPlugin::CreatePlugin(const char* 
 
   nsCOMPtr<nsILocalFile> pluginPath;
   NS_NewNativeLocalFile(nsDependentCString(aFilePath), PR_TRUE,
                         getter_AddRefs(pluginPath));
 
   nsPluginFile pluginFile(pluginPath);
   pluginRefNum = pluginFile.OpenPluginResource();
 
-  nsNPAPIPlugin* plugin = new nsNPAPIPlugin(nsnull, aLibrary, nsnull);
+  SharedLibrary* pluginLib;
+#ifdef MOZ_IPC
+  if (PR_GetEnv("DISABLE_OOP_PLUGINS") || !aFilePath)
+    pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
+  else
+    pluginLib = NPAPIPluginParent::LoadModule(aFilePath, aLibrary);
+#else
+  pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
+#endif
+  nsNPAPIPlugin* plugin = new nsNPAPIPlugin(nsnull, pluginLib, aLibrary, nsnull);
   ::UseResFile(appRefNum);
   if (!plugin)
     return NS_ERROR_OUT_OF_MEMORY;
 
   *aResult = plugin;
 
   NS_ADDREF(*aResult);
   if (NS_FAILED((*aResult)->Initialize())) {
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -202,24 +202,26 @@
 #endif
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #include "nsICrashReporter.h"
 #define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
 #endif
 
+#ifdef MOZ_IPC
 #include "base/at_exit.h"
 #include "base/command_line.h"
 #include "base/message_loop.h"
 #include "base/thread.h"
 #include "mozilla/ipc/GeckoThread.h"
 
 using mozilla::ipc::BrowserProcessSubThread;
 using mozilla::ipc::GeckoThread;
+#endif
 
 // on x86 linux, the current builds of some popular plugins (notably
 // flashplayer and real) expect a few builtin symbols from libgcc
 // which were available in some older versions of gcc.  However,
 // they're _NOT_ available in newer versions of gcc (eg 3.1), so if
 // we want those plugin to work with a gcc-3.1 built binary, we need
 // to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
 // to true on x86 linux, and false everywhere else.
@@ -2945,20 +2947,22 @@ XRE_main(int argc, char* argv[], const n
   }
     
 #ifdef NS_TRACE_MALLOC
   gArgc = argc = NS_TraceMallocStartupArgs(gArgc, gArgv);
 #endif
 
   MOZ_SPLASHSCREEN_UPDATE(20);
 
+#ifdef MOZ_IPC
   // Set up chromium libs
   base::AtExitManager exitManager;
   CommandLine::Init(gArgc, gArgv);
   MessageLoopForUI mainMessageLoop;
+#endif
 
   {
     nsXREDirProvider dirProvider;
     rv = dirProvider.Initialize(gAppData->directory, gAppData->xreDirectory);
     if (NS_FAILED(rv))
       return 1;
 
     // Check for -register, which registers chrome and then exits immediately.
@@ -3407,24 +3411,26 @@ XRE_main(int argc, char* argv[], const n
             // of the IO thread so we start it now.
              scoped_ptr<base::Thread> x11Thread(
                new BrowserProcessSubThread(BrowserProcessSubThread::BACKGROUND_X11));
              if (NS_UNLIKELY(!x11Thread->Start())) {
                NS_ERROR("Failed to create chromium's X11 thread!");
                return NS_ERROR_FAILURE;
              }
 #endif
+#ifdef MOZ_IPC
             scoped_ptr<base::Thread> ipcThread(
               new BrowserProcessSubThread(BrowserProcessSubThread::IO));
             base::Thread::Options options;
             options.message_loop_type = MessageLoop::TYPE_IO;
             if (NS_UNLIKELY(!ipcThread->StartWithOptions(options))) {
               NS_ERROR("Failed to create chromium's IO thread!");
               return NS_ERROR_FAILURE;
             }
+#endif
 
             NS_TIMELINE_ENTER("appStartup->Run");
             rv = appStartup->Run();
             NS_TIMELINE_LEAVE("appStartup->Run");
             if (NS_FAILED(rv)) {
               NS_ERROR("failed to run appstartup");
               gLogConsoleErrors = PR_TRUE;
             }
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -36,22 +36,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsXULAppAPI.h"
 
 #include <stdlib.h>
 
 #include "prenv.h"
 
-#include "base/at_exit.h"
-#include "base/command_line.h"
-#include "base/message_loop.h"
-#include "base/thread.h"
-#include "chrome/common/child_process.h"
-
 #include "nsIAppShell.h"
 #include "nsIAppStartupNotifier.h"
 #include "nsIDirectoryService.h"
 #include "nsILocalFile.h"
 #include "nsIToolkitChromeRegistry.h"
 #include "nsIToolkitProfile.h"
 
 #include "nsAppDirectoryServiceDefs.h"
@@ -59,16 +53,23 @@
 #include "nsAutoRef.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsStaticComponents.h"
 #include "nsString.h"
 #include "nsThreadUtils.h"
 #include "nsWidgetsCID.h"
 #include "nsXREDirProvider.h"
 
+#ifdef MOZ_IPC
+#include "base/at_exit.h"
+#include "base/command_line.h"
+#include "base/message_loop.h"
+#include "base/thread.h"
+#include "chrome/common/child_process.h"
+
 #include "mozilla/ipc/GeckoChildProcessHost.h"
 #include "mozilla/ipc/GeckoThread.h"
 #include "ScopedXREEmbed.h"
 
 #include "mozilla/plugins/PluginThreadChild.h"
 #include "TabThread.h"
 
 #include "mozilla/ipc/TestShellParent.h"
@@ -91,16 +92,17 @@ using mozilla::ipc::TestShellThread;
 using mozilla::ipc::XPCShellEnvironment;
 
 using mozilla::test::TestParent;
 using mozilla::test::TestProcessParent;
 using mozilla::test::TestThreadChild;
 
 using mozilla::Monitor;
 using mozilla::MonitorAutoEnter;
+#endif
 
 static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
 
 void
 XRE_GetStaticComponents(nsStaticModuleInfo const **aStaticComponents,
                         PRUint32 *aComponentCount)
 {
   *aStaticComponents = kPStaticModules;
@@ -224,16 +226,17 @@ XRE_StringToChildProcessType(const char*
        ++i) {
     if (!strcmp(kGeckoChildProcessTypeString[i], aProcessTypeString)) {
       return static_cast<GeckoChildProcessType>(i);
     }
   }
   return GeckoChildProcess_Invalid;
 }
 
+#ifdef MOZ_IPC
 nsresult
 XRE_InitChildProcess(int aArgc,
                      char* aArgv[],
                      GeckoChildProcessType aProcess)
 {
   NS_ENSURE_ARG_MIN(aArgc, 1);
   NS_ENSURE_ARG_POINTER(aArgv);
   NS_ENSURE_ARG_POINTER(aArgv[0]);
@@ -541,8 +544,9 @@ int
 XRE_RunIPCTestHarness(int aArgc, char* aArgv[])
 {
     nsresult rv =
         XRE_InitParentProcess(
             aArgc, aArgv, IPCTestHarnessMain, NULL);
     NS_ENSURE_SUCCESS(rv, 1);
     return 0;
 }
+#endif
--- a/widget/src/xpwidgets/nsBaseAppShell.cpp
+++ b/widget/src/xpwidgets/nsBaseAppShell.cpp
@@ -36,17 +36,19 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsBaseAppShell.h"
 #include "nsThreadUtils.h"
 #include "nsIObserverService.h"
 #include "nsServiceManagerUtils.h"
 
+#ifdef MOZ_IPC
 #include "base/message_loop.h"
+#endif
 
 // When processing the next thread event, the appshell may process native
 // events (if not in performance mode), which can result in suppressing the
 // next thread event for at most this many ticks:
 #define THREAD_EVENT_STARVATION_LIMIT PR_MillisecondsToInterval(20)
 
 NS_IMPL_THREADSAFE_ISUPPORTS3(nsBaseAppShell, nsIAppShell, nsIThreadObserver,
                               nsIObserver)
@@ -161,30 +163,39 @@ nsBaseAppShell::DoProcessNextNativeEvent
 // nsIAppShell methods:
 
 NS_IMETHODIMP
 nsBaseAppShell::Run(void)
 {
   NS_ENSURE_STATE(!mRunning);  // should not call Run twice
   mRunning = PR_TRUE;
 
-  MessageLoop::current()->Run();
+  nsIThread *thread = NS_GetCurrentThread();
 
-  NS_ProcessPendingEvents(NS_GetCurrentThread());
+#ifdef MOZ_IPC
+  MessageLoop::current()->Run();
+#else
+  while (!mExiting)
+    NS_ProcessNextEvent(thread);
+#endif
+
+  NS_ProcessPendingEvents(thread);
 
   mRunning = PR_FALSE;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBaseAppShell::Exit(void)
 {
+#ifdef MOZ_IPC
   if (mRunning && !mExiting) {
     MessageLoop::current()->Quit();
   }
+#endif
   mExiting = PR_TRUE;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBaseAppShell::FavorPerformanceHint(PRBool favorPerfOverStarvation,
                                      PRUint32 starvationDelay)
 {
--- a/xpcom/build/nsXULAppAPI.h
+++ b/xpcom/build/nsXULAppAPI.h
@@ -413,17 +413,16 @@ XRE_API(nsresult,
                            nsXREAppData *aAppData))
 
 /**
  * Free a nsXREAppData structure that was allocated with XRE_CreateAppData.
  */
 XRE_API(void,
         XRE_FreeAppData, (nsXREAppData *aAppData))
 
-
 enum GeckoChildProcessType {
   GeckoChildProcess_Default,
 
   GeckoChildProcess_Plugin,
   GeckoChildProcess_Tab,
 
   GeckoChildProcess_TestHarness,
   GeckoChildProcess_TestShell,