Bug 1463016: Part 4 - Update XPIDL interfaces to use nsPIDOMWindow(Inner|Outer) rather than nsIDOMWindow. r?nika draft
authorKris Maglione <maglione.k@gmail.com>
Sun, 20 May 2018 17:21:01 -0700
changeset 797628 a48b502edb6d62e28579a41ae921ec72eef81a53
parent 797627 baee8869ccc4089c9354d4d97ef381c2282551c8
child 797629 2d6bbf5a4b3e24733ca9547aff852974aaff92d3
push id110518
push usermaglione.k@gmail.com
push dateMon, 21 May 2018 02:57:23 +0000
reviewersnika
bugs1463016
milestone62.0a1
Bug 1463016: Part 4 - Update XPIDL interfaces to use nsPIDOMWindow(Inner|Outer) rather than nsIDOMWindow. r?nika Most of these seemed to want to deal with inner windows, so I changed those to use Window. A few were definitely dealing with outer windows, though, so I changed those to use WindowProxy. The device sensors API was a weird case. It only ever added listeners as inner windows, but the nsGlobalWindowOuter destructor had a copy of the inner window destructor's code to remove them. Since outer windows are guaranteed never to be added now, I removed that code. MozReview-Commit-ID: IR4kFLnUahq
accessible/interfaces/nsIAccessibleDocument.idl
dom/base/nsGlobalWindowOuter.cpp
dom/base/nsISlowScriptDebug.idl
dom/commandhandler/nsPICommandUpdater.idl
dom/interfaces/base/domstubs.idl
dom/interfaces/base/nsIBrowserDOMWindow.idl
dom/interfaces/base/nsIDOMWindowUtils.idl
dom/interfaces/base/nsIFocusManager.idl
dom/media/MediaManager.cpp
dom/media/bridge/IPeerConnection.idl
dom/media/nsIMediaManager.idl
dom/system/nsDeviceSensors.cpp
dom/system/nsDeviceSensors.h
dom/xul/nsIController.idl
editor/composer/nsIEditingSession.idl
mobile/android/components/SessionStore.idl
netwerk/base/LoadContextInfo.cpp
netwerk/base/LoadContextInfo.h
netwerk/base/mozIThirdPartyUtil.idl
netwerk/base/nsILoadContextInfo.idl
netwerk/base/nsIPrompt.idl
toolkit/components/browser/nsIPrintingPromptService.idl
toolkit/components/browser/nsIWebBrowser.idl
toolkit/components/commandlines/nsCommandLine.cpp
toolkit/components/commandlines/nsICommandLine.idl
toolkit/components/commandlines/nsICommandLineRunner.idl
toolkit/components/passwordmgr/nsILoginManagerPrompter.idl
toolkit/components/perfmonitoring/nsIPerformanceStats.idl
toolkit/components/remote/nsDBusRemoteService.cpp
toolkit/components/remote/nsGTKRemoteService.cpp
toolkit/components/remote/nsIRemoteService.idl
toolkit/components/remote/nsRemoteService.cpp
toolkit/components/remote/nsRemoteService.h
toolkit/components/remote/nsXRemoteService.cpp
toolkit/components/windowwatcher/nsIWindowWatcher.idl
toolkit/components/windowwatcher/nsPIPromptService.idl
toolkit/components/windowwatcher/nsPIWindowWatcher.idl
toolkit/mozapps/update/nsIUpdateService.idl
uriloader/base/nsIContentHandler.idl
uriloader/exthandler/nsIContentDispatchChooser.idl
widget/nsIApplicationChooser.idl
widget/nsIColorPicker.idl
xpcom/system/nsIDeviceSensors.idl
xpcom/system/nsIGeolocationProvider.idl
--- a/accessible/interfaces/nsIAccessibleDocument.idl
+++ b/accessible/interfaces/nsIAccessibleDocument.idl
@@ -44,17 +44,17 @@ interface nsIAccessibleDocument : nsISup
   readonly attribute AString docType;
 
   /**
    * The Document interface associated with this document.
    */
   readonly attribute Document DOMDocument;
 
   /**
-   * The nsIDOMWindow that the document resides in.
+   * The Window that the document resides in.
    */
   readonly attribute WindowProxy window;
 
   /**
    * Return the parent document accessible.
    */
   readonly attribute nsIAccessibleDocument parentDocument;
 
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -974,20 +974,16 @@ nsGlobalWindowOuter::~nsGlobalWindowOute
   if (mTabGroup) {
     mTabGroup->Leave(this);
   }
 
   // Outer windows are always supposed to call CleanUp before letting themselves
   // be destroyed.
   MOZ_ASSERT(mCleanedUp);
 
