Backout de697e323b39, b778d551c9e5, and 4b9414cba94d (bug 544088) due to build bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 12 Jul 2012 19:52:15 -0400
changeset 99138 23c4021f728cdc72b8a4eda17d3ac8a54fee8462
parent 99137 a8e4b5602618b66e6542a22de798806962111379
child 99139 70a11a81d2c5bb64759a26ff81331ac90aaff115
push id23105
push useremorley@mozilla.com
push dateFri, 13 Jul 2012 12:23:43 +0000
treeherdermozilla-central@a2d40b91eea9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs544088
milestone16.0a1
backs outde697e323b394b9e9d346003db7288b97a6d89b4
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout de697e323b39, b778d551c9e5, and 4b9414cba94d (bug 544088) due to build bustage.
dom/plugins/base/PluginPRLibrary.h
dom/plugins/base/nsNPAPIPluginInstance.cpp
dom/plugins/base/nsPluginNativeWindowGtk2.cpp
dom/plugins/ipc/PluginInstanceChild.cpp
dom/plugins/ipc/PluginInstanceChild.h
dom/plugins/ipc/PluginLibrary.h
dom/plugins/ipc/PluginModuleChild.cpp
dom/plugins/ipc/PluginModuleParent.h
widget/gtk2/nsWindow.cpp
widget/gtkxtbin/gtk2xtbin.c
widget/gtkxtbin/gtk2xtbin.h
--- a/dom/plugins/base/PluginPRLibrary.h
+++ b/dom/plugins/base/PluginPRLibrary.h
@@ -107,17 +107,17 @@ public:
 
     virtual nsresult NPP_ClearSiteData(const char* site, uint64_t flags,
                                        uint64_t maxAge);
     virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& result);
 
     virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
     virtual nsresult GetImageContainer(NPP instance, ImageContainer** aContainer);
     virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
-    NS_OVERRIDE virtual bool IsOOP() { return false; }
+    NS_OVERRIDE virtual bool UseAsyncPainting() { return false; }
 #if defined(XP_MACOSX)
     virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing);
 #endif
     NS_OVERRIDE
     virtual nsresult SetBackgroundUnknown(NPP instance);
     NS_OVERRIDE
     virtual nsresult BeginUpdateBackground(NPP instance,
                                            const nsIntRect&, gfxContext** aCtx);
--- a/dom/plugins/base/nsNPAPIPluginInstance.cpp
+++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp
@@ -987,17 +987,17 @@ nsNPAPIPluginInstance::UseAsyncPainting(
     *aIsAsync = mUsePluginLayersPref;
     return NS_OK;
   }
 
   AutoPluginLibraryCall library(this);
   if (!library)
     return NS_ERROR_FAILURE;
 
-  *aIsAsync = library->IsOOP();
+  *aIsAsync = library->UseAsyncPainting();
   return NS_OK;
 }
 
 nsresult
 nsNPAPIPluginInstance::SetBackgroundUnknown()
 {
   if (RUNNING != mRunning)
     return NS_OK;
--- a/dom/plugins/base/nsPluginNativeWindowGtk2.cpp
+++ b/dom/plugins/base/nsPluginNativeWindowGtk2.cpp
@@ -6,17 +6,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  *  This file is the Gtk2 implementation of plugin native window.
  */
 
 #include "nsDebug.h"
 #include "nsPluginNativeWindow.h"
-#include "nsNPAPIPlugin.h"
 #include "npapi.h"
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 #include <gdk/gdk.h>
 
 #include "gtk2compat.h"
 #include "gtk2xtbin.h"
 
@@ -28,17 +27,17 @@ public:
   virtual nsresult CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance);
 private:
   NPSetWindowCallbackStruct mWsInfo;
   /**
    * Either a GtkSocket or a special GtkXtBin widget (derived from GtkSocket)
    * that encapsulates the Xt toolkit within a Gtk Application.
    */
   GtkWidget* mSocketWidget;
-  nsresult  CreateXEmbedWindow(bool aEnableXtFocus);
+  nsresult  CreateXEmbedWindow();
   nsresult  CreateXtWindow();
   void      SetAllocation();
 };
 
 static gboolean plug_removed_cb   (GtkWidget *widget, gpointer data);
 static void socket_unrealize_cb   (GtkWidget *widget, gpointer data);
 
 nsPluginNativeWindowGtk2::nsPluginNativeWindowGtk2() : nsPluginNativeWindow()
@@ -101,20 +100,18 @@ nsresult nsPluginNativeWindowGtk2::CallS
         // If the call returned an error code make sure we still use our default value.
         if (NS_FAILED(rv)) {
           needsXEmbed = 0;
         }
 #ifdef DEBUG
         printf("nsPluginNativeWindowGtk2: NPPVpluginNeedsXEmbed=%d\n", needsXEmbed);
 #endif
 
