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/. */
7 #ifndef ThirdPartyUtil_h__
8 #define ThirdPartyUtil_h__
11 #include "ErrorList.h"
12 #include "mozIThirdPartyUtil.h"
13 #include "mozilla/RefPtr.h"
14 #include "nsISupports.h"
17 class mozIDOMWindowProxy
;
18 class nsEffectiveTLDService
;
22 class nsPIDOMWindowOuter
;
24 namespace mozilla::dom
{
25 class WindowGlobalParent
;
26 } // namespace mozilla::dom
28 class ThirdPartyUtil final
: public mozIThirdPartyUtil
{
30 NS_DECL_THREADSAFE_ISUPPORTS
31 NS_DECL_MOZITHIRDPARTYUTIL
35 static void Startup();
36 static ThirdPartyUtil
* GetInstance();
38 nsresult
IsThirdPartyGlobal(mozilla::dom::WindowGlobalParent
* aWindowGlobal
,
44 bool IsThirdPartyInternal(const nsCString
& aFirstDomain
,
45 const nsCString
& aSecondDomain
) {
46 // Check strict equality.
47 return aFirstDomain
!= aSecondDomain
;
49 nsresult
IsThirdPartyInternal(const nsCString
& aFirstDomain
,
50 nsIURI
* aSecondURI
, bool* aResult
);
52 nsCString
GetBaseDomainFromWindow(nsPIDOMWindowOuter
* aWindow
);
54 RefPtr
<nsEffectiveTLDService
> mTLDService
;