Bug 1338172 part E - make all the PPluginWidget stuff Windows-only. Rip out the GTK-specific native widget support from widget/gtk/nsWindow and elsewhere, r=jimm
☠☠ backed out by 12a0181ef7db ☠ ☠
authorBenjamin Smedberg <benjamin@smedbergs.us>
Thu, 09 Feb 2017 11:53:50 -0500
changeset 389539 9ee6c6f4e59c7967108a727a80e46d686b983a0b
parent 389538 1c92fbfca20a1fc85df7aa617962a80b49869f79
child 389540 5af9888cba809572c65e2091aed456d916c9ec22
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1338172
milestone54.0a1
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
Bug 1338172 part E - make all the PPluginWidget stuff Windows-only. Rip out the GTK-specific native widget support from widget/gtk/nsWindow and elsewhere, r=jimm MozReview-Commit-ID: J6E8sYcyX4U
dom/base/nsFrameLoader.cpp
dom/ipc/PPluginWidget.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
dom/plugins/base/moz.build
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/base/nsPluginNativeWindow.cpp
dom/plugins/base/nsPluginNativeWindowGtk.cpp
dom/plugins/base/nsPluginNativeWindowGtk.h
dom/plugins/ipc/PluginWidgetChild.cpp
dom/plugins/ipc/PluginWidgetChild.h
dom/plugins/ipc/PluginWidgetParent.cpp
dom/plugins/ipc/PluginWidgetParent.h
dom/plugins/ipc/moz.build
widget/PluginWidgetProxy.cpp
widget/PluginWidgetProxy.h
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
widget/moz.build
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -71,18 +71,16 @@
 #include "nsIDOMChromeWindow.h"
 #include "nsInProcessTabChildGlobal.h"
 
 #include "Layers.h"
 #include "ClientLayerManager.h"
 
 #include "ContentParent.h"
 #include "TabParent.h"
-#include "mozilla/plugins/PPluginWidgetParent.h"
-#include "../plugins/ipc/PluginWidgetParent.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/BasePrincipal.h"
 #include "mozilla/GuardObjects.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Unused.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/layout/RenderFrameParent.h"
@@ -97,16 +95,21 @@
 #include "mozilla/dom/ipc/StructuredCloneData.h"
 #include "mozilla/WebBrowserPersistLocalDocument.h"
 #include "mozilla/dom/GroupedHistoryEvent.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/PromiseNativeHandler.h"
 
 #include "nsPrincipal.h"
 
+#ifdef XP_WIN
+#include "mozilla/plugins/PPluginWidgetParent.h"
+#include "../plugins/ipc/PluginWidgetParent.h"
+#endif
+
 #ifdef MOZ_XUL
 #include "nsXULPopupManager.h"
 #endif
 
 #ifdef NS_PRINTING
 #include "mozilla/embedding/printingui/PrintingParent.h"
 #include "nsIWebBrowserPrint.h"
 #endif
@@ -1435,25 +1438,27 @@ nsFrameLoader::SwapWithOtherRemoteLoader
   }
   if (!OwnerIsMozBrowserFrame() && aOther->OwnerIsMozBrowserFrame()) {
     aOther->DestroyBrowserFrameScripts();
   }
 
   aOther->mRemoteBrowser->SetBrowserDOMWindow(browserDOMWindow);
   mRemoteBrowser->SetBrowserDOMWindow(otherBrowserDOMWindow);
 
+#ifdef XP_WIN
   // Native plugin windows used by this remote content need to be reparented.
   if (nsPIDOMWindowOuter* newWin = ourDoc->GetWindow()) {
     RefPtr<nsIWidget> newParent = nsGlobalWindow::Cast(newWin)->GetMainWidget();
     const ManagedContainer<mozilla::plugins::PPluginWidgetParent>& plugins =
       aOther->mRemoteBrowser->ManagedPPluginWidgetParent();
     for (auto iter = plugins.ConstIter(); !iter.Done(); iter.Next()) {
       static_cast<mozilla::plugins::PluginWidgetParent*>(iter.Get()->GetKey())->SetParent(newParent);
     }
   }
+#endif // XP_WIN
 
   MaybeUpdatePrimaryTabParent(eTabParentRemoved);
   aOther->MaybeUpdatePrimaryTabParent(eTabParentRemoved);
 
   SetOwnerContent(otherContent);
   aOther->SetOwnerContent(ourContent);
 
   mRemoteBrowser->SetOwnerElement(otherContent);
