Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/base/nsDOMWindowList.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
#ifndef nsDOMWindowList_h___
7
#define nsDOMWindowList_h___
8
9
#include "nsCOMPtr.h"
10
#include <stdint.h>
11
#include "nsIDocShell.h"
12
13
class nsIDocShell;
14
class nsIDOMWindow;
15
16
class nsDOMWindowList final
17
{
18
public:
19
  explicit nsDOMWindowList(nsIDocShell* aDocShell);
20
21
  NS_INLINE_DECL_REFCOUNTING(nsDOMWindowList)
22
23
  uint32_t GetLength();
24
  already_AddRefed<nsPIDOMWindowOuter> IndexedGetter(uint32_t aIndex);
25
  already_AddRefed<nsPIDOMWindowOuter> NamedItem(const nsAString& aName);
26
27
  //local methods
28
  void SetDocShell(nsIDocShell* aDocShell);
29
  already_AddRefed<nsIDocShellTreeItem> GetDocShellTreeItemAt(uint32_t aIndex)
30
0
  {
31
0
    EnsureFresh();
32
0
    nsCOMPtr<nsIDocShellTreeItem> item;
33
0
    if (mDocShellNode) {
34
0
      mDocShellNode->GetChildAt(aIndex, getter_AddRefs(item));
35
0
    }
36
0
    return item.forget();
37
0
  }
38
39
protected:
40
  ~nsDOMWindowList();
41
42
  // Note: this function may flush and cause mDocShellNode to become null.
43
  void EnsureFresh();
44
45
  nsIDocShell* mDocShellNode; //Weak Reference
46
};
47
48
#endif // nsDOMWindowList_h___