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 "ReferrerInfo.h" 14 15 namespace mozilla { 16 17 StaticRefPtr<URLExtraData> URLExtraData::sDummy; 18 19 /* static */ InitDummy()20void URLExtraData::InitDummy() { 21 RefPtr<nsIURI> baseURI = new NullPrincipalURI(); 22 nsCOMPtr<nsIReferrerInfo> referrerInfo = new dom::ReferrerInfo(nullptr); 23 sDummy = new URLExtraData(baseURI.forget(), referrerInfo.forget(), 24 NullPrincipal::CreateWithoutOriginAttributes()); 25 } 26 27 /* static */ ReleaseDummy()28void URLExtraData::ReleaseDummy() { sDummy = nullptr; } 29 ~URLExtraData()30URLExtraData::~URLExtraData() { 31 if (!NS_IsMainThread()) { 32 NS_ReleaseOnMainThread("URLExtraData::mPrincipal", mPrincipal.forget()); 33 } 34 } 35 36 StaticRefPtr<URLExtraData> 37 URLExtraData::sShared[size_t(UserAgentStyleSheetID::Count)]; 38 39 } // namespace mozilla 40