--- a/dom/ipc/PPluginWidget.ipdl
+++ b/dom/ipc/PPluginWidget.ipdl
@@ -1,24 +1,24 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
+        /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include protocol PBrowser;
 
 include "mozilla/GfxMessageUtils.h";
 
 using nsIntRect from "nsRect.h";
 
 namespace mozilla {
 namespace plugins {
 
 /**
  * PPluginWidget - a nsIWidget'ish protocol for windowed plugins in e10s.
- * On windows and linux we create native widgets in chrome which we then manage
+ * On windows we create native widgets in chrome which we then manage
  * from content.  On the content side there's PluginWidgetProxy which
  * implements nsIWidget. We hand this around layout and plugins code. Anything
  * not dealt with via PluginWidgetProxy falls through to PuppetWidget. Native
  * widget exists on the chrome side (PluginWidgetParent) attached to the
  * browser window as a child. Window management calls are forwarded from
  * PluginWidgetProxy to PluginWidgetParent over this interface.
  *
  * Note lifetime management for PluginWidgetProxy (the plugin widget) and the
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -15,17 +15,16 @@
 #include "Layers.h"
 #include "ContentChild.h"
 #include "TabParent.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/BrowserElementParent.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h"
-#include "mozilla/plugins/PluginWidgetChild.h"
 #include "mozilla/IMEStateManager.h"
 #include "mozilla/ipc/DocumentRendererChild.h"
 #include "mozilla/ipc/URIUtils.h"
 #include "mozilla/layers/APZChild.h"
 #include "mozilla/layers/APZCCallbackHelper.h"
 #include "mozilla/layers/APZCTreeManager.h"
 #include "mozilla/layers/APZCTreeManagerChild.h"
 #include "mozilla/layers/APZEventState.h"
@@ -34,16 +33,17 @@
 #include "mozilla/layers/DoubleTapToZoom.h"
 #include "mozilla/layers/IAPZCTreeManager.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 #include "mozilla/layers/InputAPZContext.h"
 #include "mozilla/layers/ShadowLayers.h"
 #include "mozilla/layers/WebRenderLayerManager.h"
 #include "mozilla/layout/RenderFrameChild.h"
 #include "mozilla/layout/RenderFrameParent.h"
+#include "mozilla/plugins/PPluginWidgetChild.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/Move.h"
 #include "mozilla/PresShell.h"
 #include "mozilla/ProcessHangMonitor.h"
 #include "mozilla/ScopeExit.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
@@ -118,16 +118,20 @@
 #include "nsISHistory.h"
 #include "nsQueryObject.h"
 #include "GroupedSHistory.h"
 #include "nsIHttpChannel.h"
 #include "mozilla/dom/DocGroup.h"
 #include "nsISupportsPrimitives.h"
 #include "mozilla/Telemetry.h"
 
+#ifdef XP_WIN
+#include "mozilla/plugins/PluginWidgetChild.h"
+#endif
+
 #ifdef NS_PRINTING
 #include "nsIPrintSession.h"
 #include "nsIPrintSettings.h"
 #include "nsIPrintSettingsService.h"
 #include "nsIWebBrowserPrint.h"
 #endif
 
 #define BROWSER_ELEMENT_CHILD_SCRIPT \
@@ -3139,26 +3143,32 @@ TabChild::TakeAwaitingLargeAlloc()
   bool awaiting = mAwaitingLA;
   mAwaitingLA = false;
   return awaiting;
 }
 
 mozilla::plugins::PPluginWidgetChild*
 TabChild::AllocPPluginWidgetChild()
 {
-    return new mozilla::plugins::PluginWidgetChild();
+#ifdef XP_WIN
+  return new mozilla::plugins::PluginWidgetChild();
+#else
+  MOZ_ASSERT_UNREACHABLE();
+  return nullptr;
+#endif
 }
 
 bool
 TabChild::DeallocPPluginWidgetChild(mozilla::plugins::PPluginWidgetChild* aActor)
 {
-    delete aActor;
-    return true;
+  delete aActor;
+  return true;
 }
 
+#ifdef XP_WIN
 nsresult
 TabChild::CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut)
 {
   *aOut = nullptr;
   mozilla::plugins::PluginWidgetChild* child =
     static_cast<mozilla::plugins::PluginWidgetChild*>(SendPPluginWidgetConstructor());
   if (!child) {
     NS_ERROR("couldn't create PluginWidgetChild");
@@ -3179,16 +3189,17 @@ TabChild::CreatePluginWidget(nsIWidget* 
                                      LayoutDeviceIntRect(0, 0, 0, 0),
                                      &initData);
   if (NS_FAILED(rv)) {
     NS_WARNING("Creating native plugin widget on the chrome side failed.");
   }
   pluginWidget.forget(aOut);
   return rv;
 }
+#endif // XP_WIN
 
 ScreenIntSize
 TabChild::GetInnerSize()
 {
   LayoutDeviceIntSize innerSize =
     RoundedToInt(mUnscaledInnerSize * mPuppetWidget->GetDefaultScale());
   return ViewAs<ScreenPixel>(innerSize, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
 };
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -57,20 +57,16 @@ class AsyncDragMetrics;
 class IAPZCTreeManager;
 class ImageCompositeNotification;
 } // namespace layers
 
 namespace widget {
 struct AutoCacheNativeKeyCommands;
 } // namespace widget
 
-namespace plugins {
-class PluginWidgetChild;
-} // namespace plugins
-
 namespace dom {
 
 class TabChild;
 class TabGroup;
 class ClonedMessageData;
 class TabChildBase;
 
 class TabChildGlobal : public DOMEventTargetHelper,
@@ -604,17 +600,19 @@ public:
 
   /**
    * Native widget remoting protocol for use with windowed plugins with e10s.
    */
   PPluginWidgetChild* AllocPPluginWidgetChild() override;
 
   bool DeallocPPluginWidgetChild(PPluginWidgetChild* aActor) override;
 
+#ifdef XP_WIN
   nsresult CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut);
+#endif
 
   LayoutDeviceIntPoint GetClientOffset() const { return mClientOffset; }
   LayoutDeviceIntPoint GetChromeDisplacement() const { return mChromeDisp; };
 
   bool IPCOpen() const { return mIPCOpen; }
 
   bool ParentIsActive() const
   {
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -15,28 +15,28 @@
 #endif
 #include "mozilla/BrowserElementParent.h"
 #include "mozilla/dom/ContentBridgeParent.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/DataTransfer.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/indexedDB/ActorsParent.h"
 #include "mozilla/dom/ipc/BlobParent.h"
-#include "mozilla/plugins/PluginWidgetParent.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/DataSurfaceHelpers.h"
 #include "mozilla/gfx/GPUProcessManager.h"
 #include "mozilla/Hal.h"
 #include "mozilla/IMEStateManager.h"
 #include "mozilla/ipc/DocumentRendererParent.h"
 #include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/layers/AsyncDragMetrics.h"
 #include "mozilla/layers/InputAPZContext.h"
 #include "mozilla/layout/RenderFrameParent.h"
+#include "mozilla/plugins/PPluginWidgetParent.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/PresShell.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TouchEvents.h"
 #include "mozilla/UniquePtr.h"
@@ -95,16 +95,20 @@
 #include "gfxDrawable.h"
 #include "ImageOps.h"
 #include "UnitTransforms.h"
 #include <algorithm>
 #include "mozilla/WebBrowserPersistDocumentParent.h"
 #include "nsIGroupedSHistory.h"
 #include "PartialSHistory.h"
 
+#ifdef XP_WIN
+#include "mozilla/plugins/PluginWidgetParent.h"
+#endif
+
 #if defined(XP_WIN) && defined(ACCESSIBILITY)
 #include "mozilla/a11y/AccessibleWrap.h"
 #include "mozilla/a11y/nsWinUtils.h"
 #endif
 
 using namespace mozilla::dom;
 using namespace mozilla::ipc;
 using namespace mozilla::layers;
@@ -381,25 +385,27 @@ TabParent::DestroyInternal()
   // destroy itself and send back __delete__().
   Unused << SendDestroy();
 
   if (RenderFrameParent* frame = GetRenderFrame()) {
     RemoveTabParentFromTable(frame->GetLayersId());
     frame->Destroy();
   }
 
+#ifdef XP_WIN
   // Let all PluginWidgets know we are tearing down. Prevents
   // these objects from sending async events after the child side
   // is shut down.
   const ManagedContainer<PPluginWidgetParent>& kids =
     ManagedPPluginWidgetParent();
   for (auto iter = kids.ConstIter(); !iter.Done(); iter.Next()) {
     static_cast<mozilla::plugins::PluginWidgetParent*>(
        iter.Get()->GetKey())->ParentDestroy();
   }
+#endif
 }
 
 void
 TabParent::Destroy()
 {
   // Aggressively release the window to avoid leaking the world in shutdown
   // corner cases.
   mBrowserDOMWindow = nullptr;
@@ -2871,17 +2877,22 @@ TabParent::RecvRemotePaintIsReady()
   bool dummy;
   mFrameElement->DispatchEvent(event, &dummy);
   return IPC_OK();
 }
 
 mozilla::plugins::PPluginWidgetParent*
 TabParent::AllocPPluginWidgetParent()
 {
+#ifdef XP_WIN
   return new mozilla::plugins::PluginWidgetParent();
+#else
+  MOZ_ASSERT_UNREACHABLE();
+  return nullptr;
+#endif
 }
 
 bool
 TabParent::DeallocPPluginWidgetParent(mozilla::plugins::PPluginWidgetParent* aActor)
 {
   delete aActor;
   return true;
 }
--- a/dom/plugins/base/moz.build
+++ b/dom/plugins/base/moz.build
@@ -26,17 +26,16 @@ EXPORTS += [
     'nptypes.h',
     'nsJSNPRuntime.h',
     'nsNPAPIPluginInstance.h',
     'nsPluginDirServiceProvider.h',
     'nsPluginHost.h',
     'nsPluginInstanceOwner.h',
     'nsPluginLogging.h',
     'nsPluginNativeWindow.h',
-    'nsPluginNativeWindowGtk.h',
     'nsPluginsCID.h',
     'nsPluginsDir.h',
     'nsPluginTags.h',
 ]
 
 EXPORTS.mozilla += [
     'PluginPRLibrary.h',
 ]
@@ -65,27 +64,19 @@ if CONFIG['OS_ARCH'] == 'WINNT':
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     UNIFIED_SOURCES += [
         'nsPluginNativeWindow.cpp',
         'nsPluginsDirDarwin.cpp',
     ]
 else:
     UNIFIED_SOURCES += [
+        'nsPluginNativeWindow.cpp',
         'nsPluginsDirUnix.cpp',
     ]
-    if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
-        # This file cannot be built in unified mode because of name clashes in X11 headers.
-        SOURCES += [
-            'nsPluginNativeWindowGtk.cpp',
-        ]
-    else:
-        UNIFIED_SOURCES += [
-            'nsPluginNativeWindow.cpp',
-        ]
 
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/plugins/ipc',
     '/layout/generic',
     '/layout/xul',
     '/netwerk/base',
     '/widget',
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -3339,61 +3339,62 @@ void* nsPluginInstanceOwner::GetPluginPo
 void nsPluginInstanceOwner::ReleasePluginPort(void * pluginPort)
 {
 }
 
 NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
 {
   NS_ENSURE_TRUE(mPluginWindow, NS_ERROR_NULL_POINTER);
 
-  nsresult rv = NS_ERROR_FAILURE;
-
   // Can't call this twice!
   if (mWidget) {
     NS_WARNING("Trying to create a plugin widget twice!");
     return NS_ERROR_FAILURE;
   }
 
   bool windowless = false;
   mInstance->IsWindowless(&windowless);
   if (!windowless) {
+#ifndef XP_WIN
+    // Only Windows supports windowed mode!
+    MOZ_ASSERT_UNREACHABLE();
+    return NS_ERROR_FAILURE;
+#else
     // Try to get a parent widget, on some platforms widget creation will fail without
     // a parent.
+    nsresult rv = NS_ERROR_FAILURE;
+
     nsCOMPtr<nsIWidget> parentWidget;
     nsIDocument *doc = nullptr;
     nsCOMPtr<nsIContent> content = do_QueryReferent(mContent);
     if (content) {
       doc = content->OwnerDoc();
       parentWidget = nsContentUtils::WidgetForDocument(doc);
-#ifndef XP_MACOSX
       // If we're running in the content process, we need a remote widget created in chrome.
       if (XRE_IsContentProcess()) {
         if (nsCOMPtr<nsPIDOMWindowOuter> window = doc->GetWindow()) {
           if (nsCOMPtr<nsPIDOMWindowOuter> topWindow = window->GetTop()) {
             dom::TabChild* tc = dom::TabChild::GetFrom(topWindow);
             if (tc) {
               // This returns a PluginWidgetProxy which remotes a number of calls.
               rv = tc->CreatePluginWidget(parentWidget.get(), getter_AddRefs(mWidget));
               if (NS_FAILED(rv)) {
                 return rv;
               }
             }
           }
         }
       }
-#endif // XP_MACOSX
     }
 
-#ifndef XP_MACOSX
     // A failure here is terminal since we can't fall back on the non-e10s code
     // path below.
     if (!mWidget && XRE_IsContentProcess()) {
       return NS_ERROR_UNEXPECTED;
     }
-#endif // XP_MACOSX
 
     if (!mWidget) {
       // native (single process)
       mWidget = do_CreateInstance(kWidgetCID, &rv);
       nsWidgetInitData initData;
       initData.mWindowType = eWindowType_plugin;
       initData.mUnicode = false;
       initData.clipChildren = true;
@@ -3405,16 +3406,17 @@ NS_IMETHODIMP nsPluginInstanceOwner::Cre
         mWidget = nullptr;
         return rv;
       }
     }
 
     mWidget->EnableDragDrop(true);
     mWidget->Show(false);
     mWidget->Enable(false);
+#endif // XP_WIN
   }
 
   if (mPluginFrame) {
     // nullptr widget is fine, will result in windowless setup.
     mPluginFrame->PrepForDrawing(mWidget);
   }
 
   if (windowless) {
--- a/dom/plugins/base/nsPluginNativeWindow.cpp
+++ b/dom/plugins/base/nsPluginNativeWindow.cpp
@@ -7,47 +7,59 @@
  *  This file is the default implementation of plugin native window
  *  empty stubs, it should be replaced with real platform implementation
  *  for every platform
  */
 
 #include "nsDebug.h"
 #include "nsPluginNativeWindow.h"
 
-class nsPluginNativeWindowPLATFORM : public nsPluginNativeWindow {
-public: 
-  nsPluginNativeWindowPLATFORM();
-  virtual ~nsPluginNativeWindowPLATFORM();
+class nsPluginNativeWindowImpl : public nsPluginNativeWindow
+{
+public:
+  nsPluginNativeWindowImpl();
+  virtual ~nsPluginNativeWindowImpl();
+
+#ifdef MOZ_WIDGET_GTK
+  NPSetWindowCallbackStruct mWsInfo;
+#endif
 };
 
-nsPluginNativeWindowPLATFORM::nsPluginNativeWindowPLATFORM() : nsPluginNativeWindow()
+nsPluginNativeWindowImpl::nsPluginNativeWindowImpl() : nsPluginNativeWindow()
 {
   // initialize the struct fields
-  window = nullptr; 
-  x = 0; 
-  y = 0; 
-  width = 0; 
-  height = 0; 
+  window = nullptr;
+  x = 0;
+  y = 0;
+  width = 0;
+  height = 0;
   memset(&clipRect, 0, sizeof(clipRect));
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+  type = NPWindowTypeWindow;
+
+#ifdef MOZ_WIDGET_GTK
+  ws_info = &mWsInfo;
+  mWsInfo.type = 0;
+  mWsInfo.display = nullptr;
+  mWsInfo.visual = nullptr;
+  mWsInfo.colormap = 0;
+  mWsInfo.depth = 0;
+#elif defined(XP_UNIX) && !defined(XP_MACOSX)
   ws_info = nullptr;
 #endif
-  type = NPWindowTypeWindow;
 }
 
-nsPluginNativeWindowPLATFORM::~nsPluginNativeWindowPLATFORM() 
+nsPluginNativeWindowImpl::~nsPluginNativeWindowImpl()
 {
 }
 
 nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow)
 {
   NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
-  *aPluginNativeWindow = new nsPluginNativeWindowPLATFORM();
+  *aPluginNativeWindow = new nsPluginNativeWindowImpl();
   return NS_OK;
 }
 
 nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
 {
   NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
-  nsPluginNativeWindowPLATFORM *p = (nsPluginNativeWindowPLATFORM *)aPluginNativeWindow;
-  delete p;
+  delete static_cast<nsPluginNativeWindowImpl*>(aPluginNativeWindow);
   return NS_OK;
 }
deleted file mode 100644
--- a/dom/plugins/base/nsPluginNativeWindowGtk.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2:
-*/
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * 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 "nsPluginNativeWindowGtk.h"
-#include "nsNPAPIPlugin.h"
-#include "npapi.h"
-#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-#include <gdk/gdk.h>
-
-#if (GTK_MAJOR_VERSION == 3)
-#include <gtk/gtkx.h>
-#else
-#include "gtk2xtbin.h"
-#endif
-#include "mozilla/X11Util.h"
-
-static void plug_added_cb(GtkWidget *widget, gpointer data);
-static gboolean plug_removed_cb   (GtkWidget *widget, gpointer data);
-static void socket_unrealize_cb   (GtkWidget *widget, gpointer data);
-
-nsPluginNativeWindowGtk::nsPluginNativeWindowGtk() : nsPluginNativeWindow()
-{
-  // initialize the struct fields
-  window = nullptr; 
-  x = 0; 
-  y = 0; 
-  width = 0; 
-  height = 0; 
-  memset(&clipRect, 0, sizeof(clipRect));
-  ws_info = &mWsInfo;
-  type = NPWindowTypeWindow;
-  mSocketWidget = 0;
-  mWsInfo.type = 0;
-  mWsInfo.display = nullptr;
-  mWsInfo.visual = nullptr;
-  mWsInfo.colormap = 0;
-  mWsInfo.depth = 0;
-}
-
-nsPluginNativeWindowGtk::~nsPluginNativeWindowGtk() 
-{
-  if(mSocketWidget) {
-    gtk_widget_destroy(mSocketWidget);
-  }
-}
-
-nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow)
-{
-  NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
-  *aPluginNativeWindow = new nsPluginNativeWindowGtk();
-  return NS_OK;
-}
-
-nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
-{
-  NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
-  nsPluginNativeWindowGtk *p = (nsPluginNativeWindowGtk *)aPluginNativeWindow;
-  delete p;
-  return NS_OK;
-}
-
-nsresult nsPluginNativeWindowGtk::CallSetWindow(RefPtr<nsNPAPIPluginInstance> &aPluginInstance)
-{
-  if (aPluginInstance) {
-    if (type == NPWindowTypeWindow &&
-        XRE_IsContentProcess()) {
-      // In this case, most of the initialization code here has already happened
-      // in the chrome process. The window we have in content is the XID of the
-      // socket widget we need to hand to plugins.
-      SetWindow((XID)window);
-	  } else if (type == NPWindowTypeWindow) {
-      if (!mSocketWidget) {
-        nsresult rv;
-
-        // The documentation on the types for many variables in NP(N|P)_GetValue
-        // is vague.  Often boolean values are NPBool (1 byte), but
-        // https://developer.mozilla.org/en/XEmbed_Extension_for_Mozilla_Plugins
-        // treats NPPVpluginNeedsXEmbed as PRBool (int), and
-        // on x86/32-bit, flash stores to this using |movl 0x1,&needsXEmbed|.
-        // thus we can't use NPBool for needsXEmbed, or the three bytes above
-        // it on the stack would get clobbered. so protect with the larger bool.
-        int needsXEmbed = 0;
-        rv = aPluginInstance->GetValueFromPlugin(NPPVpluginNeedsXEmbed, &needsXEmbed);
-        // If the call returned an error code make sure we still use our default value.
-        if (NS_FAILED(rv)) {
-          needsXEmbed = 0;
-        }
-#ifdef DEBUG
-        printf("nsPluginNativeWindowGtk: NPPVpluginNeedsXEmbed=%d\n", needsXEmbed);
-#endif
-
-        bool isOOPPlugin = aPluginInstance->GetPlugin()->GetLibrary()->IsOOP();
-        if (needsXEmbed || isOOPPlugin) {        
-          bool enableXtFocus = !needsXEmbed;
-          rv = CreateXEmbedWindow(enableXtFocus);
-        }
-        else {
-#if (MOZ_WIDGET_GTK == 2)
-          rv = CreateXtWindow();
-#else
-          return NS_ERROR_FAILURE;
-#endif
-        }
-
-        if (NS_FAILED(rv)) {
-          return NS_ERROR_FAILURE;
-        }
-      }
-
-      if (!mSocketWidget) {
-        return NS_ERROR_FAILURE;
-      }
-
-      // Make sure to resize and re-place the window if required.
-      SetAllocation();
-      // Need to reset "window" each time as nsPluginFrame::DidReflow sets it
-      // to the ancestor window.
-#if (MOZ_WIDGET_GTK == 2)
-      if (GTK_IS_XTBIN(mSocketWidget)) {
-        // Point the NPWindow structures window to the actual X window
-        SetWindow(GTK_XTBIN(mSocketWidget)->xtwindow);
-      }
-      else { // XEmbed or OOP&Xt
-        SetWindow(gtk_socket_get_id(GTK_SOCKET(mSocketWidget)));
-      }
-#else
-      // Gtk3 supports only OOP by GtkSocket
-      SetWindow(gtk_socket_get_id(GTK_SOCKET(mSocketWidget)));
-#endif
-
-#ifdef DEBUG
-      printf("nsPluginNativeWindowGtk: call SetWindow with xid=%p\n", (void *)window);
-#endif
-    } // NPWindowTypeWindow
-    aPluginInstance->SetWindow(this);
-  } else if (mPluginInstance) {
-    mPluginInstance->SetWindow(nullptr);
-  }
-
-  SetPluginInstance(aPluginInstance);
-  return NS_OK;
-}
-
-nsresult nsPluginNativeWindowGtk::CreateXEmbedWindow(bool aEnableXtFocus) {
-  NS_ASSERTION(!mSocketWidget,"Already created a socket widget!");
-  GdkDisplay *display = gdk_display_get_default();
-  GdkWindow *parent_win = gdk_x11_window_lookup_for_display(display, GetWindow());
-  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);
-
-  g_signal_connect(mSocketWidget, "plug_added",
-                   G_CALLBACK(plug_added_cb), nullptr);
-
-  // 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), nullptr);
-
-  g_signal_connect(mSocketWidget, "unrealize",
-                   G_CALLBACK(socket_unrealize_cb), nullptr);
-
-  g_signal_connect(mSocketWidget, "destroy",
-                   G_CALLBACK(gtk_widget_destroyed), &mSocketWidget);
-
-  gpointer user_data = nullptr;
-  gdk_window_get_user_data(parent_win, &user_data);
-
-  GtkContainer *container = GTK_CONTAINER(user_data);
-  gtk_container_add(container, mSocketWidget);
-  gtk_widget_realize(mSocketWidget);
-
-  // The GtkSocket has a visible window, but the plugin's XEmbed plug will
-  // cover this window.  Normally GtkSockets let the X server paint their
-  // background and this would happen immediately (before the plug is
-  // created).  Setting the background to None prevents the server from
-  // painting this window, avoiding flicker.
-  // TODO GTK3
-#if (MOZ_WIDGET_GTK == 2)
-  gdk_window_set_back_pixmap(gtk_widget_get_window(mSocketWidget), nullptr, FALSE);
-#endif
-
-  // Resize before we show
-  SetAllocation();
-
-  gtk_widget_show(mSocketWidget);
-
-  gdk_flush();
-  SetWindow(gtk_socket_get_id(GTK_SOCKET(mSocketWidget)));
-
-  // Fill out the ws_info structure.
-  // (The windowless case is done in nsPluginFrame.cpp.)
-  GdkWindow *gdkWindow = gdk_x11_window_lookup_for_display(display, GetWindow());
-  if(!gdkWindow)
-    return NS_ERROR_FAILURE;
-
-  mWsInfo.display = GDK_WINDOW_XDISPLAY(gdkWindow);
-#if (MOZ_WIDGET_GTK == 2)
-  mWsInfo.colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(gdkWindow));
-  GdkVisual* gdkVisual = gdk_drawable_get_visual(gdkWindow);
-  mWsInfo.depth = gdkVisual->depth;
-#else
-  mWsInfo.colormap = X11None;
-  GdkVisual* gdkVisual = gdk_window_get_visual(gdkWindow);
-  mWsInfo.depth = gdk_visual_get_depth(gdkVisual);
-#endif
-  mWsInfo.visual = GDK_VISUAL_XVISUAL(gdkVisual);
-    
-  return NS_OK;
-}
-
-void nsPluginNativeWindowGtk::SetAllocation() {
-  if (!mSocketWidget)
-    return;
-
-  GtkAllocation new_allocation;
-  new_allocation.x = 0;
-  new_allocation.y = 0;
-  new_allocation.width = width;
-  new_allocation.height = height;
-  gtk_widget_size_allocate(mSocketWidget, &new_allocation);
-}
-
-#if (MOZ_WIDGET_GTK == 2)
-nsresult nsPluginNativeWindowGtk::CreateXtWindow() {
-  NS_ASSERTION(!mSocketWidget,"Already created a socket widget!");
-
-#ifdef DEBUG      
-  printf("About to create new xtbin of %i X %i from %p...\n",
-         width, height, (void*)window);
-#endif
-  GdkDisplay *display = gdk_display_get_default();
-  GdkWindow *gdkWindow = gdk_x11_window_lookup_for_display(display, GetWindow());
-  mSocketWidget = gtk_xtbin_new(gdkWindow, 0);
-  // Check to see if creating the xtbin failed for some reason.
-  // if it did, we can't go any further.
-  if (!mSocketWidget)
-    return NS_ERROR_FAILURE;
-
-  g_signal_connect(mSocketWidget, "destroy",
-                   G_CALLBACK(gtk_widget_destroyed), &mSocketWidget);
-
-  gtk_widget_set_size_request(mSocketWidget, width, height);
-
-#ifdef DEBUG
-  printf("About to show xtbin(%p)...\n", (void*)mSocketWidget); fflush(nullptr);
-#endif
-  gtk_widget_show(mSocketWidget);
-#ifdef DEBUG
-  printf("completed gtk_widget_show(%p)\n", (void*)mSocketWidget); fflush(nullptr);
-#endif
-
-  // Fill out the ws_info structure.
-  GtkXtBin* xtbin = GTK_XTBIN(mSocketWidget);
-  // The xtbin has its own Display structure.
-  mWsInfo.display = xtbin->xtdisplay;
-  mWsInfo.colormap = xtbin->xtclient.xtcolormap;
-  mWsInfo.visual = xtbin->xtclient.xtvisual;
-  mWsInfo.depth = xtbin->xtclient.xtdepth;
-  // Leave mWsInfo.type = 0 - Who knows what this is meant to be?
-
-  XFlush(mWsInfo.display);
-
-  return NS_OK;
-}
-#endif
-
-static void
-plug_window_finalize_cb(gpointer socket, GObject* plug_window)
-{
-  g_object_unref(socket);
-}
-
-static void
-plug_added_cb(GtkWidget *socket, gpointer data)
-{
-  // The plug window has been embedded, and gtk_socket_add_window() has added
-  // a filter to the socket's plug_window, passing the socket as data for the
-  // filter, so the socket must live as long as events may be received on the
-  // plug window.
-  //
-  // https://git.gnome.org/browse/gtk+/tree/gtk/gtksocket.c?h=3.18.7#n1124
-  g_object_ref(socket);
-  // When the socket is unrealized, perhaps during gtk_widget_destroy() from
-  // ~nsPluginNativeWindowGtk, the plug is removed.  The plug in the child
-  // process then destroys its widget and window.  When the browser process
-  // receives the DestroyNotify event for the plug window, GDK releases its
-  // reference to plugWindow.  This is typically the last reference and so the
-  // weak ref callback triggers release of the socket.
-  GdkWindow* plugWindow = gtk_socket_get_plug_window(GTK_SOCKET(socket));
-  g_object_weak_ref(G_OBJECT(plugWindow), plug_window_finalize_cb, socket);
-}
-
-/* static */
-gboolean
-plug_removed_cb (GtkWidget *widget, gpointer data)
-{
-  // Gee, thanks for the info!
-  return TRUE;
-}
-
-static void
-socket_unrealize_cb(GtkWidget *widget, gpointer data)
-{
-  // Unmap and reparent any child windows that GDK does not yet know about.
-  // (See bug 540114 comment 10.)
-  GdkWindow* socket_window =  gtk_widget_get_window(widget);
-  GdkDisplay* gdkDisplay = gdk_display_get_default();
-  Display* display = GDK_DISPLAY_XDISPLAY(gdkDisplay);
-
-  // Ignore X errors that may happen if windows get destroyed (possibly
-  // requested by the plugin) between XQueryTree and when we operate on them.
-  gdk_error_trap_push();
-
-  Window root, parent;
-  Window* children;
-  unsigned int nchildren;
-  if (!XQueryTree(display, gdk_x11_window_get_xid(socket_window),
-                  &root, &parent, &children, &nchildren))
-    return;
-
-  for (unsigned int i = 0; i < nchildren; ++i) {
-    Window child = children[i];
-    if (!gdk_x11_window_lookup_for_display(gdkDisplay, child)) {
-      // This window is not known to GDK.
-      XUnmapWindow(display, child);
-      XReparentWindow(display, child, DefaultRootWindow(display), 0, 0);
-    }
-  }
-
-  if (children) XFree(children);
-
-  mozilla::FinishX(display);
-#if (MOZ_WIDGET_GTK == 3)
-  gdk_error_trap_pop_ignored();
-#else
-  gdk_error_trap_pop();
-#endif
-}
deleted file mode 100644
--- a/dom/plugins/base/nsPluginNativeWindowGtk.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef _nsPluginNativeWindowGdk_h_
-#define _nsPluginNativeWindowGdk_h_
-
-#include "nsPluginNativeWindow.h"
-#include "npapi.h"
-#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-#include <gdk/gdk.h>
-#if (GTK_MAJOR_VERSION == 3)
-#include <gtk/gtkx.h>
-#else
-#include "gtk2xtbin.h"
-#endif
-#include "mozilla/X11Util.h"
-
-class nsPluginNativeWindowGtk : public nsPluginNativeWindow {
-public:
-  nsPluginNativeWindowGtk();
-  virtual ~nsPluginNativeWindowGtk();
-
-  virtual nsresult CallSetWindow(RefPtr<nsNPAPIPluginInstance> &aPluginInstance);
-  nsresult CreateXEmbedWindow(bool aEnableXtFocus);
-  void SetAllocation();
-
-  XID GetWindow() const
-  {
-    return static_cast<XID>(reinterpret_cast<uintptr_t>(window));
-  }
-
-private:
-  void SetWindow(XID aWindow)
-  {
-    window = reinterpret_cast<void*>(static_cast<uintptr_t>(aWindow));
-  }
-
-  NPSetWindowCallbackStruct mWsInfo;
-  /**
-   * Either a GtkSocket or a special GtkXtBin widget (derived from GtkSocket)
-   * that encapsulates the Xt toolkit within a Gtk Application.
-   */
-  GtkWidget* mSocketWidget;
-#if (MOZ_WIDGET_GTK == 2)
-  nsresult  CreateXtWindow();
-#endif
-};
-
-#endif
--- a/dom/plugins/ipc/PluginWidgetChild.cpp
+++ b/dom/plugins/ipc/PluginWidgetChild.cpp
@@ -7,19 +7,17 @@
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/plugins/PluginWidgetParent.h"
 #include "PluginWidgetProxy.h"
 
 #include "mozilla/Unused.h"
 #include "mozilla/DebugOnly.h"
 #include "nsDebug.h"
 