-        bool isOOPPlugin = aPluginInstance->GetPlugin()->GetLibrary()->IsOOP();
-        if (needsXEmbed || isOOPPlugin) {        
-          bool enableXtFocus = !needsXEmbed;
-          rv = CreateXEmbedWindow(enableXtFocus);
+        if (needsXEmbed) {
+          rv = CreateXEmbedWindow();
         }
         else {
           rv = CreateXtWindow();
         }
 
         if (NS_FAILED(rv)) {
           return NS_ERROR_FAILURE;
         }
@@ -127,46 +124,42 @@ nsresult nsPluginNativeWindowGtk2::CallS
       // Make sure to resize and re-place the window if required.
       // Need to reset "window" each time as nsObjectFrame::DidReflow sets it
       // to the ancestor window.
       if (GTK_IS_XTBIN(mSocketWidget)) {
         gtk_xtbin_resize(mSocketWidget, width, height);
         // Point the NPWindow structures window to the actual X window
         window = (void*)GTK_XTBIN(mSocketWidget)->xtwindow;
       }
-      else { // XEmbed or OOP&Xt
+      else { // XEmbed
         SetAllocation();
         window = (void*)gtk_socket_get_id(GTK_SOCKET(mSocketWidget));
       }
 #ifdef DEBUG
       printf("nsPluginNativeWindowGtk2: call SetWindow with xid=%p\n", (void *)window);
 #endif
     } // NPWindowTypeWindow
     aPluginInstance->SetWindow(this);
   }
   else if (mPluginInstance)
     mPluginInstance->SetWindow(nsnull);
 
   SetPluginInstance(aPluginInstance);
   return NS_OK;
 }
 
