Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/style/URLExtraData.cpp
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
7
/* thread-safe container of information for resolving url values */
8
9
#include "mozilla/URLExtraData.h"
10
11
#include "mozilla/NullPrincipalURI.h"
12
#include "nsProxyRelease.h"
13
#include "mozilla/net/ReferrerPolicy.h"
14
15
namespace mozilla {
16
17
StaticRefPtr<URLExtraData> URLExtraData::sDummy;
18
19
/* static */ void
20
URLExtraData::InitDummy()
21
3
{
22
3
  RefPtr<nsIURI> baseURI = NullPrincipalURI::Create();
23
3
  RefPtr<nsIURI> referrer = baseURI;
24
3
  sDummy = new URLExtraData(baseURI.forget(),
25
3
                            referrer.forget(),
26
3
                            NullPrincipal::CreateWithoutOriginAttributes(),
27
3
                            net::RP_Unset);
28
3
}
29
30
/* static */ void
31
URLExtraData::ReleaseDummy()
32
0
{
33
0
  sDummy = nullptr;
34
0
}
35
36
URLExtraData::~URLExtraData()
37
0
{
38
0
  if (!NS_IsMainThread()) {
39
0
    NS_ReleaseOnMainThreadSystemGroup("URLExtraData::mBaseURI",
40
0
                                      mBaseURI.forget());
41
0
    NS_ReleaseOnMainThreadSystemGroup("URLExtraData::mReferrer",
42
0
                                      mReferrer.forget());
43
0
    NS_ReleaseOnMainThreadSystemGroup("URLExtraData::mPrincipal",
44
0
                                      mPrincipal.forget());
45
0
  }
46
0
}
47
48
} // namespace mozilla