Bug 1241764: Replace nsPIDOMWindow with nsPIDOMWindowInner/Outer. r=mrbkap,smaug
authorKyle Huey <khuey@kylehuey.com>
Sat, 30 Jan 2016 09:05:36 -0800
changeset 320665 e22b3043887ed36bf2c634c2924a7c8d39d226b1
parent 320664 7a5baf370ad97f1e76c66f6f0c7a6c1806173bfc
child 320666 998d61de14ee09ad3d63c9d3922269f9b996b791
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap, smaug
bugs1241764
milestone47.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 1241764: Replace nsPIDOMWindow with nsPIDOMWindowInner/Outer. r=mrbkap,smaug
accessible/base/DocManager.cpp
accessible/base/FocusManager.cpp
accessible/base/Logging.cpp
accessible/generic/ApplicationAccessible.cpp
accessible/generic/HyperTextAccessible.cpp
accessible/generic/ImageAccessible.cpp
accessible/generic/RootAccessible.cpp
accessible/interfaces/nsIAccessibleDocument.idl
accessible/interfaces/nsIAccessibleRetrieval.idl
accessible/windows/msaa/nsWinUtils.cpp
accessible/xpcom/xpcAccessibleDocument.cpp
accessible/xpcom/xpcAccessibleDocument.h
chrome/nsChromeRegistry.cpp
chrome/nsChromeRegistry.h
docshell/base/LoadContext.cpp
docshell/base/nsDSURIContentListener.cpp
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
docshell/base/nsDocShellEditorData.cpp
docshell/base/nsIDocShell.idl
docshell/base/nsIDocShellTreeItem.idl
docshell/base/nsILoadContext.idl
dom/activities/Activity.cpp
dom/activities/Activity.h
dom/activities/interfaces/nsIActivityProxy.idl
dom/archivereader/ArchiveReader.cpp
dom/archivereader/ArchiveReader.h
dom/archivereader/ArchiveRequest.cpp
dom/archivereader/ArchiveRequest.h
dom/audiochannel/AudioChannelAgent.cpp
dom/audiochannel/AudioChannelAgent.h
dom/audiochannel/AudioChannelService.cpp
dom/audiochannel/AudioChannelService.h
dom/audiochannel/nsIAudioChannelAgent.idl
dom/audiochannel/nsIAudioChannelService.idl
dom/base/BarProps.cpp
dom/base/BarProps.h
dom/base/ChromeNodeList.cpp
dom/base/Comment.cpp
dom/base/Console.cpp
dom/base/Console.h
dom/base/DOMCursor.cpp
dom/base/DOMCursor.h
dom/base/DOMError.cpp
dom/base/DOMError.h
dom/base/DOMParser.cpp
dom/base/DOMRequest.cpp
dom/base/DOMRequest.h
dom/base/DocumentFragment.cpp
dom/base/Element.cpp
dom/base/EventSource.cpp
dom/base/EventSource.h
dom/base/File.cpp
dom/base/FragmentOrElement.cpp
dom/base/MultipartBlobImpl.cpp
dom/base/MultipartBlobImpl.h
dom/base/Navigator.cpp
dom/base/Navigator.h
dom/base/PerformanceObserver.cpp
dom/base/PerformanceObserver.h
dom/base/PostMessageEvent.cpp
dom/base/PostMessageEvent.h
dom/base/ScreenOrientation.cpp
dom/base/ScreenOrientation.h
dom/base/ScriptSettings.cpp
dom/base/ScriptSettings.h
dom/base/StructuredCloneHolder.cpp
dom/base/Text.cpp
dom/base/TextInputProcessor.cpp
dom/base/TextInputProcessor.h
dom/base/ThirdPartyUtil.cpp
dom/base/WebSocket.cpp
dom/base/WebSocket.h
dom/base/WindowNamedPropertiesHandler.cpp
dom/base/WindowOrientationObserver.cpp
dom/base/moz.build
dom/base/mozIDOMWindow.idl
dom/base/nsCCUncollectableMarker.cpp
dom/base/nsContentAreaDragDrop.cpp
dom/base/nsContentAreaDragDrop.h
dom/base/nsContentPermissionHelper.cpp
dom/base/nsContentPermissionHelper.h
dom/base/nsContentPolicy.cpp
dom/base/nsContentPolicyUtils.h
dom/base/nsContentSink.cpp
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
dom/base/nsCopySupport.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMDataChannel.cpp
dom/base/nsDOMDataChannel.h
dom/base/nsDOMDataChannelDeclarations.h
dom/base/nsDOMMutationObserver.cpp
dom/base/nsDOMMutationObserver.h
dom/base/nsDOMWindowList.cpp
dom/base/nsDOMWindowList.h
dom/base/nsDOMWindowUtils.cpp
dom/base/nsDataDocumentContentPolicy.cpp
dom/base/nsDocument.cpp
dom/base/nsDocument.h
dom/base/nsFocusManager.cpp
dom/base/nsFocusManager.h
dom/base/nsFrameLoader.cpp
dom/base/nsFrameMessageManager.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/base/nsGlobalWindowCommands.cpp
dom/base/nsHistory.cpp
dom/base/nsHistory.h
dom/base/nsIDOMDOMRequest.idl
dom/base/nsIDocument.h
dom/base/nsIMessageManager.idl
dom/base/nsINode.cpp
dom/base/nsINode.h
dom/base/nsISiteSpecificUserAgent.idl
dom/base/nsInProcessTabChildGlobal.cpp
dom/base/nsInProcessTabChildGlobal.h
dom/base/nsJSEnvironment.cpp
dom/base/nsJSEnvironment.h
dom/base/nsJSUtils.cpp
dom/base/nsLocation.cpp
dom/base/nsLocation.h
dom/base/nsMimeTypeArray.cpp
dom/base/nsMimeTypeArray.h
dom/base/nsNodeUtils.cpp
dom/base/nsObjectLoadingContent.cpp
dom/base/nsPIDOMWindow.h
dom/base/nsPIDOMWindowInlines.h
dom/base/nsPIWindowRoot.h
dom/base/nsPerformance.cpp
dom/base/nsPerformance.h
dom/base/nsPluginArray.cpp
dom/base/nsPluginArray.h
dom/base/nsRange.cpp
dom/base/nsScreen.cpp
dom/base/nsScreen.h
dom/base/nsScriptLoader.cpp
dom/base/nsWindowMemoryReporter.cpp
dom/base/nsWindowRoot.cpp
dom/base/nsWindowRoot.h
dom/base/nsXMLHttpRequest.cpp
dom/base/nsXMLHttpRequest.h
dom/battery/BatteryManager.cpp
dom/battery/BatteryManager.h
dom/bindings/BindingUtils.cpp
dom/bindings/BindingUtils.h
dom/bindings/Bindings.conf
dom/bindings/CallbackObject.cpp
dom/bindings/Exceptions.cpp
dom/bindings/Exceptions.h
dom/bindings/Nullable.h
dom/bindings/test/TestInterfaceIterableDouble.cpp
dom/bindings/test/TestInterfaceIterableDouble.h
dom/bindings/test/TestInterfaceIterableSingle.cpp
dom/bindings/test/TestInterfaceIterableSingle.h
dom/bindings/test/TestInterfaceMaplike.cpp
dom/bindings/test/TestInterfaceMaplike.h
dom/bindings/test/TestInterfaceMaplikeObject.cpp
dom/bindings/test/TestInterfaceMaplikeObject.h
dom/bindings/test/TestInterfaceSetlike.cpp
dom/bindings/test/TestInterfaceSetlike.h
dom/bindings/test/TestInterfaceSetlikeNode.cpp
dom/bindings/test/TestInterfaceSetlikeNode.h
dom/bluetooth/common/webapi/BluetoothAdapter.cpp
dom/bluetooth/common/webapi/BluetoothAdapter.h
dom/bluetooth/common/webapi/BluetoothClassOfDevice.cpp
dom/bluetooth/common/webapi/BluetoothClassOfDevice.h
dom/bluetooth/common/webapi/BluetoothDevice.cpp
dom/bluetooth/common/webapi/BluetoothDevice.h
dom/bluetooth/common/webapi/BluetoothDiscoveryHandle.cpp
dom/bluetooth/common/webapi/BluetoothDiscoveryHandle.h
dom/bluetooth/common/webapi/BluetoothGatt.cpp
dom/bluetooth/common/webapi/BluetoothGatt.h
dom/bluetooth/common/webapi/BluetoothGattCharacteristic.cpp
dom/bluetooth/common/webapi/BluetoothGattCharacteristic.h
dom/bluetooth/common/webapi/BluetoothGattDescriptor.cpp
dom/bluetooth/common/webapi/BluetoothGattDescriptor.h
dom/bluetooth/common/webapi/BluetoothGattServer.cpp
dom/bluetooth/common/webapi/BluetoothGattServer.h
dom/bluetooth/common/webapi/BluetoothGattService.cpp
dom/bluetooth/common/webapi/BluetoothGattService.h
dom/bluetooth/common/webapi/BluetoothManager.cpp
dom/bluetooth/common/webapi/BluetoothManager.h
dom/bluetooth/common/webapi/BluetoothMapRequestHandle.cpp
dom/bluetooth/common/webapi/BluetoothMapRequestHandle.h
dom/bluetooth/common/webapi/BluetoothObexAuthHandle.cpp
dom/bluetooth/common/webapi/BluetoothObexAuthHandle.h
dom/bluetooth/common/webapi/BluetoothPairingHandle.cpp
dom/bluetooth/common/webapi/BluetoothPairingHandle.h
dom/bluetooth/common/webapi/BluetoothPairingListener.cpp
dom/bluetooth/common/webapi/BluetoothPairingListener.h
dom/bluetooth/common/webapi/BluetoothPbapRequestHandle.cpp
dom/bluetooth/common/webapi/BluetoothPbapRequestHandle.h
dom/broadcastchannel/BroadcastChannel.cpp
dom/broadcastchannel/BroadcastChannel.h
dom/browser-element/BrowserElementAudioChannel.cpp
dom/browser-element/BrowserElementAudioChannel.h
dom/browser-element/BrowserElementParent.cpp
dom/browser-element/BrowserElementParent.h
dom/cache/CacheStorage.cpp
dom/camera/DOMCameraCapabilities.cpp
dom/camera/DOMCameraCapabilities.h
dom/camera/DOMCameraControl.cpp
dom/camera/DOMCameraControl.h
dom/camera/DOMCameraManager.cpp
dom/camera/DOMCameraManager.h
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/CanvasRenderingContext2D.h
dom/canvas/DocumentRendererChild.cpp
dom/canvas/DocumentRendererChild.h
dom/cellbroadcast/CellBroadcast.cpp
dom/cellbroadcast/CellBroadcast.h
dom/cellbroadcast/CellBroadcastMessage.cpp
dom/cellbroadcast/CellBroadcastMessage.h
dom/datastore/DataStore.cpp
dom/datastore/DataStore.h
dom/datastore/DataStoreService.cpp
dom/datastore/DataStoreService.h
dom/datastore/nsIDataStore.idl
dom/datastore/nsIDataStoreService.idl
dom/devicestorage/DeviceStorage.h
dom/devicestorage/DeviceStorageAreaListener.cpp
dom/devicestorage/DeviceStorageAreaListener.h
dom/devicestorage/nsDeviceStorage.cpp
dom/devicestorage/nsDeviceStorage.h
dom/events/CompositionEvent.cpp
dom/events/CompositionEvent.h
dom/events/ContentEventHandler.cpp
dom/events/DOMEventTargetHelper.cpp
dom/events/DOMEventTargetHelper.h
dom/events/DataContainerEvent.cpp
dom/events/DragEvent.cpp
dom/events/DragEvent.h
dom/events/Event.cpp
dom/events/Event.h
dom/events/EventDispatcher.cpp
dom/events/EventListenerManager.cpp
dom/events/EventListenerManager.h
dom/events/EventStateManager.cpp
dom/events/EventStateManager.h
dom/events/EventTarget.h
dom/events/FocusEvent.cpp
dom/events/FocusEvent.h
dom/events/InputEvent.cpp
dom/events/KeyboardEvent.cpp
dom/events/KeyboardEvent.h
dom/events/MessageEvent.cpp
dom/events/MessageEvent.h
dom/events/MouseEvent.cpp
dom/events/MouseEvent.h
dom/events/MouseScrollEvent.cpp
dom/events/MouseScrollEvent.h
dom/events/ScrollAreaEvent.cpp
dom/events/ScrollAreaEvent.h
dom/events/SimpleGestureEvent.cpp
dom/events/SimpleGestureEvent.h
dom/events/TouchEvent.cpp
dom/events/TouchEvent.h
dom/events/UIEvent.cpp
dom/events/UIEvent.h
dom/events/WheelEvent.cpp
dom/events/WheelEvent.h
dom/events/XULCommandEvent.cpp
dom/events/XULCommandEvent.h
dom/fetch/Fetch.cpp
dom/fetch/Response.cpp
dom/filesystem/DeviceStorageFileSystem.cpp
dom/filesystem/DeviceStorageFileSystem.h
dom/filesystem/Directory.cpp
dom/filesystem/Directory.h
dom/filesystem/FileSystemBase.cpp
dom/filesystem/FileSystemBase.h
dom/filesystem/FileSystemPermissionRequest.cpp
dom/filesystem/FileSystemPermissionRequest.h
dom/filesystem/OSFileSystem.cpp
dom/filesystem/OSFileSystem.h
dom/fmradio/FMRadio.cpp
dom/fmradio/FMRadio.h
dom/gamepad/Gamepad.cpp
dom/gamepad/GamepadService.cpp
dom/geolocation/nsGeolocation.cpp
dom/geolocation/nsGeolocation.h
dom/html/HTMLAudioElement.cpp
dom/html/HTMLBodyElement.cpp
dom/html/HTMLCanvasElement.cpp
dom/html/HTMLFormElement.cpp
dom/html/HTMLFrameElement.cpp
dom/html/HTMLFrameSetElement.cpp
dom/html/HTMLIFrameElement.cpp
dom/html/HTMLImageElement.cpp
dom/html/HTMLInputElement.cpp
dom/html/HTMLMediaElement.cpp
dom/html/HTMLObjectElement.cpp
dom/html/HTMLObjectElement.h
dom/html/HTMLOptionElement.cpp
dom/html/HTMLTrackElement.cpp
dom/html/HTMLVideoElement.cpp
dom/html/ImageDocument.cpp
dom/html/MediaDocument.cpp
dom/html/TextTrackManager.cpp
dom/html/nsBrowserElement.cpp
dom/html/nsBrowserElement.h
dom/html/nsGenericHTMLElement.cpp
dom/html/nsGenericHTMLFrameElement.cpp
dom/html/nsGenericHTMLFrameElement.h
dom/html/nsHTMLDocument.cpp
dom/html/nsHTMLDocument.h
dom/html/nsIFormSubmitObserver.idl
dom/html/nsTextEditorState.cpp
dom/icc/Icc.cpp
dom/icc/Icc.h
dom/icc/IccCallback.cpp
dom/icc/IccCallback.h
dom/icc/IccCardLockError.cpp
dom/icc/IccCardLockError.h
dom/icc/IccInfo.cpp
dom/icc/IccInfo.h
dom/icc/IccManager.cpp
dom/icc/IccManager.h
dom/indexedDB/ActorsChild.cpp
dom/indexedDB/IDBCursor.cpp
dom/indexedDB/IDBCursor.h
dom/indexedDB/IDBDatabase.cpp
dom/indexedDB/IDBDatabase.h
dom/indexedDB/IDBFactory.cpp
dom/indexedDB/IDBFactory.h
dom/indexedDB/IDBFileHandle.h
dom/indexedDB/IDBFileRequest.cpp
dom/indexedDB/IDBFileRequest.h
dom/indexedDB/IDBIndex.cpp
dom/indexedDB/IDBIndex.h
dom/indexedDB/IDBMutableFile.h
dom/indexedDB/IDBObjectStore.cpp
dom/indexedDB/IDBObjectStore.h
dom/indexedDB/IDBRequest.cpp
dom/indexedDB/IDBRequest.h
dom/indexedDB/IDBTransaction.cpp
dom/indexedDB/IDBTransaction.h
dom/indexedDB/IDBWrapperCache.cpp
dom/indexedDB/IDBWrapperCache.h
dom/inputport/AVInputPort.cpp
dom/inputport/AVInputPort.h
dom/inputport/DisplayPortInputPort.cpp
dom/inputport/DisplayPortInputPort.h
dom/inputport/HDMIInputPort.cpp
dom/inputport/HDMIInputPort.h
dom/inputport/InputPort.cpp
dom/inputport/InputPort.h
dom/inputport/InputPortManager.cpp
dom/inputport/InputPortManager.h
dom/interfaces/base/nsIBrowserDOMWindow.idl
dom/interfaces/base/nsIContentPermissionPrompt.idl
dom/interfaces/base/nsIDOMGlobalPropertyInitializer.idl
dom/interfaces/base/nsIDOMWindowCollection.idl
dom/interfaces/base/nsIFocusManager.idl
dom/interfaces/base/nsIServiceWorkerManager.idl
dom/interfaces/base/nsITextInputProcessor.idl
dom/interfaces/core/nsIDOMDocument.idl
dom/interfaces/core/nsIDOMXMLDocument.idl
dom/interfaces/events/moz.build
dom/interfaces/events/nsIDOMCompositionEvent.idl
dom/interfaces/events/nsIDOMDragEvent.idl
dom/interfaces/events/nsIDOMFocusEvent.idl
dom/interfaces/events/nsIDOMKeyEvent.idl
dom/interfaces/events/nsIDOMMessageEvent.idl
dom/interfaces/events/nsIDOMMouseEvent.idl
dom/interfaces/events/nsIDOMMouseScrollEvent.idl
dom/interfaces/events/nsIDOMScrollAreaEvent.idl
dom/interfaces/events/nsIDOMSimpleGestureEvent.idl
dom/interfaces/events/nsIDOMUIEvent.idl
dom/interfaces/events/nsIDOMWheelEvent.idl
dom/interfaces/html/nsIDOMHTMLDocument.idl
dom/interfaces/html/nsIDOMHTMLFrameElement.idl
dom/interfaces/html/nsIDOMHTMLIFrameElement.idl
dom/interfaces/smil/nsIDOMTimeEvent.idl
dom/interfaces/storage/nsIDOMStorageManager.idl
dom/interfaces/xul/nsIDOMXULCommandDispatcher.idl
dom/interfaces/xul/nsIDOMXULCommandEvent.idl
dom/interfaces/xul/nsIDOMXULDocument.idl
dom/ipc/ColorPickerParent.cpp
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/FilePickerParent.cpp
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
dom/jsurl/nsJSProtocolHandler.cpp
dom/media/AudioTrackList.h
dom/media/CanvasCaptureMediaStream.cpp
dom/media/CanvasCaptureMediaStream.h
dom/media/DOMMediaStream.cpp
dom/media/DOMMediaStream.h
dom/media/GetUserMediaRequest.cpp
dom/media/GetUserMediaRequest.h
dom/media/MediaDevices.cpp
dom/media/MediaDevices.h
dom/media/MediaManager.cpp
dom/media/MediaManager.h
dom/media/MediaPermissionGonk.cpp
dom/media/MediaRecorder.cpp
dom/media/MediaRecorder.h
dom/media/MediaStreamError.cpp
dom/media/MediaStreamError.h
dom/media/MediaTrack.cpp
dom/media/MediaTrack.h
dom/media/MediaTrackList.cpp
dom/media/MediaTrackList.h
dom/media/TextTrack.cpp
dom/media/TextTrack.h
dom/media/TextTrackCue.cpp
dom/media/TextTrackCue.h
dom/media/TextTrackList.cpp
dom/media/TextTrackList.h
dom/media/TextTrackRegion.cpp
dom/media/VideoTrackList.h
dom/media/WebVTTListener.cpp
dom/media/eme/MediaKeySession.cpp
dom/media/eme/MediaKeySession.h
dom/media/eme/MediaKeyStatusMap.cpp
dom/media/eme/MediaKeyStatusMap.h
dom/media/eme/MediaKeySystemAccess.cpp
dom/media/eme/MediaKeySystemAccess.h
dom/media/eme/MediaKeySystemAccessManager.cpp
dom/media/eme/MediaKeySystemAccessManager.h
dom/media/eme/MediaKeys.cpp
dom/media/eme/MediaKeys.h
dom/media/gmp/GMPService.cpp
dom/media/gmp/GMPService.h
dom/media/imagecapture/ImageCapture.cpp
dom/media/imagecapture/ImageCapture.h
dom/media/mediasource/MediaSource.cpp
dom/media/mediasource/MediaSource.h
dom/media/webaudio/AudioBuffer.h
dom/media/webaudio/AudioContext.cpp
dom/media/webaudio/AudioContext.h
dom/media/webaudio/AudioDestinationNode.cpp
dom/media/webaudio/MediaBufferDecoder.cpp
dom/media/webaudio/MediaStreamAudioSourceNode.cpp
dom/media/webrtc/MediaEngineTabVideoSource.cpp
dom/media/webrtc/MediaEngineTabVideoSource.h
dom/media/webrtc/nsITabSource.idl
dom/media/webspeech/recognition/SpeechRecognition.cpp
dom/media/webspeech/recognition/SpeechRecognition.h
dom/media/webspeech/synth/SpeechSynthesis.cpp
dom/media/webspeech/synth/SpeechSynthesis.h
dom/media/webspeech/synth/SpeechSynthesisUtterance.cpp
dom/media/webspeech/synth/SpeechSynthesisUtterance.h
dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
dom/media/webvtt/nsIWebVTTParserWrapper.idl
dom/messagechannel/MessageChannel.cpp
dom/messagechannel/MessageChannel.h
dom/messagechannel/MessagePort.cpp
dom/messagechannel/MessagePort.h
dom/mobileconnection/MobileCellInfo.cpp
dom/mobileconnection/MobileCellInfo.h
dom/mobileconnection/MobileConnection.cpp
dom/mobileconnection/MobileConnection.h
dom/mobileconnection/MobileConnectionArray.cpp
dom/mobileconnection/MobileConnectionArray.h
dom/mobileconnection/MobileConnectionCallback.cpp
dom/mobileconnection/MobileConnectionCallback.h
dom/mobileconnection/MobileConnectionInfo.cpp
dom/mobileconnection/MobileConnectionInfo.h
dom/mobileconnection/MobileNetworkInfo.cpp
dom/mobileconnection/MobileNetworkInfo.h
dom/mobileid/interfaces/nsIMobileIdentityService.idl
dom/mobilemessage/DOMMobileMessageError.cpp
dom/mobilemessage/DOMMobileMessageError.h
dom/mobilemessage/MmsMessage.cpp
dom/mobilemessage/MmsMessage.h
dom/mobilemessage/MobileMessageCallback.cpp
dom/mobilemessage/MobileMessageCursorCallback.cpp
dom/mobilemessage/MobileMessageCursorCallback.h
dom/mobilemessage/MobileMessageManager.cpp
dom/mobilemessage/MobileMessageManager.h
dom/mobilemessage/MobileMessageThread.cpp
dom/mobilemessage/MobileMessageThread.h
dom/mobilemessage/SmsMessage.cpp
dom/mobilemessage/SmsMessage.h
dom/network/Connection.cpp
dom/network/Connection.h
dom/network/TCPServerSocket.h
dom/network/TCPSocket.cpp
dom/network/TCPSocket.h
dom/network/UDPSocket.cpp
dom/network/UDPSocket.h
dom/nfc/MozIsoDepTech.cpp
dom/nfc/MozIsoDepTech.h
dom/nfc/MozNfcATech.cpp
dom/nfc/MozNfcATech.h
dom/notification/DesktopNotification.cpp
dom/notification/DesktopNotification.h
dom/notification/Notification.cpp
dom/notification/Notification.h
dom/offline/nsDOMOfflineResourceList.cpp
dom/offline/nsDOMOfflineResourceList.h
dom/payment/PaymentProviderUtils.cpp
dom/permission/PermissionStatus.cpp
dom/permission/PermissionStatus.h
dom/permission/Permissions.cpp
dom/permission/Permissions.h
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/base/nsNPAPIPluginInstance.cpp
dom/plugins/base/nsNPAPIPluginInstance.h
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/base/nsPluginStreamListenerPeer.cpp
dom/plugins/ipc/PluginHangUIParent.cpp
dom/power/PowerManager.cpp
dom/power/PowerManager.h
dom/power/PowerManagerService.cpp
dom/power/PowerManagerService.h
dom/power/WakeLock.cpp
dom/power/WakeLock.h
dom/power/nsIPowerManagerService.idl
dom/presentation/Presentation.cpp
dom/presentation/Presentation.h
dom/presentation/PresentationAvailability.cpp
dom/presentation/PresentationAvailability.h
dom/presentation/PresentationCallbacks.cpp
dom/presentation/PresentationConnection.cpp
dom/presentation/PresentationConnection.h
dom/presentation/PresentationReceiver.cpp
dom/presentation/PresentationReceiver.h
dom/presentation/PresentationRequest.cpp
dom/presentation/PresentationRequest.h
dom/promise/Promise.cpp
dom/quota/ActorsParent.cpp
dom/quota/QuotaManager.h
dom/smil/TimeEvent.cpp
dom/smil/TimeEvent.h
dom/smil/nsSMILTimeValueSpec.cpp
dom/speakermanager/SpeakerManager.cpp
dom/speakermanager/SpeakerManager.h
dom/storage/DOMStorage.cpp
dom/storage/DOMStorage.h
dom/storage/DOMStorageManager.cpp
dom/storage/DOMStorageManager.h
dom/svg/DOMSVGNumber.cpp
dom/system/gonk/AudioChannelManager.cpp
dom/system/gonk/AudioChannelManager.h
dom/system/nsDeviceSensors.cpp
dom/telephony/CallsList.cpp
dom/telephony/CallsList.h
dom/telephony/MMICall.cpp
dom/telephony/MMICall.h
dom/telephony/Telephony.cpp
dom/telephony/Telephony.h
dom/telephony/TelephonyCall.cpp
dom/telephony/TelephonyCall.h
dom/telephony/TelephonyCallGroup.cpp
dom/telephony/TelephonyCallGroup.h
dom/telephony/TelephonyCallId.cpp
dom/telephony/TelephonyCallId.h
dom/telephony/TelephonyDialCallback.cpp
dom/telephony/TelephonyDialCallback.h
dom/telephony/USSDSession.cpp
dom/telephony/USSDSession.h
dom/time/TimeChangeObserver.cpp
dom/time/TimeChangeObserver.h
dom/time/TimeManager.h
dom/tv/TVChannel.cpp
dom/tv/TVChannel.h
dom/tv/TVManager.cpp
dom/tv/TVManager.h
dom/tv/TVSource.cpp
dom/tv/TVSource.h
dom/tv/TVTuner.cpp
dom/tv/TVTuner.h
dom/tv/nsITVSimulatorService.idl
dom/voicemail/Voicemail.cpp
dom/voicemail/Voicemail.h
dom/workers/Navigator.cpp
dom/workers/RuntimeService.cpp
dom/workers/RuntimeService.h
dom/workers/ServiceWorker.cpp
dom/workers/ServiceWorker.h
dom/workers/ServiceWorkerClient.cpp
dom/workers/ServiceWorkerClients.cpp
dom/workers/ServiceWorkerContainer.cpp
dom/workers/ServiceWorkerContainer.h
dom/workers/ServiceWorkerManager.cpp
dom/workers/ServiceWorkerManager.h
dom/workers/ServiceWorkerRegistration.cpp
dom/workers/ServiceWorkerRegistration.h
dom/workers/SharedWorker.cpp
dom/workers/SharedWorker.h
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerPrivate.h
dom/workers/WorkerRunnable.cpp
dom/workers/Workers.h
dom/workers/XMLHttpRequest.cpp
dom/workers/nsIWorkerDebugger.idl
dom/xbl/nsXBLPrototypeHandler.cpp
dom/xbl/nsXBLWindowKeyHandler.cpp
dom/xml/nsXMLPrettyPrinter.cpp
dom/xslt/xslt/txMozillaXMLOutput.cpp
dom/xslt/xslt/txMozillaXSLTProcessor.cpp
dom/xul/XULDocument.cpp
dom/xul/nsXULCommandDispatcher.cpp
dom/xul/nsXULCommandDispatcher.h
dom/xul/nsXULElement.cpp
dom/xul/nsXULPopupListener.cpp
dom/xul/templates/nsXULTemplateBuilder.cpp
editor/composer/nsComposerCommandsUpdater.cpp
editor/composer/nsComposerCommandsUpdater.h
editor/composer/nsEditingSession.cpp
editor/composer/nsEditingSession.h
editor/composer/nsIEditingSession.idl
editor/libeditor/nsEditor.cpp
editor/libeditor/nsEditorEventListener.cpp
editor/libeditor/nsHTMLEditor.cpp
embedding/browser/nsCommandHandler.cpp
embedding/browser/nsCommandHandler.h
embedding/browser/nsContextMenuInfo.cpp
embedding/browser/nsDocShellTreeOwner.cpp
embedding/browser/nsICommandHandler.idl
embedding/browser/nsIPrintingPromptService.idl
embedding/browser/nsIWebBrowser.idl
embedding/browser/nsIWebBrowserFocus.idl
embedding/browser/nsIWebBrowserPrint.idl
embedding/browser/nsWebBrowser.cpp
embedding/browser/nsWebBrowser.h
embedding/components/commandhandler/nsCommandManager.cpp
embedding/components/commandhandler/nsCommandManager.h
embedding/components/commandhandler/nsICommandManager.idl
embedding/components/commandhandler/nsPICommandUpdater.idl
embedding/components/find/nsIWebBrowserFind.idl
embedding/components/find/nsWebBrowserFind.cpp
embedding/components/find/nsWebBrowserFind.h
embedding/components/printingui/ipc/PrintDataUtils.cpp
embedding/components/printingui/ipc/PrintingParent.cpp
embedding/components/printingui/ipc/PrintingParent.h
embedding/components/printingui/ipc/nsPrintingProxy.cpp
embedding/components/printingui/mac/nsPrintProgress.cpp
embedding/components/printingui/mac/nsPrintProgress.h
embedding/components/printingui/mac/nsPrintingPromptServiceX.mm
embedding/components/printingui/unixshared/nsPrintProgress.cpp
embedding/components/printingui/unixshared/nsPrintingPromptService.cpp
embedding/components/printingui/unixshared/nsPrintingPromptService.h
embedding/components/printingui/win/nsPrintProgress.cpp
embedding/components/printingui/win/nsPrintingPromptService.cpp
embedding/components/printingui/win/nsPrintingPromptService.h
embedding/components/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
embedding/components/windowwatcher/nsAutoWindowStateHelper.cpp
embedding/components/windowwatcher/nsAutoWindowStateHelper.h
embedding/components/windowwatcher/nsIPromptFactory.idl
embedding/components/windowwatcher/nsIPromptService.idl
embedding/components/windowwatcher/nsIPromptService2.idl
embedding/components/windowwatcher/nsIWindowWatcher.idl
embedding/components/windowwatcher/nsPIWindowWatcher.idl
embedding/components/windowwatcher/nsWindowWatcher.cpp
embedding/components/windowwatcher/nsWindowWatcher.h
embedding/nsIWindowProvider.idl
extensions/cookie/nsCookiePromptService.cpp
extensions/cookie/nsICookiePromptService.idl
extensions/cookie/nsPermissionManager.cpp
hal/Hal.cpp
hal/Hal.h
hal/WindowIdentifier.cpp
hal/WindowIdentifier.h
hal/sandbox/SandboxHal.cpp
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/nsScriptError.cpp
js/xpconnect/src/xpcpublic.h
js/xpconnect/wrappers/AccessCheck.cpp
js/xpconnect/wrappers/XrayWrapper.cpp
layout/base/AccessibleCaretManager.cpp
layout/base/ActiveLayerTracker.cpp
layout/base/MobileViewportManager.cpp
layout/base/ZoomConstraintsClient.cpp
layout/base/nsDocumentViewer.cpp
layout/base/nsIPresShell.h
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/base/nsPresContext.cpp
layout/base/nsPresShell.cpp
layout/base/nsPresShell.h
layout/base/nsRefreshDriver.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsPluginFrame.cpp
layout/inspector/inLayoutUtils.cpp
layout/printing/nsIPrintProgress.idl
layout/printing/nsIPrintStatusFeedback.idl
layout/printing/nsPrintData.h
layout/printing/nsPrintEngine.cpp
layout/printing/nsPrintEngine.h
layout/printing/nsPrintObject.cpp
layout/printing/nsPrintPreviewListener.cpp
layout/style/FontFace.cpp
layout/style/FontFaceSet.cpp
layout/style/FontFaceSet.h
layout/svg/nsSVGOuterSVGFrame.cpp
layout/tools/layout-debug/src/nsILayoutDebuggingTools.idl
layout/tools/layout-debug/src/nsILayoutRegressionTester.idl
layout/tools/layout-debug/src/nsLayoutDebugCLH.cpp
layout/tools/layout-debug/src/nsLayoutDebuggingTools.cpp
layout/tools/layout-debug/src/nsRegressionTester.cpp
layout/tools/layout-debug/src/nsRegressionTester.h
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsResizerFrame.cpp
layout/xul/nsTitleBarFrame.cpp
layout/xul/nsXULPopupManager.cpp
layout/xul/nsXULPopupManager.h
layout/xul/nsXULTooltipListener.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
media/webrtc/signaling/test/FakeMediaStreams.h
moz.build
netwerk/base/LoadInfo.cpp
netwerk/base/LoadInfo.h
netwerk/base/mozIThirdPartyUtil.idl
netwerk/base/nsChannelClassifier.cpp
netwerk/base/nsIPermissionManager.idl
netwerk/base/nsISecureBrowserUI.idl
netwerk/protocol/http/HttpBaseChannel.cpp
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/nsHttpHandler.cpp
parser/htmlparser/nsExpatDriver.cpp
security/manager/pki/nsNSSDialogHelper.cpp
security/manager/pki/nsNSSDialogHelper.h
security/manager/pki/nsNSSDialogs.cpp
security/manager/ssl/nsSecureBrowserUIImpl.cpp
toolkit/components/alerts/nsXULAlerts.cpp
toolkit/components/alerts/nsXULAlerts.h
toolkit/components/downloads/nsDownloadManager.cpp
toolkit/components/perfmonitoring/nsPerformanceStats.cpp
toolkit/components/remote/nsGTKRemoteService.cpp
toolkit/components/remote/nsIRemoteService.idl
toolkit/components/satchel/nsFormFillController.cpp
toolkit/components/satchel/nsFormFillController.h
toolkit/components/startup/nsAppStartup.cpp
toolkit/components/statusfilter/nsBrowserStatusFilter.cpp
toolkit/components/typeaheadfind/nsITypeAheadFind.idl
toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
toolkit/components/typeaheadfind/nsTypeAheadFind.h
toolkit/mozapps/extensions/AddonContentPolicy.cpp
toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini
toolkit/xre/ProfileReset.cpp
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsNativeAppSupportCocoa.mm
toolkit/xre/nsNativeAppSupportWin.cpp
uriloader/base/nsDocLoader.cpp
uriloader/base/nsIWebProgress.idl
uriloader/exthandler/nsExternalHelperAppService.cpp
uriloader/exthandler/nsExternalHelperAppService.h
uriloader/prefetch/OfflineCacheUpdateChild.cpp
uriloader/prefetch/OfflineCacheUpdateChild.h
uriloader/prefetch/OfflineCacheUpdateParent.cpp
uriloader/prefetch/nsIOfflineCacheUpdate.idl
uriloader/prefetch/nsOfflineCacheUpdate.h
uriloader/prefetch/nsOfflineCacheUpdateService.cpp
widget/SharedWidgetUtils.cpp
widget/WidgetUtils.h
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/android/nsAppShell.cpp
widget/android/nsIAndroidBridge.idl
widget/android/nsWindow.cpp
widget/cocoa/nsColorPicker.h
widget/cocoa/nsColorPicker.mm
widget/cocoa/nsMenuItemIconX.mm
widget/cocoa/nsMenuUtilsX.mm
widget/cocoa/nsPrintDialogX.h
widget/cocoa/nsPrintDialogX.mm
widget/gtk/nsApplicationChooser.cpp
widget/gtk/nsColorPicker.cpp
widget/gtk/nsPrintDialogGTK.cpp
widget/gtk/nsPrintDialogGTK.h
widget/nsBaseFilePicker.cpp
widget/nsBaseFilePicker.h
widget/nsBaseWidget.cpp
widget/nsColorPickerProxy.cpp
widget/nsFilePickerProxy.cpp
widget/nsFilePickerProxy.h
widget/nsIApplicationChooser.idl
widget/nsIColorPicker.idl
widget/nsIFilePicker.idl
widget/nsIPrintDialogService.h
widget/nsIWinTaskbar.idl
widget/nsNativeTheme.cpp
widget/nsPrintOptionsImpl.cpp
widget/windows/WinTaskbar.cpp
widget/windows/nsColorPicker.cpp
widget/windows/nsColorPicker.h
widget/windows/nsFilePicker.cpp
widget/windows/nsFilePicker.h
xpcom/base/nsIMemoryReporter.idl
xpcom/base/nsMemoryReporterManager.cpp
xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
xpcom/system/nsIExternalApplication.idl
xpfe/appshell/nsAppShellService.cpp
xpfe/appshell/nsAppShellWindowEnumerator.cpp
xpfe/appshell/nsChromeTreeOwner.cpp
xpfe/appshell/nsContentTreeOwner.cpp
xpfe/appshell/nsIAppShellService.idl
xpfe/appshell/nsIWindowMediator.idl
xpfe/appshell/nsWebShellWindow.cpp
xpfe/appshell/nsWindowMediator.cpp
xpfe/appshell/nsWindowMediator.h
xpfe/appshell/nsXULWindow.cpp
xpfe/appshell/nsXULWindow.h
xpfe/components/directory/nsDirectoryViewer.cpp
--- a/accessible/base/DocManager.cpp
+++ b/accessible/base/DocManager.cpp
@@ -21,17 +21,16 @@
 #endif
 
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
 #include "nsCURILoader.h"
 #include "nsDocShellLoadTypes.h"
 #include "nsIChannel.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMWindow.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIWebNavigation.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIWebProgress.h"
 #include "nsCoreUtils.h"
 #include "nsXULAppAPI.h"
 #include "mozilla/dom/TabChild.h"
 
