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 "nsPIDOMWindow.h"
#include "nsPIWindowRoot.h"
#include "nsIDOMWindowCollection.h"
#include "nsIWindowWatcher.h"
#include "nsPIWindowWatcher.h"
#include "nsIPrompt.h"

View File

@@ -26,20 +26,10 @@ nsDOMWindowList::~nsDOMWindowList()
{
}
NS_IMPL_ADDREF(nsDOMWindowList)
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
void
nsDOMWindowList::SetDocShell(nsIDocShell* aDocShell)
{
mDocShellNode = aDocShell; // Weak Reference
return NS_OK;
}
void
@@ -71,13 +61,6 @@ nsDOMWindowList::GetLength()
return uint32_t(length);
}
NS_IMETHODIMP
nsDOMWindowList::GetLength(uint32_t* aLength)
{
*aLength = GetLength();
return NS_OK;
}
already_AddRefed<nsPIDOMWindowOuter>
nsDOMWindowList::IndexedGetter(uint32_t aIndex)
{
@@ -92,14 +75,6 @@ nsDOMWindowList::IndexedGetter(uint32_t aIndex)
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>
nsDOMWindowList::NamedItem(const nsAString& aName)
{
@@ -116,11 +91,3 @@ nsDOMWindowList::NamedItem(const nsAString& aName)
nsCOMPtr<nsPIDOMWindowOuter> childWindow(do_GetInterface(item));
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___
#include "nsCOMPtr.h"
#include "nsIDOMWindowCollection.h"
#include <stdint.h>
#include "nsIDocShell.h"
class nsIDocShell;
class nsIDOMWindow;
class nsDOMWindowList : public nsIDOMWindowCollection
class nsDOMWindowList final
{
public:
explicit nsDOMWindowList(nsIDocShell* aDocShell);
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMWINDOWCOLLECTION
NS_INLINE_DECL_REFCOUNTING(nsDOMWindowList)
uint32_t GetLength();
already_AddRefed<nsPIDOMWindowOuter> IndexedGetter(uint32_t aIndex);
already_AddRefed<nsPIDOMWindowOuter> NamedItem(const nsAString& aName);
//local methods
NS_IMETHOD SetDocShell(nsIDocShell* aDocShell);
void SetDocShell(nsIDocShell* aDocShell);
already_AddRefed<nsIDocShellTreeItem> GetDocShellTreeItemAt(uint32_t aIndex)
{
EnsureFresh();
@@ -39,7 +37,7 @@ public:
}
protected:
virtual ~nsDOMWindowList();
~nsDOMWindowList();
// Note: this function may flush and cause mDocShellNode to become null.
void EnsureFresh();

View File

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

View File

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

View File

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

View File

@@ -18,7 +18,6 @@ XPIDL_SOURCES += [
'nsIDOMChromeWindow.idl',
'nsIDOMGlobalPropertyInitializer.idl',
'nsIDOMWindow.idl',
'nsIDOMWindowCollection.idl',
'nsIDOMWindowUtils.idl',
'nsIFocusManager.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);
};