--- dom/plugins/base/nsNPAPIPlugin.cpp	2011-08-11 17:40:55.000000000 -0400
+++ dom/plugins/base/nsNPAPIPlugin.cpp	2011-08-16 09:43:33.000000000 -0400
@@ -76,17 +76,17 @@ 
 #include "nsIPrincipal.h"
 #include "nsWildCard.h"
 
 #include "nsIXPConnect.h"
 
 #include "nsIObserverService.h"
 #include <prinrval.h>
 
-#ifdef XP_MACOSX
+#ifdef MOZ_WIDGET_COCOA
 #include <Carbon/Carbon.h>
 #include <ApplicationServices/ApplicationServices.h>
 #include <OpenGL/OpenGL.h>
 #endif
 
 // needed for nppdf plugin
 #ifdef MOZ_WIDGET_GTK2
 #include <gdk/gdk.h>
--- dom/plugins/ipc/PluginInstanceChild.cpp	2011-08-11 17:40:55.000000000 -0400
+++ dom/plugins/ipc/PluginInstanceChild.cpp	2011-08-16 10:18:22.000000000 -0400
@@ -123,17 +123,17 @@ 
     , mPluginWndProc(0)
     , mPluginParentHWND(0)
     , mCachedWinlessPluginHWND(0)
     , mWinlessPopupSurrogateHWND(0)
     , mWinlessThrottleOldWndProc(0)
     , mWinlessHiddenMsgHWND(0)
 #endif // OS_WIN
     , mAsyncCallMutex("PluginInstanceChild::mAsyncCallMutex")
-#if defined(OS_MACOSX)
+#if defined(MOZ_WIDGET_COCOA)
 #if defined(__i386__)
     , mEventModel(NPEventModelCarbon)
 #endif
     , mShColorSpace(nsnull)
     , mShContext(nsnull)
     , mDrawingModel(NPDrawingModelCoreGraphics)
     , mCurrentEvent(nsnull)
 #endif
@@ -171,17 +171,17 @@ 
 #endif // OS_WIN
 }
 
 PluginInstanceChild::~PluginInstanceChild()
 {
 #if defined(OS_WIN)
     NS_ASSERTION(!mPluginWindowHWND, "Destroying PluginInstanceChild without NPP_Destroy?");
 #endif
-#if defined(OS_MACOSX)
+#if defined(MOZ_WIDGET_COCOA)
     if (mShColorSpace) {
         ::CGColorSpaceRelease(mShColorSpace);
     }
     if (mShContext) {
         ::CGContextRelease(mShContext);
     }
 #endif
 }
--- dom/plugins/ipc/PluginInstanceChild.h	2011-08-11 17:40:55.000000000 -0400
+++ dom/plugins/ipc/PluginInstanceChild.h	2011-08-16 10:12:11.000000000 -0400
@@ -40,17 +40,17 @@ 
 #define dom_plugins_PluginInstanceChild_h 1
 
 #include "mozilla/plugins/PPluginInstanceChild.h"
 #include "mozilla/plugins/PluginScriptableObjectChild.h"
 #include "mozilla/plugins/StreamNotifyChild.h"
 #include "mozilla/plugins/PPluginSurfaceChild.h"
 #if defined(OS_WIN)
 #include "mozilla/gfx/SharedDIBWin.h"
-#elif defined(OS_MACOSX)
+#elif defined(MOZ_WIDGET_COCOA)
 #include "nsCoreAnimationSupport.h"
 #include "base/timer.h"
 #endif
 
 #include "npfunctions.h"
 #include "nsAutoPtr.h"
 #include "nsTArray.h"
 #include "ChildAsyncCall.h"
@@ -402,17 +402,17 @@ 
     };
     gfx::SharedDIBWin mSharedSurfaceDib;
     struct {
       PRUint16        doublePass;
       HDC             hdc;
       HBITMAP         bmp;
     } mAlphaExtract;
 #endif // defined(OS_WIN)
-#if defined(OS_MACOSX)
+#if defined(MOZ_WIDGET_COCOA)
 private:
 #if defined(__i386__)
     NPEventModel          mEventModel;
 #endif
     CGColorSpaceRef       mShColorSpace;
     CGContextRef          mShContext;
     int16_t               mDrawingModel;
     nsCARenderer          mCARenderer;
