Backed out 4 changesets (bug 1268889) for Windows GTest failures. CLOSED TREE
authorNarcis Beleuzu <nbeleuzu@mozilla.com>
Thu, 21 Jun 2018 16:51:55 +0300
changeset 477502 59322b179c0fdb4423d42b624da7bf64ee5a2327
parent 477501 688b3d9f8611dfb00a99e631538d2cfe5135ac7b
child 477503 ca90f5e47f465d8bf1d8c65f88efc34343bdf597
push id9385
push userdluca@mozilla.com
push dateFri, 22 Jun 2018 15:47:18 +0000
treeherdermozilla-beta@82a9a1027e2b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1268889
milestone62.0a1
backs outda427a67372e19b219eaec6fada813babfd6e4b2
97528847b7b7b47475b5e0a54550194ffa38a7df
b2320061fbcb5a844162e50fe22f409ce9a03ff9
dd3b7047ea6f00c7488329b50842623f1bbdd3fb
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
Backed out 4 changesets (bug 1268889) for Windows GTest failures. CLOSED TREE Backed out changeset da427a67372e (bug 1268889) Backed out changeset 97528847b7b7 (bug 1268889) Backed out changeset b2320061fbcb (bug 1268889) Backed out changeset dd3b7047ea6f (bug 1268889)
dom/base/nsGlobalWindowInner.cpp
dom/base/nsGlobalWindowInner.h
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/PContent.ipdl
dom/locales/en-US/chrome/security/security.properties
image/ImageCacheKey.h
image/imgICache.idl
image/imgLoader.cpp
layout/build/nsLayoutStatics.cpp
modules/libpref/init/StaticPrefList.h
testing/web-platform/meta/clear-site-data/__dir__.ini
testing/web-platform/meta/clear-site-data/navigation.https.html.ini
testing/web-platform/meta/clear-site-data/storage.https.html.ini
toolkit/components/cleardata/ClearDataService.js
toolkit/components/clearsitedata/ClearSiteData.cpp
toolkit/components/clearsitedata/ClearSiteData.h
toolkit/components/clearsitedata/moz.build
toolkit/components/moz.build
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -936,20 +936,16 @@ nsGlobalWindowInner::nsGlobalWindowInner
       nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
       if (os) {
         // Watch for online/offline status changes so we can fire events. Use
         // a strong reference.
         os->AddObserver(mObserver, NS_IOSERVICE_OFFLINE_STATUS_TOPIC,
                         false);
 
         os->AddObserver(mObserver, MEMORY_PRESSURE_OBSERVER_TOPIC, false);
-
-        if (aOuterWindow->IsTopLevelWindow()) {
-          os->AddObserver(mObserver, "clear-site-data-reload-needed", false);
-        }
       }
 
       Preferences::AddStrongObserver(mObserver, "intl.accept_languages");
 
       // Watch for storage notifications so we can fire storage events.
       RefPtr<StorageNotifierService> sns =
         StorageNotifierService::GetOrCreate();
       if (sns) {
@@ -1267,21 +1263,16 @@ nsGlobalWindowInner::FreeInnerObjects()
 
   DisconnectEventTargetObjects();
 
   if (mObserver) {
     nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
     if (os) {
       os->RemoveObserver(mObserver, NS_IOSERVICE_OFFLINE_STATUS_TOPIC);
       os->RemoveObserver(mObserver, MEMORY_PRESSURE_OBSERVER_TOPIC);
-
-      if (GetOuterWindowInternal() &&
-          GetOuterWindowInternal()->IsTopLevelWindow()) {
-        os->RemoveObserver(mObserver, "clear-site-data-reload-needed");
-      }
     }
 
     RefPtr<StorageNotifierService> sns = StorageNotifierService::GetOrCreate();
     if (sns) {
      sns->Unregister(mObserver);
     }
 
     if (mIdleService) {
@@ -5822,23 +5813,16 @@ nsGlobalWindowInner::Observe(nsISupports
 
   if (!nsCRT::strcmp(aTopic, MEMORY_PRESSURE_OBSERVER_TOPIC)) {
     if (mPerformance) {
       mPerformance->MemoryPressure();
     }
     return NS_OK;
   }
 
-  if (!nsCRT::strcmp(aTopic, "clear-site-data-reload-needed")) {
-    // The reload is propagated from the top-level window only.
-    NS_ConvertUTF16toUTF8 otherOrigin(aData);
-    PropagateClearSiteDataReload(otherOrigin);
-    return NS_OK;
-  }
-
   if (!nsCRT::strcmp(aTopic, OBSERVER_TOPIC_IDLE)) {
     mCurrentlyIdle = true;
     if (IsFrozen()) {
       // need to fire only one idle event while the window is frozen.
       mNotifyIdleObserversIdleOnThaw = true;
       mNotifyIdleObserversActiveOnThaw = false;
     } else if (IsCurrentInnerWindow()) {
       HandleIdleActiveEvent();
@@ -8064,49 +8048,16 @@ nsPIDOMWindowInner::MaybeCreateDoc()
     // Note that |document| here is the same thing as our mDoc, but we
     // don't have to explicitly set the member variable because the docshell
     // has already called SetNewDocument().
     nsCOMPtr<nsIDocument> document = docShell->GetDocument();
     Unused << document;
   }
 }
 
-void
-nsGlobalWindowInner::PropagateClearSiteDataReload(const nsACString& aOrigin)
-{
-  nsIPrincipal* principal = GetPrincipal();
-  if (!principal) {
-    return;
-  }
-
-  nsAutoCString origin;
-  nsresult rv = principal->GetOrigin(origin);
-  NS_ENSURE_SUCCESS_VOID(rv);
-
-  // If the URL of this window matches, let's refresh this window only.
-  // We don't need to traverse the DOM tree.
-  if (origin.Equals(aOrigin)) {
-    nsCOMPtr<nsIDocShell> docShell = GetDocShell();
-    nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
-    if (NS_WARN_IF(!webNav)) {
-      return;
-    }
-
-    // We don't need any special reload flags, because this notification is
-    // dispatched by Clear-Site-Data header, which should have already cleaned
-    // up all the needed data.
-    rv = webNav->Reload(nsIWebNavigation::LOAD_FLAGS_NONE);
-    NS_ENSURE_SUCCESS_VOID(rv);
-
-    return;
-  }
-
-  CallOnChildren(&nsGlobalWindowInner::PropagateClearSiteDataReload, aOrigin);
-}
-
 mozilla::dom::DocGroup*
 nsPIDOMWindowInner::GetDocGroup() const
 {
   nsIDocument* doc = GetExtantDoc();
   if (doc) {
     return doc->GetDocGroup();
   }
   return nullptr;
--- a/dom/base/nsGlobalWindowInner.h
+++ b/dom/base/nsGlobalWindowInner.h
@@ -974,18 +974,16 @@ public:
   void GetInterface(JSContext* aCx, nsIJSID* aIID,
                     JS::MutableHandle<JS::Value> aRetval,
                     mozilla::ErrorResult& aError);
 
   already_AddRefed<nsWindowRoot> GetWindowRoot(mozilla::ErrorResult& aError);
 
   bool ShouldReportForServiceWorkerScope(const nsAString& aScope);
 
-  void PropagateClearSiteDataReload(const nsACString& aOrigin);
-
   already_AddRefed<mozilla::dom::InstallTriggerImpl> GetInstallTrigger();
 
   void UpdateTopInnerWindow();
 
   virtual bool IsInSyncOperation() override
   {
     return GetExtantDoc() && GetExtantDoc()->IsInSyncOperation();
   }
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -2585,28 +2585,16 @@ ContentChild::RecvUpdateAppLocales(nsTAr
 mozilla::ipc::IPCResult
 ContentChild::RecvUpdateRequestedLocales(nsTArray<nsCString>&& aRequestedLocales)
 {
   LocaleService::GetInstance()->AssignRequestedLocales(aRequestedLocales);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
-ContentChild::RecvClearSiteDataReloadNeeded(const nsString& aOrigin)
-{
-  // Rebroadcast "clear-site-data-reload-needed".
-  nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-  if (obs) {
-    obs->NotifyObservers(nullptr, "clear-site-data-reload-needed",
-                         aOrigin.get());
-  }
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
 ContentChild::RecvAddPermission(const IPC::Permission& permission)
 {
   nsCOMPtr<nsIPermissionManager> permissionManagerIface =
     services::GetPermissionManager();
   nsPermissionManager* permissionManager =
     static_cast<nsPermissionManager*>(permissionManagerIface.get());
   MOZ_ASSERT(permissionManager,
          "We have no permissionManager in the Content process !");
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -400,18 +400,16 @@ public:
 
   virtual mozilla::ipc::IPCResult RecvUpdateDictionaryList(InfallibleTArray<nsString>&& aDictionaries) override;
 
   virtual mozilla::ipc::IPCResult RecvUpdateFontList(InfallibleTArray<SystemFontListEntry>&& aFontList) override;
 
   virtual mozilla::ipc::IPCResult RecvUpdateAppLocales(nsTArray<nsCString>&& aAppLocales) override;
   virtual mozilla::ipc::IPCResult RecvUpdateRequestedLocales(nsTArray<nsCString>&& aRequestedLocales) override;
 
-  virtual mozilla::ipc::IPCResult RecvClearSiteDataReloadNeeded(const nsString& aOrigin) override;
-
   virtual mozilla::ipc::IPCResult RecvAddPermission(const IPC::Permission& permission) override;
 
   virtual mozilla::ipc::IPCResult RecvFlushMemory(const nsString& reason) override;
 
   virtual mozilla::ipc::IPCResult RecvActivateA11y(const uint32_t& aMainChromeTid,
                                                    const uint32_t& aMsaaID) override;
   virtual mozilla::ipc::IPCResult RecvShutdownA11y() override;
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -589,17 +589,16 @@ static const char* sObserverTopics[] = {
 #ifdef ACCESSIBILITY
   "a11y-init-or-shutdown",
 #endif
   "cacheservice:empty-cache",
   "intl:app-locales-changed",
   "intl:requested-locales-changed",
   "cookie-changed",
   "private-cookie-changed",
-  "clear-site-data-reload-needed",
 };
 
 // PreallocateProcess is called by the PreallocatedProcessManager.
 // ContentParent then takes this process back within GetNewOrUsedBrowserProcess.
 /*static*/ already_AddRefed<ContentParent>
 ContentParent::PreallocateProcess()
 {
   RefPtr<ContentParent> process =
@@ -3008,19 +3007,16 @@ ContentParent::Observe(nsISupports* aSub
     nsCOMPtr<nsICookie> xpcCookie = do_QueryInterface(aSubject);
     NS_ASSERTION(xpcCookie, "couldn't get cookie");
     if (!nsCRT::strcmp(aData, u"deleted")) {
       cs->RemoveCookie(xpcCookie);
     } else if ((!nsCRT::strcmp(aData, u"added")) ||
                (!nsCRT::strcmp(aData, u"changed"))) {
       cs->AddCookie(xpcCookie);
     }
-  } else if (!strcmp(aTopic, "clear-site-data-reload-needed")) {
-    // Rebroadcast "clear-site-data-reload-needed".
-    Unused << SendClearSiteDataReloadNeeded(nsString(aData));
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ContentParent::GetInterface(const nsIID& aIID, void** aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -450,18 +450,16 @@ child:
 
     async UpdateDictionaryList(nsString[] dictionaries);
 
     async UpdateFontList(SystemFontListEntry[] fontList);
 
     async UpdateAppLocales(nsCString[] appLocales);
     async UpdateRequestedLocales(nsCString[] requestedLocales);
 
-    async ClearSiteDataReloadNeeded(nsString origin);
-
     // nsIPermissionManager messages
     async AddPermission(Permission permission);
 
     async FlushMemory(nsString reason);
 
     async GarbageCollect();
     async CycleCollect();
     async UnlinkGhosts();
--- a/dom/locales/en-US/chrome/security/security.properties
+++ b/dom/locales/en-US/chrome/security/security.properties
@@ -89,10 +89,8 @@ BlockScriptWithWrongMimeType=Script from “%1$S” was blocked because of a disallowed MIME type.
 BlockTopLevelDataURINavigation=Navigation to toplevel data: URI not allowed (Blocked loading of: “%1$S”)
 BlockSubresourceRedirectToData=Redirecting to insecure data: URI not allowed (Blocked loading of: “%1$S”)
 
 BlockSubresourceFTP=Loading FTP subresource within http(s) page not allowed (Blocked loading of: “%1$S”)
 
 # LOCALIZATION NOTE (BrowserUpgradeInsecureDisplayRequest):
 # %1$S is the browser name "brandShortName"; %2$S is the URL of the upgraded request; %1$S is the upgraded scheme.
 BrowserUpgradeInsecureDisplayRequest = %1$S is upgrading an insecure display request ‘%2$S’ to use ‘%3$S’
-RunningClearSiteDataValue=Clear-Site-Data header forces the clean up of “%S” data.
-UnknownClearSiteDataValue=Clear-Site-Data header found. Unknown value “%S”.
--- a/image/ImageCacheKey.h
+++ b/image/ImageCacheKey.h
@@ -36,21 +36,19 @@ public:
                 nsIDocument* aDocument, nsresult& aRv);
 
   ImageCacheKey(const ImageCacheKey& aOther);
   ImageCacheKey(ImageCacheKey&& aOther);
 
   bool operator==(const ImageCacheKey& aOther) const;
   PLDHashNumber Hash() const { return mHash; }
 
-  /// A weak pointer to the URI.
+  /// A weak pointer to the URI. For logging only.
   nsIURI* URI() const { return mURI; }
 
-  const OriginAttributes& OriginAttributesRef() const { return mOriginAttributes; }
-
   /// Is this cache entry for a chrome image?
   bool IsChrome() const { return mIsChrome; }
 
   /// A token indicating which service worker controlled document this entry
   /// belongs to, if any.
   void* ControlledDocument() const { return mControlledDocument; }
 
 private:
--- a/image/imgICache.idl
+++ b/image/imgICache.idl
@@ -3,30 +3,21 @@
  * 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 "nsISupports.idl"
 
 interface imgIRequest;
 interface nsIDocument;
-interface nsIPrincipal;
 interface nsIProperties;
 interface nsIURI;
 
 webidl Document;
 
-%{ C++
-namespace mozilla {
-class OriginAttributes;
-} // mozilla namespace
-%}
-
-[ptr] native OriginAttributesPtr(mozilla::OriginAttributes);
-
 /**
  * imgICache interface
  *
  * @author Stuart Parmenter <pavlov@netscape.com>
  * @version 0.1
  * @see imagelib2
  */
 [scriptable, builtinclass, uuid(bfdf23ff-378e-402e-8a6c-840f0c82b6c3)]
@@ -46,24 +37,16 @@ interface imgICache : nsISupports
    * @param uri The URI to remove.
    * @param doc The document to remove the cache entry for.
    * @throws NS_ERROR_NOT_AVAILABLE if \a uri was unable to be removed from
    * the cache.
    */
   [noscript] void removeEntry(in nsIURI uri, [optional] in Document doc);
 
   /**
-   * Evict images from the cache with the same origin and the same
-   * originAttributes of the passed principal.
-   *
-   * @param aPrincipal The principal
-   */
-  void removeEntriesFromPrincipal(in nsIPrincipal aPrincipal);
-
-  /**
    * Find Properties
    * Used to get properties such as 'type' and 'content-disposition'
    * 'type' is a nsISupportsCString containing the images' mime type such as
    * 'image/png'
    * 'content-disposition' will be a nsISupportsCString containing the header
    * If you call this before any data has been loaded from a URI, it will
    * succeed, but come back empty.
    *
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -1465,55 +1465,16 @@ imgLoader::ClearCache(bool chrome)
   if (chrome) {
     return ClearChromeImageCache();
   }
   return ClearImageCache();
 
 }
 
 NS_IMETHODIMP
-imgLoader::RemoveEntriesFromPrincipal(nsIPrincipal* aPrincipal)
-{
-  nsAutoString origin;
-  nsresult rv = nsContentUtils::GetUTFOrigin(aPrincipal, origin);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  AutoTArray<RefPtr<imgCacheEntry>, 128> entriesToBeRemoved;
-
-  imgCacheTable& cache = GetCache(nsContentUtils::IsSystemPrincipal(aPrincipal));
-  for (auto iter = cache.Iter(); !iter.Done(); iter.Next()) {
-    auto& key = iter.Key();
-
-    if (key.OriginAttributesRef() != BasePrincipal::Cast(aPrincipal)->OriginAttributesRef()) {
-       continue;
-    }
-
-    nsAutoString imageOrigin;
-    nsresult rv = nsContentUtils::GetUTFOrigin(key.URI(), imageOrigin);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      continue;
-    }
-
-    if (imageOrigin == origin) {
-      entriesToBeRemoved.AppendElement(iter.Data());
-    }
-  }
-
-  for (auto& entry : entriesToBeRemoved) {
-    if (!RemoveFromCache(entry)) {
-      NS_WARNING("Couldn't remove an entry from the cache in RemoveEntriesFromPrincipal()\n");
-    }
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 imgLoader::RemoveEntry(nsIURI* aURI,
                        nsIDocument* aDoc)
 {
   if (aURI) {
     OriginAttributes attrs;
     if (aDoc) {
       nsCOMPtr<nsIPrincipal> principal = aDoc->NodePrincipal();
       if (principal) {
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -98,17 +98,16 @@
 #include "nsApplicationCacheService.h"
 #include "mozilla/dom/CustomElementRegistry.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/IMEStateManager.h"
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "TouchManager.h"
 #include "DecoderDoctorLogger.h"
 #include "MediaDecoder.h"
-#include "mozilla/ClearSiteData.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/StaticPresData.h"
 #include "mozilla/dom/WebIDLGlobalNameHash.h"
 #include "mozilla/dom/ipc/IPCBlobInputStreamStorage.h"
 #include "mozilla/dom/U2FTokenManager.h"
 #include "mozilla/dom/PointerEventHandler.h"
 #include "mozilla/dom/BlobURLProtocolHandler.h"
 #include "nsThreadManager.h"
@@ -281,18 +280,16 @@ nsLayoutStatics::Initialize()
   if (XRE_IsParentProcess()) {
     // On content process we initialize DOMPrefs when PContentChild is fully
     // initialized.
     mozilla::dom::DOMPrefs::Initialize();
   }
 
   nsThreadManager::InitializeShutdownObserver();
 
-  ClearSiteData::Initialize();
-
   return NS_OK;
 }
 
 void
 nsLayoutStatics::Shutdown()
 {
   // Don't need to shutdown nsWindowMemoryReporter, that will be done by the
   // memory reporter manager.
@@ -391,11 +388,9 @@ nsLayoutStatics::Shutdown()
 
   DisplayItemClip::Shutdown();
 
   CacheObserver::Shutdown();
 
   PromiseDebugging::Shutdown();
 
   BlobURLProtocolHandler::RemoveDataEntries();
-
-  ClearSiteData::Shutdown();
 }
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -112,32 +112,16 @@ VARCACHE_PREF(
 )
 
 // If true. then the service worker interception and the ServiceWorkerManager
 // will live in the parent process.  This only takes effect on browser start.
 // Note, this is not currently safe to use for normal browsing yet.
 PREF("dom.serviceWorkers.parent_intercept", bool, false)
 
 //---------------------------------------------------------------------------
-// Clear-Site-Data prefs
-//---------------------------------------------------------------------------
-
-#ifdef NIGHTLY
-# define PREF_VALUE true
-#else
-# define PREF_VALUE false
-#endif
-VARCACHE_PREF(
-  "dom.clearSiteData.enabled",
-   dom_clearSiteData_enabled,
-  bool, PREF_VALUE
-)
-#undef PREF_VALUE
-
-//---------------------------------------------------------------------------
 // Full-screen prefs
 //---------------------------------------------------------------------------
 
 #ifdef RELEASE_OR_BETA
 # define PREF_VALUE false
 #else
 # define PREF_VALUE true
 #endif
deleted file mode 100644
--- a/testing/web-platform/meta/clear-site-data/__dir__.ini
+++ /dev/null
@@ -1,1 +0,0 @@
-prefs: [dom.clearSiteData.enabled:true]
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/clear-site-data/navigation.https.html.ini
@@ -0,0 +1,12 @@
+[navigation.https.html]
+  expected: TIMEOUT
+  disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1387007
+  [Clear datatypes on navigation: cookies]
+    expected: TIMEOUT
+
+  [Clear datatypes on navigation: storage]
+    expected: NOTRUN
+
+  [Clear datatypes on navigation: cookies, storage]
+    expected: NOTRUN
+
--- a/testing/web-platform/meta/clear-site-data/storage.https.html.ini
+++ b/testing/web-platform/meta/clear-site-data/storage.https.html.ini
@@ -1,2 +1,7 @@
 [storage.https.html]
-  disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1456995
+  [Clear backend when 'storage' is deleted: Indexed DB]
+    expected: FAIL
+
+  [Clear backend when 'storage' is deleted: service workers]
+    expected: FAIL
+
--- a/toolkit/components/cleardata/ClearDataService.js
+++ b/toolkit/components/cleardata/ClearDataService.js
@@ -90,26 +90,16 @@ const NetworkCacheCleaner = {
     return new Promise(aResolve => {
       Services.cache2.clear();
       aResolve();
     });
   },
 };
 
 const ImageCacheCleaner = {
-  deleteByPrincipal(aPrincipal) {
-    return new Promise(aResolve => {
-      let imageCache = Cc["@mozilla.org/image/tools;1"]
-                         .getService(Ci.imgITools)
-                         .getImgCacheForDocument(null);
-      imageCache.removeEntriesFromPrincipal(aPrincipal);
-      aResolve();
-    });
-  },
-
   deleteAll() {
     return new Promise(aResolve => {
       let imageCache = Cc["@mozilla.org/image/tools;1"]
                          .getService(Ci.imgITools)
                          .getImgCacheForDocument(null);
       imageCache.clearCache(false); // true=chrome, false=content
       aResolve();
     });
@@ -708,17 +698,17 @@ ClearDataService.prototype = Object.free
   },
 
   deleteDataFromPrincipal(aPrincipal, aIsUserRequest, aFlags, aCallback) {
     if (!aPrincipal || !aCallback) {
       return Cr.NS_ERROR_INVALID_ARG;
     }
 
     return this._deleteInternal(aFlags, aCallback, aCleaner => {
-      if (aCleaner.deleteByPrincipal) {
+      if ("deleteByPrincipal" in aCleaner && aCleaner.deleteByPrincipal) {
         return aCleaner.deleteByPrincipal(aPrincipal);
       }
       // Some of the 'Cleaners' do not support to delete by principal. Fallback
       // is to delete by host.
       if (aCleaner.deleteByHost) {
         return aCleaner.deleteByHost(aPrincipal.URI.host,
                                      aPrincipal.originAttributes);
       }
deleted file mode 100644
--- a/toolkit/components/clearsitedata/ClearSiteData.cpp
+++ /dev/null
@@ -1,435 +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/. */
-
-#include "ClearSiteData.h"
-
-#include "mozilla/OriginAttributes.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/Services.h"
-#include "mozilla/StaticPrefs.h"
-#include "mozilla/Unused.h"
-#include "nsASCIIMask.h"
-#include "nsCharSeparatedTokenizer.h"
-#include "nsContentUtils.h"
-#include "nsIClearDataService.h"
-#include "nsIHttpChannel.h"
-#include "nsIHttpProtocolHandler.h"
-#include "nsIObserverService.h"
-#include "nsIPrincipal.h"
-#include "nsIScriptError.h"
-#include "nsNetUtil.h"
-
-using namespace mozilla;
-
-namespace {
-
-StaticRefPtr<ClearSiteData> gClearSiteData;
-
-} // anonymous
-
-// This object is used to suspend/resume the channel.
-class ClearSiteData::PendingCleanupHolder final
-  : public nsIClearDataCallback
-{
-public:
-  NS_DECL_ISUPPORTS
-
-  explicit PendingCleanupHolder(nsIHttpChannel* aChannel)
-    : mChannel(aChannel)
-    , mPendingOp(false)
-  {}
-
-  nsresult
-  Start()
-  {
-    MOZ_ASSERT(!mPendingOp);
-    nsresult rv = mChannel->Suspend();
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return rv;
-    }
-
-    mPendingOp = true;
-    return NS_OK;
-  }
-
-  // This method must be called after any Start() call.
-  void
-  BrowsingContextsReloadNeeded(const nsACString& aOrigin)
-  {
-    mContextsReloadOrigin = aOrigin;
-    MaybeBrowsingContextsReload();
-  }
-
-  // nsIClearDataCallback interface
-
-  NS_IMETHOD
-  OnDataDeleted(uint32_t aFailedFlags) override
-  {
-    MOZ_ASSERT(mPendingOp);
-    mPendingOp = false;
-
-    mChannel->Resume();
-    mChannel = nullptr;
-
-    MaybeBrowsingContextsReload();
-    return NS_OK;
-  }
-
-private:
-  ~PendingCleanupHolder()
-  {
-    if (mPendingOp) {
-      mChannel->Resume();
-    }
-  }
-
-  void
-  MaybeBrowsingContextsReload()
-  {
-    if (mPendingOp || mContextsReloadOrigin.IsEmpty()) {
-      return;
-    }
-
-    nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
-    if (NS_WARN_IF(!obs)) {
-      return;
-    }
-
-    NS_ConvertUTF8toUTF16 origin(mContextsReloadOrigin);
-    nsresult rv = obs->NotifyObservers(nullptr, "clear-site-data-reload-needed",
-                                       origin.get());
-    Unused << NS_WARN_IF(NS_FAILED(rv));
-  }
-
-  nsCOMPtr<nsIHttpChannel> mChannel;
-  bool mPendingOp;
-  nsCString mContextsReloadOrigin;
-};
-
-NS_INTERFACE_MAP_BEGIN(ClearSiteData::PendingCleanupHolder)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIClearDataCallback)
-  NS_INTERFACE_MAP_ENTRY(nsIClearDataCallback)
-NS_INTERFACE_MAP_END
-
-NS_IMPL_ADDREF(ClearSiteData::PendingCleanupHolder)
-NS_IMPL_RELEASE(ClearSiteData::PendingCleanupHolder)
-
-/* static */ void
-ClearSiteData::Initialize()
-{
-  MOZ_ASSERT(!gClearSiteData);
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!XRE_IsParentProcess()) {
-    return;
-  }
-
-  RefPtr<ClearSiteData> service = new ClearSiteData();
-
-  nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
-  if (NS_WARN_IF(!obs)) {
-    return;
-  }
-
-  obs->AddObserver(service, NS_HTTP_ON_EXAMINE_RESPONSE_TOPIC, false);
-  gClearSiteData = service;
-}
-
-/* static */ void
-ClearSiteData::Shutdown()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!gClearSiteData) {
-    return;
-  }
-
-  RefPtr<ClearSiteData> service = gClearSiteData;
-  gClearSiteData = nullptr;
-
-  nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
-  if (NS_WARN_IF(!obs)) {
-    return;
-  }
-
-  obs->RemoveObserver(service, NS_HTTP_ON_EXAMINE_RESPONSE_TOPIC);
-}
-
-ClearSiteData::ClearSiteData() = default;
-ClearSiteData::~ClearSiteData() = default;
-
-NS_IMETHODIMP
-ClearSiteData::Observe(nsISupports* aSubject, const char* aTopic,
-                       const char16_t* aData)
-{
-  MOZ_ASSERT(!strcmp(aTopic, NS_HTTP_ON_EXAMINE_RESPONSE_TOPIC));
-
-  // Pref disabled.
-  if (!StaticPrefs::dom_clearSiteData_enabled()) {
-    return NS_OK;
-  }
-
-  nsCOMPtr<nsIHttpChannel> channel = do_QueryInterface(aSubject);
-  if (NS_WARN_IF(!channel)) {
-    return NS_OK;
-  }
-
-  ClearDataFromChannel(channel);
-  return NS_OK;
-}
-
-void
-ClearSiteData::ClearDataFromChannel(nsIHttpChannel* aChannel)
-{
-  nsresult rv;
-  nsCOMPtr<nsIURI> uri;
-
-  // We want to use the final URI to check if Clear-Site-Data should be allowed
-  // or not.
-  rv = aChannel->GetURI(getter_AddRefs(uri));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return;
-  }
-
-  if (!IsSecureURI(uri)) {
-    return;
-  }
-
-  uint32_t flags = ParseHeader(aChannel, uri);
-  if (flags == 0) {
-    // Nothing to do.
-    return;
-  }
-
-  nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
-  if (NS_WARN_IF(!ssm)) {
-    return;
-  }
-
-  nsCOMPtr<nsIPrincipal> principal;
-  rv = ssm->GetChannelURIPrincipal(aChannel, getter_AddRefs(principal));
-  if (NS_WARN_IF(NS_FAILED(rv)) || !principal) {
-    return;
-  }
-
-  int32_t cleanFlags = 0;
-  RefPtr<PendingCleanupHolder> holder = new PendingCleanupHolder(aChannel);
-
-  if (flags & eCache) {
-    LogOpToConsole(aChannel, uri, eCache);
-    cleanFlags |= nsIClearDataService::CLEAR_ALL_CACHES;
-  }
-
-  if (flags & eCookies) {
-    LogOpToConsole(aChannel, uri, eCookies);
-    cleanFlags |= nsIClearDataService::CLEAR_COOKIES;
-  }
-
-  if (flags & eStorage) {
-    LogOpToConsole(aChannel, uri, eStorage);
-    cleanFlags |= nsIClearDataService::CLEAR_DOM_STORAGES;
-  }
-
-  if (cleanFlags) {
-    nsCOMPtr<nsIClearDataService> csd =
-      do_GetService("@mozilla.org/clear-data-service;1");
-    MOZ_ASSERT(csd);
-
-    rv = holder->Start();
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return;
-    }
-
-    rv = csd->DeleteDataFromPrincipal(principal,
-                                      false /* user request */,
-                                      cleanFlags, holder);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return;
-    }
-  }
-
-  if (flags & eExecutionContexts) {
-    LogOpToConsole(aChannel, uri, eExecutionContexts);
-    BrowsingContextsReload(holder, principal);
-  }
-}
-
-bool
-ClearSiteData::IsSecureURI(nsIURI* aURI) const
-{
-  MOZ_ASSERT(aURI);
-
-  bool prioriAuthenticated = false;
-  if (NS_WARN_IF(NS_FAILED(NS_URIChainHasFlags(aURI,
-                                               nsIProtocolHandler::URI_IS_POTENTIALLY_TRUSTWORTHY,
-                                               &prioriAuthenticated)))) {
-    return false;
-  }
-
-  return prioriAuthenticated;
-}
-
-uint32_t
-ClearSiteData::ParseHeader(nsIHttpChannel* aChannel, nsIURI* aURI) const
-{
-  MOZ_ASSERT(aChannel);
-
-  nsAutoCString headerValue;
-  nsresult rv = aChannel->GetResponseHeader(NS_LITERAL_CSTRING("Clear-Site-Data"),
-                                            headerValue);
-  if (NS_FAILED(rv)) {
-    return 0;
-  }
-
-  uint32_t flags = 0;
-
-  nsCCharSeparatedTokenizer token(headerValue, ',');
-  while (token.hasMoreTokens()) {
-    auto value = token.nextToken();
-    value.StripTaggedASCII(mozilla::ASCIIMask::MaskWhitespace());
-
-    if (value.EqualsLiteral("\"cache\"")) {
-      flags |= eCache;
-      continue;
-    }
-
-    if (value.EqualsLiteral("\"cookies\"")) {
-      flags |= eCookies;
-      continue;
-    }
-
-    if (value.EqualsLiteral("\"storage\"")) {
-      flags |= eStorage;
-      continue;
-    }
-
-    if (value.EqualsLiteral("\"executionContexts\"")) {
-      flags |= eExecutionContexts;
-      continue;
-    }
-
-    if (value.EqualsLiteral("\"*\"")) {
-      flags = eCache | eCookies | eStorage | eExecutionContexts;
-      break;
-    }
-
-    LogErrorToConsole(aChannel, aURI, value);
-  }
-
-  return flags;
-}
-
-void
-ClearSiteData::LogOpToConsole(nsIHttpChannel* aChannel, nsIURI* aURI,
-                              Type aType) const
-{
-  nsAutoString type;
-  TypeToString(aType, type);
-
-  nsTArray<nsString> params;
-  params.AppendElement(type);
-
-  LogToConsoleInternal(aChannel, aURI, "RunningClearSiteDataValue", params);
-}
-
-void
-ClearSiteData::LogErrorToConsole(nsIHttpChannel* aChannel,
-                                 nsIURI* aURI,
-                                 const nsACString& aUnknownType) const
-{
-  nsTArray<nsString> params;
-  params.AppendElement(NS_ConvertUTF8toUTF16(aUnknownType));
-
-  LogToConsoleInternal(aChannel, aURI, "UnknownClearSiteDataValue", params);
-}
-
-void
-ClearSiteData::LogToConsoleInternal(nsIHttpChannel* aChannel, nsIURI* aURI,
-                                    const char* aMsg,
-                                    const nsTArray<nsString>& aParams) const
-{
-  MOZ_ASSERT(aChannel);
-  MOZ_ASSERT(aURI);
-
-  uint64_t windowID = 0;
-
-  nsresult rv = aChannel->GetTopLevelContentWindowId(&windowID);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return;
-  }
-
-  if (!windowID) {
-    nsCOMPtr<nsILoadGroup> loadGroup;
-    nsresult rv = aChannel->GetLoadGroup(getter_AddRefs(loadGroup));
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return;
-    }
-
-    if (loadGroup) {
-      windowID = nsContentUtils::GetInnerWindowID(loadGroup);
-    }
-  }
-
-  nsAutoString localizedMsg;
-  rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eSECURITY_PROPERTIES,
-                                             aMsg, aParams, localizedMsg);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return;
-  }
-
-  rv = nsContentUtils::ReportToConsoleByWindowID(localizedMsg,
-                                                 nsIScriptError::infoFlag,
-                                                 NS_LITERAL_CSTRING("Clear-Site-Data"),
-                                                 windowID,
-                                                 aURI);
-  Unused << NS_WARN_IF(NS_FAILED(rv));
-}
-
-void
-ClearSiteData::TypeToString(Type aType, nsAString& aStr) const
-{
-  switch (aType) {
-  case eCache:
-    aStr.AssignLiteral("cache");
-    break;
-
-  case eCookies:
-    aStr.AssignLiteral("cookies");
-    break;
-
-  case eStorage:
-    aStr.AssignLiteral("storage");
-    break;
-
-  case eExecutionContexts:
-    aStr.AssignLiteral("executionContexts");
-    break;
-
-  default:
-    MOZ_CRASH("Unknown type.");
-  }
-}
-
-void
-ClearSiteData::BrowsingContextsReload(PendingCleanupHolder* aHolder,
-                                      nsIPrincipal* aPrincipal) const
-{
-  nsAutoCString origin;
-  nsresult rv = aPrincipal->GetOrigin(origin);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return;
-  }
-
-  aHolder->BrowsingContextsReloadNeeded(origin);
-}
-
-NS_INTERFACE_MAP_BEGIN(ClearSiteData)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver)
-  NS_INTERFACE_MAP_ENTRY(nsIObserver)
-NS_INTERFACE_MAP_END
-
-NS_IMPL_ADDREF(ClearSiteData)
-NS_IMPL_RELEASE(ClearSiteData)
deleted file mode 100644
--- a/toolkit/components/clearsitedata/ClearSiteData.h
+++ /dev/null
@@ -1,87 +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 mozilla_clearsitedata_h
-#define mozilla_clearsitedata_h
-
-#include "nsIObserver.h"
-#include "nsTArray.h"
-
-class nsIHttpChannel;
-class nsIPrincipal;
-class nsIURI;
-
-namespace mozilla {
-
-class ClearSiteData final : public nsIObserver
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIOBSERVER
-
-  static void
-  Initialize();
-
-  static void
-  Shutdown();
-
-private:
-  ClearSiteData();
-  ~ClearSiteData();
-
-  class PendingCleanupHolder;
-
-  // Starts the cleanup if the channel contains the Clear-Site-Data header and
-  // if the URI is secure.
-  void
-  ClearDataFromChannel(nsIHttpChannel* aChannel);
-
-  // This method checks if the protocol handler of the URI has the
-  // URI_IS_POTENTIALLY_TRUSTWORTHY flag.
-  bool
-  IsSecureURI(nsIURI* aURI) const;
-
-  // From the Clear-Site-Data header, it returns a bitmap with Type values.
-  uint32_t
-  ParseHeader(nsIHttpChannel* aChannel, nsIURI* aURI) const;
-
-  enum Type
-  {
-    eCache = 0x01,
-    eCookies = 0x02,
-    eStorage = 0x04,
-    eExecutionContexts = 0x08,
-  };
-
-  // This method writes a console message when a cleanup operation is going to
-  // be executed.
-  void
-  LogOpToConsole(nsIHttpChannel* aChannel, nsIURI* aURI, Type aType) const;
-
-  // Logging of an unknown type value.
-  void
-  LogErrorToConsole(nsIHttpChannel* aChannel, nsIURI* aURI,
-                    const nsACString& aUnknownType) const;
-
-  void
-  LogToConsoleInternal(nsIHttpChannel* aChannel, nsIURI* aURI,
-                       const char* aMsg,
-                       const nsTArray<nsString>& aParams) const;
-
-  // This method converts a Type to the corrisponding string format.
-  void
-  TypeToString(Type aType, nsAString& aStr) const;
-
-  // When called, after the cleanup, PendingCleanupHolder will reload all the
-  // browsing contexts.
-  void
-  BrowsingContextsReload(PendingCleanupHolder* aHolder,
-                         nsIPrincipal* aPrincipal) const;
-};
-
-} // namespace mozilla
-
-#endif // mozilla_clearsitedata_h
deleted file mode 100644
--- a/toolkit/components/clearsitedata/moz.build
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- 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/.
-
-EXPORTS.mozilla = [
-    'ClearSiteData.h',
-]
-
-UNIFIED_SOURCES += [
-    'ClearSiteData.cpp',
-]
-
-include('/ipc/chromium/chromium-config.mozbuild')
-
-with Files('**'):
-    BUG_COMPONENT = ('Toolkit', 'Data Sanitization')
-
-FINAL_LIBRARY = 'xul'
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -18,17 +18,16 @@ DIRS += [
     'aboutperformance',
     'alerts',
     'antitracking',
     'apppicker',
     'asyncshutdown',
     'backgroundhangmonitor',
     'browser',
     'cleardata',
-    'clearsitedata',
     'cloudstorage',
     'commandlines',
     'contentprefs',
     'contextualidentity',
     'crashes',
     'crashmonitor',
     'diskspacewatcher',
     'downloads',