-nsresult nsPluginNativeWindowGtk2::CreateXEmbedWindow(bool aEnableXtFocus) {
+nsresult nsPluginNativeWindowGtk2::CreateXEmbedWindow() {
   NS_ASSERTION(!mSocketWidget,"Already created a socket widget!");
   GdkDisplay *display = gdk_display_get_default();
   GdkWindow *parent_win = gdk_x11_window_lookup_for_display(display, (XID)window);
   mSocketWidget = gtk_socket_new();
 
   //attach the socket to the container widget
   gtk_widget_set_parent_window(mSocketWidget, parent_win);
 
-  // enable/disable focus event handlers,
-  // see plugin_window_filter_func() for details
-  g_object_set_data(G_OBJECT(mSocketWidget), "enable-xt-focus", (void *)aEnableXtFocus);
-
   // Make sure to handle the plug_removed signal.  If we don't the
   // socket will automatically be destroyed when the plug is
   // removed, which means we're destroying it more than once.
   // SYNTAX ERROR.
   g_signal_connect(mSocketWidget, "plug_removed",
                    G_CALLBACK(plug_removed_cb), NULL);
 
   g_signal_connect(mSocketWidget, "unrealize",
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -103,19 +103,16 @@ struct RunnableMethodTraits<PluginInstan
 PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface)
     : mPluginIface(aPluginIface)
     , mDrawingModel(kDefaultDrawingModel)
     , mCurrentAsyncSurface(0)
     , mAsyncInvalidateMutex("PluginInstanceChild::mAsyncInvalidateMutex")
     , mAsyncInvalidateTask(0)
     , mCachedWindowActor(nsnull)
     , mCachedElementActor(nsnull)
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
-    , mXEmbed(false)
-#endif // MOZ_X11 && XP_UNIX && !XP_MACOSX
 #if defined(OS_WIN)
     , mPluginWindowHWND(0)
     , mPluginWndProc(0)
     , mPluginParentHWND(0)
     , mCachedWinlessPluginHWND(0)
     , mWinlessPopupSurrogateHWND(0)
     , mWinlessThrottleOldWndProc(0)
     , mWinlessHiddenMsgHWND(0)
@@ -144,25 +141,23 @@ PluginInstanceChild::PluginInstanceChild
     , mDoAlphaExtraction(false)
     , mHasPainted(false)
     , mSurfaceDifferenceRect(0,0,0,0)
 #if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)
     , mMaemoImageRendering(true)
 #endif
 {
     memset(&mWindow, 0, sizeof(mWindow));
-    mWindow.type = NPWindowTypeWindow;
     mData.ndata = (void*) this;
     mData.pdata = nsnull;
     mAsyncBitmaps.Init();
 #if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
     mWindow.ws_info = &mWsInfo;
     memset(&mWsInfo, 0, sizeof(mWsInfo));
-    mWsInfo.display = NULL;
-    mXtClient.top_widget = NULL;
+    mWsInfo.display = DefaultXDisplay();
 #endif // MOZ_X11 && XP_UNIX && !XP_MACOSX
 #if defined(OS_WIN)
     memset(&mAlphaExtract, 0, sizeof(mAlphaExtract));
 #endif // OS_WIN
 #if defined(OS_WIN)
     InitPopupMenuHook();
 #endif // OS_WIN
 }
@@ -306,25 +301,16 @@ PluginInstanceChild::NPN_GetValue(NPNVar
     case NPNVSupportsXEmbedBool:
         *((NPBool*)aValue) = true;
         return NPERR_NO_ERROR;
 
     case NPNVToolkit:
         *((NPNToolkitType*)aValue) = NPNVGtk2;
         return NPERR_NO_ERROR;
 
-    case NPNVxDisplay:
-        if (!mWsInfo.display) {
-            // We are called before Initialize() so we have to call it now.
-           Initialize();
-           NS_ASSERTION(mWsInfo.display, "We should have a valid display!");
-        }
-        *(void **)aValue = mWsInfo.display;
-        return NPERR_NO_ERROR;
-    
 #elif defined(OS_WIN)
     case NPNVToolkit:
         return NPERR_GENERIC_ERROR;
 #endif
     case NPNVjavascriptEnabledBool: {
         bool v = false;
         NPError result;
         if (!CallNPN_GetValue_NPNVjavascriptEnabledBool(&v, &result)) {
@@ -501,29 +487,16 @@ PluginInstanceChild::NPN_SetValue(NPPVar
     switch (aVar) {
     case NPPVpluginWindowBool: {
         NPError rv;
         bool windowed = (NPBool) (intptr_t) aValue;
 
         if (!CallNPN_SetValue_NPPVpluginWindow(windowed, &rv))
             return NPERR_GENERIC_ERROR;
 
-        NPWindowType newWindowType = windowed ? NPWindowTypeWindow : NPWindowTypeDrawable;
-        if (mWindow.type != newWindowType && mWsInfo.display) {
-           // plugin type has been changed but we already have a valid display
-           // so update it for the recent plugin mode
-           if (mXEmbed || !windowed) {
-               // Use default GTK display for XEmbed and windowless plugins
-               mWsInfo.display = DefaultXDisplay();
-           }
-           else {
-               mWsInfo.display = xt_client_get_display();
-           }
-        }
-        mWindow.type = newWindowType;
         return rv;
     }
 
     case NPPVpluginTransparentBool: {
         NPError rv;
         mIsTransparent = (!!aValue);
 
         if (!CallNPN_SetValue_NPPVpluginTransparent(mIsTransparent, &rv))
@@ -997,98 +970,47 @@ PluginInstanceChild::RecvWindowPosChange
     int16_t dontcare;
     return AnswerNPP_HandleEvent(event, &dontcare);
 #else
     NS_RUNTIMEABORT("WindowPosChanged is a windows-only message");
     return false;
 #endif
 }
 
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
-// Create a new window from NPWindow
-bool PluginInstanceChild::CreateWindow(const NPRemoteWindow& aWindow)
-{ 
-    PLUGIN_LOG_DEBUG(("%s (aWindow=<window: 0x%lx, x: %d, y: %d, width: %d, height: %d>)",
-                      FULLFUNCTION,
-                      aWindow.window,
-                      aWindow.x, aWindow.y,
-                      aWindow.width, aWindow.height));
-
-    if (mXEmbed) {
-        mWindow.window = reinterpret_cast<void*>(aWindow.window);
-    }
-    else {
-        Window browserSocket = (Window)(aWindow.window);
-        xt_client_init(&mXtClient, mWsInfo.visual, mWsInfo.colormap, mWsInfo.depth);
-        xt_client_create(&mXtClient, browserSocket, mWindow.width, mWindow.height); 
-        mWindow.window = (void *)XtWindow(mXtClient.child_widget);
-    }  
-
-    return true;
-}
-
-// Destroy window
-void PluginInstanceChild::DeleteWindow()
-{
-  PLUGIN_LOG_DEBUG(("%s (aWindow=<window: 0x%lx, x: %d, y: %d, width: %d, height: %d>)",
-                    FULLFUNCTION,
-                    mWindow.window,
-                    mWindow.x, mWindow.y,
-                    mWindow.width, mWindow.height));
-
-  if (!mWindow.window)
-      return;
-
-  if (mXtClient.top_widget) {     
-      xt_client_unrealize(&mXtClient);
-      xt_client_destroy(&mXtClient); 
-      mXtClient.top_widget = NULL;
-  }
-
-  // We don't have to keep the plug-in window ID any longer.
-  mWindow.window = nsnull;
-}
-#endif
-
 bool
 PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
 {
     PLUGIN_LOG_DEBUG(("%s (aWindow=<window: 0x%lx, x: %d, y: %d, width: %d, height: %d>)",
                       FULLFUNCTION,
                       aWindow.window,
                       aWindow.x, aWindow.y,
                       aWindow.width, aWindow.height));
     NS_ASSERTION(!mLayersRendering && !mPendingPluginCall,
                  "Shouldn't be receiving NPP_SetWindow with layer rendering");
     AssertPluginThread();
 
 #if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
-    NS_ASSERTION(mWsInfo.display, "We should have a valid display!");
-
     // The minimum info is sent over IPC to allow this
     // code to determine the rest.
 
+    mWindow.window = reinterpret_cast<void*>(aWindow.window);
     mWindow.x = aWindow.x;
     mWindow.y = aWindow.y;
     mWindow.width = aWindow.width;
     mWindow.height = aWindow.height;
     mWindow.clipRect = aWindow.clipRect;
     mWindow.type = aWindow.type;
 
     mWsInfo.colormap = aWindow.colormap;
     if (!XVisualIDToInfo(mWsInfo.display, aWindow.visualID,
                          &mWsInfo.visual, &mWsInfo.depth))
         return false;
 
-    if (!mWindow.window && mWindow.type == NPWindowTypeWindow) {
-        CreateWindow(aWindow);
-    }
-
 #ifdef MOZ_WIDGET_GTK2
-    if (mXEmbed && gtk_check_version(2,18,7) != NULL) { // older
+    if (gtk_check_version(2,18,7) != NULL) { // older
         if (aWindow.type == NPWindowTypeWindow) {
             GdkWindow* socket_window = gdk_window_lookup(static_cast<GdkNativeWindow>(aWindow.window));
             if (socket_window) {
                 // A GdkWindow for the socket already exists.  Need to
                 // workaround https://bugzilla.gnome.org/show_bug.cgi?id=607061
                 // See wrap_gtk_plug_embedded in PluginModuleChild.cpp.
                 g_object_set_data(G_OBJECT(socket_window),
                                   "moz-existed-before-set-window",
@@ -1209,43 +1131,16 @@ PluginInstanceChild::AnswerNPP_SetWindow
 #endif
 
     return true;
 }
 
 bool
 PluginInstanceChild::Initialize()
 {
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
-    NPError rv;
-
-    if (mWsInfo.display) {
-        // Already initialized
-        return false;
-    }
-
-    // Request for windowless plugins is set in newp(), before this call.
-    if (mWindow.type == NPWindowTypeWindow) {
-        AnswerNPP_GetValue_NPPVpluginNeedsXEmbed(&mXEmbed, &rv);
-
-        // Set up Xt loop for windowed plugins without XEmbed support
-        if (!mXEmbed) {
-           xt_client_xloop_create();
-        }
-    }
-
-    // Use default GTK display for XEmbed and windowless plugins
-    if (mXEmbed || mWindow.type != NPWindowTypeWindow) {
-        mWsInfo.display = DefaultXDisplay();
-    }
-    else {
-        mWsInfo.display = xt_client_get_display();
-    }
-#endif 
-
     return true;
 }
 
 #if defined(OS_WIN)
 
 static const TCHAR kWindowClassName[] = TEXT("GeckoPluginWindow");
 static const TCHAR kPluginInstanceChildProperty[] = TEXT("PluginInstanceChildProperty");
 static const TCHAR kFlashThrottleProperty[] = TEXT("MozillaFlashThrottleProperty");
@@ -4096,17 +3991,10 @@ PluginInstanceChild::AnswerNPP_Destroy(N
 
     mPendingAsyncCalls.Clear();
     
     if (mAsyncBitmaps.Count()) {
         NS_ERROR("Not all AsyncBitmaps were finalized by a plugin!");
         mAsyncBitmaps.Enumerate(DeleteSurface, this);
     }
 
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
-    if (mWindow.type == NPWindowTypeWindow && !mXEmbed) {
-      xt_client_xloop_destroy();
-    }
-    DeleteWindow();
-#endif
-
     return true;
 }
--- a/dom/plugins/ipc/PluginInstanceChild.h
+++ b/dom/plugins/ipc/PluginInstanceChild.h
@@ -30,20 +30,16 @@ using namespace mozilla::plugins::Plugin
 #include "ChildTimer.h"
 #include "nsRect.h"
 #include "nsTHashtable.h"
 #include "mozilla/PaintTracker.h"
 #include "gfxASurface.h"
 
 #include <map>
 
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
-#include "gtk2xtbin.h"
-#endif
-
 namespace mozilla {
 
 namespace layers {
 struct RemoteImageData;
 }
 
 namespace plugins {
 
@@ -188,21 +184,16 @@ protected:
     AnswerSetPluginFocus();
 
     virtual bool
     AnswerUpdateWindow();
 
     virtual bool
     RecvNPP_DidComposite();
 
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
-    bool CreateWindow(const NPRemoteWindow& aWindow);
-    void DeleteWindow();
-#endif
-
 public:
     PluginInstanceChild(const NPPluginFuncs* aPluginIface);
 
     virtual ~PluginInstanceChild();
 
     bool Initialize();
 
     NPP GetNPP()
@@ -379,18 +370,16 @@ private:
     CancelableTask *mAsyncInvalidateTask;
 
     // Cached scriptable actors to avoid IPC churn
     PluginScriptableObjectChild* mCachedWindowActor;
     PluginScriptableObjectChild* mCachedElementActor;
 
 #if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
     NPSetWindowCallbackStruct mWsInfo;
-    bool mXEmbed;
-    XtClient mXtClient;
 #elif defined(OS_WIN)
     HWND mPluginWindowHWND;
     WNDPROC mPluginWndProc;
     HWND mPluginParentHWND;
     int mNestedEventLevelDepth;
     HWND mCachedWinlessPluginHWND;
     HWND mWinlessPopupSurrogateHWND;
     nsIntPoint mPluginSize;
--- a/dom/plugins/ipc/PluginLibrary.h
+++ b/dom/plugins/ipc/PluginLibrary.h
@@ -65,17 +65,17 @@ public:
 
   virtual nsresult NPP_ClearSiteData(const char* site, uint64_t flags,
                                      uint64_t maxAge) = 0;
   virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& aResult) = 0;
 
   virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window) = 0;
   virtual nsresult GetImageContainer(NPP instance, ImageContainer** aContainer) = 0;
   virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0;
-  virtual bool IsOOP() = 0;
+  virtual bool UseAsyncPainting() = 0;
 #if defined(XP_MACOSX)
   virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) = 0;
 #endif
 
   /**
    * The next three methods are the third leg in the trip to
    * PluginInstanceParent.  They approximately follow the ReadbackSink
    * API.
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -1089,29 +1089,17 @@ NPError NP_CALLBACK
         case NPNVSupportsWindowless: { // Intentional fall-through
             NPError result;
             bool value;
             PluginModuleChild::current()->
                 CallNPN_GetValue_WithBoolReturn(aVariable, &result, &value);
             *(NPBool*)aValue = value ? true : false;
             return result;
         }
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
-        case NPNVxDisplay: {
-            if (aNPP) {
-                return InstCast(aNPP)->NPN_GetValue(aVariable, aValue);
-            } 
-            else {
-                *(void **)aValue = xt_client_get_display();
-            }          
-            return NPERR_NO_ERROR;
-        }
-        case NPNVxtAppContext:
-            return NPERR_GENERIC_ERROR;
-#endif
+
         default: {
             if (aNPP) {
                 return InstCast(aNPP)->NPN_GetValue(aVariable, aValue);
             }
 
             NS_WARNING("Null NPP!");
             return NPERR_INVALID_INSTANCE_ERROR;
         }
@@ -1945,17 +1933,23 @@ PluginModuleChild::AllocPPluginInstance(
     if ((mQuirks & QUIRK_FLASH_HOOK_GETWINDOWINFO) &&
         !sGetWindowInfoPtrStub) {
         sUser32Intercept.Init("user32.dll");
         sUser32Intercept.AddHook("GetWindowInfo", reinterpret_cast<intptr_t>(PMCGetWindowInfoHook),
                                  (void**) &sGetWindowInfoPtrStub);
     }
 #endif
 
-    return new PluginInstanceChild(&mFunctions);
+    nsAutoPtr<PluginInstanceChild> childInstance(
+        new PluginInstanceChild(&mFunctions));
+    if (!childInstance->Initialize()) {
+        *rv = NPERR_GENERIC_ERROR;
+        return 0;
+    }
+    return childInstance.forget();
 }
 
 void
 PluginModuleChild::InitQuirksModes(const nsCString& aMimeType)
 {
     if (mQuirks != QUIRKS_NOT_INITIALIZED)
       return;
     mQuirks = 0;
@@ -2038,18 +2032,16 @@ PluginModuleChild::AnswerPPluginInstance
                           argc,
                           argn,
                           argv,
                           0);
     if (NPERR_NO_ERROR != *rv) {
         return true;
     }
 
-    childInstance->Initialize();
-
 #if defined(XP_MACOSX) && defined(__i386__)
     // If an i386 Mac OS X plugin has selected the Carbon event model then
     // we have to fail. We do not support putting Carbon event model plugins
     // out of process. Note that Carbon is the default model so out of process
     // plugins need to actively negotiate something else in order to work
     // out of process.
     if (childInstance->EventModel() == NPEventModelCarbon) {
       // Send notification that a plugin tried to negotiate Carbon NPAPI so that
--- a/dom/plugins/ipc/PluginModuleParent.h
+++ b/dom/plugins/ipc/PluginModuleParent.h
@@ -239,17 +239,17 @@ private:
                                 void *value);
     static void NPP_URLRedirectNotify(NPP instance, const char* url,
                                       int32_t status, void* notifyData);
 
     virtual bool HasRequiredFunctions();
     virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window);
     virtual nsresult GetImageContainer(NPP instance, mozilla::layers::ImageContainer** aContainer);
     virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize);
-    NS_OVERRIDE virtual bool IsOOP() { return true; }
+    NS_OVERRIDE virtual bool UseAsyncPainting() { return true; }
     NS_OVERRIDE
     virtual nsresult SetBackgroundUnknown(NPP instance);
     NS_OVERRIDE
     virtual nsresult BeginUpdateBackground(NPP instance,
                                            const nsIntRect& aRect,
                                            gfxContext** aCtx);
     NS_OVERRIDE
     virtual nsresult EndUpdateBackground(NPP instance,
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -5407,20 +5407,18 @@ plugin_window_filter_func(GdkXEvent *gdk
 #if defined(MOZ_WIDGET_GTK2)
                 if (GTK_IS_XTBIN(widget)) {
                     nswindow->SetPluginType(nsWindow::PluginType_NONXEMBED);
                     break;
                 }
                 else 
 #endif
                 if(GTK_IS_SOCKET(widget)) {
-                    if (!g_object_get_data(G_OBJECT(widget), "enable-xt-focus")) {
-                        nswindow->SetPluginType(nsWindow::PluginType_XEMBED);
-                        break;
-                    }
+                    nswindow->SetPluginType(nsWindow::PluginType_XEMBED);
+                    break;
                 }
             }
             nswindow->SetPluginType(nsWindow::PluginType_NONXEMBED);
             return_val = GDK_FILTER_REMOVE;
             break;
         case EnterNotify:
             nswindow->SetNonXEmbedPluginFocus();
             break;
--- a/widget/gtkxtbin/gtk2xtbin.c
+++ b/widget/gtkxtbin/gtk2xtbin.c
@@ -38,25 +38,40 @@
 static void            gtk_xtbin_class_init (GtkXtBinClass *klass);
 static void            gtk_xtbin_init       (GtkXtBin      *xtbin);
 static void            gtk_xtbin_realize    (GtkWidget      *widget);
 static void            gtk_xtbin_unrealize    (GtkWidget      *widget);
 static void            gtk_xtbin_destroy    (GtkObject      *object);
 static void            gtk_xtbin_shutdown   (GtkObject      *object);
 
 /* Xt aware XEmbed */
+static void       xt_client_init      (XtClient * xtclient, 
+                                       Visual *xtvisual, 
+                                       Colormap xtcolormap, 
+                                       int xtdepth);
+static void       xt_client_create    (XtClient * xtclient, 
+                                       Window embeder, 
+                                       int height, 
+                                       int width );
+static void       xt_client_unrealize (XtClient* xtclient);
+static void       xt_client_destroy   (XtClient* xtclient);
+static void       xt_client_set_info  (Widget xtplug, 
+                                       unsigned long flags);
+static void       xt_client_event_handler (Widget w, 
+                                           XtPointer client_data, 
+                                           XEvent *event);
 static void       xt_client_handle_xembed_message (Widget w, 
                                                    XtPointer client_data, 
                                                    XEvent *event);
+static void       xt_client_focus_listener       (Widget w, 
+                                                   XtPointer user_data, 
+                                                   XEvent *event);
 static void       xt_add_focus_listener( Widget w, XtPointer user_data );
 static void       xt_add_focus_listener_tree ( Widget treeroot, XtPointer user_data); 
 static void       xt_remove_focus_listener(Widget w, XtPointer user_data);
-static void       xt_client_event_handler (Widget w, XtPointer client_data, XEvent *event);
-static void       xt_client_focus_listener (Widget w, XtPointer user_data, XEvent *event);
-static void       xt_client_set_info (Widget xtplug, unsigned long flags);
 static void       send_xembed_message (XtClient *xtclient,
                                        long message, 
                                        long detail, 
                                        long data1, 
                                        long data2,
                                        long time);  
 static int        error_handler       (Display *display, 
                                        XErrorEvent *error);
@@ -289,18 +304,54 @@ gtk_xtbin_new (GdkWindow *parent_window,
      */
 #ifdef DEBUG_XTBIN
     printf("gtk_xtbin_init: XtOpenDisplay() returned NULL.\n");
 #endif
     g_free (xtbin);
     return (GtkWidget *)NULL;
   }
 
-  /* Launch X event loop */
-  xt_client_xloop_create();
+  /* If this is the first running widget, hook this display into the
+     mainloop */
+  if (0 == num_widgets) {
+    int           cnumber;
+    /*
+     * hook Xt event loop into the glib event loop.
+     */
+
+    /* the assumption is that gtk_init has already been called */
+    GSource* gs = g_source_new(&xt_event_funcs, sizeof(GSource));
+      if (!gs) {
+       return NULL;
+      }
+    
+    g_source_set_priority(gs, GDK_PRIORITY_EVENTS);
+    g_source_set_can_recurse(gs, TRUE);
+    tag = g_source_attach(gs, (GMainContext*)NULL);
+#ifdef VMS
+    cnumber = XConnectionNumber(xtdisplay);
+#else
+    cnumber = ConnectionNumber(xtdisplay);
+#endif
+    xt_event_poll_fd.fd = cnumber;
+    xt_event_poll_fd.events = G_IO_IN; 
+    xt_event_poll_fd.revents = 0;    /* hmm... is this correct? */
+
+    g_main_context_add_poll ((GMainContext*)NULL, 
+                             &xt_event_poll_fd, 
+                             G_PRIORITY_LOW);
+    /* add a timer so that we can poll and process Xt timers */
+    xt_polling_timer_id =
+      g_timeout_add(25,
+                    (GtkFunction)xt_event_polling_timer_callback,
+                    xtdisplay);
+  }
+
+  /* Bump up our usage count */
+  num_widgets++;
 
   /* Build the hierachy */
   xtbin->xtdisplay = xtbin->xtclient.xtdisplay;
   gtk_widget_set_parent_window(GTK_WIDGET(xtbin), parent_window);
   gdk_window_get_user_data(xtbin->parent_window, &user_data);
   if (user_data)
     gtk_container_add(GTK_CONTAINER(user_data), GTK_WIDGET(xtbin));
 
@@ -401,29 +452,41 @@ gtk_xtbin_destroy (GtkObject *object)
 
   xtbin = GTK_XTBIN (object);
 
   if(xtbin->xtwindow) {
     /* remove the event handler */
     xt_client_destroy(&(xtbin->xtclient));
     xtbin->xtwindow = 0;
 
-    /* stop X event loop */
-    xt_client_xloop_destroy();
+    num_widgets--; /* reduce our usage count */
+
+    /* If this is the last running widget, remove the Xt display
+       connection from the mainloop */
+    if (0 == num_widgets) {
+#ifdef DEBUG_XTBIN
+      printf("removing the Xt connection from the main loop\n");
+#endif
+      g_main_context_remove_poll((GMainContext*)NULL, &xt_event_poll_fd);
+      g_source_remove(tag);
+
+      g_source_remove(xt_polling_timer_id);
+      xt_polling_timer_id = 0;
+    }
   }
 
   GTK_OBJECT_CLASS(parent_class)->destroy(object);
 }
 
 /*
 * Following is the implementation of Xt XEmbedded for client side
 */
 
 /* Initial Xt plugin */
-void
+static void
 xt_client_init( XtClient * xtclient, 
                 Visual *xtvisual, 
                 Colormap xtcolormap,
                 int xtdepth)
 {
   XtAppContext  app_context;
   char         *mArgv[1];
   int           mArgc = 0;
@@ -453,97 +516,19 @@ xt_client_init( XtClient * xtclient,
       xt_is_initialized = TRUE;
   }
   xtclient->xtdisplay  = xtdisplay;
   xtclient->xtvisual   = xtvisual;
   xtclient->xtcolormap = xtcolormap;
   xtclient->xtdepth    = xtdepth;
 }
 
-void
-xt_client_xloop_create(void)
-{
-  /* If this is the first running widget, hook this display into the
-     mainloop */
-  if (0 == num_widgets) {
-    int           cnumber;
-
-    /* Set up xtdisplay in case we're missing one */
-    if (!xtdisplay) {
-      (void)xt_client_get_display();
-    }
-
-    /*
-     * hook Xt event loop into the glib event loop.
-     */
-    /* the assumption is that gtk_init has already been called */
-    GSource* gs = g_source_new(&xt_event_funcs, sizeof(GSource));
-      if (!gs) {
-       return NULL;
-      }
-    
-    g_source_set_priority(gs, GDK_PRIORITY_EVENTS);
-    g_source_set_can_recurse(gs, TRUE);
-    tag = g_source_attach(gs, (GMainContext*)NULL);
-#ifdef VMS
-    cnumber = XConnectionNumber(xtdisplay);
-#else
-    cnumber = ConnectionNumber(xtdisplay);
-#endif
-    xt_event_poll_fd.fd = cnumber;
-    xt_event_poll_fd.events = G_IO_IN; 
-    xt_event_poll_fd.revents = 0;    /* hmm... is this correct? */
-
-    g_main_context_add_poll ((GMainContext*)NULL, 
-                             &xt_event_poll_fd, 
-                             G_PRIORITY_LOW);
-    /* add a timer so that we can poll and process Xt timers */
-    xt_polling_timer_id =
-      g_timeout_add(25,
-                    (GtkFunction)xt_event_polling_timer_callback,
-                    xtdisplay);
-  }
-
-  /* Bump up our usage count */
-  num_widgets++;
-}
-
-void
-xt_client_xloop_destroy(void)
-{
-  num_widgets--; /* reduce our usage count */
-
-  /* If this is the last running widget, remove the Xt display
-     connection from the mainloop */
-  if (0 == num_widgets) {
-#ifdef DEBUG_XTBIN
-    printf("removing the Xt connection from the main loop\n");
-#endif
-    g_main_context_remove_poll((GMainContext*)NULL, &xt_event_poll_fd);
-    g_source_remove(tag);
-
-    g_source_remove(xt_polling_timer_id);
-    xt_polling_timer_id = 0;
-  }
-}
-
-/* Get Xt Client display */
-Display	*
-xt_client_get_display(void)
-{
-  if (!xtdisplay) {
-    XtClient tmp;
-    xt_client_init(&tmp,NULL,0,0);
-  }
-  return xtdisplay;
-}
-
 /* Create the Xt client widgets
 *  */
-void
+static void
 xt_client_create ( XtClient* xtclient , 
                    Window embedderid, 
                    int height, 
                    int width ) 
 {
   int           n;
   Arg           args[6];
   Widget        child_widget;
@@ -609,17 +594,17 @@ xt_client_create ( XtClient* xtclient ,
   XtAddEventHandler(child_widget, 
                     SubstructureNotifyMask | ButtonReleaseMask, 
                     TRUE, 
                     (XtEventHandler)xt_client_focus_listener, 
                     xtclient);
   XSync(xtclient->xtdisplay, FALSE);
 }
 
-void
+static void
 xt_client_unrealize ( XtClient* xtclient )
 {
 #if XlibSpecificationRelease >= 6
   XtUnregisterDrawable(xtclient->xtdisplay,
                        xtclient->top_widget->core.window);
 #else
   _XtUnregisterWindow(xtclient->top_widget->core.window,
                       xtclient->top_widget);
@@ -628,28 +613,28 @@ xt_client_unrealize ( XtClient* xtclient
   /* flush the queue before we returning origin top_widget->core.window
      or we can get X error since the window is gone */
   XSync(xtclient->xtdisplay, False);
 
   xtclient->top_widget->core.window = xtclient->oldwindow;
   XtUnrealizeWidget(xtclient->top_widget);
 }
 
-void            
+static void            
 xt_client_destroy   (XtClient* xtclient)
 {
   if(xtclient->top_widget) {
     XtRemoveEventHandler(xtclient->child_widget, 0x0FFFFF, TRUE, 
                          (XtEventHandler)xt_client_event_handler, xtclient);
     XtDestroyWidget(xtclient->top_widget);
     xtclient->top_widget = NULL;
   }
 }
 
-void         
+static void         
 xt_client_set_info (Widget xtplug, unsigned long flags)
 {
   unsigned long buffer[2];
 
   Atom infoAtom = XInternAtom(XtDisplay(xtplug), "_XEMBED_INFO", False); 
 
   buffer[1] = 0;                /* Protocol version */
   buffer[1] = flags;
@@ -716,17 +701,17 @@ xt_client_handle_xembed_message(Widget w
       XSync( XtDisplay(xtplug->child_widget), False);
     }
     break;
   default:
     break;
   } /* End of XEmbed Message */
 }
 
-void         
+static void         
 xt_client_event_handler( Widget w, XtPointer client_data, XEvent *event)
 {
   XtClient *xtplug = (XtClient*)client_data;
   
   switch(event->type)
     {
     case ClientMessage:
       /* Handle xembed message */
@@ -816,17 +801,17 @@ untrap_error(void)
   if(trapped_error_code) {
 #ifdef DEBUG_XTBIN
     printf("Get X Window Error = %d\n", trapped_error_code);
 #endif
   }
   return trapped_error_code;
 }
 
-void         
+static void         
 xt_client_focus_listener( Widget w, XtPointer user_data, XEvent *event)
 {
   Display *dpy = XtDisplay(w);
   XtClient *xtclient = user_data;
   Window win = XtWindow(w);
 
   switch(event->type)
     {
--- a/widget/gtkxtbin/gtk2xtbin.h
+++ b/widget/gtkxtbin/gtk2xtbin.h
@@ -115,22 +115,13 @@ typedef struct _CorePart {
     Boolean         visible;            /* is window mapped and not occluded?*/
     Boolean         mapped_when_managed;/* map window if it's managed?       */
 } CorePart;
 
 typedef struct _WidgetRec {
     CorePart    core;
  } WidgetRec, CoreRec;   
 
-/* Exported functions, used by Xt plugins */
-void xt_client_create(XtClient * xtclient, Window embeder, int height, int width);
-void xt_client_unrealize(XtClient* xtclient);
-void xt_client_destroy(XtClient* xtclient);
-void xt_client_init(XtClient * xtclient, Visual *xtvisual, Colormap xtcolormap, int xtdepth);
-void xt_client_xloop_create(void);
-void xt_client_xloop_destroy(void);
-Display * xt_client_get_display(void);
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
 #endif /* __GTK_XTBIN_H__ */