--- dom/plugins/ipc/PluginInstanceParent.cpp	2011-08-11 17:40:55.000000000 -0400
+++ dom/plugins/ipc/PluginInstanceParent.cpp	2011-08-16 10:20:36.000000000 -0400
@@ -126,17 +126,17 @@ 
 {
     if (mNPP)
         mNPP->pdata = NULL;
 
 #if defined(OS_WIN)
     NS_ASSERTION(!(mPluginHWND || mPluginWndProc),
         "Subclass was not reset correctly before the dtor was reached!");
 #endif
-#if defined(OS_MACOSX)
+#if defined(MOZ_WIDGET_COCOA)
     if (mShWidth != 0 && mShHeight != 0) {
         DeallocShmem(mShSurface);
     }
     if (mShColorSpace)
         ::CGColorSpaceRelease(mShColorSpace);
     delete mIOSurface;
     if (mDrawingModel == NPDrawingModelCoreAnimation) {
         mParent->RemoveFromRefreshTimer(this);
@@ -1762,16 +1762,16 @@ 
     ::SendMessage(mPluginHWND, gOOPPPluginFocusEvent, gotFocus ? 1 : 0, 0);
     return true;
 #else
     NS_NOTREACHED("PluginInstanceParent::AnswerPluginFocusChange not implemented!");
     return false;
 #endif
 }
 
-#ifdef OS_MACOSX
+#ifdef MOZ_WIDGET_COCOA
 void
 PluginInstanceParent::Invalidate()
 {
     NPRect windowRect = {0, 0, mShHeight, mShWidth};
     RecvNPN_InvalidateRect(windowRect);
 }
 #endif
--- dom/plugins/ipc/PluginInstanceParent.h	2011-08-11 17:40:55.000000000 -0400
+++ dom/plugins/ipc/PluginInstanceParent.h	2011-08-16 10:07:11.000000000 -0400
@@ -38,17 +38,17 @@ 
 
 #ifndef dom_plugins_PluginInstanceParent_h
 #define dom_plugins_PluginInstanceParent_h 1
 
 #include "mozilla/plugins/PPluginInstanceParent.h"
 #include "mozilla/plugins/PluginScriptableObjectParent.h"
 #if defined(OS_WIN)
 #include "mozilla/gfx/SharedDIBWin.h"
-#elif defined(OS_MACOSX)
+#elif defined(MOZ_WIDGET_COCOA)
 #include "nsCoreAnimationSupport.h"
 #endif
 
 #include "npfunctions.h"
 #include "nsAutoPtr.h"
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
 #include "nsRect.h"
@@ -270,19 +270,19 @@ 
     GetNPP()
     {
       return mNPP;
     }
 
     virtual bool
     AnswerPluginFocusChange(const bool& gotFocus);
 
-#if defined(OS_MACOSX)
+#if defined(MOZ_WIDGET_COCOA)
     void Invalidate();
-#endif // definied(OS_MACOSX)
+#endif // definied(MOZ_WIDGET_COCOA)
 
     nsresult AsyncSetWindow(NPWindow* window);
     nsresult GetImage(mozilla::layers::ImageContainer* aContainer, mozilla::layers::Image** aImage);
     nsresult GetImageSize(nsIntSize* aSize);
 #ifdef XP_MACOSX
     nsresult IsRemoteDrawingCoreAnimation(PRBool *aDrawing);
 #endif
     nsresult SetBackgroundUnknown();
@@ -345,25 +345,25 @@ 
 private:
     gfx::SharedDIBWin  mSharedSurfaceDib;
     nsIntRect          mPluginPort;
     nsIntRect          mSharedSize;
     HWND               mPluginHWND;
     WNDPROC            mPluginWndProc;
     bool               mNestedEventState;
 #endif // defined(XP_WIN)
-#if defined(OS_MACOSX)
+#if defined(MOZ_WIDGET_COCOA)
 private:
     Shmem              mShSurface; 
     size_t             mShWidth;
     size_t             mShHeight;
     CGColorSpaceRef    mShColorSpace;
     int16_t            mDrawingModel;
     nsIOSurface       *mIOSurface;
-#endif // definied(OS_MACOSX)
+#endif // definied(MOZ_WIDGET_COCOA)
 
     // ObjectFrame layer wrapper
     nsRefPtr<gfxASurface>    mFrontSurface;
     // For windowless+transparent instances, this surface contains a
     // "pretty recent" copy of the pixels under its <object> frame.
     // On the plugin side, we use this surface to avoid doing alpha
     // recovery when possible.  This surface is created and owned by
     // the browser, but a "read-only" reference is sent to the plugin.
--- dom/plugins/ipc/PluginModuleChild.cpp	2011-08-11 17:40:55.000000000 -0400
+++ dom/plugins/ipc/PluginModuleChild.cpp	2011-08-16 10:24:51.000000000 -0400
@@ -68,17 +68,17 @@ 
 
 #include "nsNPAPIPlugin.h"
 
 #ifdef XP_WIN
 #include "COMMessageFilter.h"
 #include "nsWindowsDllInterceptor.h"
 #endif
 
-#ifdef OS_MACOSX
+#ifdef MOZ_WIDGET_COCOA
 #include "PluginInterposeOSX.h"
 #include "PluginUtilsOSX.h"
 #endif
 
 using namespace mozilla::plugins;
 
 #if defined(XP_WIN)
 const PRUnichar * kFlashFullscreenClass = L"ShockwaveFlashFullScreen";
@@ -1636,17 +1636,17 @@ 
 #endif
 
 NPError NP_CALLBACK
 _popupcontextmenu(NPP instance, NPMenu* menu)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     AssertPluginThread();
 
-#ifdef OS_MACOSX
+#ifdef MOZ_WIDGET_COCOA
     double pluginX, pluginY; 
     double screenX, screenY;
 
     const NPCocoaEvent* currentEvent = InstCast(instance)->getCurrentEvent();
     if (!currentEvent) {
         return NPERR_GENERIC_ERROR;
     }
 
@@ -2305,14 +2305,14 @@ 
     return true;
 #else
     NS_RUNTIMEABORT(
         "PluginModuleChild::RecvProcessNativeEventsInRPCCall not implemented!");
     return false;
 #endif
 }
 
