Bug 1463889 part 3. Get rid of nsIDOMWindowCollection. r=qdot

This commit is contained in:
Boris Zbarsky
2018-05-24 23:32:19 -04:00
parent 4ed0a9f56b
commit a4c9de02b0
8 changed files with 5 additions and 77 deletions

View File

@@ -37,7 +37,6 @@
#include "nsIStringBundle.h" #include "nsIStringBundle.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsPIWindowRoot.h" #include "nsPIWindowRoot.h"
#include "nsIDOMWindowCollection.h"
#include "nsIWindowWatcher.h" #include "nsIWindowWatcher.h"
#include "nsPIWindowWatcher.h" #include "nsPIWindowWatcher.h"
#include "nsIPrompt.h" #include "nsIPrompt.h"

View File

@@ -26,20 +26,10 @@ nsDOMWindowList::~nsDOMWindowList()
{ {
} }
NS_IMPL_ADDREF(nsDOMWindowList) void
NS_IMPL_RELEASE(nsDOMWindowList)
NS_INTERFACE_MAP_BEGIN(nsDOMWindowList)
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowCollection)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsDOMWindowList::SetDocShell(nsIDocShell* aDocShell) nsDOMWindowList::SetDocShell(nsIDocShell* aDocShell)
{ {
mDocShellNode = aDocShell; // Weak Reference mDocShellNode = aDocShell; // Weak Reference
return NS_OK;
} }
void void
@@ -71,13 +61,6 @@ nsDOMWindowList::GetLength()
return uint32_t(length); return uint32_t(length);
} }
NS_IMETHODIMP
nsDOMWindowList::GetLength(uint32_t* aLength)
{
*aLength = GetLength();
return NS_OK;
}
already_AddRefed<nsPIDOMWindowOuter> already_AddRefed<nsPIDOMWindowOuter>
nsDOMWindowList::IndexedGetter(uint32_t aIndex) nsDOMWindowList::IndexedGetter(uint32_t aIndex)
{ {
@@ -92,14 +75,6 @@ nsDOMWindowList::IndexedGetter(uint32_t aIndex)
return window.forget(); return window.forget();
} }
NS_IMETHODIMP
nsDOMWindowList::Item(uint32_t aIndex, mozIDOMWindowProxy** aReturn)
{
nsCOMPtr<nsPIDOMWindowOuter> window = IndexedGetter(aIndex);
window.forget(aReturn);
return NS_OK;
}
already_AddRefed<nsPIDOMWindowOuter> already_AddRefed<nsPIDOMWindowOuter>
nsDOMWindowList::NamedItem(const nsAString& aName) nsDOMWindowList::NamedItem(const nsAString& aName)
{ {
@@ -116,11 +91,3 @@ nsDOMWindowList::NamedItem(const nsAString& aName)
nsCOMPtr<nsPIDOMWindowOuter> childWindow(do_GetInterface(item)); nsCOMPtr<nsPIDOMWindowOuter> childWindow(do_GetInterface(item));
return childWindow.forget(); return childWindow.forget();
} }
NS_IMETHODIMP
nsDOMWindowList::NamedItem(const nsAString& aName, mozIDOMWindowProxy** aReturn)
{
nsCOMPtr<nsPIDOMWindowOuter> item = NamedItem(aName);
item.forget(aReturn);
return NS_OK;
}

View File