@@ -213,21 +212,21 @@ DocManager::OnStateChange(nsIWebProgress
                           nsresult aStatus)
 {
   NS_ASSERTION(aStateFlags & STATE_IS_DOCUMENT, "Other notifications excluded");
 
   if (nsAccessibilityService::IsShutdown() || !aWebProgress ||
       (aStateFlags & (STATE_START | STATE_STOP)) == 0)
     return NS_OK;
 
-  nsCOMPtr<nsIDOMWindow> DOMWindow;
+  nsCOMPtr<mozIDOMWindowProxy> DOMWindow;
   aWebProgress->GetDOMWindow(getter_AddRefs(DOMWindow));
   NS_ENSURE_STATE(DOMWindow);
 
-  nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(DOMWindow);
+  nsPIDOMWindowOuter* piWindow = nsPIDOMWindowOuter::From(DOMWindow);
   MOZ_ASSERT(piWindow);
 
   nsCOMPtr<nsIDocument> document = piWindow->GetDoc();
   NS_ENSURE_STATE(document);
 
   // Document was loaded.
   if (aStateFlags & STATE_STOP) {
 #ifdef A11Y_LOG
@@ -398,17 +397,17 @@ DocManager::HandleDOMDocumentLoad(nsIDoc
 
   docAcc->NotifyOfLoad(aLoadEventType);
 }
 
 void
 DocManager::AddListeners(nsIDocument* aDocument,
                          bool aAddDOMContentLoadedListener)
 {
-  nsPIDOMWindow* window = aDocument->GetWindow();
+  nsPIDOMWindowOuter* window = aDocument->GetWindow();
   EventTarget* target = window->GetChromeEventHandler();
   EventListenerManager* elm = target->GetOrCreateListenerManager();
   elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
                               TrustedEventsAtCapture());
 
 #ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocCreate))
     logging::Text("added 'pagehide' listener");
@@ -422,17 +421,17 @@ DocManager::AddListeners(nsIDocument* aD
       logging::Text("added 'DOMContentLoaded' listener");
 #endif
   }
 }
 
 void
 DocManager::RemoveListeners(nsIDocument* aDocument)
 {
-  nsPIDOMWindow* window = aDocument->GetWindow();
+  nsPIDOMWindowOuter* window = aDocument->GetWindow();
   if (!window)
     return;
 
   EventTarget* target = window->GetChromeEventHandler();
   if (!target)
     return;
 
   EventListenerManager* elm = target->GetOrCreateListenerManager();
--- a/accessible/base/FocusManager.cpp
+++ b/accessible/base/FocusManager.cpp
@@ -384,17 +384,17 @@ FocusManager::FocusedDOMNode() const
   if (focusedElm) {
     if (EventStateManager::IsRemoteTarget(focusedElm)) {
       return nullptr;
     }
     return focusedElm;
   }
 
   // Otherwise the focus can be on DOM document.
-  nsPIDOMWindow* focusedWnd = DOMFocusManager->GetFocusedWindow();
+  nsPIDOMWindowOuter* focusedWnd = DOMFocusManager->GetFocusedWindow();
   return focusedWnd ? focusedWnd->GetExtantDoc() : nullptr;
 }
 
 nsIDocument*
 FocusManager::FocusedDOMDocument() const
 {
   nsINode* focusedNode = FocusedDOMNode();
   return focusedNode ? focusedNode->OwnerDoc() : nullptr;
--- a/accessible/base/Logging.cpp
+++ b/accessible/base/Logging.cpp
@@ -387,19 +387,19 @@ static const char* sDocEventTitle = "DOC
 static const char* sFocusTitle = "FOCUS";
 
 void
 logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
                  nsIRequest* aRequest, uint32_t aStateFlags)
 {
   MsgBegin(sDocLoadTitle, aMsg);
 
-  nsCOMPtr<nsIDOMWindow> DOMWindow;
+  nsCOMPtr<mozIDOMWindowProxy> DOMWindow;
   aWebProgress->GetDOMWindow(getter_AddRefs(DOMWindow));
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(DOMWindow);
+  nsPIDOMWindowOuter* window = nsPIDOMWindowOuter::From(DOMWindow);
   if (!window) {
     MsgEnd();
     return;
   }
 
   nsCOMPtr<nsIDocument> documentNode = window->GetDoc();
   if (!documentNode) {
     MsgEnd();
--- a/accessible/generic/ApplicationAccessible.cpp
+++ b/accessible/generic/ApplicationAccessible.cpp
@@ -10,17 +10,16 @@
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
 
 #include "nsIComponentManager.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMWindow.h"
 #include "nsIWindowMediator.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/Services.h"
 #include "nsIStringBundle.h"
 
 using namespace mozilla::a11y;
 
 ApplicationAccessible::ApplicationAccessible() :
@@ -188,17 +187,17 @@ ApplicationAccessible::CacheChildren()
   if (NS_FAILED(rv))
     return;
 
   bool hasMore = false;
   windowEnumerator->HasMoreElements(&hasMore);
   while (hasMore) {
     nsCOMPtr<nsISupports> window;
     windowEnumerator->GetNext(getter_AddRefs(window));
-    nsCOMPtr<nsPIDOMWindow> DOMWindow = do_QueryInterface(window);
+    nsCOMPtr<nsPIDOMWindowOuter> DOMWindow = do_QueryInterface(window);
     if (DOMWindow) {
       nsCOMPtr<nsIDocument> docNode = DOMWindow->GetDoc();
       if (docNode) {
         GetAccService()->GetDocAccessible(docNode); // ensure creation
       }
     }
     windowEnumerator->HasMoreElements(&hasMore);
   }
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -1355,17 +1355,17 @@ HyperTextAccessible::SetSelectionRange(i
   if (isFocusable)
     return NS_OK;
 
   nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
   if (DOMFocusManager) {
     NS_ENSURE_TRUE(mDoc, NS_ERROR_FAILURE);
     nsIDocument* docNode = mDoc->DocumentNode();
     NS_ENSURE_TRUE(docNode, NS_ERROR_FAILURE);
-    nsCOMPtr<nsPIDOMWindow> window = docNode->GetWindow();
+    nsCOMPtr<nsPIDOMWindowOuter> window = docNode->GetWindow();
     nsCOMPtr<nsIDOMElement> result;
     DOMFocusManager->MoveFocus(window, nullptr, nsIFocusManager::MOVEFOCUS_CARET,
                                nsIFocusManager::FLAG_BYMOVEFOCUS, getter_AddRefs(result));
   }
 
   return NS_OK;
 }
 
--- a/accessible/generic/ImageAccessible.cpp
+++ b/accessible/generic/ImageAccessible.cpp
@@ -127,21 +127,21 @@ ImageAccessible::DoAction(uint8_t aIndex
   if (!uri)
     return false;
 
   nsAutoCString utf8spec;
   uri->GetSpec(utf8spec);
   NS_ConvertUTF8toUTF16 spec(utf8spec);
 
   nsIDocument* document = mContent->OwnerDoc();
-  nsCOMPtr<nsPIDOMWindow> piWindow = document->GetWindow();
+  nsCOMPtr<nsPIDOMWindowOuter> piWindow = document->GetWindow();
   if (!piWindow)
     return false;
 
-  nsCOMPtr<nsPIDOMWindow> tmp;
+  nsCOMPtr<nsPIDOMWindowOuter> tmp;
   return NS_SUCCEEDED(piWindow->Open(spec, EmptyString(), EmptyString(),
                                      getter_AddRefs(tmp)));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // ImageAccessible
 
 nsIntPoint
--- a/accessible/generic/RootAccessible.cpp
+++ b/accessible/generic/RootAccessible.cpp
@@ -480,22 +480,20 @@ RootAccessible::Shutdown()
 }
 
 Relation
 RootAccessible::RelationByType(RelationType aType)
 {
   if (!mDocumentNode || aType != RelationType::EMBEDS)
     return DocAccessibleWrap::RelationByType(aType);
 
-  nsPIDOMWindow* rootWindow = mDocumentNode->GetWindow();
-  if (rootWindow) {
-    nsCOMPtr<nsIDOMWindow> contentWindow = nsGlobalWindow::Cast(rootWindow)->GetContent();
-    nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(contentWindow);
-    if (piWindow) {
-      nsCOMPtr<nsIDocument> contentDocumentNode = piWindow->GetDoc();
+  if (nsPIDOMWindowOuter* rootWindow = mDocumentNode->GetWindow()) {
+    nsCOMPtr<nsPIDOMWindowOuter> contentWindow = nsGlobalWindow::Cast(rootWindow)->GetContent();
+    if (contentWindow) {
+      nsCOMPtr<nsIDocument> contentDocumentNode = contentWindow->GetDoc();
       if (contentDocumentNode) {
         DocAccessible* contentDocument =
           GetAccService()->GetDocAccessible(contentDocumentNode);
         if (contentDocument)
           return Relation(contentDocument);
       }
     }
   }
--- a/accessible/interfaces/nsIAccessibleDocument.idl
+++ b/accessible/interfaces/nsIAccessibleDocument.idl
@@ -2,29 +2,29 @@
 /* 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 nsIAccessiblePivot;
 interface nsIDOMDocument;
-interface nsIDOMWindow;
+interface mozIDOMWindowProxy;
 
 /**
  * An interface for in-process accessibility clients
  * that wish to retrieve information about a document.
  * When accessibility is turned on in Gecko,
  * there is an nsIAccessibleDocument for each document
  * whether it is XUL, HTML or whatever.
  * You can QueryInterface to nsIAccessibleDocument from the nsIAccessible for
  * the root node of a document or you can get one from
  * nsIAccessible::GetDocument().
  */
-[scriptable, uuid(2be938df-0210-4609-9ece-26b197a517e5)]
+[scriptable, uuid(5cad5f91-fcce-40e7-913e-4671701d19b4)]
 interface nsIAccessibleDocument : nsISupports
 {
   /**
    * The URL of the document
    */
   readonly attribute AString URL;
 
   /**
@@ -45,17 +45,17 @@ interface nsIAccessibleDocument : nsISup
   /**
    * The nsIDOMDocument interface associated with this document.
    */
   readonly attribute nsIDOMDocument DOMDocument;
 
   /**
    * The nsIDOMWindow that the document resides in.
    */
-  readonly attribute nsIDOMWindow window;
+  readonly attribute mozIDOMWindowProxy window;
 
   /**
    * Return the parent document accessible.
    */
   readonly attribute nsIAccessibleDocument parentDocument;
 
   /**
    * Return the count of child document accessibles.
--- a/accessible/interfaces/nsIAccessibleRetrieval.idl
+++ b/accessible/interfaces/nsIAccessibleRetrieval.idl
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 interface nsIDOMNode;
 interface nsIAccessible;
 interface nsIWeakReference;
 interface nsIPresShell;
-interface nsIDOMWindow;
 interface nsIAccessiblePivot;
 
 /**
  * An interface for in-process accessibility clients wishing to get an
  * nsIAccessible for a given DOM node.  More documentation at:
  *   http://www.mozilla.org/projects/ui/accessibility
  */
 [scriptable, uuid(17f86615-1a3d-4021-b227-3a2ef5cbffd8)]
--- a/accessible/windows/msaa/nsWinUtils.cpp
+++ b/accessible/windows/msaa/nsWinUtils.cpp
@@ -40,18 +40,17 @@ nsRefPtrHashtable<nsPtrHashKey<void>, Do
 already_AddRefed<nsIDOMCSSStyleDeclaration>
 nsWinUtils::GetComputedStyleDeclaration(nsIContent* aContent)
 {
   nsIContent* elm = nsCoreUtils::GetDOMElementFor(aContent);
   if (!elm)
     return nullptr;
 
   // Returns number of items in style declaration
-  nsCOMPtr<nsPIDOMWindow> window =
-    do_QueryInterface(elm->OwnerDoc()->GetInnerWindow());
+  nsCOMPtr<nsPIDOMWindowInner> window = elm->OwnerDoc()->GetInnerWindow();
   if (!window)
     return nullptr;
 
   ErrorResult dummy;
   nsCOMPtr<nsICSSDeclaration> cssDecl;
   nsCOMPtr<Element> domElement(do_QueryInterface(elm));
   cssDecl = window->GetComputedStyle(*domElement, EmptyString(), dummy);
   nsCOMPtr<nsIDOMCSSStyleDeclaration> domDecl = do_QueryInterface(cssDecl);
--- a/accessible/xpcom/xpcAccessibleDocument.cpp
+++ b/accessible/xpcom/xpcAccessibleDocument.cpp
@@ -94,17 +94,17 @@ xpcAccessibleDocument::GetDOMDocument(ns
 
   if (Intl()->DocumentNode())
     CallQueryInterface(Intl()->DocumentNode(), aDOMDocument);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-xpcAccessibleDocument::GetWindow(nsIDOMWindow** aDOMWindow)
+xpcAccessibleDocument::GetWindow(mozIDOMWindowProxy** aDOMWindow)
 {
   NS_ENSURE_ARG_POINTER(aDOMWindow);
   *aDOMWindow = nullptr;
 
   if (!Intl())
     return NS_ERROR_FAILURE;
 
   NS_IF_ADDREF(*aDOMWindow = Intl()->DocumentNode()->GetWindow());
--- a/accessible/xpcom/xpcAccessibleDocument.h
+++ b/accessible/xpcom/xpcAccessibleDocument.h
@@ -36,17 +36,17 @@ public:
                                            xpcAccessibleGeneric)
 
   // nsIAccessibleDocument
   NS_IMETHOD GetURL(nsAString& aURL) final override;
   NS_IMETHOD GetTitle(nsAString& aTitle) final override;
   NS_IMETHOD GetMimeType(nsAString& aType) final override;
   NS_IMETHOD GetDocType(nsAString& aType) final override;
   NS_IMETHOD GetDOMDocument(nsIDOMDocument** aDOMDocument) final override;
-  NS_IMETHOD GetWindow(nsIDOMWindow** aDOMWindow) final override;
+  NS_IMETHOD GetWindow(mozIDOMWindowProxy** aDOMWindow) final override;
   NS_IMETHOD GetParentDocument(nsIAccessibleDocument** aDocument)
     final override;
   NS_IMETHOD GetChildDocumentCount(uint32_t* aCount) final override;
   NS_IMETHOD GetChildDocumentAt(uint32_t aIndex,
                                 nsIAccessibleDocument** aDocument)
     final override;
   NS_IMETHOD GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor)
     final override;
--- a/chrome/nsChromeRegistry.cpp
+++ b/chrome/nsChromeRegistry.cpp
@@ -308,17 +308,17 @@ nsChromeRegistry::ConvertChromeURL(nsIUR
   return NS_NewURI(aResult, path, nullptr, baseURI);
 }
 
 ////////////////////////////////////////////////////////////////////////
 
 // theme stuff
 
 
-static void FlushSkinBindingsForWindow(nsPIDOMWindow* aWindow)
+static void FlushSkinBindingsForWindow(nsPIDOMWindowOuter* aWindow)
 {
   // Get the document.
   nsCOMPtr<nsIDocument> document = aWindow->GetDoc();
   if (!document)
     return;
 
   // Annihilate all XBL bindings.
   document->FlushSkinBindings();
@@ -335,32 +335,32 @@ NS_IMETHODIMP nsChromeRegistry::RefreshS
   nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
   windowMediator->GetEnumerator(nullptr, getter_AddRefs(windowEnumerator));
   bool more;
   windowEnumerator->HasMoreElements(&more);
   while (more) {
     nsCOMPtr<nsISupports> protoWindow;
     windowEnumerator->GetNext(getter_AddRefs(protoWindow));
     if (protoWindow) {
-      nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface(protoWindow);
+      nsCOMPtr<nsPIDOMWindowOuter> domWindow = do_QueryInterface(protoWindow);
       if (domWindow)
         FlushSkinBindingsForWindow(domWindow);
     }
     windowEnumerator->HasMoreElements(&more);
   }
 
   FlushSkinCaches();
 
   windowMediator->GetEnumerator(nullptr, getter_AddRefs(windowEnumerator));
   windowEnumerator->HasMoreElements(&more);
   while (more) {
     nsCOMPtr<nsISupports> protoWindow;
     windowEnumerator->GetNext(getter_AddRefs(protoWindow));
     if (protoWindow) {
-      nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface(protoWindow);
+      nsCOMPtr<nsPIDOMWindowOuter> domWindow = do_QueryInterface(protoWindow);
       if (domWindow)
         RefreshWindow(domWindow);
     }
     windowEnumerator->HasMoreElements(&more);
   }
    
   return NS_OK;
 }
@@ -372,27 +372,27 @@ nsChromeRegistry::FlushSkinCaches()
     mozilla::services::GetObserverService();
   NS_ASSERTION(obsSvc, "Couldn't get observer service.");
 
   obsSvc->NotifyObservers(static_cast<nsIChromeRegistry*>(this),
                           NS_CHROME_FLUSH_SKINS_TOPIC, nullptr);
 }
 
 // XXXbsmedberg: move this to windowmediator
-nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindow* aWindow)
+nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow)
 {
   // Deal with our subframes first.
   nsCOMPtr<nsIDOMWindowCollection> frames = aWindow->GetFrames();
   uint32_t length;
   frames->GetLength(&length);
   uint32_t j;
   for (j = 0; j < length; j++) {
-    nsCOMPtr<nsIDOMWindow> childWin;
+    nsCOMPtr<mozIDOMWindowProxy> childWin;
     frames->Item(j, getter_AddRefs(childWin));
-    nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(childWin);
+    nsCOMPtr<nsPIDOMWindowOuter> piWindow = nsPIDOMWindowOuter::From(childWin);
     RefreshWindow(piWindow);
   }
 
   nsresult rv;
   // Get the document.
   nsCOMPtr<nsIDocument> document = aWindow->GetDoc();
   if (!document)
     return NS_OK;
@@ -498,17 +498,17 @@ nsChromeRegistry::ReloadChrome()
       // Get each dom window
       bool more;
       rv = windowEnumerator->HasMoreElements(&more);
       if (NS_FAILED(rv)) return rv;
       while (more) {
         nsCOMPtr<nsISupports> protoWindow;
         rv = windowEnumerator->GetNext(getter_AddRefs(protoWindow));
         if (NS_SUCCEEDED(rv)) {
-          nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface(protoWindow);
+          nsCOMPtr<nsPIDOMWindowOuter> domWindow = do_QueryInterface(protoWindow);
           if (domWindow) {
             nsIDOMLocation* location = domWindow->GetLocation();
             if (location) {
               rv = location->Reload(false);
               if (NS_FAILED(rv)) return rv;
             }
           }
         }
--- a/chrome/nsChromeRegistry.h
+++ b/chrome/nsChromeRegistry.h
@@ -17,17 +17,17 @@
 #include "nsString.h"
 #include "nsURIHashKey.h"
 #include "nsInterfaceHashtable.h"
 #include "nsXULAppAPI.h"
 #include "nsIXPConnect.h"
 
 #include "mozilla/FileLocation.h"
 
-class nsPIDOMWindow;
+class nsPIDOMWindowOuter;
 class nsIPrefBranch;
 class nsIURL;
 
 // The chrome registry is actually split between nsChromeRegistryChrome and
 // nsChromeRegistryContent. The work/data that is common to both resides in
 // the shared nsChromeRegistry implementation, with operations that only make
 // sense for one side erroring out in the other.
 
@@ -90,17 +90,17 @@ protected:
   virtual nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
                                         const nsCString& aProvider,
                                         const nsCString& aPath) = 0;
   virtual nsresult GetFlagsFromPackage(const nsCString& aPackage,
                                        uint32_t* aFlags) = 0;
 
   nsresult SelectLocaleFromPref(nsIPrefBranch* prefs);
 
-  static nsresult RefreshWindow(nsPIDOMWindow* aWindow);
+  static nsresult RefreshWindow(nsPIDOMWindowOuter* aWindow);
   static nsresult GetProviderAndPath(nsIURL* aChromeURL,
                                      nsACString& aProvider, nsACString& aPath);
 
   bool GetDirectionForLocale(const nsACString& aLocale);
 
 public:
   static already_AddRefed<nsChromeRegistry> GetSingleton();
 
--- a/docshell/base/LoadContext.cpp
+++ b/docshell/base/LoadContext.cpp
@@ -64,26 +64,26 @@ LoadContext::LoadContext(nsIPrincipal* a
     NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs)));
 }
 
 //-----------------------------------------------------------------------------
 // LoadContext::nsILoadContext
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
-LoadContext::GetAssociatedWindow(nsIDOMWindow**)
+LoadContext::GetAssociatedWindow(mozIDOMWindowProxy**)
 {
   MOZ_ASSERT(mIsNotNull);
 
   // can't support this in the parent process
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
-LoadContext::GetTopWindow(nsIDOMWindow**)
+LoadContext::GetTopWindow(mozIDOMWindowProxy**)
 {
   MOZ_ASSERT(mIsNotNull);
 
   // can't support this in the parent process
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
--- a/docshell/base/nsDSURIContentListener.cpp
+++ b/docshell/base/nsDSURIContentListener.cpp
@@ -143,18 +143,18 @@ nsDSURIContentListener::DoContent(const 
 
   if (NS_FAILED(rv)) {
     // we don't know how to handle the content
     *aContentHandler = nullptr;
     return rv;
   }
 
   if (loadFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI) {
-    nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface(
-      mDocShell ? mDocShell->GetWindow() : nullptr);
+    nsCOMPtr<nsPIDOMWindowOuter> domWindow =
+      mDocShell ? mDocShell->GetWindow() : nullptr;
     NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);
     domWindow->Focus();
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -289,25 +289,25 @@ nsDSURIContentListener::CheckOneFrameOpt
   if (!mDocShell) {
     return true;
   }
 
   // We need to check the location of this window and the location of the top
   // window, if we're not the top.  X-F-O: SAMEORIGIN requires that the
   // document must be same-origin with top window.  X-F-O: DENY requires that
   // the document must never be framed.
-  nsCOMPtr<nsPIDOMWindow> thisWindow = mDocShell->GetWindow();
+  nsCOMPtr<nsPIDOMWindowOuter> thisWindow = mDocShell->GetWindow();
   // If we don't have DOMWindow there is no risk of clickjacking
   if (!thisWindow) {
     return true;
   }
 
   // GetScriptableTop, not GetTop, because we want this to respect
   // <iframe mozbrowser> boundaries.
-  nsCOMPtr<nsPIDOMWindow> topWindow = thisWindow->GetScriptableTop();
+  nsCOMPtr<nsPIDOMWindowOuter> topWindow = thisWindow->GetScriptableTop();
 
   // if the document is in the top window, it's not in a frame.
   if (thisWindow == topWindow) {
     return true;
   }
 
   // Find the top docshell in our parent chain that doesn't have the system
   // principal and use it for the principal comparison.  Finding the top
@@ -462,23 +462,22 @@ nsDSURIContentListener::CheckFrameOption
 
 void
 nsDSURIContentListener::ReportXFOViolation(nsIDocShellTreeItem* aTopDocShellItem,
                                            nsIURI* aThisURI,
                                            XFOHeader aHeader)
 {
   MOZ_ASSERT(aTopDocShellItem, "Need a top docshell");
 
-  nsCOMPtr<nsPIDOMWindow> topOuterWindow = aTopDocShellItem->GetWindow();
+  nsCOMPtr<nsPIDOMWindowOuter> topOuterWindow = aTopDocShellItem->GetWindow();
   if (!topOuterWindow) {
     return;
   }
 
-  NS_ASSERTION(topOuterWindow->IsOuterWindow(), "Huh?");
-  nsPIDOMWindow* topInnerWindow = topOuterWindow->GetCurrentInnerWindow();
+  nsPIDOMWindowInner* topInnerWindow = topOuterWindow->GetCurrentInnerWindow();
   if (!topInnerWindow) {
     return;
   }
 
   nsCOMPtr<nsIURI> topURI;
 
   nsCOMPtr<nsIDocument> document = aTopDocShellItem->GetDocument();
   nsresult rv = document->NodePrincipal()->GetURI(getter_AddRefs(topURI));
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -959,17 +959,18 @@ nsDocShell::GetInterface(const nsIID& aI
 
   if (aIID.Equals(NS_GET_IID(nsICommandManager))) {
     NS_ENSURE_SUCCESS(EnsureCommandHandler(), NS_ERROR_FAILURE);
     *aSink = mCommandManager;
   } else if (aIID.Equals(NS_GET_IID(nsIURIContentListener))) {
     *aSink = mContentListener;
   } else if ((aIID.Equals(NS_GET_IID(nsIScriptGlobalObject)) ||
               aIID.Equals(NS_GET_IID(nsIGlobalObject)) ||
-              aIID.Equals(NS_GET_IID(nsPIDOMWindow)) ||
+              aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter)) ||
+              aIID.Equals(NS_GET_IID(mozIDOMWindowProxy)) ||
               aIID.Equals(NS_GET_IID(nsIDOMWindow)) ||
               aIID.Equals(NS_GET_IID(nsIDOMWindowInternal))) &&
              NS_SUCCEEDED(EnsureScriptEnvironment())) {
     return mScriptGlobal->QueryInterface(aIID, aSink);
   } else if (aIID.Equals(NS_GET_IID(nsIDOMDocument)) &&
              NS_SUCCEEDED(EnsureContentViewer())) {
     mContentViewer->GetDOMDocument((nsIDOMDocument**)aSink);
     return *aSink ? NS_OK : NS_NOINTERFACE;
@@ -1007,17 +1008,17 @@ nsDocShell::GetInterface(const nsIID& aI
     nsresult rv;
     nsCOMPtr<nsIWindowWatcher> wwatch =
       do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Get the an auth prompter for our window so that the parenting
     // of the dialogs works as it should when using tabs.
     nsIPrompt* prompt;
-    rv = wwatch->GetNewPrompter(mScriptGlobal, &prompt);
+    rv = wwatch->GetNewPrompter(mScriptGlobal->AsOuter(), &prompt);
     NS_ENSURE_SUCCESS(rv, rv);
 
     *aSink = prompt;
     return NS_OK;
   } else if (aIID.Equals(NS_GET_IID(nsIAuthPrompt)) ||
              aIID.Equals(NS_GET_IID(nsIAuthPrompt2))) {
     return NS_SUCCEEDED(GetAuthPrompt(PROMPT_NORMAL, aIID, aSink)) ?
       NS_OK : NS_NOINTERFACE;
@@ -1075,18 +1076,17 @@ nsDocShell::GetInterface(const nsIID& aI
     }
   } else if (aIID.Equals(NS_GET_IID(nsIContentFrameMessageManager))) {
     nsCOMPtr<nsITabChild> tabChild =
       do_GetInterface(static_cast<nsIDocShell*>(this));
     nsCOMPtr<nsIContentFrameMessageManager> mm;
     if (tabChild) {
       tabChild->GetMessageManager(getter_AddRefs(mm));
     } else {
-      nsCOMPtr<nsPIDOMWindow> win = GetWindow();
-      if (win) {
+      if (nsPIDOMWindowOuter* win = GetWindow()) {
         mm = do_QueryInterface(win->GetParentTarget());
       }
     }
     *aSink = mm.get();
   } else {
     return nsDocLoader::GetInterface(aIID, aSink);
   }
 
@@ -1712,17 +1712,18 @@ nsDocShell::FirePageHideNotification(boo
 void
 nsDocShell::MaybeInitTiming()
 {
   if (mTiming && !mBlankTiming) {
     return;
   }
 
   if (mScriptGlobal && mBlankTiming) {
-    nsPIDOMWindow* innerWin = mScriptGlobal->GetCurrentInnerWindow();
+    nsPIDOMWindowInner* innerWin =
+      mScriptGlobal->AsOuter()->GetCurrentInnerWindow();
     if (innerWin && innerWin->GetPerformance()) {
       mTiming = innerWin->GetPerformance()->GetDOMTiming();
       mBlankTiming = false;
     }
   }
 
   if (!mTiming) {
     mTiming = new nsDOMNavigationTiming();
@@ -2425,18 +2426,18 @@ nsDocShell::GetAllowMedia(bool* aAllowMe
 
 NS_IMETHODIMP
 nsDocShell::SetAllowMedia(bool aAllowMedia)
 {
   mAllowMedia = aAllowMedia;
 
   // Mute or unmute audio contexts attached to the inner window.
   if (mScriptGlobal) {
-    nsPIDOMWindow* innerWin = mScriptGlobal->GetCurrentInnerWindow();
-    if (innerWin) {
+    if (nsPIDOMWindowInner* innerWin =
+        mScriptGlobal->AsOuter()->GetCurrentInnerWindow()) {
       if (aAllowMedia) {
         innerWin->UnmuteAudioContexts();
       } else {
         innerWin->MuteAudioContexts();
       }
     }
   }
 
@@ -2512,17 +2513,17 @@ nsDocShell::GetFullscreenAllowed(bool* a
   if (mFullscreenAllowed != CHECK_ATTRIBUTES) {
     *aFullscreenAllowed = (mFullscreenAllowed == PARENT_ALLOWS);
     return NS_OK;
   }
 
   // Assume false until we determine otherwise...
   *aFullscreenAllowed = false;
 
-  nsCOMPtr<nsPIDOMWindow> win = GetWindow();
+  nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
   if (!win) {
     return NS_OK;
   }
   nsCOMPtr<Element> frameElement = win->GetFrameElementInternal();
   if (frameElement && !frameElement->IsXULElement()) {
     // We do not allow document inside any containing element other
     // than iframe to enter fullscreen.
     if (!frameElement->IsHTMLElement(nsGkAtoms::iframe)) {
@@ -2967,24 +2968,25 @@ nsDocShell::GetSessionStorageForPrincipa
                                           bool aCreate,
                                           nsIDOMStorage** aStorage)
 {
   nsCOMPtr<nsIDOMStorageManager> manager = TopSessionStorageManager();
   if (!manager) {
     return NS_ERROR_UNEXPECTED;
   }
 
-  nsCOMPtr<nsIDOMWindow> domWin = do_GetInterface(GetAsSupports(this));
+  nsCOMPtr<nsPIDOMWindowOuter> domWin = do_GetInterface(GetAsSupports(this));
 
   if (aCreate) {
-    return manager->CreateStorage(domWin, aPrincipal, aDocumentURI,
-                                  mInPrivateBrowsing, aStorage);
-  }
-
-  return manager->GetStorage(domWin, aPrincipal, mInPrivateBrowsing, aStorage);
+    return manager->CreateStorage(domWin->GetCurrentInnerWindow(), aPrincipal,
+                                  aDocumentURI, mInPrivateBrowsing, aStorage);
+  }
+
+  return manager->GetStorage(domWin->GetCurrentInnerWindow(), aPrincipal,
+                             mInPrivateBrowsing, aStorage);
 }
 
 nsresult
 nsDocShell::AddSessionStorage(nsIPrincipal* aPrincipal, nsIDOMStorage* aStorage)
 {
   RefPtr<DOMStorage> storage = static_cast<DOMStorage*>(aStorage);
   if (!storage) {
     return NS_ERROR_UNEXPECTED;
@@ -3540,38 +3542,38 @@ nsDocShell::CanAccessItem(nsIDocShellTre
     return false;
   }
 
   if (!aConsiderOpener) {
     // All done here
     return false;
   }
 
-  nsCOMPtr<nsPIDOMWindow> targetWindow = aTargetItem->GetWindow();
+  nsCOMPtr<nsPIDOMWindowOuter> targetWindow = aTargetItem->GetWindow();
   if (!targetWindow) {
     NS_ERROR("This should not happen, really");
     return false;
   }
 
-  nsCOMPtr<nsIDOMWindow> targetOpener = targetWindow->GetOpener();
+  nsCOMPtr<mozIDOMWindowProxy> targetOpener = targetWindow->GetOpener();
   nsCOMPtr<nsIWebNavigation> openerWebNav(do_GetInterface(targetOpener));
   nsCOMPtr<nsIDocShellTreeItem> openerItem(do_QueryInterface(openerWebNav));
 
   if (!openerItem) {
     return false;
   }
 
   return CanAccessItem(openerItem, aAccessingItem, false);
 }
 
 static bool
 ItemIsActive(nsIDocShellTreeItem* aItem)
 {
-  if (nsCOMPtr<nsIDOMWindow> window = aItem->GetWindow()) {
-    auto* win = static_cast<nsGlobalWindow*>(window.get());
+  if (nsCOMPtr<nsPIDOMWindowOuter> window = aItem->GetWindow()) {
+    auto* win = nsGlobalWindow::Cast(window);
     MOZ_ASSERT(win->IsOuterWindow());
     if (!win->GetClosedOuter()) {
       return true;
     }
   }
 
   return false;
 }
@@ -3818,17 +3820,17 @@ PrintDocTree(nsIDocShellTreeItem* aParen
   aParentNode->GetChildCount(&childWebshellCount);
   nsCOMPtr<nsIDocShell> parentAsDocShell(do_QueryInterface(aParentNode));
   int32_t type = aParentNode->ItemType();
   nsCOMPtr<nsIPresShell> presShell = parentAsDocShell->GetPresShell();
   RefPtr<nsPresContext> presContext;
   parentAsDocShell->GetPresContext(getter_AddRefs(presContext));
   nsIDocument* doc = presShell->GetDocument();
 
-  nsCOMPtr<nsIDOMWindow> domwin(doc->GetWindow());
+  nsCOMPtr<nsPIDOMWindowOuter> domwin(doc->GetWindow());
 
   nsCOMPtr<nsIWidget> widget;
   nsViewManager* vm = presShell->GetViewManager();
   if (vm) {
     vm->GetWidget(getter_AddRefs(widget));
   }
   dom::Element* rootElement = doc->GetRootElement();
 
@@ -4437,23 +4439,23 @@ nsDocShell::GetScriptGlobalObject()
 
 nsIDocument*
 nsDocShell::GetDocument()
 {
   NS_ENSURE_SUCCESS(EnsureContentViewer(), nullptr);
   return mContentViewer->GetDocument();
 }
 
-nsPIDOMWindow*
+nsPIDOMWindowOuter*
 nsDocShell::GetWindow()
 {
   if (NS_FAILED(EnsureScriptEnvironment())) {
     return nullptr;
   }
-  return mScriptGlobal;
+  return mScriptGlobal->AsOuter();
 }
 
 NS_IMETHODIMP
 nsDocShell::SetDeviceSizeIsPageSize(bool aValue)
 {
   if (mDeviceSizeIsPageSize != aValue) {
     mDeviceSizeIsPageSize = aValue;
     RefPtr<nsPresContext> presContext;
@@ -7570,17 +7572,17 @@ nsDocShell::EndPageLoad(nsIWebProgress* 
 
     // Handle iframe document not loading error because source was
     // a tracking URL. We make a note of this iframe node by including
     // it in a dedicated array of blocked tracking nodes under its parent
     // document. (document of parent window of blocked document)
     if (isTopFrame == false && aStatus == NS_ERROR_TRACKING_URI) {
       // frameElement is our nsIContent to be annotated
       nsCOMPtr<nsIDOMElement> frameElement;
-      nsPIDOMWindow* thisWindow = GetWindow();
+      nsPIDOMWindowOuter* thisWindow = GetWindow();
       if (!thisWindow) {
         return NS_OK;
       }
 
       frameElement = thisWindow->GetFrameElement();
       if (!frameElement) {
         return NS_OK;
       }
@@ -7809,18 +7811,17 @@ nsDocShell::EnsureContentViewer()
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIURI> baseURI;
   nsIPrincipal* principal = GetInheritedPrincipal(false);
   nsCOMPtr<nsIDocShellTreeItem> parentItem;
   GetSameTypeParent(getter_AddRefs(parentItem));
   if (parentItem) {
-    nsCOMPtr<nsPIDOMWindow> domWin = GetWindow();
-    if (domWin) {
+    if (nsCOMPtr<nsPIDOMWindowOuter> domWin = GetWindow()) {
       nsCOMPtr<Element> parentElement = domWin->GetFrameElementInternal();
       if (parentElement) {
         baseURI = parentElement->GetBaseURI();
       }
     }
   }
 
   nsresult rv = CreateAboutBlankContentViewer(principal, baseURI);
@@ -8663,18 +8664,17 @@ nsDocShell::RestoreFromHistory()
         }
 
         // Ick, it'd be nicer to not rewalk all of the subdocs here.
         if (d->AnimationsPaused()) {
           document->SuppressEventHandling(nsIDocument::eAnimationsOnly,
                                           d->AnimationsPaused());
         }
 
-        nsCOMPtr<nsPIDOMWindow> parentWindow = d->GetWindow();
-        if (parentWindow) {
+        if (nsCOMPtr<nsPIDOMWindowOuter> parentWindow = d->GetWindow()) {
           parentSuspendCount = parentWindow->TimeoutSuspendCount();
         }
       }
     }
 
     // Use the uri from the mLSHE we had when we entered this function
     // (which need not match the document's URI if anchors are involved),
     // since that's the history entry we're loading.  Note that if we use
@@ -8683,17 +8683,17 @@ nsDocShell::RestoreFromHistory()
     nsCOMPtr<nsIURI> uri;
     origLSHE->GetURI(getter_AddRefs(uri));
     SetCurrentURI(uri, document->GetChannel(), true, 0);
   }
 
   // This is the end of our CreateContentViewer() replacement.
   // Now we simulate a load.  First, we restore the state of the javascript
   // window object.
-  nsCOMPtr<nsPIDOMWindow> privWin = GetWindow();
+  nsCOMPtr<nsPIDOMWindowOuter> privWin = GetWindow();
   NS_ASSERTION(privWin, "could not get nsPIDOMWindow interface");
 
   rv = privWin->RestoreWindowState(windowState);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Now, dispatch a title change event which would happen as the
   // <head> is parsed.
   document->NotifyPossibleTitleChange(false);
@@ -9603,17 +9603,17 @@ nsDocShell::InternalLoad(nsIURI* aURI,
 
   //
   // First, notify any nsIContentPolicy listeners about the document load.
   // Only abort the load if a content policy listener explicitly vetos it!
   //
   nsCOMPtr<Element> requestingElement;
   // Use nsPIDOMWindow since we _want_ to cross the chrome boundary if needed
   if (mScriptGlobal) {
-    requestingElement = mScriptGlobal->GetFrameElementInternal();
+    requestingElement = mScriptGlobal->AsOuter()->GetFrameElementInternal();
   }
 
   RefPtr<nsGlobalWindow> MMADeathGrip = mScriptGlobal;
 
   int16_t shouldLoad = nsIContentPolicy::ACCEPT;
   uint32_t contentType;
   bool isNewDocShell = false;
   bool isTargetTopLevelDocShell = false;
@@ -9757,34 +9757,34 @@ nsDocShell::InternalLoad(nsIURI* aURI,
 
       if (doc) {
         sandboxFlags = doc->GetSandboxFlags();
         if (sandboxFlags & SANDBOXED_AUXILIARY_NAVIGATION) {
           return NS_ERROR_DOM_INVALID_ACCESS_ERR;
         }
       }
 
-      nsCOMPtr<nsPIDOMWindow> win = GetWindow();
+      nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
       NS_ENSURE_TRUE(win, NS_ERROR_NOT_AVAILABLE);
 
       nsDependentString name(aWindowTarget);
-      nsCOMPtr<nsIDOMWindow> newWin;
+      nsCOMPtr<nsPIDOMWindowOuter> newWin;
       nsAutoCString spec;
       if (aURI) {
         aURI->GetSpec(spec);
       }
       rv = win->OpenNoNavigate(NS_ConvertUTF8toUTF16(spec),
                                name,  // window name
                                EmptyString(), // Features
                                getter_AddRefs(newWin));
 
       // In some cases the Open call doesn't actually result in a new
       // window being opened.  We can detect these cases by examining the
       // document in |newWin|, if any.
-      nsCOMPtr<nsPIDOMWindow> piNewWin = do_QueryInterface(newWin);
+      nsCOMPtr<nsPIDOMWindowOuter> piNewWin = do_QueryInterface(newWin);
       if (piNewWin) {
         nsCOMPtr<nsIDocument> newDoc = piNewWin->GetExtantDoc();
         if (!newDoc || newDoc->IsInitialDocument()) {
           isNewWindow = true;
           aFlags |= INTERNAL_LOAD_FLAGS_FIRST_LOAD;
 
           // set opener object to null for noreferrer
           if (aFlags & INTERNAL_LOAD_FLAGS_NO_OPENER) {
@@ -9827,17 +9827,17 @@ nsDocShell::InternalLoad(nsIURI* aURI,
         if (isNewWindow) {
           //
           // At this point, a new window has been created, but the
           // URI did not have any data associated with it...
           //
           // So, the best we can do, is to tear down the new window
           // that was just created!
           //
-          if (nsCOMPtr<nsPIDOMWindow> domWin = targetDocShell->GetWindow()) {
+          if (nsCOMPtr<nsPIDOMWindowOuter> domWin = targetDocShell->GetWindow()) {
             domWin->Close();
           }
         }
         //
         // NS_ERROR_NO_CONTENT should not be returned to the
         // caller... This is an internal error code indicating that
         // the URI had no data associated with it - probably a
         // helper-app style protocol (ie. mailto://)
@@ -10182,17 +10182,17 @@ nsDocShell::InternalLoad(nsIURI* aURI,
       if (win) {
         // Fire a hashchange event URIs differ, and only in their hashes.
         bool doHashchange = sameExceptHashes && !curHash.Equals(newHash);
 
         if (historyNavBetweenSameDoc || doHashchange) {
           win->DispatchSyncPopState();
         }
 
-        if (needsScrollPosUpdate && win->HasActiveDocument()) {
+        if (needsScrollPosUpdate && win->AsInner()->HasActiveDocument()) {
           SetCurScrollPosEx(bx, by);
         }
 
         if (doHashchange) {
           // Note that currentURI hasn't changed because it's on the
           // stack, so we can just use it directly as the old URI.
           win->DispatchAsyncHashchange(currentURI, aURI);
         }
@@ -10525,17 +10525,17 @@ nsDocShell::DoURILoad(nsIURI* aURI,
     // page. To avoid recursion, we skip this check if aURI's scheme is "about".
 
     // The goal is to prevent leaking sensitive information of an invalid page of
     // an app, so allowing about:blank would not be conflict to the goal.
     bool isAbout = false;
     rv = aURI->SchemeIs("about", &isAbout);
     if (NS_SUCCEEDED(rv) && !isAbout &&
         nsIDocShell::GetIsApp()) {
-      nsCOMPtr<Element> frameElement = mScriptGlobal->GetFrameElementInternal();
+      nsCOMPtr<Element> frameElement = mScriptGlobal->AsOuter()->GetFrameElementInternal();
       if (frameElement) {
         nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(frameElement);
         // |GetReallyIsApp| indicates the browser frame is a valid app or widget.
         // Here we prevent navigating to an app or widget which loses its validity
         // by loading invalid page or other way.
         if (browserFrame && !browserFrame->GetReallyIsApp()) {
           nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
           if (serv) {
@@ -10549,17 +10549,17 @@ nsDocShell::DoURILoad(nsIURI* aURI,
 
   // open a channel for the url
   nsCOMPtr<nsIChannel> channel;
 
   bool isSrcdoc = !aSrcdoc.IsVoid();
 
   nsCOMPtr<nsINode> requestingNode;
   if (mScriptGlobal) {
-    requestingNode = mScriptGlobal->GetFrameElementInternal();
+    requestingNode = mScriptGlobal->AsOuter()->GetFrameElementInternal();
     if (!requestingNode) {
       requestingNode = mScriptGlobal->GetExtantDoc();
     }
   }
 
   bool isSandBoxed = mSandboxFlags & SANDBOXED_ORIGIN;
   // only inherit if we have a triggeringPrincipal
   bool inherit = false;
@@ -12959,18 +12959,18 @@ nsDocShell::EnsureFind()
   // we promise that the nsIWebBrowserFind that we return has been set
   // up to point to the focused, or content window, so we have to
   // set that up each time.
 
   nsIScriptGlobalObject* scriptGO = GetScriptGlobalObject();
   NS_ENSURE_TRUE(scriptGO, NS_ERROR_UNEXPECTED);
 
   // default to our window
-  nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(scriptGO);
-  nsCOMPtr<nsPIDOMWindow> windowToSearch;
+  nsCOMPtr<nsPIDOMWindowOuter> ourWindow = do_QueryInterface(scriptGO);
+  nsCOMPtr<nsPIDOMWindowOuter> windowToSearch;
   nsFocusManager::GetFocusedDescendant(ourWindow, true,
                                        getter_AddRefs(windowToSearch));
 
   nsCOMPtr<nsIWebBrowserFindInFrames> findInFrames = do_QueryInterface(mFind);
   if (!findInFrames) {
     return NS_ERROR_NO_INTERFACE;
   }
 
@@ -13133,52 +13133,52 @@ nsDocShell::GetAuthPrompt(uint32_t aProm
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = EnsureScriptEnvironment();
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Get the an auth prompter for our window so that the parenting
   // of the dialogs works as it should when using tabs.
 
-  return wwatch->GetPrompt(mScriptGlobal, aIID,
+  return wwatch->GetPrompt(mScriptGlobal->AsOuter(), aIID,
                            reinterpret_cast<void**>(aResult));
 }
 
 //*****************************************************************************
 // nsDocShell::nsILoadContext
 //*****************************************************************************
 
 NS_IMETHODIMP
-nsDocShell::GetAssociatedWindow(nsIDOMWindow** aWindow)
+nsDocShell::GetAssociatedWindow(mozIDOMWindowProxy** aWindow)
 {
   CallGetInterface(this, aWindow);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::GetTopWindow(nsIDOMWindow** aWindow)
-{
-  nsCOMPtr<nsPIDOMWindow> win = GetWindow();
+nsDocShell::GetTopWindow(mozIDOMWindowProxy** aWindow)
+{
+  nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
   if (win) {
     win = win->GetTop();
   }
   win.forget(aWindow);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetTopFrameElement(nsIDOMElement** aElement)
 {
   *aElement = nullptr;
-  nsCOMPtr<nsPIDOMWindow> win = GetWindow();
+  nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
   if (!win) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsPIDOMWindow> top = win->GetScriptableTop();
+  nsCOMPtr<nsPIDOMWindowOuter> top = win->GetScriptableTop();
   NS_ENSURE_TRUE(top, NS_ERROR_FAILURE);
 
   // GetFrameElementInternal, /not/ GetScriptableFrameElement -- if |top| is
   // inside <iframe mozbrowser>, we want to return the iframe, not null.
   // And we want to cross the content/chrome boundary.
   nsCOMPtr<nsIDOMElement> elt =
     do_QueryInterface(top->GetFrameElementInternal());
   elt.forget(aElement);
@@ -13290,17 +13290,17 @@ nsDocShell::EnsureCommandHandler()
 {
   if (!mCommandManager) {
     nsCOMPtr<nsPICommandUpdater> commandUpdater =
       do_CreateInstance("@mozilla.org/embedcomp/command-manager;1");
     if (!commandUpdater) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
-    nsCOMPtr<nsIDOMWindow> domWindow = GetWindow();
+    nsCOMPtr<nsPIDOMWindowOuter> domWindow = GetWindow();
     nsresult rv = commandUpdater->Init(domWindow);
     if (NS_SUCCEEDED(rv)) {
       mCommandManager = do_QueryInterface(commandUpdater);
     }
   }
 
   return mCommandManager ? NS_OK : NS_ERROR_FAILURE;
 }
@@ -13579,20 +13579,20 @@ nsDocShell::OnLinkClickSync(nsIContent* 
   // referer, since the current URI in this docshell may be a
   // new document that we're in the process of loading.
   nsCOMPtr<nsIDocument> refererDoc = aContent->OwnerDoc();
   NS_ENSURE_TRUE(refererDoc, NS_ERROR_UNEXPECTED);
 
   // Now check that the refererDoc's inner window is the current inner
   // window for mScriptGlobal.  If it's not, then we don't want to
   // follow this link.
-  nsPIDOMWindow* refererInner = refererDoc->GetInnerWindow();
+  nsPIDOMWindowInner* refererInner = refererDoc->GetInnerWindow();
   NS_ENSURE_TRUE(refererInner, NS_ERROR_UNEXPECTED);
   if (!mScriptGlobal ||
-      mScriptGlobal->GetCurrentInnerWindow() != refererInner) {
+      mScriptGlobal->AsOuter()->GetCurrentInnerWindow() != refererInner) {
     // We're no longer the current inner window
     return NS_OK;
   }
 
   nsCOMPtr<nsIURI> referer = refererDoc->GetDocumentURI();
   uint32_t refererPolicy = refererDoc->GetReferrerPolicy();
 
   // get referrer attribute from clicked link and parse it
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -215,18 +215,18 @@ public:
   NS_IMETHOD OnLeaveLink() override;
 
   nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType);
   uint32_t ConvertDocShellLoadInfoToLoadType(
     nsDocShellInfoLoadType aDocShellLoadType);
 
   // Don't use NS_DECL_NSILOADCONTEXT because some of nsILoadContext's methods
   // are shared with nsIDocShell (appID, etc.) and can't be declared twice.
-  NS_IMETHOD GetAssociatedWindow(nsIDOMWindow**) override;
-  NS_IMETHOD GetTopWindow(nsIDOMWindow**) override;
+  NS_IMETHOD GetAssociatedWindow(mozIDOMWindowProxy**) override;
+  NS_IMETHOD GetTopWindow(mozIDOMWindowProxy**) override;
   NS_IMETHOD GetTopFrameElement(nsIDOMElement**) override;
   NS_IMETHOD GetNestedFrameId(uint64_t*) override;
   NS_IMETHOD IsAppOfType(uint32_t, bool*) override;
   NS_IMETHOD GetIsContent(bool*) override;
   NS_IMETHOD GetUsePrivateBrowsing(bool*) override;
   NS_IMETHOD SetUsePrivateBrowsing(bool) override;
   NS_IMETHOD SetPrivateBrowsing(bool) override;
   NS_IMETHOD GetUseRemoteTabs(bool*) override;
--- a/docshell/base/nsDocShellEditorData.cpp
+++ b/docshell/base/nsDocShellEditorData.cpp
@@ -71,17 +71,17 @@ nsresult
 nsDocShellEditorData::CreateEditor()
 {
   nsCOMPtr<nsIEditingSession> editingSession;
   nsresult rv = GetEditingSession(getter_AddRefs(editingSession));
   if (NS_FAILED(rv)) {
     return rv;
   }
 
-  nsCOMPtr<nsIDOMWindow> domWindow =
+  nsCOMPtr<nsPIDOMWindowOuter> domWindow =
     mDocShell ? mDocShell->GetWindow() : nullptr;
   rv = editingSession->SetupEditorOnWindow(domWindow);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   return NS_OK;
 }
@@ -144,51 +144,49 @@ nsDocShellEditorData::EnsureEditingSessi
 }
 
 nsresult
 nsDocShellEditorData::DetachFromWindow()
 {
   NS_ASSERTION(mEditingSession,
                "Can't detach when we don't have a session to detach!");
 
-  nsCOMPtr<nsIDOMWindow> domWindow =
+  nsCOMPtr<nsPIDOMWindowOuter> domWindow =
     mDocShell ? mDocShell->GetWindow() : nullptr;
   nsresult rv = mEditingSession->DetachFromWindow(domWindow);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mIsDetached = true;
   mDetachedMakeEditable = mMakeEditable;
   mMakeEditable = false;
 
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(domWindow);
-  nsCOMPtr<nsIDocument> doc = window->GetDoc();
+  nsCOMPtr<nsIDocument> doc = domWindow->GetDoc();
   nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(doc);
   if (htmlDoc) {
     mDetachedEditingState = htmlDoc->GetEditingState();
   }
 
   mDocShell = nullptr;
 
   return NS_OK;
 }
 
 nsresult
 nsDocShellEditorData::ReattachToWindow(nsIDocShell* aDocShell)
 {
   mDocShell = aDocShell;
 
-  nsCOMPtr<nsIDOMWindow> domWindow =
+  nsCOMPtr<nsPIDOMWindowOuter> domWindow =
     mDocShell ? mDocShell->GetWindow() : nullptr;
   nsresult rv = mEditingSession->ReattachToWindow(domWindow);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mIsDetached = false;
   mMakeEditable = mDetachedMakeEditable;
 
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(domWindow);
-  nsCOMPtr<nsIDocument> doc = window->GetDoc();
+  nsCOMPtr<nsIDocument> doc = domWindow->GetDoc();
   nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(doc);
   if (htmlDoc) {
     htmlDoc->SetEditingState(mDetachedEditingState);
   }
 
   return NS_OK;
 }
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -38,17 +38,17 @@ interface nsIPrincipal;
 interface nsIWebBrowserPrint;
 interface nsIPrivacyTransitionObserver;
 interface nsIReflowObserver;
 interface nsIScrollObserver;
 interface nsITabParent;
 
 typedef unsigned long nsLoadFlags;
 
-[scriptable, builtinclass, uuid(98358234-3936-4b95-b051-fcda4e55b52d)]
+[scriptable, builtinclass, uuid(049234fe-da10-478b-bc5d-bc6f9a1ba63d)]
 interface nsIDocShell : nsIDocShellTreeItem
 {
   /**
    * Loads a given URI.  This will give priority to loading the requested URI
    * in the object implementing	this interface.  If it can't be loaded here
    * however, the URL dispatcher will go through its normal process of content
    * loading.
    *
--- a/docshell/base/nsIDocShellTreeItem.idl
+++ b/docshell/base/nsIDocShellTreeItem.idl
@@ -3,26 +3,26 @@
  * 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 nsIDocShellTreeOwner;
 interface nsIDocument;
-interface nsPIDOMWindow;
+interface nsPIDOMWindowOuter;
 
 
 /**
  * The nsIDocShellTreeItem supplies the methods that are required of any item
  * that wishes to be able to live within the docshell tree either as a middle
  * node or a leaf. 
  */
 
-[scriptable, uuid(edb99640-8378-4106-8673-e701a086eb1c)]
+[scriptable, uuid(9b7c586f-9214-480c-a2c4-49b526fff1a6)]
 interface nsIDocShellTreeItem : nsISupports
 {
 	/*
 	name of the DocShellTreeItem
 	*/
 	attribute AString name;
 
         /**
@@ -174,11 +174,11 @@ interface nsIDocShellTreeItem : nsISuppo
 	*/
 	nsIDocShellTreeItem findChildWithName(in wstring aName,
 	                                      in boolean aRecurse,
 	                                      in boolean aSameType,
 	                                      in nsIDocShellTreeItem aRequestor,
 	                                      in nsIDocShellTreeItem aOriginalRequestor);
 
   [noscript,nostdcall,notxpcom] nsIDocument getDocument();
-  [noscript,nostdcall,notxpcom] nsPIDOMWindow getWindow();
+  [noscript,nostdcall,notxpcom] nsPIDOMWindowOuter getWindow();
 };
 
--- a/docshell/base/nsILoadContext.idl
+++ b/docshell/base/nsILoadContext.idl
@@ -1,49 +1,49 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: ft=cpp tw=78 sw=2 et ts=2 sts=2 cin
  * 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;
+interface mozIDOMWindowProxy;
 interface nsIDOMElement;
 
 %{C++
 #ifdef MOZILLA_INTERNAL_API
 #include "mozilla/BasePrincipal.h" // for DocShellOriginAttributes
 #endif
 %}
 
 /**
  * An nsILoadContext represents the context of a load.  This interface
  * can be queried for various information about where the load is
  * happening.
  */
-[scriptable, uuid(c71ef717-8fb9-425e-98ef-aef5894890f8)]
+[scriptable, uuid(2813a7a3-d084-4d00-acd0-f76620315c02)]
 interface nsILoadContext : nsISupports
 {
   /**
    * associatedWindow is the window with which the load is associated, if any.
    * Note that the load may be triggered by a document which is different from
    * the document in associatedWindow, and in fact the source of the load need
    * not be same-origin with the document in associatedWindow.  This attribute
    * may be null if there is no associated window.
    */
-  readonly attribute nsIDOMWindow associatedWindow;
+  readonly attribute mozIDOMWindowProxy associatedWindow;
 
   /**
    * topWindow is the top window which is of same type as associatedWindow.
    * This is equivalent to associatedWindow.top, but is provided here as a
    * convenience.  All the same caveats as associatedWindow of apply, of
    * course.  This attribute may be null if there is no associated window.
    */
-  readonly attribute nsIDOMWindow topWindow;
+  readonly attribute mozIDOMWindowProxy topWindow;
 
   /**
    * topFrameElement is the <iframe>, <frame>, or <browser> element which
    * contains the topWindow with which the load is associated.
    *
    * Note that we may have a topFrameElement even when we don't have an
    * associatedWindow, if the topFrameElement's content lives out of process.
    * topFrameElement is available in single-process and multiprocess contexts.
--- a/dom/activities/Activity.cpp
+++ b/dom/activities/Activity.cpp
@@ -29,17 +29,17 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
 /* virtual */ JSObject*
 Activity::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return MozActivityBinding::Wrap(aCx, this, aGivenProto);
 }
 
 nsresult
-Activity::Initialize(nsPIDOMWindow* aWindow,
+Activity::Initialize(nsPIDOMWindowInner* aWindow,
                      JSContext* aCx,
                      const ActivityOptions& aOptions)
 {
   MOZ_ASSERT(aWindow);
 
   nsCOMPtr<nsIDocument> document = aWindow->GetExtantDoc();
 
   bool isActive;
@@ -92,13 +92,13 @@ Activity::Initialize(nsPIDOMWindow* aWin
 
 Activity::~Activity()
 {
   if (mProxy) {
     mProxy->Cleanup();
   }
 }
 
-Activity::Activity(nsPIDOMWindow* aWindow)
+Activity::Activity(nsPIDOMWindowInner* aWindow)
   : DOMRequest(aWindow)
 {
 }
 
--- a/dom/activities/Activity.h
+++ b/dom/activities/Activity.h
@@ -25,31 +25,31 @@ public:
 
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   static already_AddRefed<Activity>
   Constructor(const GlobalObject& aOwner,
               const ActivityOptions& aOptions,
               ErrorResult& aRv)
   {
-    nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aOwner.GetAsSupports());
+    nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aOwner.GetAsSupports());
     if (!window) {
       aRv.Throw(NS_ERROR_UNEXPECTED);
       return nullptr;
     }
 
     RefPtr<Activity> activity = new Activity(window);
     aRv = activity->Initialize(window, aOwner.Context(), aOptions);
     return activity.forget();
   }
 
-  explicit Activity(nsPIDOMWindow* aWindow);
+  explicit Activity(nsPIDOMWindowInner* aWindow);
 
 protected:
-  nsresult Initialize(nsPIDOMWindow* aWindow,
+  nsresult Initialize(nsPIDOMWindowInner* aWindow,
                       JSContext* aCx,
                       const ActivityOptions& aOptions);
 
   nsCOMPtr<nsIActivityProxy> mProxy;
 
   ~Activity();
 };
 
--- a/dom/activities/interfaces/nsIActivityProxy.idl
+++ b/dom/activities/interfaces/nsIActivityProxy.idl
@@ -1,20 +1,20 @@
 /* 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;
+interface mozIDOMWindow;
 
 /**
   * Implemented by @mozilla.org/dom/activities/proxy;1
   */
-[scriptable, uuid(e04c0bbc-ab7d-41ba-b801-1068dd58660b)]
+[scriptable, uuid(87653623-d864-4b03-8874-96808b8cdb81)]
 interface nsIActivityProxy : nsISupports
 {
     void startActivity(in nsISupports /* MozActivity */ activity,
                        in jsval options,
-                       in nsIDOMWindow window,
+                       in mozIDOMWindow window,
                        in unsigned long long childID);
     void cleanup();
 };
--- a/dom/archivereader/ArchiveReader.cpp
+++ b/dom/archivereader/ArchiveReader.cpp
@@ -23,17 +23,17 @@ using namespace mozilla::dom;
 USING_ARCHIVEREADER_NAMESPACE
 
 /* static */ already_AddRefed<ArchiveReader>
 ArchiveReader::Constructor(const GlobalObject& aGlobal,
                            Blob& aBlob,
                            const ArchiveReaderOptions& aOptions,
                            ErrorResult& aError)
 {
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
+  nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
   if (!window) {
     aError.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
 
   nsAutoCString encoding;
   if (!EncodingUtils::FindEncodingForLabelNoReplacement(aOptions.mEncoding,
                                                         encoding)) {
@@ -41,17 +41,17 @@ ArchiveReader::Constructor(const GlobalO
     return nullptr;
   }
 
   RefPtr<ArchiveReader> reader =
     new ArchiveReader(aBlob, window, encoding);
   return reader.forget();
 }
 
-ArchiveReader::ArchiveReader(Blob& aBlob, nsPIDOMWindow* aWindow,
+ArchiveReader::ArchiveReader(Blob& aBlob, nsPIDOMWindowInner* aWindow,
                              const nsACString& aEncoding)
   : mBlobImpl(aBlob.Impl())
   , mWindow(aWindow)
   , mStatus(NOT_STARTED)
   , mEncoding(aEncoding)
 {
   MOZ_ASSERT(aWindow);
 }
--- a/dom/archivereader/ArchiveReader.h
+++ b/dom/archivereader/ArchiveReader.h
@@ -38,20 +38,20 @@ class ArchiveReader final : public nsISu
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ArchiveReader)
 
   static already_AddRefed<ArchiveReader>
   Constructor(const GlobalObject& aGlobal, Blob& aBlob,
               const ArchiveReaderOptions& aOptions, ErrorResult& aError);
 
-  ArchiveReader(Blob& aBlob, nsPIDOMWindow* aWindow,
+  ArchiveReader(Blob& aBlob, nsPIDOMWindowInner* aWindow,
                 const nsACString& aEncoding);
 
-  nsIDOMWindow* GetParentObject() const
+  nsPIDOMWindowInner* GetParentObject() const
   {
     return mWindow;
   }
 
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   already_AddRefed<ArchiveRequest> GetFilenames();
   already_AddRefed<ArchiveRequest> GetFile(const nsAString& filename);
@@ -80,17 +80,17 @@ private:
 
   void RequestReady(ArchiveRequest* aRequest);
 
 protected:
   // The archive blob/file
   RefPtr<BlobImpl> mBlobImpl;
 
   // The window is needed by the requests
-  nsCOMPtr<nsPIDOMWindow> mWindow;
+  nsCOMPtr<nsPIDOMWindowInner> mWindow;
 
   // Are we ready to return data?
   enum {
     NOT_STARTED = 0,
     WORKING,
     READY
   } mStatus;
 
--- a/dom/archivereader/ArchiveRequest.cpp
+++ b/dom/archivereader/ArchiveRequest.cpp
@@ -44,17 +44,17 @@ ArchiveRequestEvent::Run()
 {
   MOZ_ASSERT(mRequest, "the request is not longer valid");
   mRequest->Run();
   return NS_OK;
 }
 
 // ArchiveRequest
 
-ArchiveRequest::ArchiveRequest(nsPIDOMWindow* aWindow,
+ArchiveRequest::ArchiveRequest(nsPIDOMWindowInner* aWindow,
                                ArchiveReader* aReader)
 : DOMRequest(aWindow),
   mArchiveReader(aReader)
 {
   MOZ_ASSERT(aReader);
 
   MOZ_COUNT_CTOR(ArchiveRequest);
 
@@ -252,17 +252,17 @@ ArchiveRequest::GetFilesResult(JSContext
   }
 
   aValue.setObject(*array);
   return NS_OK;
 }
 
 // static
 already_AddRefed<ArchiveRequest>
-ArchiveRequest::Create(nsPIDOMWindow* aOwner,
+ArchiveRequest::Create(nsPIDOMWindowInner* aOwner,
                        ArchiveReader* aReader)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
   RefPtr<ArchiveRequest> request = new ArchiveRequest(aOwner, aReader);
 
   return request.forget();
 }
--- a/dom/archivereader/ArchiveRequest.h
+++ b/dom/archivereader/ArchiveRequest.h
@@ -29,17 +29,17 @@ public:
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   ArchiveReader* Reader() const;
 
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ArchiveRequest, DOMRequest)
 
-  ArchiveRequest(nsPIDOMWindow* aWindow,
+  ArchiveRequest(nsPIDOMWindowInner* aWindow,
                  ArchiveReader* aReader);
 
   // nsIDOMEventTarget
   virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) override;
 
 public:
   // This is called by the DOMArchiveRequestEvent
   void Run();
@@ -47,17 +47,17 @@ public:
   // Set the types for this request
   void OpGetFilenames();
   void OpGetFile(const nsAString& aFilename);
   void OpGetFiles();
 
   nsresult ReaderReady(nsTArray<RefPtr<File>>& aFileList, nsresult aStatus);
 
 public: // static
-  static already_AddRefed<ArchiveRequest> Create(nsPIDOMWindow* aOwner,
+  static already_AddRefed<ArchiveRequest> Create(nsPIDOMWindowInner* aOwner,
                                                  ArchiveReader* aReader);
 
 private:
   ~ArchiveRequest();
 
   nsresult GetFilenamesResult(JSContext* aCx,
                               JS::Value* aValue,
                               nsTArray<RefPtr<File>>& aFileList);
--- a/dom/audiochannel/AudioChannelAgent.cpp
+++ b/dom/audiochannel/AudioChannelAgent.cpp
@@ -59,66 +59,60 @@ AudioChannelAgent::Shutdown()
 
 NS_IMETHODIMP AudioChannelAgent::GetAudioChannelType(int32_t *aAudioChannelType)
 {
   *aAudioChannelType = mAudioChannelType;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-AudioChannelAgent::Init(nsIDOMWindow* aWindow, int32_t aChannelType,
+AudioChannelAgent::Init(mozIDOMWindow* aWindow, int32_t aChannelType,
                         nsIAudioChannelAgentCallback *aCallback)
 {
-  return InitInternal(aWindow, aChannelType, aCallback,
-                      /* useWeakRef = */ false);
+  return InitInternal(nsPIDOMWindowInner::From(aWindow), aChannelType,
+                      aCallback, /* useWeakRef = */ false);
 }
 
 NS_IMETHODIMP
-AudioChannelAgent::InitWithWeakCallback(nsIDOMWindow* aWindow,
+AudioChannelAgent::InitWithWeakCallback(mozIDOMWindow* aWindow,
                                         int32_t aChannelType,
                                         nsIAudioChannelAgentCallback *aCallback)
 {
-  return InitInternal(aWindow, aChannelType, aCallback,
-                      /* useWeakRef = */ true);
+  return InitInternal(nsPIDOMWindowInner::From(aWindow), aChannelType,
+                      aCallback, /* useWeakRef = */ true);
 }
 
 nsresult
-AudioChannelAgent::FindCorrectWindow(nsIDOMWindow* aWindow)
+AudioChannelAgent::FindCorrectWindow(nsPIDOMWindowInner* aWindow)
 {
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aWindow);
-  MOZ_ASSERT(window->IsInnerWindow());
+  MOZ_ASSERT(aWindow->IsInnerWindow());
 
-  mWindow = window->GetScriptableTop();
+  mWindow = aWindow->GetScriptableTop();
   if (NS_WARN_IF(!mWindow)) {
     return NS_OK;
   }
 
-  mWindow = mWindow->GetOuterWindow();
-  if (NS_WARN_IF(!mWindow)) {
-    return NS_ERROR_FAILURE;
-  }
-
   // From here we do an hack for nested iframes.
   // The system app doesn't have access to the nested iframe objects so it
   // cannot control the volume of the agents running in nested apps. What we do
   // here is to assign those Agents to the top scriptable window of the parent
   // iframe (what is controlled by the system app).
   // For doing this we go recursively back into the chain of windows until we
   // find apps that are not the system one.
-  window = mWindow->GetParent();
-  if (!window || window == mWindow) {
+  nsCOMPtr<nsPIDOMWindowOuter> outerParent = mWindow->GetParent();
+  if (!outerParent || outerParent == mWindow) {
     return NS_OK;
   }
 
-  window = window->GetCurrentInnerWindow();
-  if (!window) {
+  nsCOMPtr<nsPIDOMWindowInner> parent = outerParent->GetCurrentInnerWindow();
+  if (!parent) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
+  nsCOMPtr<nsIDocument> doc = parent->GetExtantDoc();
   if (!doc) {
     return NS_OK;
   }
 
   nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
 
   uint32_t appId;
   nsresult rv = principal->GetAppId(&appId);
@@ -147,21 +141,22 @@ AudioChannelAgent::FindCorrectWindow(nsI
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (systemAppId == appId) {
     return NS_OK;
   }
 
-  return FindCorrectWindow(window);
+  return FindCorrectWindow(parent);
 }
 
 nsresult
-AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType,
+AudioChannelAgent::InitInternal(nsPIDOMWindowInner* aWindow,
+                                int32_t aChannelType,
                                 nsIAudioChannelAgentCallback *aCallback,
                                 bool aUseWeakRef)
 {
   // We syncd the enum of channel type between nsIAudioChannelAgent.idl and
   // AudioChannelBinding.h the same.
   MOZ_ASSERT(int(AUDIO_AGENT_CHANNEL_NORMAL) == int(AudioChannel::Normal) &&
              int(AUDIO_AGENT_CHANNEL_CONTENT) == int(AudioChannel::Content) &&
              int(AUDIO_AGENT_CHANNEL_NOTIFICATION) == int(AudioChannel::Notification) &&
@@ -177,19 +172,18 @@ AudioChannelAgent::InitInternal(nsIDOMWi
       aChannelType < AUDIO_AGENT_CHANNEL_NORMAL) {
     return NS_ERROR_FAILURE;
   }
 
   if (NS_WARN_IF(!aWindow)) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsPIDOMWindow> pInnerWindow = do_QueryInterface(aWindow);
-  MOZ_ASSERT(pInnerWindow->IsInnerWindow());
-  mInnerWindowID = pInnerWindow->WindowID();
+  MOZ_ASSERT(aWindow->IsInnerWindow());
+  mInnerWindowID = aWindow->WindowID();
 
   nsresult rv = FindCorrectWindow(aWindow);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   mAudioChannelType = aChannelType;
 
--- a/dom/audiochannel/AudioChannelAgent.h
+++ b/dom/audiochannel/AudioChannelAgent.h
@@ -12,17 +12,18 @@
 #include "nsCOMPtr.h"
 #include "nsWeakPtr.h"
 
 #define NS_AUDIOCHANNELAGENT_CONTRACTID "@mozilla.org/audiochannelagent;1"
 // f27688e2-3dd7-11e2-904e-10bf48d64bd4
 #define NS_AUDIOCHANNELAGENT_CID {0xf27688e2, 0x3dd7, 0x11e2, \
       {0x90, 0x4e, 0x10, 0xbf, 0x48, 0xd6, 0x4b, 0xd4}}
 
-class nsPIDOMWindow;
+class nsPIDOMWindowInner;
+class nsPIDOMWindowOuter;
 
 namespace mozilla {
 namespace dom {
 
 /* Header file */
 class AudioChannelAgent : public nsIAudioChannelAgent
 {
 public:
@@ -31,40 +32,40 @@ public:
 
   NS_DECL_CYCLE_COLLECTION_CLASS(AudioChannelAgent)
 
   AudioChannelAgent();
 
   void WindowVolumeChanged();
   void WindowAudioCaptureChanged(uint64_t aInnerWindowID, bool aCapture);
 
-  nsPIDOMWindow* Window() const
+  nsPIDOMWindowOuter* Window() const
   {
     return mWindow;
   }
 
   uint64_t WindowID() const;
   uint64_t InnerWindowID() const;
 
 private:
   virtual ~AudioChannelAgent();
 
   // Returns mCallback if that's non-null, or otherwise tries to get an
   // nsIAudioChannelAgentCallback out of mWeakCallback.
   already_AddRefed<nsIAudioChannelAgentCallback> GetCallback();
 
-  nsresult InitInternal(nsIDOMWindow* aWindow, int32_t aAudioAgentType,
+  nsresult InitInternal(nsPIDOMWindowInner* aWindow, int32_t aAudioAgentType,
                         nsIAudioChannelAgentCallback* aCallback,
                         bool aUseWeakRef);
 
   void Shutdown();
 
-  nsresult FindCorrectWindow(nsIDOMWindow* aWindow);
+  nsresult FindCorrectWindow(nsPIDOMWindowInner* aWindow);
 
-  nsCOMPtr<nsPIDOMWindow> mWindow;
+  nsCOMPtr<nsPIDOMWindowOuter> mWindow;
   nsCOMPtr<nsIAudioChannelAgentCallback> mCallback;
 
   nsWeakPtr mWeakCallback;
 
   int32_t mAudioChannelType;
   uint64_t mInnerWindowID;
   bool mIsRegToService;
 };
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -98,39 +98,26 @@ void
 NotifyChannelActive(uint64_t aWindowID, AudioChannel aAudioChannel,
                     bool aActive)
 {
   RefPtr<nsRunnable> runnable =
     new NotifyChannelActiveRunnable(aWindowID, aAudioChannel, aActive);
   NS_DispatchToCurrentThread(runnable);
 }
 
-already_AddRefed<nsPIDOMWindow>
-GetTopWindow(nsPIDOMWindow* aWindow)
-{
-  MOZ_ASSERT(aWindow);
-
-  nsCOMPtr<nsPIDOMWindow> topWindow = aWindow->GetScriptableTop();
-  MOZ_ASSERT(topWindow);
-
-  topWindow = topWindow->GetOuterWindow();
-
-  return topWindow.forget();
-}
-
 bool
 IsParentProcess()
 {
   return XRE_GetProcessType() == GeckoProcessType_Default;
 }
 
 class MediaPlaybackRunnable : public nsRunnable
 {
 public:
-  MediaPlaybackRunnable(nsIDOMWindow* aWindow, bool aActive)
+  MediaPlaybackRunnable(nsPIDOMWindowOuter* aWindow, bool aActive)
     : mWindow(aWindow)
     , mActive(aActive)
   {}
 
  NS_IMETHOD Run()
  {
     nsCOMPtr<nsIObserverService> observerService =
       services::GetObserverService();
@@ -141,17 +128,17 @@ public:
         mActive ? MOZ_UTF16("active")
                 : MOZ_UTF16("inactive"));
     }
 
     return NS_OK;
   }
 
 private:
-  nsCOMPtr<nsIDOMWindow> mWindow;
+  nsCOMPtr<nsPIDOMWindowOuter> mWindow;
   bool mActive;
 };
 
 } // anonymous namespace
 
 StaticRefPtr<AudioChannelService> gAudioChannelService;
 
 // Mappings from 'mozaudiochannel' attribute strings to an enumeration.
@@ -362,17 +349,17 @@ AudioChannelService::RegisterTabParent(T
 void
 AudioChannelService::UnregisterTabParent(TabParent* aTabParent)
 {
   MOZ_ASSERT(aTabParent);
   mTabParents.RemoveElement(aTabParent);
 }
 
 void
-AudioChannelService::GetState(nsPIDOMWindow* aWindow, uint32_t aAudioChannel,
+AudioChannelService::GetState(nsPIDOMWindowOuter* aWindow, uint32_t aAudioChannel,
                               float* aVolume, bool* aMuted)
 {
   MOZ_ASSERT(!aWindow || aWindow->IsOuterWindow());
   MOZ_ASSERT(aVolume && aMuted);
   MOZ_ASSERT(aAudioChannel < NUMBER_OF_AUDIO_CHANNELS);
 
 
   if (!aWindow || !aWindow->IsOuterWindow()) {
@@ -380,31 +367,31 @@ AudioChannelService::GetState(nsPIDOMWin
     *aMuted = true;
     return;
   }
 
   *aVolume = 1.0;
   *aMuted = false;
 
   AudioChannelWindow* winData = nullptr;
-  nsCOMPtr<nsPIDOMWindow> window = aWindow;
+  nsCOMPtr<nsPIDOMWindowOuter> window = aWindow;
 
   // The volume must be calculated based on the window hierarchy. Here we go up
   // to the top window and we calculate the volume and the muted flag.
   do {
     winData = GetWindowData(window->WindowID());
     if (winData) {
       *aVolume *= winData->mChannels[aAudioChannel].mVolume;
       *aMuted = *aMuted || winData->mChannels[aAudioChannel].mMuted;
     }
 
     *aVolume *= window->GetAudioVolume();
     *aMuted = *aMuted || window->GetAudioMuted();
 
-    nsCOMPtr<nsPIDOMWindow> win = window->GetScriptableParent();
+    nsCOMPtr<nsPIDOMWindowOuter> win = window->GetScriptableParent();
     if (window == win) {
       break;
     }
 
     window = do_QueryInterface(win);
 
     // If there is no parent, or we are the toplevel we don't continue.
   } while (window && window != aWindow);
@@ -582,22 +569,22 @@ AudioChannelService::Observe(nsISupports
     RemoveChildStatus(childID);
   }
 
   return NS_OK;
 }
 
 void
 AudioChannelService::RefreshAgentsVolumeAndPropagate(AudioChannel aAudioChannel,
-                                                     nsPIDOMWindow* aWindow)
+                                                     nsPIDOMWindowOuter* aWindow)
 {
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aWindow->IsOuterWindow());
 
-  nsCOMPtr<nsPIDOMWindow> topWindow = aWindow->GetScriptableTop();
+  nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop();
   if (!topWindow) {
     return;
   }
 
   AudioChannelWindow* winData = GetWindowData(topWindow->WindowID());
   if (!winData) {
     return;
   }
@@ -607,22 +594,22 @@ AudioChannelService::RefreshAgentsVolume
                                                    winData->mChannels[(uint32_t)aAudioChannel].mVolume,
                                                    winData->mChannels[(uint32_t)aAudioChannel].mMuted);
   }
 
   RefreshAgentsVolume(aWindow);
 }
 
 void
-AudioChannelService::RefreshAgentsVolume(nsPIDOMWindow* aWindow)
+AudioChannelService::RefreshAgentsVolume(nsPIDOMWindowOuter* aWindow)
 {
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aWindow->IsOuterWindow());
 
-  nsCOMPtr<nsPIDOMWindow> topWindow = aWindow->GetScriptableTop();
+  nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop();
   if (!topWindow) {
     return;
   }
 
   AudioChannelWindow* winData = GetWindowData(topWindow->WindowID());
   if (!winData) {
     return;
   }
@@ -630,29 +617,29 @@ AudioChannelService::RefreshAgentsVolume
   nsTObserverArray<AudioChannelAgent*>::ForwardIterator
     iter(winData->mAgents);
   while (iter.HasMore()) {
     iter.GetNext()->WindowVolumeChanged();
   }
 }
 
 void
-AudioChannelService::SetWindowAudioCaptured(nsPIDOMWindow* aWindow,
+AudioChannelService::SetWindowAudioCaptured(nsPIDOMWindowOuter* aWindow,
                                             uint64_t aInnerWindowID,
                                             bool aCapture)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aWindow->IsOuterWindow());
 
   MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug,
          ("AudioChannelService, SetWindowAudioCaptured, window = %p, "
           "aCapture = %d\n", aWindow, aCapture));
 
-  nsCOMPtr<nsPIDOMWindow> topWindow = aWindow->GetScriptableTop();
+  nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop();
   if (!topWindow) {
     return;
   }
 
   AudioChannelWindow* winData = GetWindowData(topWindow->WindowID());
 
   // This can happen, but only during shutdown, because the the outer window
   // changes ScriptableTop, so that its ID is different.
@@ -735,17 +722,17 @@ AudioChannelService::GetDefaultAudioChan
         aString = audioChannel;
         break;
       }
     }
   }
 }
 
 AudioChannelService::AudioChannelWindow*
-AudioChannelService::GetOrCreateWindowData(nsPIDOMWindow* aWindow)
+AudioChannelService::GetOrCreateWindowData(nsPIDOMWindowOuter* aWindow)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aWindow->IsOuterWindow());
 
   AudioChannelWindow* winData = GetWindowData(aWindow->WindowID());
   if (!winData) {
     winData = new AudioChannelWindow(aWindow->WindowID());
@@ -766,43 +753,41 @@ AudioChannelService::GetWindowData(uint6
       return next;
     }
   }
 
   return nullptr;
 }
 
 float
-AudioChannelService::GetAudioChannelVolume(nsPIDOMWindow* aWindow,
+AudioChannelService::GetAudioChannelVolume(nsPIDOMWindowOuter* aWindow,
                                            AudioChannel aAudioChannel)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aWindow->IsOuterWindow());
 
   AudioChannelWindow* winData = GetOrCreateWindowData(aWindow);
   return winData->mChannels[(uint32_t)aAudioChannel].mVolume;
 }
 
 NS_IMETHODIMP
-AudioChannelService::GetAudioChannelVolume(nsIDOMWindow* aWindow,
+AudioChannelService::GetAudioChannelVolume(mozIDOMWindowProxy* aWindow,
                                            unsigned short aAudioChannel,
                                            float* aVolume)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow);
-  nsCOMPtr<nsPIDOMWindow> window = GetTopWindow(piWindow);
-  MOZ_ASSERT(window->IsOuterWindow());
+  auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop();
   *aVolume = GetAudioChannelVolume(window, (AudioChannel)aAudioChannel);
   return NS_OK;
 }
 
 void
-AudioChannelService::SetAudioChannelVolume(nsPIDOMWindow* aWindow,
+AudioChannelService::SetAudioChannelVolume(nsPIDOMWindowOuter* aWindow,
                                            AudioChannel aAudioChannel,
                                            float aVolume)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aWindow->IsOuterWindow());
 
   MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug,
@@ -810,57 +795,53 @@ AudioChannelService::SetAudioChannelVolu
           "volume = %f\n", aWindow, aAudioChannel, aVolume));
 
   AudioChannelWindow* winData = GetOrCreateWindowData(aWindow);
   winData->mChannels[(uint32_t)aAudioChannel].mVolume = aVolume;
   RefreshAgentsVolumeAndPropagate(aAudioChannel, aWindow);
 }
 
 NS_IMETHODIMP
-AudioChannelService::SetAudioChannelVolume(nsIDOMWindow* aWindow,
+AudioChannelService::SetAudioChannelVolume(mozIDOMWindowProxy* aWindow,
                                            unsigned short aAudioChannel,
                                            float aVolume)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow);
-  nsCOMPtr<nsPIDOMWindow> window = GetTopWindow(piWindow);
-  MOZ_ASSERT(window->IsOuterWindow());
+  auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop();
   SetAudioChannelVolume(window, (AudioChannel)aAudioChannel, aVolume);
   return NS_OK;
 }
 
 bool
-AudioChannelService::GetAudioChannelMuted(nsPIDOMWindow* aWindow,
+AudioChannelService::GetAudioChannelMuted(nsPIDOMWindowOuter* aWindow,
                                           AudioChannel aAudioChannel)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aWindow->IsOuterWindow());
 
   AudioChannelWindow* winData = GetOrCreateWindowData(aWindow);
   return winData->mChannels[(uint32_t)aAudioChannel].mMuted;
 }
 
 NS_IMETHODIMP
-AudioChannelService::GetAudioChannelMuted(nsIDOMWindow* aWindow,
+AudioChannelService::GetAudioChannelMuted(mozIDOMWindowProxy* aWindow,
                                           unsigned short aAudioChannel,
                                           bool* aMuted)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow);
-  nsCOMPtr<nsPIDOMWindow> window = GetTopWindow(piWindow);
-  MOZ_ASSERT(window->IsOuterWindow());
+  auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop();
   *aMuted = GetAudioChannelMuted(window, (AudioChannel)aAudioChannel);
   return NS_OK;
 }
 
 void
-AudioChannelService::SetAudioChannelMuted(nsPIDOMWindow* aWindow,
+AudioChannelService::SetAudioChannelMuted(nsPIDOMWindowOuter* aWindow,
                                           AudioChannel aAudioChannel,
                                           bool aMuted)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aWindow->IsOuterWindow());
 
   MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug,
@@ -873,51 +854,47 @@ AudioChannelService::SetAudioChannelMute
   }
 
   AudioChannelWindow* winData = GetOrCreateWindowData(aWindow);
   winData->mChannels[(uint32_t)aAudioChannel].mMuted = aMuted;
   RefreshAgentsVolumeAndPropagate(aAudioChannel, aWindow);
 }
 
 NS_IMETHODIMP
-AudioChannelService::SetAudioChannelMuted(nsIDOMWindow* aWindow,
+AudioChannelService::SetAudioChannelMuted(mozIDOMWindowProxy* aWindow,
                                           unsigned short aAudioChannel,
                                           bool aMuted)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow);
-  nsCOMPtr<nsPIDOMWindow> window = GetTopWindow(piWindow);
-  MOZ_ASSERT(window->IsOuterWindow());
+  auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop();
   SetAudioChannelMuted(window, (AudioChannel)aAudioChannel, aMuted);
   return NS_OK;
 }
 
 bool
-AudioChannelService::IsAudioChannelActive(nsPIDOMWindow* aWindow,
+AudioChannelService::IsAudioChannelActive(nsPIDOMWindowOuter* aWindow,
                                           AudioChannel aAudioChannel)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aWindow->IsOuterWindow());
 
   AudioChannelWindow* winData = GetOrCreateWindowData(aWindow);
   return !!winData->mChannels[(uint32_t)aAudioChannel].mNumberOfAgents;
 }
 
 NS_IMETHODIMP
-AudioChannelService::IsAudioChannelActive(nsIDOMWindow* aWindow,
+AudioChannelService::IsAudioChannelActive(mozIDOMWindowProxy* aWindow,
                                           unsigned short aAudioChannel,
                                           bool* aActive)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow);
-  nsCOMPtr<nsPIDOMWindow> window = GetTopWindow(piWindow);
-  MOZ_ASSERT(window->IsOuterWindow());
+  auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop();
   *aActive = IsAudioChannelActive(window, (AudioChannel)aAudioChannel);
   return NS_OK;
 }
 void
 AudioChannelService::SetDefaultVolumeControlChannel(int32_t aChannel,
                                                     bool aVisible)
 {
   SetDefaultVolumeControlChannelInternal(aChannel, aVisible,
--- a/dom/audiochannel/AudioChannelService.h
+++ b/dom/audiochannel/AudioChannelService.h
@@ -13,17 +13,17 @@
 #include "nsTObserverArray.h"
 #include "nsTArray.h"
 
 #include "AudioChannelAgent.h"
 #include "nsAttrValue.h"
 #include "mozilla/dom/AudioChannelBinding.h"
 
 class nsIRunnable;
-class nsPIDOMWindow;
+class nsPIDOMWindowOuter;
 struct PRLogModuleInfo;
 
 namespace mozilla {
 namespace dom {
 
 #ifdef MOZ_WIDGET_GONK
 class SpeakerManagerService;
 #endif
@@ -69,31 +69,31 @@ public:
    */
   void RegisterTabParent(TabParent* aTabParent);
   void UnregisterTabParent(TabParent* aTabParent);
 
   /**
    * Return the state to indicate this audioChannel for his window should keep
    * playing/muted.
    */
-  void GetState(nsPIDOMWindow* aWindow, uint32_t aChannel,
+  void GetState(nsPIDOMWindowOuter* aWindow, uint32_t aChannel,
                 float* aVolume, bool* aMuted);
 
   /* Methods for the BrowserElementAudioChannel */
-  float GetAudioChannelVolume(nsPIDOMWindow* aWindow, AudioChannel aChannel);
+  float GetAudioChannelVolume(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel);
 
-  void SetAudioChannelVolume(nsPIDOMWindow* aWindow, AudioChannel aChannel,
+  void SetAudioChannelVolume(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel,
                              float aVolume);
 
-  bool GetAudioChannelMuted(nsPIDOMWindow* aWindow, AudioChannel aChannel);
+  bool GetAudioChannelMuted(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel);
 
-  void SetAudioChannelMuted(nsPIDOMWindow* aWindow, AudioChannel aChannel,
+  void SetAudioChannelMuted(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel,
                             bool aMuted);
 
-  bool IsAudioChannelActive(nsPIDOMWindow* aWindow, AudioChannel aChannel);
+  bool IsAudioChannelActive(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel);
 
   /**
    * Return true if there is a telephony channel active in this process
    * or one of its subprocesses.
    */
   bool TelephonyChannelIsActive();
 
   /**
@@ -108,30 +108,29 @@ public:
    * the default audio channel will be used. Otherwise aChannel is casted to
    * AudioChannel enum.
    */
   virtual void SetDefaultVolumeControlChannel(int32_t aChannel,
                                               bool aVisible);
 
   bool AnyAudioChannelIsActive();
 
-  void RefreshAgentsVolume(nsPIDOMWindow* aWindow);
+  void RefreshAgentsVolume(nsPIDOMWindowOuter* aWindow);
 
   void RefreshAgentsVolumeAndPropagate(AudioChannel aAudioChannel,
-                                       nsPIDOMWindow* aWindow);
+                                       nsPIDOMWindowOuter* aWindow);
 
   // This method needs to know the inner window that wants to capture audio. We
   // group agents per top outer window, but we can have multiple innerWindow per
   // top outerWindow (subiframes, etc.) and we have to identify all the agents
   // just for a particular innerWindow.
-  void SetWindowAudioCaptured(nsPIDOMWindow* aWindow,
+  void SetWindowAudioCaptured(nsPIDOMWindowOuter* aWindow,
                               uint64_t aInnerWindowID,
                               bool aCapture);
 
-
 #ifdef MOZ_WIDGET_GONK
   void RegisterSpeakerManager(SpeakerManagerService* aSpeakerManager)
   {
     if (!mSpeakerManager.Contains(aSpeakerManager)) {
       mSpeakerManager.AppendElement(aSpeakerManager);
     }
   }
 
@@ -199,17 +198,17 @@ private:
     bool mIsAudioCaptured;
     AudioChannelConfig mChannels[NUMBER_OF_AUDIO_CHANNELS];
 
     // Raw pointer because the AudioChannelAgent must unregister itself.
     nsTObserverArray<AudioChannelAgent*> mAgents;
   };
 
   AudioChannelWindow*
-  GetOrCreateWindowData(nsPIDOMWindow* aWindow);
+  GetOrCreateWindowData(nsPIDOMWindowOuter* aWindow);
 
   AudioChannelWindow*
   GetWindowData(uint64_t aWindowID) const;
 
   struct AudioChannelChildStatus final
   {
     explicit AudioChannelChildStatus(uint64_t aChildID)
       : mChildID(aChildID)
--- a/dom/audiochannel/nsIAudioChannelAgent.idl
+++ b/dom/audiochannel/nsIAudioChannelAgent.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 nsIDOMWindow;
+interface mozIDOMWindow;
 
-[uuid(0a451ee0-972e-11e5-a837-0800200c9a66)]
+[uuid(15c05894-408e-4798-b527-a8c32d9c5f8c)]
 interface nsIAudioChannelAgentCallback : nsISupports
 {
   /**
    * Notified when the window volume/mute is changed
    */
   void windowVolumeChanged(in float aVolume, in bool aMuted);
 
   /**
@@ -75,27 +75,27 @@ interface nsIAudioChannelAgent : nsISupp
    * @param callback
    *    1. Once the playable status changes, agent uses this callback function
    *       to notify Gecko component.
    *    2. The callback is allowed to be null. Ex: telephony doesn't need to
    *       listen change of the playable status.
    *    3. The AudioChannelAgent keeps a strong reference to the callback
    *       object.
    */
-  void init(in nsIDOMWindow window, in long channelType,
+  void init(in mozIDOMWindow window, in long channelType,
             in nsIAudioChannelAgentCallback callback);
 
   /**
    * This method is just like init(), except the audio channel agent keeps a
    * weak reference to the callback object.
    *
    * In order for this to work, |callback| must implement
    * nsISupportsWeakReference.
    */
-  void initWithWeakCallback(in nsIDOMWindow window, in long channelType,
+  void initWithWeakCallback(in mozIDOMWindow window, in long channelType,
                             in nsIAudioChannelAgentCallback callback);
 
   /**
    * Notify the agent that we want to start playing.
    * Note: Gecko component SHOULD call this function first then start to
    *          play audio stream only when return value is true.
    *
    * @return
--- a/dom/audiochannel/nsIAudioChannelService.idl
+++ b/dom/audiochannel/nsIAudioChannelService.idl
@@ -1,29 +1,29 @@
 /* -*- 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;
+interface mozIDOMWindowProxy;
 
-[scriptable, builtinclass, uuid(323e5472-b8f4-4288-b1b9-53c7c54bbbe8)]
+[scriptable, builtinclass, uuid(5cb24dbc-36c7-46a4-9966-ac73141dc795)]
 interface nsIAudioChannelService : nsISupports
 {
-  float getAudioChannelVolume(in nsIDOMWindow window,
+  float getAudioChannelVolume(in mozIDOMWindowProxy window,
                               in unsigned short audioChannel);
 
-  void setAudioChannelVolume(in nsIDOMWindow window,
+  void setAudioChannelVolume(in mozIDOMWindowProxy window,
                              in unsigned short audioChannel,
                              in float volume);
 
-  boolean getAudioChannelMuted(in nsIDOMWindow window,
+  boolean getAudioChannelMuted(in mozIDOMWindowProxy window,
                                in unsigned short audioChannel);
 
-  void setAudioChannelMuted(in nsIDOMWindow window,
+  void setAudioChannelMuted(in mozIDOMWindowProxy window,
                             in unsigned short audioChannel,
                             in boolean muted);
 
-  boolean isAudioChannelActive(in nsIDOMWindow window,
+  boolean isAudioChannelActive(in mozIDOMWindowProxy window,
                                in unsigned short audioChannel);
 };
--- a/dom/base/BarProps.cpp
+++ b/dom/base/BarProps.cpp
@@ -23,20 +23,20 @@ BarProp::BarProp(nsGlobalWindow* aWindow
 {
   MOZ_ASSERT(aWindow->IsInnerWindow());
 }
 
 BarProp::~BarProp()
 {
 }
 
-nsPIDOMWindow*
+nsPIDOMWindowInner*
 BarProp::GetParentObject() const
 {
-  return mDOMWindow;
+  return mDOMWindow->AsInner();
 }
 
 JSObject*
 BarProp::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return BarPropBinding::Wrap(aCx, this, aGivenProto);
 }
 
--- a/dom/base/BarProps.h
+++ b/dom/base/BarProps.h
@@ -33,17 +33,17 @@ class BarProp : public nsISupports,
                 public nsWrapperCache
 {
 public:
   explicit BarProp(nsGlobalWindow *aWindow);
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(BarProp)
 
-  nsPIDOMWindow* GetParentObject() const;
+  nsPIDOMWindowInner* GetParentObject() const;
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   virtual bool GetVisible(ErrorResult& aRv) = 0;
   virtual void SetVisible(bool aVisible, ErrorResult& aRv) = 0;
 
 protected:
--- a/dom/base/ChromeNodeList.cpp
+++ b/dom/base/ChromeNodeList.cpp
@@ -8,17 +8,17 @@
 #include "mozilla/dom/ChromeNodeListBinding.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 already_AddRefed<ChromeNodeList>
 ChromeNodeList::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
 {
-  nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aGlobal.GetAsSupports());
+  nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports());
   nsIDocument* root = win ? win->GetExtantDoc() : nullptr;
   RefPtr<ChromeNodeList> list = new ChromeNodeList(root);
   return list.forget();
 }
 
 JSObject*
 ChromeNodeList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
--- a/dom/base/Comment.cpp
+++ b/dom/base/Comment.cpp
@@ -60,17 +60,17 @@ Comment::List(FILE* out, int32_t aIndent
   fputs("-->\n", out);
 }
 #endif
 
 /* static */ already_AddRefed<Comment>
 Comment::Constructor(const GlobalObject& aGlobal,
                      const nsAString& aData, ErrorResult& aRv)
 {
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
+  nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
   if (!window || !window->GetDoc()) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   return window->GetDoc()->CreateComment(aData);
 }
 
--- a/dom/base/Console.cpp
+++ b/dom/base/Console.cpp
@@ -243,17 +243,17 @@ private:
     AssertIsOnMainThread();
 
     // Walk up to our containing page
     WorkerPrivate* wp = mWorkerPrivate;
     while (wp->GetParent()) {
       wp = wp->GetParent();
     }
 
-    nsPIDOMWindow* window = wp->GetWindow();
+    nsPIDOMWindowInner* window = wp->GetWindow();
     if (!window) {
       RunWindowless();
     } else {
       RunWithWindow(window);
     }
 
     PostDispatch();
     return NS_OK;
@@ -292,28 +292,28 @@ private:
     };
 
     RefPtr<WorkerControlRunnable> runnable =
       new ConsoleReleaseRunnable(mWorkerPrivate, this);
     runnable->Dispatch(nullptr);
   }
 
   void
-  RunWithWindow(nsPIDOMWindow* aWindow)
+  RunWithWindow(nsPIDOMWindowInner* aWindow)
   {
     AutoJSAPI jsapi;
     MOZ_ASSERT(aWindow);
 
-    RefPtr<nsGlobalWindow> win = static_cast<nsGlobalWindow*>(aWindow);
+    RefPtr<nsGlobalWindow> win = nsGlobalWindow::Cast(aWindow);
     if (NS_WARN_IF(!jsapi.Init(win))) {
       return;
     }
 
     MOZ_ASSERT(aWindow->IsInnerWindow());
-    nsPIDOMWindow* outerWindow = aWindow->GetOuterWindow();
+    nsPIDOMWindowOuter* outerWindow = aWindow->GetOuterWindow();
     if (NS_WARN_IF(!outerWindow)) {
       return;
     }
 
     RunConsole(jsapi.cx(), outerWindow, aWindow);
   }
 
   void
@@ -342,18 +342,18 @@ private:
     RunConsole(cx, nullptr, nullptr);
   }
 
 protected:
   virtual bool
   PreDispatch(JSContext* aCx) = 0;
 
   virtual void
-  RunConsole(JSContext* aCx, nsPIDOMWindow* aOuterWindow,
-             nsPIDOMWindow* aInnerWindow) = 0;
+  RunConsole(JSContext* aCx, nsPIDOMWindowOuter* aOuterWindow,
+             nsPIDOMWindowInner* aInnerWindow) = 0;
 
   virtual JSObject* CustomReadHandler(JSContext* aCx,
                                       JSStructuredCloneReader* aReader,
                                       uint32_t aTag,
                                       uint32_t aIndex) override
   {
     AssertIsOnMainThread();
 
@@ -479,18 +479,18 @@ private:
       return false;
     }
 
     mCallData->CleanupJSObjects();
     return true;
   }
 
   void
-  RunConsole(JSContext* aCx, nsPIDOMWindow* aOuterWindow,
-             nsPIDOMWindow* aInnerWindow) override
+  RunConsole(JSContext* aCx, nsPIDOMWindowOuter* aOuterWindow,
+             nsPIDOMWindowInner* aInnerWindow) override
   {
     MOZ_ASSERT(NS_IsMainThread());
 
     // The windows have to run in parallel.
     MOZ_ASSERT(!!aOuterWindow == !!aInnerWindow);
 
     if (aOuterWindow) {
       mCallData->SetIDs(aOuterWindow->WindowID(), aInnerWindow->WindowID());
@@ -609,18 +609,18 @@ private:
       return false;
     }
 
     mArguments.Clear();
     return true;
   }
 
   void
-  RunConsole(JSContext* aCx, nsPIDOMWindow* aOuterWindow,
-             nsPIDOMWindow* aInnerWindow) override
+  RunConsole(JSContext* aCx, nsPIDOMWindowOuter* aOuterWindow,
+             nsPIDOMWindowInner* aInnerWindow) override
   {
     ClearException ce(aCx);
 
     // Now we could have the correct window (if we are not window-less).
     mClonedData.mParent = aInnerWindow;
 
     JS::Rooted<JS::Value> argumentsValue(aCx);
     bool ok = Read(aCx, &argumentsValue);
@@ -684,29 +684,29 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(Console
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Console)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END
 
-Console::Console(nsPIDOMWindow* aWindow)
+Console::Console(nsPIDOMWindowInner* aWindow)
   : mWindow(aWindow)
   , mOuterID(0)
   , mInnerID(0)
 {
   if (mWindow) {
     MOZ_ASSERT(mWindow->IsInnerWindow());
     mInnerID = mWindow->WindowID();
 
     // Without outerwindow any console message coming from this object will not
     // shown in the devtools webconsole. But this should be fine because
     // probably we are shutting down, or the window is CCed/GCed.
-    nsPIDOMWindow* outerWindow = mWindow->GetOuterWindow();
+    nsPIDOMWindowOuter* outerWindow = mWindow->GetOuterWindow();
     if (outerWindow) {
       mOuterID = outerWindow->WindowID();
     }
   }
 
   if (NS_IsMainThread()) {
     nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
     if (obs) {
@@ -1061,17 +1061,17 @@ Console::Method(JSContext* aCx, MethodNa
     }
   }
 
   // Monotonic timer for 'time' and 'timeEnd'
   if (aMethodName == MethodTime ||
       aMethodName == MethodTimeEnd ||
       aMethodName == MethodTimeStamp) {
     if (mWindow) {
-      nsGlobalWindow *win = static_cast<nsGlobalWindow*>(mWindow.get());
+      nsGlobalWindow *win = nsGlobalWindow::Cast(mWindow);
       MOZ_ASSERT(win);
 
       RefPtr<nsPerformance> performance = win->GetPerformance();
       if (!performance) {
         return;
       }
 
       callData->mMonotonicTimer = performance->Now();
--- a/dom/base/Console.h
+++ b/dom/base/Console.h
@@ -34,20 +34,20 @@ class Console final : public nsIObserver
 {
   ~Console();
 
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Console, nsIObserver)
   NS_DECL_NSIOBSERVER
 
-  explicit Console(nsPIDOMWindow* aWindow);
+  explicit Console(nsPIDOMWindowInner* aWindow);
 
   // WebIDL methods
-  nsISupports* GetParentObject() const
+  nsPIDOMWindowInner* GetParentObject() const
   {
     return mWindow;
   }
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   void
@@ -198,17 +198,17 @@ private:
                    const nsTArray<JS::Heap<JS::Value>>& aArguments);
 
   bool
   ShouldIncludeStackTrace(MethodName aMethodName);
 
   JSObject*
   GetOrCreateSandbox(JSContext* aCx, nsIPrincipal* aPrincipal);
 
-  nsCOMPtr<nsPIDOMWindow> mWindow;
+  nsCOMPtr<nsPIDOMWindowInner> mWindow;
   nsCOMPtr<nsIConsoleAPIStorage> mStorage;
   RefPtr<JSObjectHolder> mSandbox;
 
   nsDataHashtable<nsStringHashKey, DOMHighResTimeStamp> mTimerRegistry;
   nsDataHashtable<nsStringHashKey, uint32_t> mCounterRegistry;
 
   uint64_t mOuterID;
   uint64_t mInnerID;
--- a/dom/base/DOMCursor.cpp
+++ b/dom/base/DOMCursor.cpp
@@ -15,17 +15,17 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(DOMCu
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DOMCursor)
   NS_INTERFACE_MAP_ENTRY(nsIDOMDOMCursor)
 NS_INTERFACE_MAP_END_INHERITING(DOMRequest)
 
 NS_IMPL_ADDREF_INHERITED(DOMCursor, DOMRequest)
 NS_IMPL_RELEASE_INHERITED(DOMCursor, DOMRequest)
 
-DOMCursor::DOMCursor(nsPIDOMWindow* aWindow, nsICursorContinueCallback* aCallback)
+DOMCursor::DOMCursor(nsPIDOMWindowInner* aWindow, nsICursorContinueCallback* aCallback)
   : DOMRequest(aWindow)
   , mCallback(aCallback)
   , mFinished(false)
 {
 }
 
 DOMCursor::DOMCursor(nsIGlobalObject* aGlobal, nsICursorContinueCallback* aCallback)
   : DOMRequest(aGlobal)
--- a/dom/base/DOMCursor.h
+++ b/dom/base/DOMCursor.h
@@ -20,17 +20,17 @@ class DOMCursor : public DOMRequest
                 , public nsIDOMDOMCursor
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMDOMCURSOR
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DOMCursor,
                                            DOMRequest)
 
-  DOMCursor(nsPIDOMWindow* aWindow, nsICursorContinueCallback *aCallback);
+  DOMCursor(nsPIDOMWindowInner* aWindow, nsICursorContinueCallback *aCallback);
   DOMCursor(nsIGlobalObject* aGlobal, nsICursorContinueCallback *aCallback);
 
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   bool Done() const
   {
     return mFinished;
   }
--- a/dom/base/DOMError.cpp
+++ b/dom/base/DOMError.cpp
@@ -16,38 +16,38 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DO
 NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMError)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMError)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMError)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(DOMError)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-DOMError::DOMError(nsPIDOMWindow* aWindow)
+DOMError::DOMError(nsPIDOMWindowInner* aWindow)
   : mWindow(aWindow)
 {
 }
 
-DOMError::DOMError(nsPIDOMWindow* aWindow, nsresult aValue)
+DOMError::DOMError(nsPIDOMWindowInner* aWindow, nsresult aValue)
   : mWindow(aWindow)
 {
   nsCString name, message;
   NS_GetNameAndMessageForDOMNSResult(aValue, name, message);
 
   CopyUTF8toUTF16(name, mName);
   CopyUTF8toUTF16(message, mMessage);
 }
 
-DOMError::DOMError(nsPIDOMWindow* aWindow, const nsAString& aName)
+DOMError::DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName)
   : mWindow(aWindow)
   , mName(aName)
 {
 }
 
-DOMError::DOMError(nsPIDOMWindow* aWindow, const nsAString& aName,
+DOMError::DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName,
                    const nsAString& aMessage)
   : mWindow(aWindow)
   , mName(aName)
   , mMessage(aMessage)
 {
 }
 
 DOMError::~DOMError()
@@ -60,17 +60,17 @@ DOMError::WrapObject(JSContext* aCx, JS:
   return DOMErrorBinding::Wrap(aCx, this, aGivenProto);
 }
 
 /* static */ already_AddRefed<DOMError>
 DOMError::Constructor(const GlobalObject& aGlobal,
                       const nsAString& aName, const nsAString& aMessage,
                       ErrorResult& aRv)
 {
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
+  nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
 
   // Window is null for chrome code.
 
   RefPtr<DOMError> ret = new DOMError(window, aName, aMessage);
   return ret.forget();
 }
 
 } // namespace dom
--- a/dom/base/DOMError.h
+++ b/dom/base/DOMError.h
@@ -6,59 +6,60 @@
 
 #ifndef mozilla_dom_domerror_h__
 #define mozilla_dom_domerror_h__
 
 #include "mozilla/Attributes.h"
 #include "nsWrapperCache.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
-#include "nsPIDOMWindow.h"
 
 #define DOMERROR_IID \
 { 0x220cb63f, 0xa37d, 0x4ba4, \
  { 0x8e, 0x31, 0xfc, 0xde, 0xec, 0x48, 0xe1, 0x66 } }
 
+class nsPIDOMWindowInner;
+
 namespace mozilla {
 
 class ErrorResult;
 
 namespace dom {
 
 class GlobalObject;
 
 class DOMError : public nsISupports,
                  public nsWrapperCache
 {
-  nsCOMPtr<nsPIDOMWindow> mWindow;
+  nsCOMPtr<nsPIDOMWindowInner> mWindow;
   nsString mName;
   nsString mMessage;
 
 protected:
   virtual ~DOMError();
 
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMError)
 
   NS_DECLARE_STATIC_IID_ACCESSOR(DOMERROR_IID)
 
   // aWindow can be null if this DOMError is not associated with a particular
   // window.
 
-  explicit DOMError(nsPIDOMWindow* aWindow);
+  explicit DOMError(nsPIDOMWindowInner* aWindow);
 
-  DOMError(nsPIDOMWindow* aWindow, nsresult aValue);
+  DOMError(nsPIDOMWindowInner* aWindow, nsresult aValue);
 
-  DOMError(nsPIDOMWindow* aWindow, const nsAString& aName);
+  DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName);
 
-  DOMError(nsPIDOMWindow* aWindow, const nsAString& aName,
+  DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName,
            const nsAString& aMessage);
 
-  nsPIDOMWindow* GetParentObject() const
+  nsPIDOMWindowInner* GetParentObject() const
   {
     return mWindow;
   }
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   static already_AddRefed<DOMError>
--- a/dom/base/DOMParser.cpp
+++ b/dom/base/DOMParser.cpp
@@ -417,17 +417,17 @@ DOMParser::InitInternal(nsISupports* aOw
     // using the base URI and document URI of the window off of which the
     // DOMParser is created, not the window in which parse*() is called.
     // Does that matter?
 
     // Also note that |cx| matches what GetDocumentFromContext() would return,
     // while GetDocumentFromCaller() gives us the window that the DOMParser()
     // call was made on.
 
-    nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aOwner);
+    nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aOwner);
     if (!window) {
       return NS_ERROR_UNEXPECTED;
     }
 
     baseURI = window->GetDocBaseURI();
     documentURI = window->GetDocumentURI();
     if (!documentURI) {
       return NS_ERROR_UNEXPECTED;
--- a/dom/base/DOMRequest.cpp
+++ b/dom/base/DOMRequest.cpp
@@ -18,19 +18,18 @@
 using mozilla::dom::AnyCallback;
 using mozilla::dom::DOMError;
 using mozilla::dom::DOMRequest;
 using mozilla::dom::DOMRequestService;
 using mozilla::dom::DOMCursor;
 using mozilla::dom::Promise;
 using mozilla::dom::AutoJSAPI;
 
-DOMRequest::DOMRequest(nsPIDOMWindow* aWindow)
-  : DOMEventTargetHelper(aWindow->IsInnerWindow() ?
-                           aWindow : aWindow->GetCurrentInnerWindow())
+DOMRequest::DOMRequest(nsPIDOMWindowInner* aWindow)
+  : DOMEventTargetHelper(aWindow)
   , mResult(JS::UndefinedValue())
   , mDone(false)
 {
 }
 
 DOMRequest::DOMRequest(nsIGlobalObject* aGlobal)
   : DOMEventTargetHelper(aGlobal)
   , mResult(JS::UndefinedValue())
@@ -235,34 +234,34 @@ DOMRequest::Then(JSContext* aCx, AnyCall
   JS::Rooted<JSObject*> global(aCx, mPromise->GetWrapper());
   global = js::GetGlobalForObjectCrossCompartment(global);
   mPromise->Then(aCx, global, aResolveCallback, aRejectCallback, aRetval, aRv);
 }
 
 NS_IMPL_ISUPPORTS(DOMRequestService, nsIDOMRequestService)
 
 NS_IMETHODIMP
-DOMRequestService::CreateRequest(nsIDOMWindow* aWindow,
+DOMRequestService::CreateRequest(mozIDOMWindow* aWindow,
                                  nsIDOMDOMRequest** aRequest)
 {
   MOZ_ASSERT(NS_IsMainThread());
-  nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(aWindow));
-  NS_ENSURE_STATE(win);
+  NS_ENSURE_STATE(aWindow);
+  auto* win = nsPIDOMWindowInner::From(aWindow);
   NS_ADDREF(*aRequest = new DOMRequest(win));
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-DOMRequestService::CreateCursor(nsIDOMWindow* aWindow,
+DOMRequestService::CreateCursor(mozIDOMWindow* aWindow,
                                 nsICursorContinueCallback* aCallback,
                                 nsIDOMDOMCursor** aCursor)
 {
-  nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(aWindow));
-  NS_ENSURE_STATE(win);
+  NS_ENSURE_STATE(aWindow);
+  auto* win = nsPIDOMWindowInner::From(aWindow);
   NS_ADDREF(*aCursor = new DOMCursor(win, aCallback));
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DOMRequestService::FireSuccess(nsIDOMDOMRequest* aRequest,
                                JS::Handle<JS::Value> aResult)
--- a/dom/base/DOMRequest.h
+++ b/dom/base/DOMRequest.h
@@ -37,17 +37,17 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMDOMREQUEST
   NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
 
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(DOMRequest,
                                                          DOMEventTargetHelper)
 
   // WrapperCache
-  nsPIDOMWindow* GetParentObject() const
+  nsPIDOMWindowInner* GetParentObject() const
   {
     return GetOwner();
   }
 
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   // WebIDL Interface
   DOMRequestReadyState ReadyState() const
@@ -80,17 +80,17 @@ public:
        JS::MutableHandle<JS::Value> aRetval,
        mozilla::ErrorResult& aRv);
 
   void FireSuccess(JS::Handle<JS::Value> aResult);
   void FireError(const nsAString& aError);
   void FireError(nsresult aError);
   void FireDetailedError(DOMError* aError);
 
-  explicit DOMRequest(nsPIDOMWindow* aWindow);
+  explicit DOMRequest(nsPIDOMWindowInner* aWindow);
   explicit DOMRequest(nsIGlobalObject* aGlobal);
 
 protected:
   virtual ~DOMRequest();
 
   void FireEvent(const nsAString& aType, bool aBubble, bool aCancelable);
 
   void RootResultVal();
--- a/dom/base/DocumentFragment.cpp
+++ b/dom/base/DocumentFragment.cpp
@@ -111,17 +111,17 @@ DocumentFragment::DumpContent(FILE* out,
   }
 }
 #endif
 
 /* static */ already_AddRefed<DocumentFragment>
 DocumentFragment::Constructor(const GlobalObject& aGlobal,
                               ErrorResult& aRv)
 {
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
+  nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
   if (!window || !window->GetDoc()) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   return window->GetDoc()->CreateDocumentFragment();
 }
 
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -2013,21 +2013,21 @@ bool
 Element::ShouldBlur(nsIContent *aContent)
 {
   // Determine if the current element is focused, if it is not focused
   // then we should not try to blur
   nsIDocument* document = aContent->GetComposedDoc();
   if (!document)
     return false;
 
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(document->GetWindow());
+  nsCOMPtr<nsPIDOMWindowOuter> window = document->GetWindow();
   if (!window)
     return false;
 
-  nsCOMPtr<nsPIDOMWindow> focusedFrame;
+  nsCOMPtr<nsPIDOMWindowOuter> focusedFrame;
   nsIContent* contentToBlur =
     nsFocusManager::GetFocusedDescendant(window, false, getter_AddRefs(focusedFrame));
   if (contentToBlur == aContent)
     return true;
 
   // if focus on this element would get redirected, then check the redirected
   // content as well when blurring.
   return (contentToBlur && nsFocusManager::GetRedirectedFocus(aContent) == contentToBlur);
@@ -3228,17 +3228,16 @@ Element::AttrValueToCORSMode(const nsAtt
   }
 
   return CORSMode(aValue->GetEnumValue());
 }
 
 static const char*
 GetFullScreenError(nsIDocument* aDoc)
 {
-  nsCOMPtr<nsPIDOMWindow> win = aDoc->GetWindow();
   if (aDoc->NodePrincipal()->GetAppStatus() >= nsIPrincipal::APP_STATUS_INSTALLED) {
     // Request is in a web app and in the same origin as the web app.
     // Don't enforce as strict security checks for web apps, the user
     // is supposed to have trust in them. However documents cross-origin
     // to the web app must still confirm to the normal security checks.
     return nullptr;
   }
 
--- a/dom/base/EventSource.cpp
+++ b/dom/base/EventSource.cpp
@@ -7,16 +7,17 @@
 #include "mozilla/dom/EventSource.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/LoadInfo.h"
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/dom/EventSourceBinding.h"
 #include "mozilla/dom/MessageEvent.h"
+#include "mozilla/dom/MessageEventBinding.h"
 #include "mozilla/dom/ScriptSettings.h"
 
 #include "nsNetUtil.h"
 #include "nsIAuthPrompt.h"
 #include "nsIAuthPrompt2.h"
 #include "nsIInputStream.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsMimeTypes.h"
@@ -53,17 +54,17 @@ namespace dom {
 #define DEFAULT_BUFFER_SIZE 4096
 
 // Reconnection time related values in milliseconds. The default one is equal
 // to the default value of the pref dom.server-events.default-reconnection-time
 #define MIN_RECONNECTION_TIME_VALUE       500
 #define DEFAULT_RECONNECTION_TIME_VALUE   5000
 #define MAX_RECONNECTION_TIME_VALUE       PR_IntervalToMilliseconds(DELAY_INTERVAL_LIMIT)
 
-EventSource::EventSource(nsPIDOMWindow* aOwnerWindow) :
+EventSource::EventSource(nsPIDOMWindowInner* aOwnerWindow) :
   DOMEventTargetHelper(aOwnerWindow),
   mStatus(PARSE_STATE_OFF),
   mFrozen(false),
   mErrorLoadOnRedirect(false),
   mGoingToDispatchAllMessages(false),
   mWithCredentials(false),
   mWaitingForOnStopRequest(false),
   mLastConvertionResult(NS_OK),
@@ -275,17 +276,17 @@ EventSource::WrapObject(JSContext* aCx, 
 }
 
 /* static */ already_AddRefed<EventSource>
 EventSource::Constructor(const GlobalObject& aGlobal,
                          const nsAString& aURL,
                          const EventSourceInit& aEventSourceInitDict,
                          ErrorResult& aRv)
 {
-  nsCOMPtr<nsPIDOMWindow> ownerWindow =
+  nsCOMPtr<nsPIDOMWindowInner> ownerWindow =
     do_QueryInterface(aGlobal.GetAsSupports());
   if (!ownerWindow) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
   MOZ_ASSERT(ownerWindow->IsInnerWindow());
 
   RefPtr<EventSource> eventSource = new EventSource(ownerWindow);
@@ -302,17 +303,17 @@ NS_IMETHODIMP
 EventSource::Observe(nsISupports* aSubject,
                      const char* aTopic,
                      const char16_t* aData)
 {
   if (mReadyState == CLOSED) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aSubject);
+  nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aSubject);
   if (!GetOwner() || window != GetOwner()) {
     return NS_OK;
   }
 
   DebugOnly<nsresult> rv;
   if (strcmp(aTopic, DOM_WINDOW_FROZEN_TOPIC) == 0) {
     rv = Freeze();
     NS_ASSERTION(NS_SUCCEEDED(rv), "Freeze() failed");
@@ -559,17 +560,17 @@ EventSource::GetInterface(const nsIID & 
 
     nsCOMPtr<nsIPromptFactory> wwatch =
       do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Get the an auth prompter for our window so that the parenting
     // of the dialogs works as it should when using tabs.
 
-    nsCOMPtr<nsIDOMWindow> window;
+    nsCOMPtr<nsPIDOMWindowOuter> window;
     if (GetOwner()) {
       window = GetOwner()->GetOuterWindow();
     }
 
     return wwatch->GetPrompt(window, aIID, aResult);
   }
 
   return QueryInterface(aIID, aResult);
@@ -1107,23 +1108,18 @@ EventSource::DispatchAllMessageEvents()
     }
 
     // create an event that uses the MessageEvent interface,
     // which does not bubble, is not cancelable, and has no default action
 
     RefPtr<MessageEvent> event =
       NS_NewDOMMessageEvent(this, nullptr, nullptr);
 
-    rv = event->InitMessageEvent(message->mEventName, false, false, jsData,
-                                 mOrigin, message->mLastEventID, nullptr);
-    if (NS_FAILED(rv)) {
-      NS_WARNING("Failed to init the message event!!!");
-      return;
-    }
-
+    event->InitMessageEvent(nullptr, message->mEventName, false, false, jsData,
+                            mOrigin, message->mLastEventID, nullptr, nullptr);
     event->SetTrusted(true);
 
     rv = DispatchDOMEvent(nullptr, static_cast<Event*>(event), nullptr,
                           nullptr);
     if (NS_FAILED(rv)) {
       NS_WARNING("Failed to dispatch the message event!!!");
       return;
     }
--- a/dom/base/EventSource.h
+++ b/dom/base/EventSource.h
@@ -21,17 +21,17 @@
 #include "nsIChannelEventSink.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsITimer.h"
 #include "nsIHttpChannel.h"
 #include "nsWeakReference.h"
 #include "nsDeque.h"
 #include "nsIUnicodeDecoder.h"
 
-class nsPIDOMWindow;
+class nsPIDOMWindowInner;
 
 namespace mozilla {
 
 class ErrorResult;
 
 namespace dom {
 
 struct EventSourceInit;
@@ -39,32 +39,32 @@ struct EventSourceInit;
 class EventSource final : public DOMEventTargetHelper
                         , public nsIObserver
                         , public nsIStreamListener
                         , public nsIChannelEventSink
                         , public nsIInterfaceRequestor
                         , public nsSupportsWeakReference
 {
 public:
-  explicit EventSource(nsPIDOMWindow* aOwnerWindow);
+  explicit EventSource(nsPIDOMWindowInner* aOwnerWindow);
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(
     EventSource, DOMEventTargetHelper)
 
   NS_DECL_NSIOBSERVER
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSICHANNELEVENTSINK
   NS_DECL_NSIINTERFACEREQUESTOR
 
   // nsWrapperCache
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   // WebIDL
-  nsPIDOMWindow*
+  nsPIDOMWindowInner*
   GetParentObject() const
   {
     return GetOwner();
   }
   static already_AddRefed<EventSource>
   Constructor(const GlobalObject& aGlobal, const nsAString& aURL,
               const EventSourceInit& aEventSourceInitDict,
               ErrorResult& aRv);
--- a/dom/base/File.cpp
+++ b/dom/base/File.cpp
@@ -208,17 +208,17 @@ Blob::CreateTemporaryBlob(nsISupports* a
 Blob::Blob(nsISupports* aParent, BlobImpl* aImpl)
   : mImpl(aImpl)
   , mParent(aParent)
 {
   MOZ_ASSERT(mImpl);
 
 #ifdef DEBUG
   {
-    nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aParent);
+    nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aParent);
     if (win) {
       MOZ_ASSERT(win->IsInnerWindow());
     }
   }
 #endif
 }
 
 bool
@@ -597,17 +597,17 @@ File::Constructor(const GlobalObject& aG
                   ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (!nsContentUtils::IsCallerChrome()) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
+  nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
 
   RefPtr<MultipartBlobImpl> impl = new MultipartBlobImpl(EmptyString());
   impl->InitializeChromeFile(window, aData, aBag, true, aRv);
   if (aRv.Failed()) {
     return nullptr;
   }
   MOZ_ASSERT(impl->IsFile());
 
@@ -625,17 +625,17 @@ File::Constructor(const GlobalObject& aG
                   const ChromeFilePropertyBag& aBag,
                   ErrorResult& aRv)
 {
   if (!nsContentUtils::ThreadsafeIsCallerChrome()) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
+  nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
 
   RefPtr<MultipartBlobImpl> impl = new MultipartBlobImpl(EmptyString());
   impl->InitializeChromeFile(window, aData, aBag, aRv);
   if (aRv.Failed()) {
     return nullptr;
   }
   MOZ_ASSERT(impl->IsFile());
 
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -842,17 +842,17 @@ nsIContent::PreHandleEvent(EventChainPre
         break;
     }
 
     if (stopEvent) {
       // If we do stop propagation, we still want to propagate
       // the event to chrome (nsPIDOMWindow::GetParentTarget()).
       // The load event is special in that we don't ever propagate it
       // to chrome.
-      nsCOMPtr<nsPIDOMWindow> win = OwnerDoc()->GetWindow();
+      nsCOMPtr<nsPIDOMWindowOuter> win = OwnerDoc()->GetWindow();
       EventTarget* parentTarget = win && aVisitor.mEvent->mMessage != eLoad
         ? win->GetParentTarget() : nullptr;
 
       aVisitor.mParentTarget = parentTarget;
       return NS_OK;
     }
 
     if (!aVisitor.mDestInsertionPoints.IsEmpty()) {
--- a/dom/base/MultipartBlobImpl.cpp
+++ b/dom/base/MultipartBlobImpl.cpp
@@ -353,17 +353,17 @@ MultipartBlobImpl::InitializeChromeFile(
   blobSet.AppendBlobImpl(aBlob.Impl());
   mBlobImpls = blobSet.GetBlobImpls();
 
   SetLengthAndModifiedDate(aRv);
   NS_WARN_IF(aRv.Failed());
 }
 
 void
-MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
+MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindowInner* aWindow,
                                         nsIFile* aFile,
                                         const ChromeFilePropertyBag& aBag,
                                         bool aIsFromNsIFile,
                                         ErrorResult& aRv)
 {
   NS_ASSERTION(!mImmutable, "Something went wrong ...");
   if (mImmutable) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
@@ -425,17 +425,17 @@ MultipartBlobImpl::InitializeChromeFile(
   blobSet.AppendBlobImpl(static_cast<File*>(blob.get())->Impl());
   mBlobImpls = blobSet.GetBlobImpls();
 
   SetLengthAndModifiedDate(aRv);
   NS_WARN_IF(aRv.Failed());
 }
 
 void
-MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
+MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindowInner* aWindow,
                                         const nsAString& aData,
                                         const ChromeFilePropertyBag& aBag,
                                         ErrorResult& aRv)
 {
   nsCOMPtr<nsIFile> file;
   aRv = NS_NewLocalFile(aData, false, getter_AddRefs(file));
   if (NS_WARN_IF(aRv.Failed())) {
     return;
--- a/dom/base/MultipartBlobImpl.h
+++ b/dom/base/MultipartBlobImpl.h
@@ -59,22 +59,22 @@ public:
        const nsAString& aContentType,
        bool aNativeEOL,
        ErrorResult& aRv);
 
   void InitializeChromeFile(Blob& aData,
                             const ChromeFilePropertyBag& aBag,
                             ErrorResult& aRv);
 
-  void InitializeChromeFile(nsPIDOMWindow* aWindow,
+  void InitializeChromeFile(nsPIDOMWindowInner* aWindow,
                             const nsAString& aData,
                             const ChromeFilePropertyBag& aBag,
                             ErrorResult& aRv);
 
-  void InitializeChromeFile(nsPIDOMWindow* aWindow,
+  void InitializeChromeFile(nsPIDOMWindowInner* aWindow,
                             nsIFile* aData,
                             const ChromeFilePropertyBag& aBag,
                             bool aIsFromNsIFile,
                             ErrorResult& aRv);
 
   virtual already_AddRefed<BlobImpl>
   CreateSlice(uint64_t aStart, uint64_t aLength,
               const nsAString& aContentType,
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -146,17 +146,17 @@ Navigator::Init()
   Preferences::AddBoolVarCache(&sVibratorEnabled,
                                "dom.vibrator.enabled", true);
   Preferences::AddUintVarCache(&sMaxVibrateMS,
                                "dom.vibrator.max_vibrate_ms", 10000);
   Preferences::AddUintVarCache(&sMaxVibrateListLen,
                                "dom.vibrator.max_vibrate_list_len", 128);
 }
 
-Navigator::Navigator(nsPIDOMWindow* aWindow)
+Navigator::Navigator(nsPIDOMWindowInner* aWindow)
   : mWindow(aWindow)
 {
   MOZ_ASSERT(aWindow->IsInnerWindow(), "Navigator must get an inner window!");
 }
 
 Navigator::~Navigator()
 {
   Invalidate();
@@ -368,17 +368,17 @@ Navigator::Invalidate()
 //*****************************************************************************
 //    Navigator::nsIDOMNavigator
 //*****************************************************************************
 
 NS_IMETHODIMP
 Navigator::GetUserAgent(nsAString& aUserAgent)
 {
   nsCOMPtr<nsIURI> codebaseURI;
-  nsCOMPtr<nsPIDOMWindow> window;
+  nsCOMPtr<nsPIDOMWindowInner> window;
 
   if (mWindow) {
     window = mWindow;
     nsIDocShell* docshell = window->GetDocShell();
     nsString customUserAgent;
     if (docshell) {
       docshell->GetCustomUserAgent(customUserAgent);
 
@@ -753,17 +753,17 @@ Navigator::RefreshMIMEArray()
   }
 }
 
 namespace {
 
 class VibrateWindowListener : public nsIDOMEventListener
 {
 public:
-  VibrateWindowListener(nsIDOMWindow* aWindow, nsIDocument* aDocument)
+  VibrateWindowListener(nsPIDOMWindowInner* aWindow, nsIDocument* aDocument)
   {
     mWindow = do_GetWeakReference(aWindow);
     mDocument = do_GetWeakReference(aDocument);
 
     NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange");
     aDocument->AddSystemEventListener(visibilitychange,