-#ifdef OS_MACOSX
+#ifdef MOZ_WIDGET_COCOA
 void
 PluginModuleChild::ProcessNativeEvents() {
     CallProcessSomeEvents();    
 }
 #endif
--- dom/plugins/ipc/PluginModuleChild.h	2011-08-11 17:40:55.000000000 -0400
+++ dom/plugins/ipc/PluginModuleChild.h	2011-08-16 10:16:25.000000000 -0400
@@ -50,17 +50,17 @@ 
 #include "npapi.h"
 #include "npfunctions.h"
 
 #include "nsAutoPtr.h"
 #include "nsDataHashtable.h"
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
 
-#ifdef OS_MACOSX
+#ifdef MOZ_WIDGET_COCOA
 #include "PluginInterposeOSX.h"
 #endif
 
 #include "mozilla/plugins/PPluginModuleChild.h"
 #include "mozilla/plugins/PluginInstanceChild.h"
 #include "mozilla/plugins/PluginIdentifierChild.h"
 
 // NOTE: stolen from nsNPAPIPlugin.h
@@ -213,17 +213,17 @@ 
     static void NP_CALLBACK NPN_GetStringIdentifiers(const NPUTF8** aNames,
                                                      int32_t aNameCount,
                                                      NPIdentifier* aIdentifiers);
     static NPIdentifier NP_CALLBACK NPN_GetIntIdentifier(int32_t aIntId);
     static bool NP_CALLBACK NPN_IdentifierIsString(NPIdentifier aIdentifier);
     static NPUTF8* NP_CALLBACK NPN_UTF8FromIdentifier(NPIdentifier aIdentifier);
     static int32_t NP_CALLBACK NPN_IntFromIdentifier(NPIdentifier aIdentifier);
 
-#ifdef OS_MACOSX
+#ifdef MOZ_WIDGET_COCOA
     void ProcessNativeEvents();
     
     void PluginShowWindow(uint32_t window_id, bool modal, CGRect r) {
         SendPluginShowWindow(window_id, modal, r.origin.x, r.origin.y, r.size.width, r.size.height);
     }
 
     void PluginHideWindow(uint32_t window_id) {
         SendPluginHideWindow(window_id);
--- dom/plugins/ipc/PluginModuleParent.cpp	2011-08-11 17:40:55.000000000 -0400
+++ dom/plugins/ipc/PluginModuleParent.cpp	2011-08-16 10:55:23.000000000 -0400
@@ -1131,19 +1131,21 @@ 
 #ifdef OS_MACOSX
 #define DEFAULT_REFRESH_MS 20 // CoreAnimation: 50 FPS
 
 void
 CAUpdate(nsITimer *aTimer, void *aClosure) {
     nsTObserverArray<PluginInstanceParent*> *ips =
         static_cast<nsTObserverArray<PluginInstanceParent*> *>(aClosure);
     nsTObserverArray<PluginInstanceParent*>::ForwardIterator iter(*ips);
+#ifdef MOZ_WIDGET_COCOA
     while (iter.HasMore()) {
         iter.GetNext()->Invalidate();
     }
+#endif // MOZ_WIDGET_COCOA
 }
 
 void
 PluginModuleParent::AddToRefreshTimer(PluginInstanceParent *aInstance) {
     if (mCATimerTargets.Contains(aInstance)) {
         return;
     }
 
--- toolkit/library/Makefile.in	
+++ toolkit/library/Makefile.in	
@@ -189,16 +189,19 @@ endif
 
 ifeq ($(OS_ARCH),Darwin)
 ifdef MOZ_SYDNEYAUDIO
 EXTRA_DSO_LDOPTS += \
 	-framework Carbon \
 	-framework CoreAudio \
 	-framework AudioToolbox \
 	-framework AudioUnit \
+	-framework IOKit \
+	-framework Foundation \
+	-framework AppKit \
 	$(NULL)
 endif
 endif
 
 ifneq (,$(filter GNU GNU_% NetBSD OpenBSD,$(OS_ARCH)))
 ifdef MOZ_SYDNEYAUDIO
 EXTRA_DSO_LDOPTS += -lossaudio
 endif
