Bug 1463016: Part 9 - Remove nsIDOMWindow. r?nika
MozReview-Commit-ID: J19mh6wvPut
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -79,17 +79,16 @@
#include "nsICookieService.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDocument.h"
#include "nsIDocumentLoaderFactory.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNode.h"
#include "nsIDOMStorage.h"
-#include "nsIDOMWindow.h"
#include "nsIEditingSession.h"
#include "nsIExternalProtocolService.h"
#include "nsIFormPOSTActionChannel.h"
#include "nsIFrame.h"
#include "nsIGlobalHistory2.h"
#include "nsIGlobalObject.h"
#include "nsIHttpChannel.h"
#include "nsIHttpChannelInternal.h"
@@ -542,18 +541,17 @@ 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(nsPIDOMWindowOuter)) ||
- aIID.Equals(NS_GET_IID(nsIDOMWindow))) &&
+ aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter))) &&
NS_SUCCEEDED(EnsureScriptEnvironment())) {
return mScriptGlobal->QueryInterface(aIID, aSink);
} else if (aIID.Equals(NS_GET_IID(nsIDOMDocument)) &&
NS_SUCCEEDED(EnsureContentViewer())) {
nsCOMPtr<nsIDOMDocument> doc =
do_QueryInterface(mContentViewer->GetDocument());
doc.forget(aSink);
return *aSink ? NS_OK : NS_NOINTERFACE;
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -358,18 +358,17 @@ public:
if (!mWindow)
return NS_OK;
return mWindow->Observe(aSubject, aTopic, aData);
}
void Forget() { mWindow = nullptr; }
NS_IMETHOD GetInterface(const nsIID& aIID, void** aResult) override
{
if (mWindow) {
- if (aIID.Equals(NS_GET_IID(nsIDOMWindow)) ||
- aIID.Equals(NS_GET_IID(nsPIDOMWindowInner))) {
+ if (aIID.Equals(NS_GET_IID(nsPIDOMWindowInner))) {
return mWindow->QueryInterface(aIID, aResult);
}
if (aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter))) {
return mWindow->GetOuterWindow()->QueryInterface(aIID, aResult);
}
}
return NS_NOINTERFACE;
}
@@ -1330,17 +1329,16 @@ nsGlobalWindowInner::FreeInnerObjects()
//*****************************************************************************
// nsGlobalWindowInner::nsISupports
//*****************************************************************************
// QueryInterface implementation for nsGlobalWindowInner
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindowInner)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, EventTarget)
- NS_INTERFACE_MAP_ENTRY(nsIDOMWindow)
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
if (aIID.Equals(NS_GET_IID(nsPIDOMWindowInner))) {
foundInterface = static_cast<nsPIDOMWindowInner*>(this);
} else
if (aIID.Equals(NS_GET_IID(nsIDOMChromeWindow)) && IsChromeWindow()) {
--- a/dom/base/nsGlobalWindowInner.h
+++ b/dom/base/nsGlobalWindowInner.h
@@ -201,17 +201,16 @@ ImplCycleCollectionTraverse(nsCycleColle
// also contain all inner window objects that are still in memory (and in
// reality all inner window object's lists also contain its outer and all other
// inner windows belonging to the same outer window, but that's an unimportant
// side effect of inheriting PRCList).
class nsGlobalWindowInner final
: public mozilla::dom::EventTarget
, public nsPIDOMWindowInner
- , private nsIDOMWindow
// NOTE: This interface is private, as it's only
// implemented on chrome windows.
, private nsIDOMChromeWindow
, public nsIScriptGlobalObject
, public nsIScriptObjectPrincipal
, public nsSupportsWeakReference
, public nsIInterfaceRequestor
, public PRCListStr
@@ -294,19 +293,16 @@ public:
virtual nsIScriptContext *GetScriptContext() override;
virtual bool IsBlackForCC(bool aTracingNeeded = true) override;
// nsIScriptObjectPrincipal
virtual nsIPrincipal* GetPrincipal() override;
- // nsIDOMWindow
- NS_DECL_NSIDOMWINDOW
-
// nsIDOMChromeWindow (only implemented on chrome windows)
NS_DECL_NSIDOMCHROMEWINDOW
void CaptureEvents();
void ReleaseEvents();
void Dump(const nsAString& aStr);
void SetResizable(bool aResizable) const;
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -1074,17 +1074,16 @@ nsGlobalWindowOuter::ClearControllers()
//*****************************************************************************
// nsGlobalWindowOuter::nsISupports
//*****************************************************************************
// QueryInterface implementation for nsGlobalWindowOuter
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindowOuter)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, EventTarget)
- NS_INTERFACE_MAP_ENTRY(nsIDOMWindow)
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
if (aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter))) {
foundInterface = static_cast<nsPIDOMWindowOuter*>(this);
} else
if (aIID.Equals(NS_GET_IID(nsIDOMChromeWindow)) && IsChromeWindow()) {
--- a/dom/base/nsGlobalWindowOuter.h
+++ b/dom/base/nsGlobalWindowOuter.h
@@ -157,17 +157,16 @@ extern const js::Class OuterWindowProxyC
// also contain all inner window objects that are still in memory (and in
// reality all inner window object's lists also contain its outer and all other
// inner windows belonging to the same outer window, but that's an unimportant
// side effect of inheriting PRCList).
class nsGlobalWindowOuter final
: public mozilla::dom::EventTarget
, public nsPIDOMWindowOuter
- , private nsIDOMWindow
// NOTE: This interface is private, as it's only
// implemented on chrome windows.
, private nsIDOMChromeWindow
, public nsIScriptGlobalObject
, public nsIScriptObjectPrincipal
, public nsSupportsWeakReference
, public nsIInterfaceRequestor
, public PRCListStr
@@ -249,19 +248,16 @@ public:
void PoisonOuterWindowProxy(JSObject *aObject);
virtual bool IsBlackForCC(bool aTracingNeeded = true) override;
// nsIScriptObjectPrincipal
virtual nsIPrincipal* GetPrincipal() override;
- // nsIDOMWindow
- NS_DECL_NSIDOMWINDOW
-
// nsIDOMChromeWindow (only implemented on chrome windows)
NS_DECL_NSIDOMCHROMEWINDOW
mozilla::dom::ChromeMessageBroadcaster* GetMessageManager();
mozilla::dom::ChromeMessageBroadcaster* GetGroupMessageManager(const nsAString& aGroup);
nsresult
OpenJS(const nsAString& aUrl, const nsAString& aName,
--- a/dom/base/nsPIDOMWindow.h
+++ b/dom/base/nsPIDOMWindow.h
@@ -2,40 +2,42 @@
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsPIDOMWindow_h__
#define nsPIDOMWindow_h__
-#include "nsIDOMWindow.h"
-
#include "nsCOMPtr.h"
#include "nsTArray.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/TaskCategory.h"
#include "js/TypeDecls.h"
#include "nsRefPtrHashtable.h"
// Only fired for inner windows.
#define DOM_WINDOW_DESTROYED_TOPIC "dom-window-destroyed"
#define DOM_WINDOW_FROZEN_TOPIC "dom-window-frozen"
#define DOM_WINDOW_THAWED_TOPIC "dom-window-thawed"
class nsGlobalWindowInner;
class nsGlobalWindowOuter;
class nsIArray;
class nsIContent;
+class nsIControllers;
class nsICSSDeclaration;
+class nsIDOMOfflineResourceList;
+class nsIDOMWindowCollection;
class nsIDocShell;
class nsIDocShellLoadInfo;
class nsIDocument;
class nsIIdleObserver;
class nsIPrincipal;
+class nsIPrompt;
class nsIScriptTimeoutHandler;
class nsISerialEventTarget;
class nsIURI;
class nsPIDOMWindowInner;
class nsPIDOMWindowOuter;
class nsPIWindowRoot;
class nsXBLPrototypeHandler;
--- a/dom/interfaces/base/moz.build
+++ b/dom/interfaces/base/moz.build
@@ -12,17 +12,16 @@ XPIDL_SOURCES += [
'nsIBrowser.idl',
'nsIBrowserDOMWindow.idl',
'nsIContentPermissionPrompt.idl',
'nsIContentPrefService2.idl',
'nsIContentProcess.idl',
'nsIContentURIGrouper.idl',
'nsIDOMChromeWindow.idl',
'nsIDOMGlobalPropertyInitializer.idl',
- 'nsIDOMWindow.idl',
'nsIDOMWindowCollection.idl',
'nsIDOMWindowUtils.idl',
'nsIFocusManager.idl',
'nsIIdleObserver.idl',
'nsIQueryContentEventResult.idl',
'nsIRemoteBrowser.idl',
'nsIServiceWorkerManager.idl',
'nsIStructuredCloneContainer.idl',
deleted file mode 100644
--- a/dom/interfaces/base/nsIDOMWindow.idl
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- 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 "domstubs.idl"
-
-interface nsIControllers;
-interface nsIDOMOfflineResourceList;
-interface nsIPrompt;
-interface nsIVariant;
-
-/**
- * Empty interface for compatibility with older versions.
- * @deprecated Use WebIDL for script visible features,
- * nsPIDOMWindow for C++ callers.
- */
-
-[scriptable, uuid(b8343993-0383-4add-9930-ad176b189240)]
-interface nsIDOMWindow : nsISupports {};
--- a/dom/webidl/Window.webidl
+++ b/dom/webidl/Window.webidl
@@ -313,17 +313,17 @@ partial interface Window {
/**
* This method is here for backwards compatibility with 4.x only,
* its implementation is a no-op
*/
void setResizable(boolean resizable);
/**
* This is the scriptable version of
- * nsIDOMWindow::openDialog() that takes 3 optional
+ * Window::openDialog() that takes 3 optional
* arguments, plus any additional arguments are passed on as
* arguments on the dialog's window object (window.arguments).
*/
[Throws, ChromeOnly] WindowProxy? openDialog(optional DOMString url = "",
optional DOMString name = "",
optional DOMString options = "",
any... extraArguments);
@@ -332,17 +332,17 @@ partial interface Window {
ChromeOnly,
#endif
NonEnumerable, Replaceable, Throws, NeedsCallerType]
readonly attribute object? content;
[Throws, ChromeOnly] any getInterface(IID iid);
/**
- * Same as nsIDOMWindow.windowRoot, useful for event listener targeting.
+ * Same as Window.windowRoot, useful for event listener targeting.
*/
[ChromeOnly, Throws]
readonly attribute WindowRoot? windowRoot;
/**
* ChromeOnly method to determine if a particular window should see console
* reports from service workers of the given scope.
*/
--- a/testing/mochitest/tests/Harness_sanity/test_SpecialPowersExtension.html
+++ b/testing/mochitest/tests/Harness_sanity/test_SpecialPowersExtension.html
@@ -77,18 +77,18 @@ function starttest(){
// Test a DOMWindowUtils method and property
is(SpecialPowers.DOMWindowUtils.getClassName(window), "Proxy");
is(SpecialPowers.DOMWindowUtils.docCharsetIsForced, false);
// QueryInterface and getPrivilegedProps tests
is(SpecialPowers.can_QI(SpecialPowers), false);
ok(SpecialPowers.can_QI(window));
- ok(SpecialPowers.do_QueryInterface(window, "nsIDOMWindow"));
- is(SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(window, "nsIDOMWindow"), "document.nodeName"), "#document");
+ ok(SpecialPowers.do_QueryInterface(window, "nsISupports"));
+ is(SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(window, "nsISupports"), "document.nodeName"), "#document");
//try to run garbage collection
SpecialPowers.gc();
//
// Test the SpecialPowers wrapper.
//
--- a/xpfe/appshell/nsContentTreeOwner.cpp
+++ b/xpfe/appshell/nsContentTreeOwner.cpp
@@ -10,17 +10,16 @@
#include "nsXULWindow.h"
// Helper Classes
#include "nsIServiceManager.h"
#include "nsAutoPtr.h"
// Interfaces needed to be included
#include "nsIDOMNode.h"
-#include "nsIDOMWindow.h"
#include "nsIDOMChromeWindow.h"
#include "nsIBrowserDOMWindow.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIPrompt.h"
#include "nsIAuthPrompt.h"
#include "nsIWindowMediator.h"
#include "nsIXULBrowserWindow.h"
#include "nsIPrincipal.h"
@@ -138,18 +137,17 @@ NS_IMETHODIMP nsContentTreeOwner::GetInt
NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<nsIDocShell> shell;
mXULWindow->GetDocShell(getter_AddRefs(shell));
if (shell)
return shell->QueryInterface(aIID, aSink);
return NS_ERROR_FAILURE;
}
- if (aIID.Equals(NS_GET_IID(nsIDOMWindow)) ||
- aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter))) {
+ if (aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter))) {
NS_ENSURE_STATE(mXULWindow);
nsCOMPtr<nsIDocShellTreeItem> shell;
mXULWindow->GetPrimaryContentShell(getter_AddRefs(shell));
if (shell) {
nsCOMPtr<nsIInterfaceRequestor> thing(do_QueryInterface(shell));
if (thing)
return thing->GetInterface(aIID, aSink);
}
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -152,23 +152,16 @@ NS_IMETHODIMP nsXULWindow::GetInterface(
if (aIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
rv = EnsureAuthPrompter();
if (NS_FAILED(rv)) return rv;
return mAuthPrompter->QueryInterface(aIID, aSink);
}
if (aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter))) {
return GetWindowDOMWindow(reinterpret_cast<nsPIDOMWindowOuter**>(aSink));
}
- if (aIID.Equals(NS_GET_IID(nsIDOMWindow))) {
- nsCOMPtr<nsPIDOMWindowOuter> window = nullptr;
- rv = GetWindowDOMWindow(getter_AddRefs(window));
- nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(window);
- domWindow.forget(aSink);
- return rv;
- }
if (aIID.Equals(NS_GET_IID(nsIWebBrowserChrome)) &&
NS_SUCCEEDED(EnsureContentTreeOwner()) &&
NS_SUCCEEDED(mContentTreeOwner->QueryInterface(aIID, aSink)))
return NS_OK;
if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow)) &&
NS_SUCCEEDED(EnsureContentTreeOwner()) &&
NS_SUCCEEDED(mContentTreeOwner->QueryInterface(aIID, aSink)))