-  nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
-  if (ac)
-    ac->RemoveWindowAsListener(this);
-
   nsLayoutStatics::Release();
 }
 
 // static
 void
 nsGlobalWindowOuter::ShutDown()
 {
   AssertIsOnMainThread();
--- a/dom/base/nsISlowScriptDebug.idl
+++ b/dom/base/nsISlowScriptDebug.idl
@@ -1,22 +1,22 @@
 /* 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 "nsISupports.idl"
 
-interface nsIDOMWindow;
+webidl Window;
 
 webidl EventTarget;
 
 [scriptable, function, uuid(f7dbb80c-5d1e-4fd9-b55c-a9ffda4a75b1)]
 interface nsISlowScriptDebugCallback : nsISupports
 {
-  void handleSlowScriptDebug(in nsIDOMWindow aWindow);
+  void handleSlowScriptDebug(in Window aWindow);
 };
 
 [scriptable, function, uuid(b1c6ecd0-8fa4-11e4-b4a9-0800200c9a66)]
 interface nsISlowScriptDebuggerStartupCallback : nsISupports
 {
   void finishDebuggerStartup();
 };
 
--- a/dom/commandhandler/nsPICommandUpdater.idl
+++ b/dom/commandhandler/nsPICommandUpdater.idl
@@ -16,19 +16,18 @@ webidl WindowProxy;
 	from an nsICommandManager.
 */
 
 [scriptable, uuid(35e474ae-8016-4c34-9644-edc11f8b0ce1)]
 interface nsPICommandUpdater : nsISupports
 {
 
   /*
-   * Init the command updater, passing an nsIDOMWindow which 
+   * Init the command updater, passing an Window which
    * is the window that the command updater lives on.
-   * 
    */
   void    init(in WindowProxy aWindow);
    
   /*
    * Notify the command manager that the status of a command
    * changed. It may have changed from enabled to disabled,
    * or vice versa, or become toggled etc.
    */
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -24,16 +24,16 @@ interface nsIDOMNode;
 namespace mozilla {
 namespace dom {
 class DOMException;
 }
 }
 %}
 
 // Base
-interface nsIDOMWindow;
+webidl Window;
 interface nsIDOMWindowCollection;
 
 // Events
 interface nsIDOMEventListener;
 
 // HTML
 interface nsIDOMHTMLHeadElement;
--- a/dom/interfaces/base/nsIBrowserDOMWindow.idl
+++ b/dom/interfaces/base/nsIBrowserDOMWindow.idl
@@ -1,17 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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/. */
 
 #include "nsISupports.idl"
 
 webidl WindowProxy;
-interface nsIDOMWindow;
 interface nsIURI;
 interface nsIFrameLoaderOwner;
 interface nsIPrincipal;
 
 [scriptable, uuid(e774db14-79ac-4156-a7a3-aa3fd0a22c10)]
 interface nsIOpenURIInFrameParams : nsISupports
 {
   attribute DOMString referrer;
@@ -159,17 +158,17 @@ interface nsIBrowserDOMWindow : nsISuppo
                  in unsigned long long aNextTabParentId,
                  in AString aName);
 
   /**
    * @param  aWindow the window to test.
    * @return whether the window is the main content window for any
    *         currently open tab in this toplevel browser window.
    */
-  boolean isTabContentWindow(in nsIDOMWindow aWindow);
+  boolean isTabContentWindow(in WindowProxy aWindow);
 
   /**
    * This function is responsible for calling
    * nsIContentViewer::PermitUnload on each frame in the window. It
    * returns true if closing the window is allowed. See canClose() in
    * BrowserUtils.jsm for a simple implementation of this method.
    */
   boolean canClose();
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -3,17 +3,17 @@
  * 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 "nsISupports.idl"
 #include "domstubs.idl"
 
 /**
  * nsIDOMWindowUtils is intended for infrequently-used methods related
- * to the current nsIDOMWindow.  Some of the methods may require
+ * to the current Window.  Some of the methods may require
  * elevated privileges; the method implementations should contain the
  * necessary security checks.  Access this interface by calling
  * getInterface on a DOMWindow.
  *
  * WARNING: Do not use 'out jsval' parameters in this file.
  *          SpecialPowers, which is used to access nsIDOMWindowUtils
  *          in plain mochitests, does not know how to handle them.
  *          (Use 'jsval' return values instead.)
@@ -30,20 +30,17 @@ native nscolor(nscolor);
 [ptr] native gfxContext(gfxContext);
 
 interface nsIArray;
 interface nsICycleCollectorListener;
 interface nsIDOMNode;
 interface nsIPreloadedStyleSheet;
 interface nsITransferable;
 interface nsIQueryContentEventResult;
-interface nsIDOMWindow;
-interface nsIFile;
 interface nsIURI;
-interface nsIRunnable;
 interface nsITranslationNodeList;
 interface nsIJSRAIIHelper;
 interface nsIContentPermissionRequest;
 interface nsIObserver;
 interface nsIDOMStorage;
 
 webidl DOMRect;
 webidl Element;
@@ -818,25 +815,25 @@ interface nsIDOMWindowUtils : nsISupport
    *               on all windows.  Otherwise, enable them.
    */
   void disableNonTestMouseEvents(in boolean aDisable);
 
   /**
    * Returns the scroll position of the window's currently loaded document.
    *
    * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
-   * @see nsIDOMWindow::scrollX/Y
+   * @see Window::scrollX/Y
    */
   void getScrollXY(in boolean aFlushLayout, out long aScrollX, out long aScrollY);
 
   /**
    * Returns the scroll position of the window's currently loaded document.
    *
    * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
-   * @see nsIDOMWindow::scrollX/Y
+   * @see Window::scrollX/Y
    */
   void getScrollXYFloat(in boolean aFlushLayout, out float aScrollX, out float aScrollY);
 
   /**
    * Returns the scrollbar width of the window's scroll frame.
    *
    * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
    */
--- a/dom/interfaces/base/nsIFocusManager.idl
+++ b/dom/interfaces/base/nsIFocusManager.idl
@@ -10,17 +10,17 @@ interface nsIDocument;
 
 webidl Element;
 
 [scriptable, uuid(86e1f1e1-365d-493b-b52a-a649f3f311dc)]
 /**
  * The focus manager deals with all focus related behaviour. Only one element
  * in the entire application may have the focus at a time; this element
  * receives any keyboard events. While there is only one application-wide
- * focused element, each nsIDOMWindow maintains a reference to the element
+ * focused element, each Window maintains a reference to the element
  * that would be focused if the window was active.
  *
  * If the window's reference is to a frame element (iframe, browser,
  * editor), then the child window contains the element that is currently
  * focused. If the window's reference is to a root element, then the root is
  * focused. If a window's reference is null, then no element is focused, yet
  * the window is still focused.
  *
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -3739,17 +3739,17 @@ struct CaptureWindowStateData {
   uint16_t* mMicrophone;
   uint16_t* mScreenShare;
   uint16_t* mWindowShare;
   uint16_t* mAppShare;
   uint16_t* mBrowserShare;
 };
 
 NS_IMETHODIMP
-MediaManager::MediaCaptureWindowState(nsIDOMWindow* aCapturedWindow,
+MediaManager::MediaCaptureWindowState(nsPIDOMWindowInner* aCapturedWindow,
                                       uint16_t* aCamera,
                                       uint16_t* aMicrophone,
                                       uint16_t* aScreen,
                                       uint16_t* aWindow,
                                       uint16_t* aApplication,
                                       uint16_t* aBrowser)
 {
   MOZ_ASSERT(NS_IsMainThread());
--- a/dom/media/bridge/IPeerConnection.idl
+++ b/dom/media/bridge/IPeerConnection.idl
@@ -1,10 +1,9 @@
 #include "nsIThread.idl"
-#include "nsIDOMWindow.idl"
 #include "nsIPropertyBag2.idl"
 
 /* Do not confuse with nsIDOMRTCPeerConnection. This interface is purely for
  * communication between the PeerConnection JS DOM binding and the C++
  * implementation in SIPCC.
  *
  * See media/webrtc/signaling/include/PeerConnectionImpl.h
  */
--- a/dom/media/nsIMediaManager.idl
+++ b/dom/media/nsIMediaManager.idl
@@ -1,16 +1,16 @@
 /* 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 "nsISupports.idl"
 
 interface nsIArray;
-interface nsIDOMWindow;
+webidl Window;
 
 %{C++
 #define NS_MEDIAMANAGERSERVICE_CID {0xabc622ea, 0x9655, 0x4123, {0x80, 0xd9, 0x22, 0x62, 0x1b, 0xdd, 0x54, 0x65}}
 #define MEDIAMANAGERSERVICE_CONTRACTID "@mozilla.org/mediaManagerService;1"
 %}
 
 [scriptable, builtinclass, uuid(24b23e01-33fd-401f-ba25-6e52658750b0)]
 interface nsIMediaManagerService : nsISupports
@@ -19,17 +19,17 @@ interface nsIMediaManagerService : nsISu
   readonly attribute nsIArray activeMediaCaptureWindows;
 
   /* possible states for camera and microphone capture */
   const unsigned short STATE_NOCAPTURE = 0;
   const unsigned short STATE_CAPTURE_ENABLED = 1;
   const unsigned short STATE_CAPTURE_DISABLED = 2;
 
   /* Get the capture state for the given window and all descendant windows (iframes, etc) */
-  void mediaCaptureWindowState(in nsIDOMWindow aWindow,
+  void mediaCaptureWindowState(in Window aWindow,
                                out unsigned short aCamera,
                                out unsigned short aMicrophone,
                                [optional] out unsigned short aScreenShare,
                                [optional] out unsigned short aWindowShare,
                                [optional] out unsigned short aAppShare,
                                [optional] out unsigned short aBrowserShare);
 
   /* Clear per-orgin list of persistent DeviceIds stored for enumerateDevices
--- a/dom/system/nsDeviceSensors.cpp
+++ b/dom/system/nsDeviceSensors.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/Hal.h"
 #include "mozilla/HalSensor.h"
 
 #include "nsContentUtils.h"
 #include "nsDeviceSensors.h"
 
-#include "nsIDOMWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIServiceManager.h"
 #include "nsIServiceManager.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Services.h"
 #include "nsIPermissionManager.h"
@@ -37,18 +36,18 @@ using namespace hal;
 #define DEFAULT_SENSOR_POLL 100
 
 static bool gPrefSensorsEnabled = false;
 static bool gPrefMotionSensorEnabled = false;
 static bool gPrefOrientationSensorEnabled = false;
 static bool gPrefProximitySensorEnabled = false;
 static bool gPrefAmbientLightSensorEnabled = false;
 
-static const nsTArray<nsIDOMWindow*>::index_type NoIndex =
-  nsTArray<nsIDOMWindow*>::NoIndex;
+static const nsTArray<nsPIDOMWindowInner*>::index_type NoIndex =
+  nsTArray<nsPIDOMWindowInner*>::NoIndex;
 
 class nsDeviceSensorData final : public nsIDeviceSensorData
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDEVICESENSORDATA
 
   nsDeviceSensorData(unsigned long type, double x, double y, double z);
@@ -123,17 +122,17 @@ nsDeviceSensors::nsDeviceSensors()
   Preferences::AddBoolVarCache(&gPrefProximitySensorEnabled,
                               "device.sensors.proximity.enabled",
                               false);
   Preferences::AddBoolVarCache(&gPrefAmbientLightSensorEnabled,
                               "device.sensors.ambientLight.enabled",
                               false);
 
   for (int i = 0; i < NUM_SENSOR_TYPE; i++) {
-    nsTArray<nsIDOMWindow*> *windows = new nsTArray<nsIDOMWindow*>();
+    nsTArray<nsPIDOMWindowInner*> *windows = new nsTArray<nsPIDOMWindowInner*>();
     mWindowListeners.AppendElement(windows);
   }
 
   mLastDOMMotionEventTime = TimeStamp::Now();
 }
 
 nsDeviceSensors::~nsDeviceSensors()
 {
@@ -142,17 +141,17 @@ nsDeviceSensors::~nsDeviceSensors()
       UnregisterSensorObserver((SensorType)i, this);
   }
 
   for (int i = 0; i < NUM_SENSOR_TYPE; i++) {
     delete mWindowListeners[i];
   }
 }
 
-NS_IMETHODIMP nsDeviceSensors::HasWindowListener(uint32_t aType, nsIDOMWindow *aWindow, bool *aRetVal)
+NS_IMETHODIMP nsDeviceSensors::HasWindowListener(uint32_t aType, nsPIDOMWindowInner *aWindow, bool *aRetVal)
 {
   if (!IsSensorAllowedByPref(aType, aWindow))
     *aRetVal = false;
   else
     *aRetVal = mWindowListeners[aType]->IndexOf(aWindow) != NoIndex;
 
   return NS_OK;
 }
@@ -183,17 +182,17 @@ public:
 
 private:
   RefPtr<nsDeviceSensors> mTarget;
   uint32_t mType;
 };
 
 static bool sTestSensorEvents = false;
 
-NS_IMETHODIMP nsDeviceSensors::AddWindowListener(uint32_t aType, nsIDOMWindow *aWindow)
+NS_IMETHODIMP nsDeviceSensors::AddWindowListener(uint32_t aType, nsPIDOMWindowInner *aWindow)
 {
   if (!IsSensorAllowedByPref(aType, aWindow))
     return NS_OK;
 
   if (mWindowListeners[aType]->IndexOf(aWindow) != NoIndex)
     return NS_OK;
 
   if (!IsSensorEnabled(aType)) {
@@ -213,30 +212,30 @@ NS_IMETHODIMP nsDeviceSensors::AddWindow
   if (sTestSensorEvents) {
     nsCOMPtr<nsIRunnable> event = new DeviceSensorTestEvent(this, aType);
     NS_DispatchToCurrentThread(event);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsDeviceSensors::RemoveWindowListener(uint32_t aType, nsIDOMWindow *aWindow)
+NS_IMETHODIMP nsDeviceSensors::RemoveWindowListener(uint32_t aType, nsPIDOMWindowInner *aWindow)
 {
   if (mWindowListeners[aType]->IndexOf(aWindow) == NoIndex)
     return NS_OK;
 
   mWindowListeners[aType]->RemoveElement(aWindow);
 
   if (mWindowListeners[aType]->Length() == 0)
     UnregisterSensorObserver((SensorType)aType, this);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsDeviceSensors::RemoveWindowAsListener(nsIDOMWindow *aWindow)
+NS_IMETHODIMP nsDeviceSensors::RemoveWindowAsListener(nsPIDOMWindowInner *aWindow)
 {
   for (int i = 0; i < NUM_SENSOR_TYPE; i++) {
     RemoveWindowListener((SensorType)i, aWindow);
   }
   return NS_OK;
 }
 
 static bool
@@ -351,17 +350,17 @@ nsDeviceSensors::Notify(const mozilla::h
   const InfallibleTArray<float>& values = aSensorData.values();
   size_t len = values.Length();
   double x = len > 0 ? values[0] : 0.0;
   double y = len > 1 ? values[1] : 0.0;
   double z = len > 2 ? values[2] : 0.0;
   double w = len > 3 ? values[3] : 0.0;
   PRTime timestamp = aSensorData.timestamp();
 
-  nsCOMArray<nsIDOMWindow> windowListeners;
+  nsCOMArray<nsPIDOMWindowInner> windowListeners;
   for (uint32_t i = 0; i < mWindowListeners[type]->Length(); i++) {
     windowListeners.AppendObject(mWindowListeners[type]->SafeElementAt(i));
   }
 
   for (uint32_t i = windowListeners.Count(); i > 0 ; ) {
     --i;
 
     nsCOMPtr<nsPIDOMWindowInner> pwindow = do_QueryInterface(windowListeners[i]);
@@ -586,17 +585,17 @@ nsDeviceSensors::FireDOMMotionEvent(nsID
 
   mLastRotationRate.reset();
   mLastAccelerationIncludingGravity.reset();
   mLastAcceleration.reset();
   mLastDOMMotionEventTime = TimeStamp::Now();
 }
 
 bool
-nsDeviceSensors::IsSensorAllowedByPref(uint32_t aType, nsIDOMWindow* aWindow)
+nsDeviceSensors::IsSensorAllowedByPref(uint32_t aType, nsPIDOMWindowInner* aWindow)
 {
   // checks "device.sensors.enabled" master pref
   if (!gPrefSensorsEnabled) {
     return false;
   }
 
   nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aWindow);
   nsCOMPtr<nsIDocument> doc;
--- a/dom/system/nsDeviceSensors.h
+++ b/dom/system/nsDeviceSensors.h
@@ -12,17 +12,17 @@
 #include "nsTArray.h"
 #include "nsCOMPtr.h"
 #include "nsITimer.h"
 #include "mozilla/dom/DeviceMotionEvent.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/HalSensor.h"
 #include "nsDataHashtable.h"
 
-class nsIDOMWindow;
+class nsPIDOMWindowInner;
 class nsIDocument;
 
 namespace mozilla {
 namespace dom {
 class EventTarget;
 } // namespace dom
 } // namespace mozilla
 
@@ -37,17 +37,17 @@ public:
   nsDeviceSensors();
 
   void Notify(const mozilla::hal::SensorData& aSensorData) override;
 
 private:
   virtual ~nsDeviceSensors();
 
   // sensor -> window listener
-  nsTArray<nsTArray<nsIDOMWindow*>* > mWindowListeners;
+  nsTArray<nsTArray<nsPIDOMWindowInner*>* > mWindowListeners;
 
   void FireDOMLightEvent(mozilla::dom::EventTarget* aTarget,
                          double value);
 
   void FireDOMProximityEvent(mozilla::dom::EventTarget* aTarget,
                              double aValue,
                              double aMin,
                              double aMax);
@@ -68,17 +68,17 @@ private:
                           double x,
                           double y,
                           double z);
 
   inline bool IsSensorEnabled(uint32_t aType) {
     return mWindowListeners[aType]->Length() > 0;
   }
 
-  bool IsSensorAllowedByPref(uint32_t aType, nsIDOMWindow* aWindow);
+  bool IsSensorAllowedByPref(uint32_t aType, nsPIDOMWindowInner* aWindow);
 
   mozilla::TimeStamp mLastDOMMotionEventTime;
   bool mIsUserProximityNear;
   mozilla::Maybe<DeviceAccelerationInit> mLastAcceleration;
   mozilla::Maybe<DeviceAccelerationInit> mLastAccelerationIncludingGravity;
   mozilla::Maybe<DeviceRotationRateInit> mLastRotationRate;
 };
 
--- a/dom/xul/nsIController.idl
+++ b/dom/xul/nsIController.idl
@@ -35,17 +35,17 @@ interface nsICommandController : nsISupp
 
   void getSupportedCommands(out unsigned long count,
                             [array, size_is(count), retval] out string commands);
 };
 
 
 /*
   An API for registering commands in groups, to allow for 
-  updating via nsIDOMWindow::UpdateCommands.
+  updating via Window::UpdateCommands.
 */
 interface nsISimpleEnumerator;
 
 [scriptable, uuid(9F82C404-1C7B-11D5-A73C-ECA43CA836FC)]
 interface nsIControllerCommandGroup : nsISupports
 {
 
   void  addCommandToGroup(in string aCommand, in string aGroup);
--- a/editor/composer/nsIEditingSession.idl
+++ b/editor/composer/nsIEditingSession.idl
@@ -34,17 +34,17 @@ interface nsIEditingSession : nsISupport
   /**
    *  Status after editor creation and document loading
    *  Value is one of the above error codes
    */
   readonly attribute unsigned long editorStatus;
 
   /**
    *  Make this window editable
-   *  @param aWindow nsIDOMWindow, the window the embedder needs to make editable
+   *  @param aWindow Window, the window the embedder needs to make editable
    *  @param aEditorType string, "html" "htmlsimple" "text" "textsimple"
    *  @param aMakeWholeDocumentEditable if PR_TRUE make the whole document in
    *                                    aWindow editable, otherwise it's the
    *                                    embedder who should make the document
    *                                    (or part of it) editable.
    *  @param aInteractive if PR_FALSE turn off scripting and plugins
    */
   void makeWindowEditable(in WindowProxy window,
--- a/mobile/android/components/SessionStore.idl
+++ b/mobile/android/components/SessionStore.idl
@@ -1,15 +1,15 @@
 /* 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 "nsISupports.idl"
 
-interface nsIDOMWindow;
+webidl Window;
 interface nsIDOMNode;
 
 /**
  * nsISessionStore keeps track of the current browsing state.
  *
  * The nsISessionStore API operates mostly on browser windows and the browser
  * tabs contained in them.
  */
@@ -21,38 +21,38 @@ interface nsISessionStore : nsISupports
    * Get the current browsing state.
    * @returns a JSON string representing the session state.
    */
   AString getBrowserState();
 
   /**
    * Get the number of restore-able tabs for a browser window
    */
-  unsigned long getClosedTabCount(in nsIDOMWindow aWindow);
+  unsigned long getClosedTabCount(in Window aWindow);
 
   /**
    * Get closed tab data
    *
    * @param aWindow is the browser window for which to get closed tab data
    * @returns a JS array of closed tabs.
    */
-  jsval getClosedTabs(in nsIDOMWindow aWindow);
+  jsval getClosedTabs(in Window aWindow);
 
   /**
    * @param aWindow is the browser window to reopen a closed tab in.
    * @param aCloseTabData is the data of the tab to be restored.
    * @returns a reference to the reopened tab.
    */
-  nsIDOMNode undoCloseTab(in nsIDOMWindow aWindow, in jsval aCloseTabData);
+  nsIDOMNode undoCloseTab(in Window aWindow, in jsval aCloseTabData);
 
   /**
    * @param aWindow is the browser window associated with the closed tab.
    * @param aIndex  is the index of the closed tab to be removed (FIFO ordered).
    */
-  nsIDOMNode forgetClosedTab(in nsIDOMWindow aWindow, in unsigned long aIndex);
+  nsIDOMNode forgetClosedTab(in Window aWindow, in unsigned long aIndex);
 
   /**
    * Whether the "Undo close tab" message should be shown or not after a tab has been closed.
    */
  readonly attribute boolean canUndoLastCloseTab;
 
   /**
    * @param aTab is the browser tab to get the value for.
@@ -81,16 +81,16 @@ interface nsISessionStore : nsISupports
    */
   void restoreZombieTab(in jsval aTab);
 
   /**
    * Removes a window from the current session history. Data from this window
    * won't be saved when its closed.
    * @param aWindow The window to remove
    */
-  void removeWindow(in nsIDOMWindow aWindow);
+  void removeWindow(in Window aWindow);
 
   /**
    * Set the load state of the session store. Use only for testing.
    * @param aState The target load state.
    */
   void setLoadState(in long aState);
 };
--- a/netwerk/base/LoadContextInfo.cpp
+++ b/netwerk/base/LoadContextInfo.cpp
@@ -97,17 +97,17 @@ NS_IMETHODIMP LoadContextInfoFactory::Cu
 NS_IMETHODIMP LoadContextInfoFactory::FromLoadContext(nsILoadContext *aLoadContext, bool aAnonymous,
                                                       nsILoadContextInfo * *_retval)
 {
   nsCOMPtr<nsILoadContextInfo> info = GetLoadContextInfo(aLoadContext, aAnonymous);
   info.forget(_retval);
   return NS_OK;
 }
 
-NS_IMETHODIMP LoadContextInfoFactory::FromWindow(nsIDOMWindow *aWindow, bool aAnonymous,
+NS_IMETHODIMP LoadContextInfoFactory::FromWindow(nsPIDOMWindowInner *aWindow, bool aAnonymous,
                                                  nsILoadContextInfo * *_retval)
 {
   nsCOMPtr<nsILoadContextInfo> info = GetLoadContextInfo(aWindow, aAnonymous);
   info.forget(_retval);
   return NS_OK;
 }
 
 // Helper functions
@@ -149,17 +149,17 @@ GetLoadContextInfo(nsILoadContext *aLoad
     MOZ_ASSERT(aLoadContext->UsePrivateBrowsing() == (oa.mPrivateBrowsingId > 0));
   }
 #endif
 
   return new LoadContextInfo(aIsAnonymous, oa);
 }
 
 LoadContextInfo*
-GetLoadContextInfo(nsIDOMWindow *aWindow,
+GetLoadContextInfo(nsPIDOMWindowInner *aWindow,
                    bool aIsAnonymous)
 {
   nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aWindow);
   nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(webNav);
 
   return GetLoadContextInfo(loadContext, aIsAnonymous);
 }
 
--- a/netwerk/base/LoadContextInfo.h
+++ b/netwerk/base/LoadContextInfo.h
@@ -40,17 +40,17 @@ public:
 LoadContextInfo*
 GetLoadContextInfo(nsIChannel *aChannel);
 
 LoadContextInfo*
 GetLoadContextInfo(nsILoadContext *aLoadContext,
                    bool aIsAnonymous);
 
 LoadContextInfo*
-GetLoadContextInfo(nsIDOMWindow *aLoadContext,
+GetLoadContextInfo(nsPIDOMWindowInner *aLoadContext,
                    bool aIsAnonymous);
 
 LoadContextInfo*
 GetLoadContextInfo(nsILoadContextInfo *aInfo);
 
 LoadContextInfo*
 GetLoadContextInfo(bool const aIsAnonymous,
                    OriginAttributes const &aOriginAttributes);
--- a/netwerk/base/mozIThirdPartyUtil.idl
+++ b/netwerk/base/mozIThirdPartyUtil.idl
@@ -85,17 +85,17 @@ interface mozIThirdPartyUtil : nsISuppor
    *
    * 1) If 'aChannel' is an nsIHttpChannel and has the
    *    'forceAllowThirdPartyCookie' property set, then:
    *    a) If 'aURI' is null, return false.
    *    b) Otherwise, find the URI of the channel, determine whether it is
    *       foreign with respect to 'aURI', and return.
    * 2) Find the URI of the channel and determine whether it is third party with
    *    respect to the URI of the channel. If so, return.
