Bug 1547114 - Part 7: Get rid of nsCookieModule.h/cpp; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 26 Apr 2019 15:42:24 +0000
changeset 530372 fb9c7644874e516e5db3298c25b5b7d17aff2886
parent 530371 246b613845d3879b528ddd789ce10a6fd67e4772
child 530373 6b0f8ba4be72ae115f29bddca4269174298b6f73
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1547114
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1547114 - Part 7: Get rid of nsCookieModule.h/cpp; r=baku Differential Revision: https://phabricator.services.mozilla.com/D28998
extensions/cookie/components.conf
extensions/cookie/moz.build
extensions/cookie/nsCookieModule.cpp
extensions/cookie/nsCookieModule.h
extensions/cookie/nsCookiePermission.cpp
extensions/cookie/nsCookiePermission.h
--- a/extensions/cookie/components.conf
+++ b/extensions/cookie/components.conf
@@ -1,20 +1,14 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-Headers = [
-    '/extensions/cookie/nsCookieModule.h',
-]
-
-UnloadFunc = 'mozilla::CookieModuleDtor'
-
 Classes = [
     {
         'cid': '{4f6b5e00-0c36-11d5-a535-0010a401eb10}',
         'contract_ids': ['@mozilla.org/permissionmanager;1'],
         'singleton': True,
         'type': 'nsIPermissionManager',
         'constructor': 'nsPermissionManager::GetXPCOMSingleton',
         'headers': ['/extensions/cookie/nsPermissionManager.h'],
--- a/extensions/cookie/moz.build
+++ b/extensions/cookie/moz.build
@@ -6,17 +6,16 @@
 
 TEST_DIRS += ['test']
 
 EXPORTS += [
     'nsCookiePermission.h',
 ]
 
 UNIFIED_SOURCES += [
-    'nsCookieModule.cpp',
     'nsCookiePermission.cpp',
     'nsPermission.cpp',
     'nsPermissionManager.cpp',
 ]
 
 XPCOM_MANIFESTS += [
     'components.conf',
 ]
deleted file mode 100644
--- a/extensions/cookie/nsCookieModule.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsCookiePermission.h"
-
-namespace mozilla {
-
-void CookieModuleDtor() { nsCookiePermission::Shutdown(); }
-
-}  // namespace mozilla
deleted file mode 100644
--- a/extensions/cookie/nsCookieModule.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsCookieModule_h
-#define nsCookieModule_h
-
-#include "nscore.h"
-
-namespace mozilla {
-
-void CookieModuleDtor();
-
-}  // namespace mozilla
-
-#endif
--- a/extensions/cookie/nsCookiePermission.cpp
+++ b/extensions/cookie/nsCookiePermission.cpp
@@ -20,16 +20,17 @@
 #include "nsIPrincipal.h"
 #include "nsString.h"
 #include "nsCRT.h"
 #include "nsILoadContext.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsNetCID.h"
 #include "prtime.h"
 #include "mozilla/StaticPtr.h"
+#include "mozilla/ClearOnShutdown.h"
 #include "nsContentUtils.h"
 
 /****************************************************************
  ************************ nsCookiePermission ********************
  ****************************************************************/
 
 using namespace mozilla;
 
@@ -42,23 +43,21 @@ mozilla::StaticRefPtr<nsCookiePermission
 }
 
 NS_IMPL_ISUPPORTS(nsCookiePermission, nsICookiePermission)
 
 // static
 already_AddRefed<nsICookiePermission> nsCookiePermission::GetOrCreate() {
   if (!gSingleton) {
     gSingleton = new nsCookiePermission();
+    ClearOnShutdown(&gSingleton);
   }
   return do_AddRef(gSingleton);
 }
 
-// static
-void nsCookiePermission::Shutdown() { gSingleton = nullptr; }
-
 bool nsCookiePermission::Init() {
   // Initialize nsIPermissionManager and fetch relevant prefs. This is only
   // required for some methods on nsICookiePermission, so it should be done
   // lazily.
   nsresult rv;
   mPermMgr = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return false;
 
--- a/extensions/cookie/nsCookiePermission.h
+++ b/extensions/cookie/nsCookiePermission.h
@@ -11,17 +11,16 @@
 
 class nsCookiePermission final : public nsICookiePermission {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSICOOKIEPERMISSION
 
   // Singleton accessor
   static already_AddRefed<nsICookiePermission> GetOrCreate();
-  static void Shutdown();
 
   bool Init();
 
  private:
   ~nsCookiePermission() = default;
 
   bool EnsureInitialized() { return (mPermMgr != nullptr) || Init(); };