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
;
26 class WindowGlobalParent
;
28 } // namespace mozilla
30 class ThirdPartyUtil final
: public mozIThirdPartyUtil
{
32 NS_DECL_THREADSAFE_ISUPPORTS
33 NS_DECL_MOZITHIRDPARTYUTIL
37 static void Startup();
38 static ThirdPartyUtil
* GetInstance();
40 nsresult
IsThirdPartyGlobal(mozilla::dom::WindowGlobalParent
* aWindowGlobal
,
46 bool IsThirdPartyInternal(const nsCString
& aFirstDomain
,
47 const nsCString
& aSecondDomain
) {
48 // Check strict equality.
49 return aFirstDomain
!= aSecondDomain
;
51 nsresult
IsThirdPartyInternal(const nsCString
& aFirstDomain
,
52 nsIURI
* aSecondURI
, bool* aResult
);
54 nsCString
GetBaseDomainFromWindow(nsPIDOMWindowOuter
* aWindow
);
56 RefPtr
<nsEffectiveTLDService
> mTLDService
;