-   * 3) Obtain the bottommost nsIDOMWindow, and its same-type parent if it
+   * 3) Obtain the bottommost Window, and its same-type parent if it
    *    exists, from the channel's notification callbacks. Then:
    *    a) If the parent is the same as the bottommost window, and the channel
    *       has the LOAD_DOCUMENT_URI flag set, return false. This represents the
    *       case where a toplevel load is occurring and the window's URI has not
    *       yet been updated. (We have already checked that 'aURI' is not foreign
    *       with respect to the channel URI.)
    *    b) Otherwise, return the result of isThirdPartyWindow with arguments
    *       of the channel's bottommost window and the channel URI, respectively.
--- a/netwerk/base/nsILoadContextInfo.idl
+++ b/netwerk/base/nsILoadContextInfo.idl
@@ -6,17 +6,17 @@
 #include "nsISupports.idl"
 
 %{ C++
 #include "mozilla/BasePrincipal.h"
 %}
 native OriginAttributesNativePtr(const mozilla::OriginAttributes*);
 
 interface nsILoadContext;
-interface nsIDOMWindow;
+webidl Window;
 
 /**
  * Helper interface to carry informatin about the load context
  * encapsulating origin attributes and IsAnonymous, IsPrivite properties.
  * It shall be used where nsILoadContext cannot be used or is not
  * available.
  */
 