-#if defined(XP_WIN)
 #include "mozilla/plugins/PluginInstanceParent.h"
-#endif
 
 #define PWLOG(...)
 //#define PWLOG(...) printf_stderr(__VA_ARGS__)
 
 namespace mozilla {
 namespace plugins {
 
 PluginWidgetChild::PluginWidgetChild() :
--- a/dom/plugins/ipc/PluginWidgetChild.h
+++ b/dom/plugins/ipc/PluginWidgetChild.h
@@ -1,15 +1,19 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_plugins_PluginWidgetChild_h
 #define mozilla_plugins_PluginWidgetChild_h
 
+#ifndef XP_WIN
+#error "This header should be Windows-only."
+#endif
+
 #include "mozilla/plugins/PPluginWidgetChild.h"
 
 namespace mozilla {
 namespace widget {
 class PluginWidgetProxy;
 } // namespace widget
 namespace plugins {
 
--- a/dom/plugins/ipc/PluginWidgetParent.cpp
+++ b/dom/plugins/ipc/PluginWidgetParent.cpp
@@ -7,34 +7,28 @@
 #include "mozilla/dom/ContentParent.h"
 #include "nsComponentManagerUtils.h"
 #include "nsWidgetsCID.h"
 
 #include "mozilla/Unused.h"
 #include "mozilla/DebugOnly.h"
 #include "nsDebug.h"
 
-#if defined(MOZ_WIDGET_GTK)
-#include "nsPluginNativeWindowGtk.h"
-#endif
-
 using namespace mozilla;
 using namespace mozilla::widget;
 
 #define PWLOG(...)
 //#define PWLOG(...) printf_stderr(__VA_ARGS__)
 
-#if defined(XP_WIN)
 namespace mozilla {
 namespace dom {
 // For nsWindow
 const wchar_t* kPluginWidgetContentParentProperty =
   L"kPluginWidgetParentProperty";
 } }
-#endif
 
 namespace mozilla {
 namespace plugins {
 
 static NS_DEFINE_CID(kWidgetCID, NS_CHILD_CID);
 
 // This macro returns IPC_OK() to prevent an abort in the child process when
 // ipc message delivery fails.
@@ -90,29 +84,16 @@ PluginWidgetParent::RecvCreate(nsresult*
   PWLOG("PluginWidgetParent::RecvCreate()\n");
 
   *aScrollCaptureId = 0;
   *aPluginInstanceId = 0;
 
   mWidget = do_CreateInstance(kWidgetCID, aResult);
   NS_ASSERTION(NS_SUCCEEDED(*aResult), "widget create failure");
 
-#if defined(MOZ_WIDGET_GTK)
-  // We need this currently just for GTK in setting up a socket widget
-  // we can send over to content -> plugin.
-  PLUG_NewPluginNativeWindow((nsPluginNativeWindow**)&mWrapper);
-  if (!mWrapper) {
-    KillWidget();
-    return IPC_FAIL_NO_REASON(this);
-  }
-  // Give a copy of this to the widget, which handles some update
-  // work for us.
-  mWidget->SetNativeData(NS_NATIVE_PLUGIN_OBJECT_PTR, (uintptr_t)mWrapper.get());
-#endif
-
   // This returns the top level window widget
   nsCOMPtr<nsIWidget> parentWidget = GetTabParent()->GetWidget();
   // If this fails, bail.
   if (!parentWidget) {
     *aResult = NS_ERROR_NOT_AVAILABLE;
     KillWidget();
     return IPC_OK();
   }
@@ -127,58 +108,34 @@ PluginWidgetParent::RecvCreate(nsresult*
   if (NS_FAILED(*aResult)) {
     KillWidget();
     // This should never fail, abort.
     return IPC_FAIL_NO_REASON(this);
   }
 
   mWidget->EnableDragDrop(true);
 
-#if defined(MOZ_WIDGET_GTK)
-  // For setup, initially GTK code expects 'window' to hold the parent.
-  mWrapper->window = mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
-  DebugOnly<nsresult> drv = mWrapper->CreateXEmbedWindow(false);
-  NS_ASSERTION(NS_SUCCEEDED(drv), "widget call failure");
-  mWrapper->SetAllocation();
-  PWLOG("Plugin XID=%p\n", (void*)mWrapper->window);
-#elif defined(XP_WIN)
-  DebugOnly<DWORD> winres =
-    ::SetPropW((HWND)mWidget->GetNativeData(NS_NATIVE_WINDOW),
-               mozilla::dom::kPluginWidgetContentParentProperty,
-               GetTabParent()->Manager()->AsContentParent());
-  NS_ASSERTION(winres, "SetPropW call failure");
-
-  *aScrollCaptureId = mWidget->CreateScrollCaptureContainer();
-  *aPluginInstanceId =
-    reinterpret_cast<uintptr_t>(mWidget->GetNativeData(NS_NATIVE_PLUGIN_ID));
-#endif
-
   // This is a special call we make to nsBaseWidget to register this
   // window as a remote plugin window which is expected to receive
   // visibility updates from the compositor, which ships this data
   // over with corresponding layer updates.
   mWidget->RegisterPluginWindowForRemoteUpdates();
 
   return IPC_OK();
 }
 
 void
 PluginWidgetParent::KillWidget()
 {
   PWLOG("PluginWidgetParent::KillWidget() widget=%p\n", (void*)mWidget.get());
   if (mWidget) {
     mWidget->UnregisterPluginWindowForRemoteUpdates();
     mWidget->Destroy();
-#if defined(MOZ_WIDGET_GTK)
-    mWidget->SetNativeData(NS_NATIVE_PLUGIN_OBJECT_PTR, (uintptr_t)0);
-    mWrapper = nullptr;
-#elif defined(XP_WIN)
     ::RemovePropW((HWND)mWidget->GetNativeData(NS_NATIVE_WINDOW),
                   mozilla::dom::kPluginWidgetContentParentProperty);
-#endif
     mWidget = nullptr;
   }
 }
 
 void
 PluginWidgetParent::ActorDestroy(ActorDestroyReason aWhy)
 {
   PWLOG("PluginWidgetParent::ActorDestroy(%d)\n", aWhy);
@@ -202,36 +159,26 @@ PluginWidgetParent::RecvSetFocus(const b
   mWidget->SetFocus(aRaise);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 PluginWidgetParent::RecvGetNativePluginPort(uintptr_t* value)
 {
   ENSURE_CHANNEL;
-#if defined(MOZ_WIDGET_GTK)
-  *value = (uintptr_t)mWrapper->window;
-  NS_ASSERTION(*value, "no xid??");
-#else
   *value = (uintptr_t)mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
   NS_ASSERTION(*value, "no native port??");
-#endif
   PWLOG("PluginWidgetParent::RecvGetNativeData() %p\n", (void*)*value);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 PluginWidgetParent::RecvSetNativeChildWindow(const uintptr_t& aChildWindow)
 {
-#if defined(XP_WIN)
   ENSURE_CHANNEL;
   PWLOG("PluginWidgetParent::RecvSetNativeChildWindow(%p)\n",
         (void*)aChildWindow);
   mWidget->SetNativeData(NS_NATIVE_CHILD_WINDOW, aChildWindow);
   return IPC_OK();
-#else
-  NS_NOTREACHED("PluginWidgetParent::RecvSetNativeChildWindow not implemented!");
-  return IPC_FAIL_NO_REASON(this);
-#endif
 }
 
 } // namespace plugins
 } // namespace mozilla
--- a/dom/plugins/ipc/PluginWidgetParent.h
+++ b/dom/plugins/ipc/PluginWidgetParent.h
@@ -1,24 +1,24 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_plugins_PluginWidgetParent_h
 #define mozilla_plugins_PluginWidgetParent_h
 
+#ifndef XP_WIN
+#error "This header should be Windows-only."
+#endif
+
 #include "mozilla/plugins/PPluginWidgetParent.h"
 #include "nsAutoPtr.h"
 #include "nsIWidget.h"
 #include "nsCOMPtr.h"
 
-#if defined(MOZ_WIDGET_GTK)
-class nsPluginNativeWindowGtk;
-#endif
-
 namespace mozilla {
 
 namespace dom {
 class TabParent;
 } // namespace dom
 
 namespace plugins {
 
@@ -48,18 +48,15 @@ private:
   // The tab our connection is associated with.
   mozilla::dom::TabParent* GetTabParent();
 
 private:
   void KillWidget();
 
   // The chrome side native widget.
   nsCOMPtr<nsIWidget> mWidget;
-#if defined(MOZ_WIDGET_GTK)
-  nsAutoPtr<nsPluginNativeWindowGtk> mWrapper;
-#endif
 };
 
 } // namespace plugins
 } // namespace mozilla
 
 #endif // mozilla_plugins_PluginWidgetParent_h
 
--- a/dom/plugins/ipc/moz.build
+++ b/dom/plugins/ipc/moz.build
@@ -34,18 +34,16 @@ EXPORTS.mozilla.plugins += [
     'PluginQuirks.h',
     'PluginScriptableObjectChild.h',
     'PluginScriptableObjectParent.h',
     'PluginScriptableObjectUtils-inl.h',
     'PluginScriptableObjectUtils.h',
     'PluginStreamChild.h',
     'PluginStreamParent.h',
     'PluginUtilsOSX.h',
-    'PluginWidgetChild.h',
-    'PluginWidgetParent.h',
     'StreamNotifyChild.h',
     'StreamNotifyParent.h',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     EXPORTS.mozilla.plugins += [
         'PluginSurfaceParent.h',
     ]
@@ -84,31 +82,37 @@ UNIFIED_SOURCES += [
     'PluginScriptableObjectParent.cpp',
     'PluginStreamChild.cpp',
     'PluginStreamParent.cpp',
 ]
 
 SOURCES += [
     'PluginInstanceChild.cpp', # 'PluginThreadCallback' : ambiguous symbol
     'PluginModuleChild.cpp',   # Redefinition of mozilla::WindowsDllInterceptor sUser32Intercept
-    'PluginWidgetChild.cpp',
-    'PluginWidgetParent.cpp',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     UNIFIED_SOURCES += [
         'PluginInterposeOSX.mm',
         'PluginUtilsOSX.mm',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
+    EXPORTS.mozilla.plugins += [
+        'PluginWidgetChild.h',
+        'PluginWidgetParent.h',
+    ]
     UNIFIED_SOURCES += [
         'D3D11SurfaceHolder.cpp',
         'PluginUtilsWin.cpp'
     ]
+    SOURCES += [
+        'PluginWidgetChild.cpp',
+        'PluginWidgetParent.cpp',
+    ]
 
 IPDL_SOURCES += [
     'PBrowserStream.ipdl',
     'PluginTypes.ipdlh',
     'PPluginBackgroundDestroyer.ipdl',
     'PPluginInstance.ipdl',
     'PPluginModule.ipdl',
     'PPluginScriptableObject.ipdl',
--- a/widget/PluginWidgetProxy.cpp
+++ b/widget/PluginWidgetProxy.cpp
@@ -70,23 +70,21 @@ PluginWidgetProxy::Create(nsIWidget* aPa
 
   BaseCreate(aParent, aInitData);
   mParent = aParent;
 
   mBounds = aRect;
   mEnabled = true;
   mVisible = true;
 
-#if defined(XP_WIN)
   PluginInstanceParent* instance =
     PluginInstanceParent::LookupPluginInstanceByID(pluginInstanceId);
   if (instance) {
     Unused << NS_WARN_IF(NS_FAILED(instance->SetScrollCaptureId(scrollCaptureId)));
   }
-#endif
 
   return NS_OK;
 }
 
 void
 PluginWidgetProxy::SetParent(nsIWidget* aNewParent)
 {
   nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
@@ -153,17 +151,16 @@ PluginWidgetProxy::GetNativeData(uint32_
   if (mCachedPluginPort) {
     return (void*)mCachedPluginPort;
   }
   mActor->SendGetNativePluginPort(&mCachedPluginPort);
   PWLOG("PluginWidgetProxy::GetNativeData %p\n", (void*)mCachedPluginPort);
   return (void*)mCachedPluginPort;
 }
 
-#if defined(XP_WIN)
 void
 PluginWidgetProxy::SetNativeData(uint32_t aDataType, uintptr_t aVal)
 {
   if (!mActor) {
     return;
   }
 
   auto tab = static_cast<mozilla::dom::TabChild*>(mActor->Manager());
@@ -174,17 +171,16 @@ PluginWidgetProxy::SetNativeData(uint32_
   switch (aDataType) {
     case NS_NATIVE_CHILD_WINDOW:
       mActor->SendSetNativeChildWindow(aVal);
       break;
     default:
       NS_ERROR("SetNativeData called with unsupported data type.");
   }
 }
-#endif
 
 nsresult
 PluginWidgetProxy::SetFocus(bool aRaise)
 {
   ENSURE_CHANNEL;
   PWLOG("PluginWidgetProxy::SetFocus(%d)\n", aRaise);
   mActor->SendSetFocus(aRaise);
   return NS_OK;
--- a/widget/PluginWidgetProxy.h
+++ b/widget/PluginWidgetProxy.h
@@ -1,15 +1,19 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_widget_RemotePlugin_h__
 #define mozilla_widget_RemotePlugin_h__
 
+#ifndef XP_WIN
+#error "Plugin widgets are Windows-only."
+#endif
+
 #include "PuppetWidget.h"
 #include "mozilla/dom/TabChild.h"
 
 /*
  * PluginWidgetProxy is a nsIWidget wrapper we hand around in plugin and layout
  * code. It wraps a native widget it creates in the chrome process. Since this
  * is for plugins, only a limited set of the widget apis need to be overridden,
  * the rest of the implementation is in PuppetWidget or nsBaseWidget.
@@ -41,19 +45,17 @@ public:
                                        nsWidgetInitData* aInitData = nullptr)
                                        override;
   virtual void Destroy() override;
   virtual nsresult SetFocus(bool aRaise = false) override;
   virtual void SetParent(nsIWidget* aNewParent) override;
 
   virtual nsIWidget* GetParent(void) override;
   virtual void* GetNativeData(uint32_t aDataType) override;
-#if defined(XP_WIN)
   void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
-#endif
   virtual nsTransparencyMode GetTransparencyMode() override
   { return eTransparencyOpaque; }
   virtual void GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects) override;
 
 public:
   /**
    * When tabs are closed PPluginWidget can terminate before plugin code is
    * finished tearing us down. When this happens plugin calls over mActor
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -75,17 +75,16 @@
 #include "nsGfxCIID.h"
 #include "nsGtkUtils.h"
 #include "nsIObserverService.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "nsIIdleServiceInternal.h"
 #include "nsIPropertyBag2.h"
 #include "GLContext.h"
 #include "gfx2DGlue.h"
-#include "nsPluginNativeWindowGtk.h"
 
 #ifdef ACCESSIBILITY
 #include "mozilla/a11y/Accessible.h"
 #include "mozilla/a11y/Platform.h"
 #include "nsAccessibilityService.h"
 
 using namespace mozilla;
 using namespace mozilla::widget;
@@ -237,22 +236,16 @@ static nsWindow* GetFirstNSWindowForGDKW
 
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 #ifdef MOZ_X11
 static GdkFilterReturn popup_take_focus_filter (GdkXEvent *gdk_xevent,
                                                 GdkEvent *event,
                                                 gpointer data);
-static GdkFilterReturn plugin_window_filter_func (GdkXEvent *gdk_xevent,
-                                                  GdkEvent *event,
-                                                  gpointer data);
-static GdkFilterReturn plugin_client_message_filter (GdkXEvent *xevent,
-                                                     GdkEvent *event,
-                                                     gpointer data);
 #endif /* MOZ_X11 */
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
 
 static gboolean drag_motion_event_cb      (GtkWidget *aWidget,
                                            GdkDragContext *aDragContext,
                                            gint aX,
@@ -355,17 +348,16 @@ private:
 
 static NS_DEFINE_IID(kCDragServiceCID,  NS_DRAGSERVICE_CID);
 
 // The window from which the focus manager asks us to dispatch key events.
 static nsWindow         *gFocusWindow          = nullptr;
 static bool              gBlockActivateEvent   = false;
 static bool              gGlobalsInitialized   = false;
 static bool              gRaiseWindows         = true;
-static nsWindow         *gPluginFocusWindow    = nullptr;
 
 #if GTK_CHECK_VERSION(3,4,0)
 static uint32_t          gLastTouchID = 0;
 #endif
 
 #define NS_WINDOW_TITLE_MAX_LENGTH 4095
 
 // If after selecting profile window, the startup fail, please refer to
@@ -435,35 +427,32 @@ nsWindow::nsWindow()
     mHandleTouchEvent    = false;
 #endif
     mIsDragPopup         = false;
     mIsX11Display        = GDK_IS_X11_DISPLAY(gdk_display_get_default());
 
     mContainer           = nullptr;
     mGdkWindow           = nullptr;
     mShell               = nullptr;
-    mPluginNativeWindow  = nullptr;
     mHasMappedToplevel   = false;
     mIsFullyObscured     = false;
     mRetryPointerGrab    = false;
     mWindowType          = eWindowType_child;
     mSizeState           = nsSizeMode_Normal;
     mLastSizeMode        = nsSizeMode_Normal;
     mSizeConstraints.mMaxSize = GetSafeWindowSize(mSizeConstraints.mMaxSize);
 
 #ifdef MOZ_X11
     mOldFocusWindow      = 0;
 
     mXDisplay = nullptr;
     mXWindow  = X11None;
     mXVisual  = nullptr;
     mXDepth   = 0;
 #endif /* MOZ_X11 */
-    mPluginType          = PluginType_NONE;
-
     if (!gGlobalsInitialized) {
         gGlobalsInitialized = true;
 
         // It's OK if either of these fail, but it may not be one day.
         initialize_prefs();
     }
 
     mLastMotionPressure = 0;
@@ -754,23 +743,16 @@ nsWindow::Destroy()
     }
 
     // make sure that we remove ourself as the focus window
     if (gFocusWindow == this) {
         LOGFOCUS(("automatically losing focus...\n"));
         gFocusWindow = nullptr;
     }
 
-#if (MOZ_WIDGET_GTK == 2) && defined(MOZ_X11)
-    // make sure that we remove ourself as the plugin focus window
-    if (gPluginFocusWindow == this) {
-        gPluginFocusWindow->LoseNonXEmbedPluginFocus();
-    }
-#endif /* MOZ_X11 && MOZ_WIDGET_GTK == 2 && defined(MOZ_X11) */
-
     GtkWidget *owningWidget = GetMozContainerWidget();
     if (mShell) {
         gtk_widget_destroy(mShell);
         mShell = nullptr;
         mContainer = nullptr;
         MOZ_ASSERT(!mGdkWindow,
                    "mGdkWindow should be NULL when mContainer is destroyed");
     }
@@ -1119,17 +1101,16 @@ nsWindow::Resize(double aWidth, double a
     mBounds.SizeTo(width, height);
 
     if (!mCreated)
         return;
 
     NativeResize();
 
     NotifyRollupGeometryChange();
-    ResizePluginSocketWidget();
 
     // send a resize notification if this is a toplevel
     if (mIsTopLevel || mListenForResizes) {
         DispatchResized();
     }
 
     return;
 }
@@ -1150,43 +1131,25 @@ nsWindow::Resize(double aX, double aY, d
     mBounds.SizeTo(width, height);
 
     if (!mCreated)
         return;
 
     NativeMoveResize();
 
     NotifyRollupGeometryChange();
-    ResizePluginSocketWidget();
 
     if (mIsTopLevel || mListenForResizes) {
         DispatchResized();
     }
 
     return;
 }
 
 void
-nsWindow::ResizePluginSocketWidget()
-{
-    // e10s specific, a eWindowType_plugin_ipc_chrome holds its own
-    // nsPluginNativeWindowGtk wrapper. We are responsible for resizing
-    // the embedded socket widget.
-    if (mWindowType == eWindowType_plugin_ipc_chrome) {
-        auto* wrapper = (nsPluginNativeWindowGtk*)
-          GetNativeData(NS_NATIVE_PLUGIN_OBJECT_PTR);
-        if (wrapper) {
-            wrapper->width = mBounds.width;
-            wrapper->height = mBounds.height;
-            wrapper->SetAllocation();
-        }
-    }
-}
-
-void
 nsWindow::Enable(bool aState)
 {
     mEnabled = aState;
 }
 
 bool
 nsWindow::IsEnabled() const
 {
@@ -1706,43 +1669,30 @@ nsWindow::GetNativeData(uint32_t aDataTy
     case NS_NATIVE_WINDOW:
     case NS_NATIVE_WIDGET: {
         if (!mGdkWindow)
             return nullptr;
 
         return mGdkWindow;
     }
 
-    case NS_NATIVE_PLUGIN_PORT:
-        return SetupPluginPort();
-
-    case NS_NATIVE_PLUGIN_ID:
-        if (!mPluginNativeWindow) {
-          NS_WARNING("no native plugin instance!");
-          return nullptr;
-        }
-        // Return the socket widget XID
-        return (void*)mPluginNativeWindow->window;
-
     case NS_NATIVE_DISPLAY: {
 #ifdef MOZ_X11
         GdkDisplay* gdkDisplay = gdk_display_get_default();
         if (GDK_IS_X11_DISPLAY(gdkDisplay)) {
           return GDK_DISPLAY_XDISPLAY(gdkDisplay);
         }
 #endif /* MOZ_X11 */
         return nullptr;
     }
     case NS_NATIVE_SHELLWIDGET:
         return GetToplevelWidget();
 
     case NS_NATIVE_SHAREABLE_WINDOW:
         return (void *) GDK_WINDOW_XID(gdk_window_get_toplevel(mGdkWindow));
-    case NS_NATIVE_PLUGIN_OBJECT_PTR:
-        return (void *) mPluginNativeWindow;
     case NS_RAW_NATIVE_IME_CONTEXT: {
         void* pseudoIMEContext = GetPseudoIMEContext();
         if (pseudoIMEContext) {
             return pseudoIMEContext;
         }
         // If IME context isn't available on this widget, we should set |this|
         // instead of nullptr.
         if (!mIMContext) {
@@ -1757,26 +1707,16 @@ nsWindow::GetNativeData(uint32_t aDataTy
         return gfxPlatformGtk::GetPlatform()->GetCompositorDisplay();
 #endif // MOZ_X11
     default:
         NS_WARNING("nsWindow::GetNativeData called with bad value");
         return nullptr;
     }
 }
 
-void
-nsWindow::SetNativeData(uint32_t aDataType, uintptr_t aVal)
-{
-    if (aDataType != NS_NATIVE_PLUGIN_OBJECT_PTR) {
-        NS_WARNING("nsWindow::SetNativeData called with bad value");
-        return;
-    }
-    mPluginNativeWindow = (nsPluginNativeWindowGtk*)aVal;
-}
-
 nsresult
 nsWindow::SetTitle(const nsAString& aTitle)
 {
     if (!mShell)
         return NS_OK;
 
     // convert the string into utf8 and set the title.
 #define UTF8_FOLLOWBYTE(ch) (((ch) & 0xC0) == 0x80)
@@ -2615,23 +2555,16 @@ nsWindow::OnMotionNotifyEvent(GdkEventMo
             XPeekEvent (GDK_WINDOW_XDISPLAY(aEvent->window), &peeked);
             if (peeked.xany.window != gdk_x11_window_get_xid(aEvent->window)
                 || peeked.type != MotionNotify)
                 break;
 
             synthEvent = true;
             XNextEvent (GDK_WINDOW_XDISPLAY(aEvent->window), &xevent);
         }
-#if (MOZ_WIDGET_GTK == 2)
-        // if plugins still keeps the focus, get it back
-        if (gPluginFocusWindow && gPluginFocusWindow != this) {
-            RefPtr<nsWindow> kungFuDeathGrip = gPluginFocusWindow;
-            gPluginFocusWindow->LoseNonXEmbedPluginFocus();
-        }
-#endif /* MOZ_WIDGET_GTK == 2 */
     }
 #endif /* MOZ_X11 */
 
     WidgetMouseEvent event(true, eMouseMove, this, WidgetMouseEvent::eReal);
 
     gdouble pressure = 0;
     gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
     // Sometime gdk generate 0 pressure value between normal values
@@ -2939,24 +2872,16 @@ nsWindow::OnContainerFocusOutEvent(GdkEv
             shouldRollup = (sourceNode == nullptr);
         }
 
         if (shouldRollup) {
             CheckForRollup(0, 0, false, true);
         }
     }
 
-#if (MOZ_WIDGET_GTK == 2) && defined(MOZ_X11)
-    // plugin lose focus
-    if (gPluginFocusWindow) {
-        RefPtr<nsWindow> kungFuDeathGrip = gPluginFocusWindow;
-        gPluginFocusWindow->LoseNonXEmbedPluginFocus();
-    }
-#endif /* MOZ_X11 && MOZ_WIDGET_GTK == 2 */
-
     if (gFocusWindow) {
         RefPtr<nsWindow> kungFuDeathGrip = gFocusWindow;
         if (gFocusWindow->mIMContext) {
             gFocusWindow->mIMContext->OnBlurWindow(gFocusWindow);
         }
         gFocusWindow = nullptr;
     }
 
@@ -3810,16 +3735,19 @@ nsWindow::Create(nsIWidget* aParent,
 #endif
             }
         }
     }
         break;
     case eWindowType_plugin:
     case eWindowType_plugin_ipc_chrome:
     case eWindowType_plugin_ipc_content:
+        MOZ_ASSERT_UNREACHABLE();
+        return NS_ERROR_FAILURE;
+
     case eWindowType_child: {
         if (parentMozContainer) {
             mGdkWindow = CreateGdkWindow(parentGdkWindow, parentMozContainer);
             mHasMappedToplevel = parentnsWindow->mHasMappedToplevel;
         }
         else if (parentGtkContainer) {
             // This MozContainer has its own window for drawing and receives
             // events because there is no mShell widget (corresponding to this
@@ -4765,167 +4693,22 @@ void
 nsWindow::SetUrgencyHint(GtkWidget *top_window, bool state)
 {
     if (!top_window)
         return;
 
     gdk_window_set_urgency_hint(gtk_widget_get_window(top_window), state);
 }
 
-void *
-nsWindow::SetupPluginPort(void)
-{
-    if (!mGdkWindow)
-        return nullptr;
-
-    if (gdk_window_is_destroyed(mGdkWindow) == TRUE)
-        return nullptr;
-
-    Window window = gdk_x11_window_get_xid(mGdkWindow);
-
-    // we have to flush the X queue here so that any plugins that
-    // might be running on separate X connections will be able to use
-    // this window in case it was just created
-#ifdef MOZ_X11
-    XWindowAttributes xattrs;
-    Display *display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
-    XGetWindowAttributes(display, window, &xattrs);
-    XSelectInput (display, window,
-                  xattrs.your_event_mask |
-                  SubstructureNotifyMask);
-
-    gdk_window_add_filter(mGdkWindow, plugin_window_filter_func, this);
-
-    XSync(display, False);
-#endif /* MOZ_X11 */
-
-    return (void *)window;
-}
-
 void
 nsWindow::SetDefaultIcon(void)
 {
     SetIcon(NS_LITERAL_STRING("default"));
 }
 
-void
-nsWindow::SetPluginType(PluginType aPluginType)
-{
-    mPluginType = aPluginType;
-}
-
-#ifdef MOZ_X11
-void
-nsWindow::SetNonXEmbedPluginFocus()
-{
-    if (gPluginFocusWindow == this || mPluginType!=PluginType_NONXEMBED) {
-        return;
-    }
-
-    if (gPluginFocusWindow) {
-        RefPtr<nsWindow> kungFuDeathGrip = gPluginFocusWindow;
-        gPluginFocusWindow->LoseNonXEmbedPluginFocus();
-    }
-
-    LOGFOCUS(("nsWindow::SetNonXEmbedPluginFocus\n"));
-
-    Window curFocusWindow;
-    int focusState;
-
-    GdkDisplay *gdkDisplay = gdk_window_get_display(mGdkWindow);
-    XGetInputFocus(gdk_x11_display_get_xdisplay(gdkDisplay),
-                   &curFocusWindow,
-                   &focusState);
-
-    LOGFOCUS(("\t curFocusWindow=%p\n", curFocusWindow));
-
-    GdkWindow* toplevel = gdk_window_get_toplevel(mGdkWindow);
-#if (MOZ_WIDGET_GTK == 2)
-    GdkWindow *gdkfocuswin = gdk_window_lookup(curFocusWindow);
-#else
-    GdkWindow *gdkfocuswin = gdk_x11_window_lookup_for_display(gdkDisplay,
-                                                               curFocusWindow);
-#endif
-
-    // lookup with the focus proxy window is supposed to get the
-    // same GdkWindow as toplevel. If the current focused window
-    // is not the focus proxy, we return without any change.
-    if (gdkfocuswin != toplevel) {
-        return;
-    }
-
-    // switch the focus from the focus proxy to the plugin window
-    mOldFocusWindow = curFocusWindow;
-    XRaiseWindow(GDK_WINDOW_XDISPLAY(mGdkWindow),
-                 gdk_x11_window_get_xid(mGdkWindow));
-    gdk_error_trap_push();
-    XSetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
-                   gdk_x11_window_get_xid(mGdkWindow),
-                   RevertToNone,
-                   CurrentTime);
-    gdk_flush();
-#if (MOZ_WIDGET_GTK == 3)
-    gdk_error_trap_pop_ignored();
-#else
-    gdk_error_trap_pop();
-#endif
-    gPluginFocusWindow = this;
-    gdk_window_add_filter(nullptr, plugin_client_message_filter, this);
-
-    LOGFOCUS(("nsWindow::SetNonXEmbedPluginFocus oldfocus=%p new=%p\n",
-              mOldFocusWindow, gdk_x11_window_get_xid(mGdkWindow)));
-}
-
-void
-nsWindow::LoseNonXEmbedPluginFocus()
-{
-    LOGFOCUS(("nsWindow::LoseNonXEmbedPluginFocus\n"));
-
-    // This method is only for the nsWindow which contains a
-    // Non-XEmbed plugin, for example, JAVA plugin.
-    if (gPluginFocusWindow != this || mPluginType!=PluginType_NONXEMBED) {
-        return;
-    }
-
-    Window curFocusWindow;
-    int focusState;
-
-    XGetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
-                   &curFocusWindow,
-                   &focusState);
-
-    // we only switch focus between plugin window and focus proxy. If the
-    // current focused window is not the plugin window, just removing the
-    // event filter that blocks the WM_TAKE_FOCUS is enough. WM and gtk2
-    // will take care of the focus later.
-    if (!curFocusWindow ||
-        curFocusWindow == gdk_x11_window_get_xid(mGdkWindow)) {
-
-        gdk_error_trap_push();
-        XRaiseWindow(GDK_WINDOW_XDISPLAY(mGdkWindow),
-                     mOldFocusWindow);
-        XSetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
-                       mOldFocusWindow,
-                       RevertToParent,
-                       CurrentTime);
-        gdk_flush();
-#if (MOZ_WIDGET_GTK == 3)
-        gdk_error_trap_pop_ignored();
-#else
-        gdk_error_trap_pop();
-#endif
-    }
-    gPluginFocusWindow = nullptr;
-    mOldFocusWindow = 0;
-    gdk_window_remove_filter(nullptr, plugin_client_message_filter, this);
-
-    LOGFOCUS(("nsWindow::LoseNonXEmbedPluginFocus end\n"));
-}
-#endif /* MOZ_X11 */
-
 gint
 nsWindow::ConvertBorderStyles(nsBorderStyle aStyle)
 {
     gint w = 0;
 
     if (aStyle == eBorderStyle_default)
         return -1;
 
@@ -5809,120 +5592,16 @@ popup_take_focus_filter(GdkXEvent *gdk_x
     gdk_window_show_unraised(parent_window);
 
     // Request focus on the parent window.
     // Use gdk_window_focus rather than gtk_window_present to avoid
     // raising the parent window.
     gdk_window_focus(parent_window, timestamp);
     return GDK_FILTER_REMOVE;
 }
-
-static GdkFilterReturn
-plugin_window_filter_func(GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
-{
-    GdkWindow  *plugin_window;
-    XEvent     *xevent;
-    Window      xeventWindow;
-
-    RefPtr<nsWindow> nswindow = (nsWindow*)data;
-    GdkFilterReturn return_val;
-
-    xevent = (XEvent *)gdk_xevent;
-    return_val = GDK_FILTER_CONTINUE;
-
-    switch (xevent->type)
-    {
-        case CreateNotify:
-        case ReparentNotify:
-            if (xevent->type==CreateNotify) {
-                xeventWindow = xevent->xcreatewindow.window;
-            }
-            else {
-                if (xevent->xreparent.event != xevent->xreparent.parent)
-                    break;
-                xeventWindow = xevent->xreparent.window;
-            }
-#if (MOZ_WIDGET_GTK == 2)
-            plugin_window = gdk_window_lookup(xeventWindow);
-#else
-            plugin_window = gdk_x11_window_lookup_for_display(
-                                  gdk_x11_lookup_xdisplay(xevent->xcreatewindow.display), xeventWindow);
-#endif
-            if (plugin_window) {
-                GtkWidget *widget =
-                    get_gtk_widget_for_gdk_window(plugin_window);
-
-// TODO GTK3
-#if (MOZ_WIDGET_GTK == 2)
-                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_NONXEMBED);
-            return_val = GDK_FILTER_REMOVE;
-            break;
-        case EnterNotify:
-            nswindow->SetNonXEmbedPluginFocus();
-            break;
-        case DestroyNotify:
-            gdk_window_remove_filter
-                ((GdkWindow*)(nswindow->GetNativeData(NS_NATIVE_WINDOW)),
-                 plugin_window_filter_func,
-                 nswindow);
-            // Currently we consider all plugins are non-xembed and calls
-            // LoseNonXEmbedPluginFocus without any checking.
-            nswindow->LoseNonXEmbedPluginFocus();
-            break;
-        default:
-            break;
-    }
-    return return_val;
-}
-
-static GdkFilterReturn
-plugin_client_message_filter(GdkXEvent *gdk_xevent,
-                             GdkEvent *event,
-                             gpointer data)
-{
-    XEvent    *xevent;
-    xevent = (XEvent *)gdk_xevent;
-
-    GdkFilterReturn return_val;
-    return_val = GDK_FILTER_CONTINUE;
-
-    if (!gPluginFocusWindow || xevent->type!=ClientMessage) {
-        return return_val;
-    }
-
-    // When WM sends out WM_TAKE_FOCUS, gtk2 will use XSetInputFocus
-    // to set the focus to the focus proxy. To prevent this happen
-    // while the focus is on the plugin, we filter the WM_TAKE_FOCUS
-    // out.
-    if (gdk_x11_get_xatom_by_name("WM_PROTOCOLS")
-            != xevent->xclient.message_type) {
-        return return_val;
-    }
-
-    if ((Atom) xevent->xclient.data.l[0] ==
-            gdk_x11_get_xatom_by_name("WM_TAKE_FOCUS")) {
-        // block it from gtk2.0 focus proxy
-        return_val = GDK_FILTER_REMOVE;
-    }
-
-    return return_val;
-}
 #endif /* MOZ_X11 */
 
 static gboolean
 key_press_event_cb(GtkWidget *widget, GdkEventKey *event)
 {
     LOG(("key_press_event_cb\n"));
 
     UpdateLastInputEventTime(event);
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -57,17 +57,16 @@ extern PRLogModuleInfo *gWidgetDrawLog;
 #define LOG(args)
 #define LOGFOCUS(args)
 #define LOGDRAG(args)
 #define LOGDRAW(args)
 
 #endif /* MOZ_LOGGING */
 
 class gfxPattern;
-class nsPluginNativeWindowGtk;
 
 namespace mozilla {
 class TimeStamp;
 class CurrentX11TimeGetter;
 }
 
 class nsWindow : public nsBaseWidget
 {
@@ -135,17 +134,16 @@ public:
     virtual LayoutDeviceIntRect GetClientBounds() override;
     virtual LayoutDeviceIntSize GetClientSize() override;
     virtual LayoutDeviceIntPoint GetClientOffset() override;
     virtual void       SetCursor(nsCursor aCursor) override;
     virtual nsresult   SetCursor(imgIContainer* aCursor,
                                  uint32_t aHotspotX, uint32_t aHotspotY) override;
     virtual void       Invalidate(const LayoutDeviceIntRect& aRect) override;
     virtual void*      GetNativeData(uint32_t aDataType) override;
-    void               SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
     virtual nsresult   SetTitle(const nsAString& aTitle) override;
     virtual void       SetIcon(const nsAString& aIconSpec) override;
     virtual void       SetWindowClass(const nsAString& xulWinType) override;
     virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
     virtual void       CaptureMouse(bool aCapture) override;
     virtual void       CaptureRollupEvents(nsIRollupListener *aListener,
                                            bool aDoCapture) override;
     virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override;
@@ -231,28 +229,16 @@ private:
 
     void               EnsureGrabs  (void);
     void               GrabPointer  (guint32 aTime);
     void               ReleaseGrabs (void);
 
     void               UpdateClientOffset();
 
 public:
-    enum PluginType {
-        PluginType_NONE = 0,   /* do not have any plugin */
-        PluginType_XEMBED,     /* the plugin support xembed */
-        PluginType_NONXEMBED   /* the plugin does not support xembed */
-    };
-
-    void               SetPluginType(PluginType aPluginType);
-#ifdef MOZ_X11
-    void               SetNonXEmbedPluginFocus(void);
-    void               LoseNonXEmbedPluginFocus(void);
-#endif /* MOZ_X11 */
-
     void               ThemeChanged(void);
     void               OnDPIChanged(void);
     void               OnCheckResize(void);
 
 #ifdef MOZ_X11
     Window             mOldFocusWindow;
 #endif /* MOZ_X11 */
 
@@ -412,17 +398,16 @@ protected:
     // Can we access X?
     bool               mIsX11Display;
 
 private:
     void               DestroyChildWindows();
     GtkWidget         *GetToplevelWidget();
     nsWindow          *GetContainerWindow();
     void               SetUrgencyHint(GtkWidget *top_window, bool state);
-    void              *SetupPluginPort(void);
     void               SetDefaultIcon(void);
     void               InitButtonEvent(mozilla::WidgetMouseEvent& aEvent,
                                        GdkEventButton* aGdkEvent);
     bool               DispatchCommandEvent(nsIAtom* aCommand);
     bool               DispatchContentCommandEvent(mozilla::EventMessage aMsg);
     bool               CheckForRollup(gdouble aMouseX, gdouble aMouseY,
                                       bool aIsWheel, bool aAlwaysRollup);
     void               CheckForRollupDuringGrab()
@@ -439,17 +424,16 @@ private:
     GtkWidget          *mShell;
     MozContainer       *mContainer;
     GdkWindow          *mGdkWindow;
 
     uint32_t            mHasMappedToplevel : 1,
                         mIsFullyObscured : 1,
                         mRetryPointerGrab : 1;
     nsSizeMode          mSizeState;
-    PluginType          mPluginType;
 
     int32_t             mTransparencyBitmapWidth;
     int32_t             mTransparencyBitmapHeight;
 
     nsIntPoint          mClientOffset;
 
 #if GTK_CHECK_VERSION(3,4,0)
     // This field omits duplicate scroll events caused by GNOME bug 726878.
@@ -512,22 +496,16 @@ private:
 
     /**
      * Dispatch accessible window restore event for the top level window
      * accessible.
      */
     void                DispatchRestoreEventAccessible();
 #endif
 
-    // Updates the bounds of the socket widget we manage for remote plugins.
-    void ResizePluginSocketWidget();
-
-    // e10s specific - for managing the socket widget this window hosts.
-    nsPluginNativeWindowGtk* mPluginNativeWindow;
-
     // The cursor cache
     static GdkCursor   *gsGtkCursorCache[eCursorCount];
 
     // Transparency
     bool         mIsTransparent;
     // This bitmap tracks which pixels are transparent. We don't support
     // full translucency at this time; each pixel is either fully opaque
     // or fully transparent.
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -96,17 +96,16 @@ EXPORTS += [
     'nsIDeviceContextSpec.h',
     'nsIKeyEventInPluginCallback.h',
     'nsIPluginWidget.h',
     'nsIRollupListener.h',
     'nsIWidget.h',
     'nsIWidgetListener.h',
     'nsWidgetInitData.h',
     'nsWidgetsCID.h',
-    'PluginWidgetProxy.h',
     'PuppetWidget.h',
 ]
 
 EXPORTS.mozilla += [
     'BasicEvents.h',
     'CommandList.h',
     'ContentCache.h',
     'ContentEvents.h',
@@ -187,22 +186,19 @@ if CONFIG['MOZ_XUL'] and CONFIG['NS_PRIN
     UNIFIED_SOURCES += [
         'nsDeviceContextSpecProxy.cpp',
         'nsPrintOptionsImpl.cpp',
         'nsPrintSession.cpp',
     ]
 
 # nsBaseWidget.cpp needs to be built separately because of name clashes in the OS X headers
 # nsBaseDragService.cpp moved out of UNIFIED to fix xgill crash (bug 1259850) after moving widget/ContentHelper -> apz/util/TouchActionHelper
-# PluginWidgetProxy includes MacOS system headers which define a Point struct
-# that conflicts with mozilla::gfx::Point
 SOURCES += [
     'nsBaseDragService.cpp',
     'nsBaseWidget.cpp',
-    'PluginWidgetProxy.cpp',
 ]
 
 if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']:
     EXPORTS.mozilla += [
         'WidgetTraceEvent.h',
     ]
 
 EXPORTS.ipc = ['nsGUIEventIPC.h']
@@ -212,16 +208,24 @@ if CONFIG['MOZ_X11']:
     UNIFIED_SOURCES += [
         'GfxInfoX11.cpp'
     ]
     SOURCES += [
         'nsShmImage.cpp',
         'WindowSurfaceX11SHM.cpp',
     ]
 
+if toolkit == 'windows':
+    EXPORTS += [
+        'PluginWidgetProxy.h',
+    ]
+    SOURCES += [
+        'PluginWidgetProxy.cpp',
+    ]
+
 if toolkit in ('cocoa', 'windows'):
     UNIFIED_SOURCES += [
         'nsBaseClipboard.cpp',
     ]
 
 if toolkit in {'gtk2', 'gtk3', 'cocoa', 'windows',
                'android', 'gonk', 'uikit'}:
     UNIFIED_SOURCES += [