@@ -7,27 +7,25 @@
#define nsDOMWindowList_h___ #define nsDOMWindowList_h___
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsIDOMWindowCollection.h"
#include <stdint.h> #include <stdint.h>
#include "nsIDocShell.h" #include "nsIDocShell.h"
class nsIDocShell; class nsIDocShell;
class nsIDOMWindow; class nsIDOMWindow;
class nsDOMWindowList : public nsIDOMWindowCollection class nsDOMWindowList final
{ {
public: public:
explicit nsDOMWindowList(nsIDocShell* aDocShell); explicit nsDOMWindowList(nsIDocShell* aDocShell);
NS_DECL_ISUPPORTS NS_INLINE_DECL_REFCOUNTING(nsDOMWindowList)
NS_DECL_NSIDOMWINDOWCOLLECTION
uint32_t GetLength(); uint32_t GetLength();
already_AddRefed<nsPIDOMWindowOuter> IndexedGetter(uint32_t aIndex); already_AddRefed<nsPIDOMWindowOuter> IndexedGetter(uint32_t aIndex);
already_AddRefed<nsPIDOMWindowOuter> NamedItem(const nsAString& aName); already_AddRefed<nsPIDOMWindowOuter> NamedItem(const nsAString& aName);
//local methods //local methods
NS_IMETHOD SetDocShell(nsIDocShell* aDocShell); void SetDocShell(nsIDocShell* aDocShell);
already_AddRefed<nsIDocShellTreeItem> GetDocShellTreeItemAt(uint32_t aIndex) already_AddRefed<nsIDocShellTreeItem> GetDocShellTreeItemAt(uint32_t aIndex)
{ {
EnsureFresh(); EnsureFresh();
@@ -39,7 +37,7 @@ public:
} }
protected: protected:
virtual ~nsDOMWindowList(); ~nsDOMWindowList();
// Note: this function may flush and cause mDocShellNode to become null. // Note: this function may flush and cause mDocShellNode to become null.
void EnsureFresh(); void EnsureFresh();

View File

@@ -41,7 +41,6 @@
#include "nsISizeOfEventTarget.h" #include "nsISizeOfEventTarget.h"
#include "nsDOMJSUtils.h" #include "nsDOMJSUtils.h"
#include "nsArrayUtils.h" #include "nsArrayUtils.h"
#include "nsIDOMWindowCollection.h"
#include "nsDOMWindowList.h" #include "nsDOMWindowList.h"
#include "mozilla/dom/WakeLock.h" #include "mozilla/dom/WakeLock.h"
#include "mozilla/dom/power/PowerManagerService.h" #include "mozilla/dom/power/PowerManagerService.h"

View File

@@ -39,7 +39,6 @@
#include "nsISizeOfEventTarget.h" #include "nsISizeOfEventTarget.h"
#include "nsDOMJSUtils.h" #include "nsDOMJSUtils.h"
#include "nsArrayUtils.h" #include "nsArrayUtils.h"
#include "nsIDOMWindowCollection.h"
#include "nsDOMWindowList.h" #include "nsDOMWindowList.h"
#include "mozilla/dom/WakeLock.h" #include "mozilla/dom/WakeLock.h"
#include "mozilla/dom/power/PowerManagerService.h" #include "mozilla/dom/power/PowerManagerService.h"

View File

@@ -30,7 +30,6 @@ class DOMException;
// Base // Base
interface nsIDOMWindow; interface nsIDOMWindow;
interface nsIDOMWindowCollection;
// Events // Events
interface nsIDOMEventListener; interface nsIDOMEventListener;

View File

@@ -18,7 +18,6 @@ XPIDL_SOURCES += [
'nsIDOMChromeWindow.idl', 'nsIDOMChromeWindow.idl',
'nsIDOMGlobalPropertyInitializer.idl', 'nsIDOMGlobalPropertyInitializer.idl',
'nsIDOMWindow.idl', 'nsIDOMWindow.idl',
'nsIDOMWindowCollection.idl',
'nsIDOMWindowUtils.idl', 'nsIDOMWindowUtils.idl',
'nsIFocusManager.idl', 'nsIFocusManager.idl',
'nsIIdleObserver.idl', 'nsIIdleObserver.idl',

View File

@@ -1,32 +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 mozIDOMWindowProxy;
/**
* The nsIDOMWindowCollection interface is an interface for a
* collection of DOM window objects.
*/
[uuid(8d64f457-fb8c-49ea-a359-cef30eed9774)]
interface nsIDOMWindowCollection : nsISupports
{
/**
* Accessor for the number of windows in this collection.
*/
readonly attribute unsigned long length;
/**
* Method for accessing an item in this collection by index.
*/
mozIDOMWindowProxy item(in unsigned long index);
/**
* Method for accessing an item in this collection by window name.
*/
mozIDOMWindowProxy namedItem(in DOMString name);
};