@@ -80,10 +80,10 @@ interface nsILoadContextInfo : nsISuppor
 interface nsILoadContextInfoFactory : nsISupports
 {
   readonly attribute nsILoadContextInfo default;
   readonly attribute nsILoadContextInfo private;
   readonly attribute nsILoadContextInfo anonymous;
   [implicit_jscontext]
   nsILoadContextInfo custom(in boolean aAnonymous, in jsval aOriginAttributes);
   nsILoadContextInfo fromLoadContext(in nsILoadContext aLoadContext, in boolean aAnonymous);
-  nsILoadContextInfo fromWindow(in nsIDOMWindow aWindow, in boolean aAnonymous);
+  nsILoadContextInfo fromWindow(in Window aWindow, in boolean aAnonymous);
 };
--- a/netwerk/base/nsIPrompt.idl
+++ b/netwerk/base/nsIPrompt.idl
@@ -2,17 +2,17 @@
 /* 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 is the prompt interface which can be used without knowlege of a
  * parent window. The parentage is hidden by the GetInterface though
  * which it is gotten. This interface is identical to nsIPromptService
- * but without the parent nsIDOMWindow parameter. See nsIPromptService
+ * but without the parent Window parameter. See nsIPromptService
  * for all documentation.
  *
  * Accesskeys can be attached to buttons and checkboxes by inserting
  * an & before the accesskey character. For a real &, use && instead.
  */  
 
 #include "nsISupports.idl"
 
