Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / base / ThirdPartyUtil.h
blob39ba91a2e5bd62a62f016031816ae0e1c1f03671
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__
10 #include <cstdint>
11 #include "ErrorList.h"
12 #include "mozIThirdPartyUtil.h"
13 #include "mozilla/RefPtr.h"
14 #include "nsISupports.h"
15 #include "nsString.h"
17 class mozIDOMWindowProxy;
18 class nsEffectiveTLDService;
19 class nsIChannel;
20 class nsIPrincipal;
21 class nsIURI;
22 class nsPIDOMWindowOuter;
24 namespace mozilla::dom {
25 class WindowGlobalParent;
26 } // namespace mozilla::dom
28 class ThirdPartyUtil final : public mozIThirdPartyUtil {
29 public:
30 NS_DECL_THREADSAFE_ISUPPORTS
31 NS_DECL_MOZITHIRDPARTYUTIL
33 nsresult Init();
35 static void Startup();
36 static ThirdPartyUtil* GetInstance();
38 nsresult IsThirdPartyGlobal(mozilla::dom::WindowGlobalParent* aWindowGlobal,
39 bool* aResult);
41 private:
42 ~ThirdPartyUtil();
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;
57 #endif