--- a/toolkit/components/browser/nsIPrintingPromptService.idl
+++ b/toolkit/components/browser/nsIPrintingPromptService.idl
@@ -7,18 +7,16 @@
 
 #include "nsISupports.idl"
 #include "nsIWebBrowserPrint.idl"
 #include "nsIWebProgressListener.idl"
 #include "nsIPrintProgressParams.idl"
 #include "nsIPrintSettings.idl"
 #include "nsIObserver.idl"
 
-interface nsIDOMWindow;
-
 [scriptable, uuid(72006d06-a2a5-4250-ae92-04b2f0e2ab8d)]
 interface nsIPrintingPromptService : nsISupports
 {
    /**
    *  This service enables embedders to implement their own Print and Progress Dialogs.
    *  Each platform has a "base" or "basckstop" implementation of the service. The 
    *  service is automatically registered at start up.
    *
--- a/toolkit/components/browser/nsIWebBrowser.idl
+++ b/toolkit/components/browser/nsIWebBrowser.idl
@@ -4,17 +4,17 @@
  * 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 "nsISupports.idl"
 
 interface nsIInterfaceRequestor;
 interface nsIWebBrowserChrome;
 interface nsIURIContentListener;
-interface nsIDOMWindow;
+webidl Window;
 webidl WindowProxy;
 interface nsIWeakReference;
 
 %{C++
 namespace mozilla {
 class OriginAttributes;
 }
 %}
@@ -133,17 +133,17 @@ interface nsIWebBrowser : nsISupports
      * @see nsIURIContentListener
      */
     attribute nsIURIContentListener parentURIContentListener;
 
     /**
      * The top-level DOM window. The embedder may walk the entire
      * DOM starting from this value.
      *
-     * @see nsIDOMWindow
+     * @see Window
      */
     readonly attribute WindowProxy contentDOMWindow;
 
     /**
      * Whether this web browser is active. Active means that it's visible
      * enough that we want to avoid certain optimizations like discarding
      * decoded image data and throttling the refresh driver. In Firefox,
      * this corresponds to the visible tab.
--- a/toolkit/components/commandlines/nsCommandLine.cpp
+++ b/toolkit/components/commandlines/nsCommandLine.cpp
@@ -4,17 +4,17 @@
 
 #include "nsICommandLineRunner.h"
 
 #include "nsICategoryManager.h"
 #include "nsICommandLineHandler.h"
 #include "nsICommandLineValidator.h"
 #include "nsIConsoleService.h"
 #include "nsIClassInfoImpl.h"
-#include "nsIDOMWindow.h"
+#include "nsPIDOMWindow.h"
 #include "nsIFile.h"
 #include "nsISimpleEnumerator.h"
 #include "nsIStringEnumerator.h"
 
 #include "nsCOMPtr.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsISupportsImpl.h"
 #include "nsNativeCharsetUtils.h"
@@ -67,17 +67,17 @@ protected:
   void appendArg(const char* arg);
   MOZ_MUST_USE nsresult resolveShortcutURL(nsIFile* aFile, nsACString& outURL);
   nsresult EnumerateHandlers(EnumerateHandlersCallback aCallback, void *aClosure);
   nsresult EnumerateValidators(EnumerateValidatorsCallback aCallback, void *aClosure);
 
   nsTArray<nsString>      mArgs;
   uint32_t                mState;
   nsCOMPtr<nsIFile>       mWorkingDir;
-  nsCOMPtr<nsIDOMWindow>  mWindowContext;
+  nsCOMPtr<nsPIDOMWindowOuter> mWindowContext;
   bool                    mPreventDefault;
 };
 
 nsCommandLine::nsCommandLine() :
   mState(STATE_INITIAL_LAUNCH),
   mPreventDefault(false)
 {
 
@@ -227,24 +227,24 @@ nsCommandLine::GetWorkingDirectory(nsIFi
 {
   NS_ENSURE_TRUE(mWorkingDir, NS_ERROR_NOT_INITIALIZED);
 
   NS_ADDREF(*aResult = mWorkingDir);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsCommandLine::GetWindowContext(nsIDOMWindow* *aResult)
+nsCommandLine::GetWindowContext(nsPIDOMWindowOuter* *aResult)
 {
   NS_IF_ADDREF(*aResult = mWindowContext);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsCommandLine::SetWindowContext(nsIDOMWindow* aValue)
+nsCommandLine::SetWindowContext(nsPIDOMWindowOuter* aValue)
 {
   mWindowContext = aValue;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsCommandLine::ResolveFile(const nsAString& aArgument, nsIFile* *aResult)
 {
--- a/toolkit/components/commandlines/nsICommandLine.idl
+++ b/toolkit/components/commandlines/nsICommandLine.idl
@@ -1,17 +1,17 @@
 /* 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 "nsISupports.idl"
 
 interface nsIFile;
 interface nsIURI;
-interface nsIDOMWindow;
+webidl WindowProxy;
 
 /**
  * Represents the command line used to invoke a XUL application. This may be the
  * original command-line of this instance, or a command line remoted from another
  * instance of the application.
  *
  * DEFINITIONS:
  * "arguments" are any values found on the command line.
@@ -113,17 +113,17 @@ interface nsICommandLine : nsISupports
    * command line may have had a different working directory.
    */
   readonly attribute nsIFile workingDirectory;
 
   /**
    * A window to be targeted by this command line. In most cases, this will
    * be null (xremote will sometimes set this attribute).
    */
-  readonly attribute nsIDOMWindow windowContext;
+  readonly attribute WindowProxy windowContext;
 
   /**
    * Resolve a file-path argument into an nsIFile. This method gracefully
    * handles relative or absolute file paths, according to the working
    * directory of this command line.
    *
    * @param aArgument  The command-line argument to resolve.
    */
--- a/toolkit/components/commandlines/nsICommandLineRunner.idl
+++ b/toolkit/components/commandlines/nsICommandLineRunner.idl
@@ -1,15 +1,17 @@
 /* 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 "nsISupports.idl"
 #include "nsICommandLine.idl"
 
+webidl WindowProxy;
+
 [ptr] native nsArgvArray(const char* const);
 
 /**
  * Extension of nsICommandLine that allows for initialization of new command lines
  * and running the command line actions by processing the command line handlers.
  *
  * @status INTERNAL - This interface is not meant for use by embedders, and is
  *                    not intended to be frozen. If you are an embedder and need
@@ -32,17 +34,17 @@ interface nsICommandLineRunner : nsIComm
    * @param state      The nsICommandLine.state flag.
    */
   void init(in long argc, in nsArgvArray argv,
             in nsIFile workingDir, in unsigned long state);
 
   /**
    * Set the windowContext parameter.
    */
-  void setWindowContext(in nsIDOMWindow aWindow);
+  void setWindowContext(in WindowProxy aWindow);
 
   /**
    * Process the command-line handlers in the proper order, calling "handle()" on
    * each.
    *
    * @throws NS_ERROR_ABORT if any handler throws NS_ERROR_ABORT. All other errors
    *         thrown by handlers will be silently ignored.
    */
--- a/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl
+++ b/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl
@@ -1,17 +1,17 @@
 /* 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 "nsISupports.idl"
 
 interface nsILoginInfo;
-interface nsIDOMWindow;
+webidl Window;
 
 webidl Element;
 
 [scriptable, uuid(425f73b9-b2db-4e8a-88c5-9ac2512934ce)]
 interface nsILoginManagerPrompter : nsISupports {
   /**
    * Initialize the prompter. Must be called before using other interfaces.
    *
@@ -24,31 +24,31 @@ interface nsILoginManagerPrompter : nsIS
    *        aWindow can be null if there is no associated window, e.g. in a JSM
    *        or Sandbox. In this case there will be no checkbox to save the login
    *        since the window is needed to know if this is a private context.
    *
    *        If this window is a content window, the corresponding window and browser
    *        elements will be calculated. If this window is a chrome window, the
    *        corresponding browser element needs to be set using setBrowser.
    */
-  void init(in nsIDOMWindow aWindow);
+  void init(in Window aWindow);
 
   /**
    * The browser this prompter is being created for.
    * This is required if the init function received a chrome window as argument.
    */
   attribute Element browser;
 
   /**
    * The opener that was used to open the window passed to init.
    * The opener can be used to determine in which window the prompt
    * should be shown. Must be a content window that is not a frame window,
    * make sure to pass the top window using e.g. window.top.
    */
-  attribute nsIDOMWindow opener;
+  attribute Window opener;
 
   /**
    * Ask the user if they want to save a login (Yes, Never, Not Now)
    *
    * @param aLogin
    *        The login to be saved.
    */
   void promptToSavePassword(in nsILoginInfo aLogin);
--- a/toolkit/components/perfmonitoring/nsIPerformanceStats.idl
+++ b/toolkit/components/perfmonitoring/nsIPerformanceStats.idl
@@ -1,17 +1,16 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-*/
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsISupports.idl"
 #include "nsIArray.idl"
-#include "nsIDOMWindow.idl"
 
 /**
  * Mechanisms for querying the current process about performance
  * information.
  *
  * JavaScript clients should rather use PerformanceStats.jsm.
  */
 
--- a/toolkit/components/remote/nsDBusRemoteService.cpp
+++ b/toolkit/components/remote/nsDBusRemoteService.cpp
@@ -26,17 +26,17 @@
 
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
 NS_IMPL_ISUPPORTS(nsDBusRemoteService,
                   nsIRemoteService)
 
 NS_IMETHODIMP
-nsDBusRemoteService::RegisterWindow(nsPIDOMWindowInner* aWindow)
+nsDBusRemoteService::RegisterWindow(nsPIDOMWindowOuter* aWindow)
 {
   // We don't listen for property change events on DBus remote
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 const char* introspect_template =
 "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n"
 "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\";>\n"
--- a/toolkit/components/remote/nsGTKRemoteService.cpp
+++ b/toolkit/components/remote/nsGTKRemoteService.cpp
@@ -43,30 +43,30 @@ nsGTKRemoteService::Startup(const char* 
 
   for (auto iter = mWindows.Iter(); !iter.Done(); iter.Next()) {
     HandleCommandsFor(iter.Key(), iter.UserData());
   }
 
   return NS_OK;
 }
 
-static nsIWidget* GetMainWidget(nsPIDOMWindowInner* aWindow)
+static nsIWidget* GetMainWidget(nsPIDOMWindowOuter* aWindow)
 {
   // get the native window for this instance
   nsCOMPtr<nsIBaseWindow> baseWindow
     (do_QueryInterface(aWindow->GetDocShell()));
   NS_ENSURE_TRUE(baseWindow, nullptr);
 
   nsCOMPtr<nsIWidget> mainWidget;
   baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
   return mainWidget;
 }
 
 NS_IMETHODIMP
-nsGTKRemoteService::RegisterWindow(nsPIDOMWindowInner* aWindow)
+nsGTKRemoteService::RegisterWindow(nsPIDOMWindowOuter* aWindow)
 {
   nsIWidget* mainWidget = GetMainWidget(aWindow);
   NS_ENSURE_TRUE(mainWidget, NS_ERROR_FAILURE);
 
   GtkWidget* widget =
     (GtkWidget*) mainWidget->GetNativeData(NS_NATIVE_SHELLWIDGET);
   NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);
 
--- a/toolkit/components/remote/nsIRemoteService.idl
+++ b/toolkit/components/remote/nsIRemoteService.idl
@@ -1,15 +1,15 @@
 /* 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 "nsISupports.idl"
 
-webidl Window;
+webidl WindowProxy;
 
 /**
  * Start and stop the remote service (xremote/phremote), and register
  * windows with the service for backwards compatibility with old xremote
  * clients.
  *
  * @status FLUID This interface is not frozen and is not intended for embedders
  *               who want a frozen API. If you are an embedder and need this
@@ -31,15 +31,15 @@ interface nsIRemoteService : nsISupports
    */
   void startup(in string appName, in string profileName);
 
   /**
    * Register a XUL window with the xremote service. The window will be
    * configured to accept incoming remote requests. If this method is called
    * before startup(), the registration will happen once startup() is called.
    */
-  void registerWindow(in Window aWindow);
+  void registerWindow(in WindowProxy aWindow);
 
   /**
    * Stop the remote service from accepting additional requests.
    */
   void shutdown();
 };
--- a/toolkit/components/remote/nsRemoteService.cpp
+++ b/toolkit/components/remote/nsRemoteService.cpp
@@ -56,17 +56,17 @@ nsRemoteService::Startup(const char* aAp
         obs->AddObserver(this, "xpcom-shutdown", false);
         obs->AddObserver(this, "quit-application", false);
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsRemoteService::RegisterWindow(nsPIDOMWindowInner* aWindow)
+nsRemoteService::RegisterWindow(nsPIDOMWindowOuter* aWindow)
 {
     // Note: RegisterWindow() is not implemented/needed by DBus service.
     if (mGtkRemoteService) {
         mGtkRemoteService->RegisterWindow(aWindow);
     }
     return NS_OK;
 }
 
@@ -147,17 +147,17 @@ FindExtensionParameterInCommand(const ch
   } else {
     idEnd = charEnd;
   }
   *aValue = nsDependentCSubstring(idStart, idEnd);
   return true;
 }
 
 const char*
-nsRemoteService::HandleCommandLine(const char* aBuffer, nsIDOMWindow* aWindow,
+nsRemoteService::HandleCommandLine(const char* aBuffer, nsPIDOMWindowOuter* aWindow,
                                    uint32_t aTimestamp)
 {
   nsresult rv;
 
   nsCOMPtr<nsICommandLineRunner> cmdline
     (do_CreateInstance("@mozilla.org/toolkit/command-line;1", &rv));
   if (NS_FAILED(rv))
     return "509 internal error";
--- a/toolkit/components/remote/nsRemoteService.h
+++ b/toolkit/components/remote/nsRemoteService.h
@@ -18,17 +18,17 @@ class nsRemoteService final : public nsI
 {
 public:
   // We will be a static singleton, so don't use the ordinary methods.
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREMOTESERVICE
   NS_DECL_NSIOBSERVER
 
   static const char*
-  HandleCommandLine(const char* aBuffer, nsIDOMWindow* aWindow,
+  HandleCommandLine(const char* aBuffer, nsPIDOMWindowOuter* aWindow,
                     uint32_t aTimestamp);
 
   nsCOMPtr<nsIRemoteService> mDBusRemoteService;
   nsCOMPtr<nsIRemoteService> mGtkRemoteService;
 
   nsRemoteService()
     {}
 private:
--- a/toolkit/components/remote/nsXRemoteService.cpp
+++ b/toolkit/components/remote/nsXRemoteService.cpp
@@ -111,17 +111,17 @@ nsXRemoteService::HandleCommandsFor(Wind
 
 bool
 nsXRemoteService::HandleNewProperty(XID aWindowId, Display* aDisplay,
                                     Time aEventTime,
                                     Atom aChangedAtom,
                                     nsIWeakReference* aDomWindow)
 {
 
-  nsCOMPtr<nsIDOMWindow> window (do_QueryReferent(aDomWindow));
+  nsCOMPtr<nsPIDOMWindowOuter> window (do_QueryReferent(aDomWindow));
 
   if (aChangedAtom == sMozCommandLineAtom) {
     // We got a new command atom.
     int result;
     Atom actual_type;
     int actual_format;
     unsigned long nitems, bytes_after;
     char *data = 0;
--- a/toolkit/components/windowwatcher/nsIWindowWatcher.idl
+++ b/toolkit/components/windowwatcher/nsIWindowWatcher.idl
@@ -74,34 +74,36 @@ interface nsIWindowWatcher : nsISupports
       service). This method adds an aObserver to the list of objects
       to be notified.
       @param aObserver the object to be notified when windows are
                        opened or closed. Its Observe method will be
                        called with the following parameters:
 
       aObserver::Observe interprets its parameters so:
       aSubject the window being opened or closed, sent as an nsISupports
-               which can be QIed to an nsIDOMWindow.
+               which can be QIed to an nsPIDOMWindowOuter from C++,
+               and is automatically wrapped as a WindowProxy for JS.
       aTopic   a wstring, either "domwindowopened" or "domwindowclosed".
       someData not used.
   */
   void registerNotification(in nsIObserver aObserver);
 
   /** Clients of this service can register themselves to be notified
       when a window is opened or closed (added to or removed from this
       service). This method removes an aObserver from the list of objects
       to be notified.
       @param aObserver the observer to be removed.
   */
   void unregisterNotification(in nsIObserver aObserver);
 
   /** Get an iterator for currently open windows in the order they were opened,
       guaranteeing that each will be visited exactly once.
       @return an enumerator which will itself return nsISupports objects which
-              can be QIed to an nsIDOMWindow
+              can be QIed to an nsPIDOMWindowOuter from C++,
+              and are automatically wrapped as a WindowProxy for JS.
   */
 
   nsISimpleEnumerator getWindowEnumerator();
 
   /** Return a newly created nsIPrompt implementation.
       @param aParent the parent window used for posing alerts. can be null.
       @return a new nsIPrompt object
   */
--- a/toolkit/components/windowwatcher/nsPIPromptService.idl
+++ b/toolkit/components/windowwatcher/nsPIPromptService.idl
@@ -3,17 +3,17 @@
  * 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/. */
 
 /* The general dialog posing function within nsPromptService, for
    private consumption, only. */
 
 #include "nsISupports.idl"
 
-interface nsIDOMWindow;
+webidl Window;
 interface nsIDialogParamBlock;
 
 [uuid(C60A1955-6CB3-4827-8EF8-4F5C668AF0B3)]
 interface nsPIPromptService : nsISupports
 {
 %{C++
   // eOpeningSound is obsolete but we need to support it for the compatibility.
   // The implementers should use eSoundEventId instead.
@@ -21,11 +21,11 @@ interface nsPIPromptService : nsISupport
         eEditfield2Msg=5, eEditfield1Value=6, eEditfield2Value=7,
         eButton0Text=8, eButton1Text=9, eButton2Text=10, eButton3Text=11,
         eDialogTitle=12, eOpeningSound=13};
   enum {eButtonPressed=0, eCheckboxState=1, eNumberButtons=2,
         eNumberEditfields=3, eEditField1Password=4, eDefaultButton=5,
         eDelayButtonEnable=6, eSoundEventId=7};
 %}
 
-   void doDialog(in nsIDOMWindow aParent, in nsIDialogParamBlock aParamBlock, in string aChromeURL);
+   void doDialog(in Window aParent, in nsIDialogParamBlock aParamBlock, in string aChromeURL);
 };
 
--- a/toolkit/components/windowwatcher/nsPIWindowWatcher.idl
+++ b/toolkit/components/windowwatcher/nsPIWindowWatcher.idl
@@ -6,21 +6,18 @@
 
 /* Private "control" methods on the Window Watcher. These are annoying
    bookkeeping methods, not part of the public (embedding) interface.
 */
 
 #include "nsISupports.idl"
 
 webidl WindowProxy;
-interface nsIDOMWindow;
-interface nsISimpleEnumerator;
 interface nsIWebBrowserChrome;
 interface nsIDocShellTreeItem;
-interface nsIArray;
 interface nsITabParent;
 interface nsIDocShellLoadInfo;
 
 [uuid(d162f9c4-19d5-4723-931f-f1e51bfa9f68)]
 
 interface nsPIWindowWatcher : nsISupports
 {
   /** A window has been created. Add it to our list.
@@ -47,17 +44,17 @@ interface nsPIWindowWatcher : nsISupport
              method will effectively act as if aParent were null.
       @param aURL url to which to open the new window. Must already be
              escaped, if applicable. can be null.
       @param aName window name from JS window.open. can be null.  If a window
              with this name already exists, the openWindow call may just load
              aUrl in it (if aUrl is not null) and return it.
       @param aFeatures window features from JS window.open. can be null.
       @param aCalledFromScript true if we were called from script.
-      @param aDialog use dialog defaults (see nsIDOMWindow::openDialog)
+      @param aDialog use dialog defaults (see Window::openDialog)
       @param aNavigate true if we should navigate the new window to the
              specified URL.
       @param aArgs Window argument
       @param aIsPopupSpam true if the window is a popup spam window; used for
                           popup blocker internals.
       @param aForceNoOpener If true, force noopener behavior.  This means not
                             looking for existing windows with the given name,
                             not setting an opener on the newly opened window,
--- a/toolkit/mozapps/update/nsIUpdateService.idl
+++ b/toolkit/mozapps/update/nsIUpdateService.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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/. */
 
 #include "nsISupports.idl"
 
-interface nsIDOMWindow;
+webidl Window;
 interface nsIRequest;
 interface nsIRequestObserver;
 interface nsISimpleEnumerator;
 interface nsIFile;
 
 webidl Element;
 webidl Document;
 
@@ -517,19 +517,19 @@ interface nsIUpdatePrompt : nsISupports
    *          the error occurred during an update check and will instead be an
    *          nsIUpdate object with the error information for the update check.
    */
   void showUpdateError(in nsIUpdate update);
 
   /**
    * Shows a list of all updates installed to date.
    * @param   parent
-   *          An nsIDOMWindow to set as the parent for this window. Can be null.
+   *          An Window to set as the parent for this window. Can be null.
    */
-  void showUpdateHistory(in nsIDOMWindow parent);
+  void showUpdateHistory(in Window parent);
 
   /**
    * Shows the application update downloaded user interface advising that an
    * update, which requires elevation, has now been downloaded and a restart is
    * necessary to complete the update.
    */
   void showUpdateElevationRequired();
 };
--- a/uriloader/base/nsIContentHandler.idl
+++ b/uriloader/base/nsIContentHandler.idl
@@ -13,17 +13,17 @@ interface nsIContentHandler : nsISupport
   /**
    * Tells the content handler to take over handling the content. If this
    * function succeeds, the URI Loader will leave this request alone, ignoring
    * progress notifications. Failure of this method will cause the request to be
    * cancelled, unless the error code is NS_ERROR_WONT_HANDLE_CONTENT (see
    * below).
    *
    * @param aWindowContext
-   *        Window context, used to get things like the current nsIDOMWindow
+   *        Window context, used to get things like the current Window
    *        for this request. May be null.
    * @param aContentType
    *        The content type of aRequest
    * @param aRequest
    *        A request whose content type is already known.
    *
    * @throw NS_ERROR_WONT_HANDLE_CONTENT Indicates that this handler does not
    *        want to handle this content. A different way for handling this
--- a/uriloader/exthandler/nsIContentDispatchChooser.idl
+++ b/uriloader/exthandler/nsIContentDispatchChooser.idl
@@ -25,17 +25,17 @@ interface nsIContentDispatchChooser : ns
   * Asks the user what to do with the content.
   *
   * @param aHander
   *        The interface describing the details of how this content should or
   *        can be handled.
   * @param aWindowContext
   *        The parent window context to show this chooser.  This can be null,
   *        and some implementations may not care about it.  Generally, you'll
-  *        want to pass an nsIDOMWindow in so the chooser can be properly
+  *        want to pass an Window in so the chooser can be properly
   *        parented when opened.
   * @param aURI
   *        The URI of the resource that we are asking about.
   * @param aReason
   *        The reason why we are asking (see above).
   */
   void ask(in nsIHandlerInfo aHandler,
            in nsIInterfaceRequestor aWindowContext,
--- a/widget/nsIApplicationChooser.idl
+++ b/widget/nsIApplicationChooser.idl
@@ -17,17 +17,17 @@ interface nsIApplicationChooserFinishedC
 
 [scriptable, uuid(f7a149da-612a-46ba-8a2f-54786fc28791)]
 interface nsIApplicationChooser : nsISupports
 {
  /**
   * Initialize the application chooser picker widget.  The application chooser
   * is not valid until this method is called.
   *
-  * @param      parent   nsIDOMWindow parent.  This dialog will be dependent
+  * @param      parent   Window parent.  This dialog will be dependent
   *                      on this parent. parent must be non-null.
   * @param      title    The title for the file widget
   *
   */
   void init(in WindowProxy parent, in ACString title);
 
   /**
    * Open application chooser dialog.
--- a/widget/nsIColorPicker.idl
+++ b/widget/nsIColorPicker.idl
@@ -50,17 +50,17 @@ interface nsIColorPicker : nsISupports
   * open() is called.
   * If the backend doesn't support setting a title to the native color picker
   * widget, the title parameter might be ignored.
   * If the initialColor parameter does not follow the format specified on top of
   * this file, the behavior will be unspecified. The initialColor could be the
   * one used by the underlying backend or an arbitrary one. The backend could
   * also assert.
   *
-  * @param      parent       nsIDOMWindow parent. This dialog will be dependent
+  * @param      parent       Window parent. This dialog will be dependent
   *                          on this parent. parent must be non-null.
   * @param      title        The title for the color picker widget.
   * @param      initialColor The color to show when the widget is opened. The
   *                          parameter has to follow the format specified on top
   *                          of this file.
   */
   void init(in WindowProxy parent, in AString title, in AString initialColor);
 
--- a/xpcom/system/nsIDeviceSensors.idl
+++ b/xpcom/system/nsIDeviceSensors.idl
@@ -1,15 +1,15 @@
 /* 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 "nsISupports.idl"
 
-interface nsIDOMWindow;
+webidl Window;
 
 [scriptable, uuid(0462247e-fe8c-4aa5-b675-3752547e485f)]
 interface nsIDeviceSensorData : nsISupports
 {
   // Keep in sync with hal/HalSensor.h
 
   // 1. TYPE_ORIENTATION: absolute device orientation, not spec-conform and
   // deprecated on Android.
@@ -34,24 +34,24 @@ interface nsIDeviceSensorData : nsISuppo
 };
 
 [scriptable, uuid(e46e47c7-55ff-44c4-abce-21b14ba07f86)]
 interface nsIDeviceSensors : nsISupports
 {
   /**
    * Returns true if the given window has any listeners of the given type
    */
-  bool hasWindowListener(in unsigned long aType, in nsIDOMWindow aWindow);
+  bool hasWindowListener(in unsigned long aType, in Window aWindow);
 
   // Holds pointers, not AddRef objects -- it is up to the caller
   // to call RemoveWindowListener before the window is deleted.
 
-  [noscript] void addWindowListener(in unsigned long aType, in nsIDOMWindow aWindow);
-  [noscript] void removeWindowListener(in unsigned long aType, in nsIDOMWindow aWindow);
-  [noscript] void removeWindowAsListener(in nsIDOMWindow aWindow);
+  [noscript] void addWindowListener(in unsigned long aType, in Window aWindow);
+  [noscript] void removeWindowListener(in unsigned long aType, in Window aWindow);
+  [noscript] void removeWindowAsListener(in Window aWindow);
 };
 
 %{C++
 
 #define NS_DEVICE_SENSORS_CID \
 { 0xecba5203, 0x77da, 0x465a, \
 { 0x86, 0x5e, 0x78, 0xb7, 0xaf, 0x10, 0xd8, 0xf7 } }
 
--- a/xpcom/system/nsIGeolocationProvider.idl
+++ b/xpcom/system/nsIGeolocationProvider.idl
@@ -2,17 +2,16 @@
  * 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 "nsISupports.idl"
 
 interface nsIURI;
-interface nsIDOMWindow;
 interface nsIDOMGeoPosition;
 interface nsIGeolocationPrompt;
 
 /**
 
  * Interface provides a way for a geolocation provider to
  * notify the system that a new location is available.
  */