Bug 1539641 - Log and report storage access granted reason; r=Ehsan,chutten
authorLiang-Heng Chen <xeonchen@gmail.com>
Fri, 12 Apr 2019 00:38:57 +0000
changeset 469227 c3b55b97b9ae1101c615ec2fe525fd9336bb8599
parent 469216 a632dfa60af6edd4f7dd03d404d898b6222b56c3
child 469228 98bf8629efc6d4959c293c9c46e318dae44e2114
push id112776
push usershindli@mozilla.com
push dateFri, 12 Apr 2019 16:20:17 +0000
treeherdermozilla-inbound@b4501ced5619 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan, chutten
bugs1539641
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 1539641 - Log and report storage access granted reason; r=Ehsan,chutten Differential Revision: https://phabricator.services.mozilla.com/D26720
dom/base/ContentBlockingLog.cpp
dom/base/ContentBlockingLog.h
dom/base/Document.h
dom/base/nsGlobalWindowOuter.cpp
dom/base/nsGlobalWindowOuter.h
dom/base/nsPIDOMWindow.h
dom/ipc/WindowGlobalChild.h
dom/ipc/WindowGlobalParent.h
js/xpconnect/src/xpcpublic.h
toolkit/components/antitracking/AntiTrackingCommon.cpp
toolkit/components/perfmonitoring/PerformanceUtils.h
toolkit/components/remote/nsGTKRemoteServer.cpp
toolkit/components/remote/nsRemoteService.cpp
toolkit/components/remote/nsRemoteService.h
toolkit/components/telemetry/TelemetryOriginEnums.h
--- a/dom/base/ContentBlockingLog.cpp
+++ b/dom/base/ContentBlockingLog.cpp
@@ -87,26 +87,53 @@ void ContentBlockingLog::ReportLog() {
     }
 
     for (const auto& logEntry : Reversed(originEntry.mData->mLogs)) {
       if (logEntry.mType !=
           nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER) {
         continue;
       }
 
-      bool isBlocked = logEntry.mBlocked;
-      auto metricId = isBlocked
-                          ? Telemetry::OriginMetricID::ContentBlocking_Blocked
-                          : Telemetry::OriginMetricID::ContentBlocking_Exempt;
-      if (StaticPrefs::telemetry_origin_telemetry_test_mode_enabled()) {
-        metricId =
-            isBlocked
-                ? Telemetry::OriginMetricID::ContentBlocking_Blocked_TestOnly
-                : Telemetry::OriginMetricID::ContentBlocking_Exempt_TestOnly;
+      const bool isBlocked = logEntry.mBlocked;
+      Maybe<StorageAccessGrantedReason> reason = logEntry.mReason;
+      const bool testMode =
+          StaticPrefs::telemetry_origin_telemetry_test_mode_enabled();
+
+      using OriginMetricID = Telemetry::OriginMetricID;
+      OriginMetricID metricId =
+          testMode ? OriginMetricID::ContentBlocking_Blocked_TestOnly
+                   : OriginMetricID::ContentBlocking_Blocked;
+      if (!isBlocked) {
+        MOZ_ASSERT(reason.isSome());
+        switch (reason.value()) {
+          case StorageAccessGrantedReason::eStorageAccessAPI:
+            metricId =
+                testMode
+                    ? OriginMetricID::
+                          ContentBlocking_StorageAccessAPIExempt_TestOnly
+                    : OriginMetricID::ContentBlocking_StorageAccessAPIExempt;
+            break;
+          case StorageAccessGrantedReason::eOpenerAfterUserInteraction:
+            metricId =
+                testMode
+                    ? OriginMetricID::
+                          ContentBlocking_OpenerAfterUserInteractionExempt_TestOnly
+                    : OriginMetricID::
+                          ContentBlocking_OpenerAfterUserInteractionExempt;
+            break;
+          case StorageAccessGrantedReason::eOpener:
+            metricId =
+                testMode ? OriginMetricID::ContentBlocking_OpenerExempt_TestOnly
+                         : OriginMetricID::ContentBlocking_OpenerExempt;
+            break;
+          default:
+            MOZ_ASSERT_UNREACHABLE("Unknown StorageAccessGrantedReason");
+        }
       }
+
       Telemetry::RecordOrigin(metricId, originEntry.mOrigin);
       break;
     }
   }
 }
 
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/base/ContentBlockingLog.h
+++ b/dom/base/ContentBlockingLog.h
@@ -2,33 +2,38 @@
 /* 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_dom_ContentBlockingLog_h
 #define mozilla_dom_ContentBlockingLog_h
 
+#include "mozilla/AntiTrackingCommon.h"
 #include "mozilla/JSONWriter.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/StaticPrefs.h"
 #include "mozilla/Tuple.h"
 #include "mozilla/UniquePtr.h"
 #include "nsReadableUtils.h"
 #include "nsTArray.h"
 #include "nsWindowSizes.h"
 
 namespace mozilla {
 namespace dom {
 
 class ContentBlockingLog final {
+  typedef AntiTrackingCommon::StorageAccessGrantedReason
+      StorageAccessGrantedReason;
+
   struct LogEntry {
     uint32_t mType;
     uint32_t mRepeatCount;
     bool mBlocked;
+    Maybe<AntiTrackingCommon::StorageAccessGrantedReason> mReason;
   };
 
   struct OriginDataEntry {
     OriginDataEntry() : mHasTrackingContentLoaded(false) {}
 
     bool mHasTrackingContentLoaded;
     Maybe<bool> mHasCookiesLoaded;
     nsTArray<LogEntry> mLogs;
@@ -63,17 +68,28 @@ class ContentBlockingLog final {
       return aLeft.mOrigin.Equals(aRight);
     }
   };
 
  public:
   ContentBlockingLog() = default;
   ~ContentBlockingLog() = default;
 
-  void RecordLog(const nsACString& aOrigin, uint32_t aType, bool aBlocked) {
+  void RecordLog(
+      const nsACString& aOrigin, uint32_t aType, bool aBlocked,
+      const Maybe<AntiTrackingCommon::StorageAccessGrantedReason>& aReason) {
+    MOZ_ASSERT_IF(aBlocked, aReason.isNothing());
+    MOZ_ASSERT_IF(
+        aType != nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER,
+        aReason.isNothing());
+    MOZ_ASSERT_IF(
+        !aBlocked &&
+            aType == nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER,
+        aReason.isSome());
+
     if (aOrigin.IsVoid()) {
       return;
     }
     auto index = mLog.IndexOf(aOrigin, 0, Comparator());
     if (index != OriginDataTable::NoIndex) {
       OriginEntry& entry = mLog[index];
       if (!entry.mData) {
         return;
@@ -91,26 +107,28 @@ class ContentBlockingLog final {
         }
         return;
       }
       if (!entry.mData->mLogs.IsEmpty()) {
         auto& last = entry.mData->mLogs.LastElement();
         if (last.mType == aType && last.mBlocked == aBlocked) {
           ++last.mRepeatCount;
           // Don't record recorded events.  This helps compress our log.
+          // We don't care about if the the reason is the same, just keep the
+          // first one.
           return;
         }
       }
       if (entry.mData->mLogs.Length() ==
           std::max(1u,
                    StaticPrefs::browser_contentblocking_originlog_length())) {
         // Cap the size at the maximum length adjustable by the pref
         entry.mData->mLogs.RemoveElementAt(0);
       }
-      entry.mData->mLogs.AppendElement(LogEntry{aType, 1u, aBlocked});
+      entry.mData->mLogs.AppendElement(LogEntry{aType, 1u, aBlocked, aReason});
       return;
     }
 
     // The entry has not been found.
 
     OriginEntry* entry = mLog.AppendElement();
     if (NS_WARN_IF(!entry || !entry->mData)) {
       return;
@@ -119,17 +137,17 @@ class ContentBlockingLog final {
     entry->mOrigin = aOrigin;
 
     if (aType == nsIWebProgressListener::STATE_LOADED_TRACKING_CONTENT) {
       entry->mData->mHasTrackingContentLoaded = aBlocked;
     } else if (aType == nsIWebProgressListener::STATE_COOKIES_LOADED) {
       MOZ_ASSERT(entry->mData->mHasCookiesLoaded.isNothing());
       entry->mData->mHasCookiesLoaded.emplace(aBlocked);
     } else {
-      entry->mData->mLogs.AppendElement(LogEntry{aType, 1u, aBlocked});
+      entry->mData->mLogs.AppendElement(LogEntry{aType, 1u, aBlocked, aReason});
     }
   }
 
   void ReportLog();
 
   nsAutoCString Stringify() {
     nsAutoCString buffer;
 
@@ -162,16 +180,19 @@ class ContentBlockingLog final {
         w.EndArray();
       }
       for (const LogEntry& item : entry.mData->mLogs) {
         w.StartArrayElement(w.SingleLineStyle);
         {
           w.IntElement(item.mType);
           w.BoolElement(item.mBlocked);
           w.IntElement(item.mRepeatCount);
+          if (item.mReason.isSome()) {
+            w.IntElement(item.mReason.value());
+          }
         }
         w.EndArray();
       }
       w.EndArray();
     }
 
     w.End();
 
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -1101,21 +1101,22 @@ class Document : public nsINode,
     RecordContentBlockingLog(aOriginBlocked,
                              nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL,
                              aHasAllCookiesBlocked);
   }
 
   /**
    * Set the tracking cookies blocked flag for this document.
    */
-  void SetHasTrackingCookiesBlocked(bool aHasTrackingCookiesBlocked,
-                                    const nsACString& aOriginBlocked) {
+  void SetHasTrackingCookiesBlocked(
+      bool aHasTrackingCookiesBlocked, const nsACString& aOriginBlocked,
+      const Maybe<AntiTrackingCommon::StorageAccessGrantedReason>& aReason) {
     RecordContentBlockingLog(
         aOriginBlocked, nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER,
-        aHasTrackingCookiesBlocked);
+        aHasTrackingCookiesBlocked, aReason);
   }
 
   /**
    * Set the third-party cookies blocked flag for this document.
    */
   void SetHasForeignCookiesBlocked(bool aHasForeignCookiesBlocked,
                                    const nsACString& aOriginBlocked) {
     RecordContentBlockingLog(
@@ -3835,19 +3836,21 @@ class Document : public nsINode,
   void NotifyStyleSheetApplicableStateChanged();
   // Just like EnableStyleSheetsForSet, but doesn't check whether
   // aSheetSet is null and allows the caller to control whether to set
   // aSheetSet as the preferred set in the CSSLoader.
   void EnableStyleSheetsForSetInternal(const nsAString& aSheetSet,
                                        bool aUpdateCSSLoader);
 
  private:
-  void RecordContentBlockingLog(const nsACString& aOrigin, uint32_t aType,
-                                bool aBlocked) {
-    mContentBlockingLog.RecordLog(aOrigin, aType, aBlocked);
+  void RecordContentBlockingLog(
+      const nsACString& aOrigin, uint32_t aType, bool aBlocked,
+      const Maybe<AntiTrackingCommon::StorageAccessGrantedReason>& aReason =
+          Nothing()) {
+    mContentBlockingLog.RecordLog(aOrigin, aType, aBlocked, aReason);
   }
 
   mutable std::bitset<eDeprecatedOperationCount> mDeprecationWarnedAbout;
   mutable std::bitset<eDocumentWarningCount> mDocWarningWarnedAbout;
 
   // Lazy-initialization to have mDocGroup initialized in prior to the
   // SelectorCaches.
   UniquePtr<SelectorCache> mSelectorCache;
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -5350,21 +5350,28 @@ void nsGlobalWindowOuter::FirePopupBlock
   RefPtr<PopupBlockedEvent> event = PopupBlockedEvent::Constructor(
       aDoc, NS_LITERAL_STRING("DOMPopupBlocked"), init);
 
   event->SetTrusted(true);
 
   aDoc->DispatchEvent(*event);
 }
 
-void nsGlobalWindowOuter::NotifyContentBlockingEvent(unsigned aEvent,
-                                                     nsIChannel* aChannel,
-                                                     bool aBlocked,
-                                                     nsIURI* aURIHint) {
+void nsGlobalWindowOuter::NotifyContentBlockingEvent(
+    unsigned aEvent, nsIChannel* aChannel, bool aBlocked, nsIURI* aURIHint,
+    const mozilla::Maybe<AntiTrackingCommon::StorageAccessGrantedReason>&
+        aReason) {
   MOZ_ASSERT(aURIHint);
+  MOZ_ASSERT_IF(aBlocked, aReason.isNothing());
+  MOZ_ASSERT_IF(aEvent != nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER,
+                aReason.isNothing());
+  MOZ_ASSERT_IF(
+      !aBlocked &&
+          aEvent == nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER,
+      aReason.isSome());
 
   nsCOMPtr<nsIDocShell> docShell = GetDocShell();
   if (!docShell) {
     return;
   }
   nsCOMPtr<Document> doc = docShell->GetDocument();
   NS_ENSURE_TRUE_VOID(doc);
 
@@ -5376,17 +5383,17 @@ void nsGlobalWindowOuter::NotifyContentB
     Preferences::AddBoolVarCache(
         &gSyncContentBlockingNotifications,
         "dom.testing.sync-content-blocking-notifications", false);
     prefInitialized = true;
   }
 
   nsCOMPtr<nsIRunnable> func = NS_NewRunnableFunction(
       "NotifyContentBlockingEventDelayed",
-      [doc, docShell, uri, channel, aEvent, aBlocked]() {
+      [doc, docShell, uri, channel, aEvent, aBlocked, aReason]() {
         // This event might come after the user has navigated to another
         // page. To prevent showing the TrackingProtection UI on the wrong
         // page, we need to check that the loading URI for the channel is
         // the same as the URI currently loaded in the document.
         if (!SameLoadingURI(doc, channel) &&
             aEvent == nsIWebProgressListener::STATE_BLOCKED_TRACKING_CONTENT) {
           return;
         }
@@ -5443,17 +5450,17 @@ void nsGlobalWindowOuter::NotifyContentB
         } else if (aEvent == nsIWebProgressListener::
                                  STATE_COOKIES_BLOCKED_BY_PERMISSION) {
           doc->SetHasCookiesBlockedByPermission(aBlocked, origin);
           if (!aBlocked) {
             unblocked = !doc->GetHasCookiesBlockedByPermission();
           }
         } else if (aEvent ==
                    nsIWebProgressListener::STATE_COOKIES_BLOCKED_TRACKER) {
-          doc->SetHasTrackingCookiesBlocked(aBlocked, origin);
+          doc->SetHasTrackingCookiesBlocked(aBlocked, origin, aReason);
           if (!aBlocked) {
             unblocked = !doc->GetHasTrackingCookiesBlocked();
           }
         } else if (aEvent ==
                    nsIWebProgressListener::STATE_COOKIES_BLOCKED_ALL) {
           doc->SetHasAllCookiesBlocked(aBlocked, origin);
           if (!aBlocked) {
             unblocked = !doc->GetHasAllCookiesBlocked();
--- a/dom/base/nsGlobalWindowOuter.h
+++ b/dom/base/nsGlobalWindowOuter.h
@@ -450,19 +450,21 @@ class nsGlobalWindowOuter final : public
   bool HadOriginalOpener() const { return mHadOriginalOpener; }
 
   bool IsTopLevelWindow();
 
   virtual void FirePopupBlockedEvent(
       Document* aDoc, nsIURI* aPopupURI, const nsAString& aPopupWindowName,
       const nsAString& aPopupWindowFeatures) override;
 
-  virtual void NotifyContentBlockingEvent(unsigned aEvent, nsIChannel* aChannel,
-                                          bool aBlocked,
-                                          nsIURI* aURIHint) override;
+  virtual void NotifyContentBlockingEvent(
+      unsigned aEvent, nsIChannel* aChannel, bool aBlocked, nsIURI* aURIHint,
+      const mozilla::Maybe<
+          mozilla::AntiTrackingCommon::StorageAccessGrantedReason>& aReason)
+      override;
 
   void AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const;
 
   void AllowScriptsToClose() { mAllowScriptsToClose = true; }
 
   // Outer windows only.
   uint32_t GetAutoActivateVRDisplayID();
   // Outer windows only.
--- a/dom/base/nsPIDOMWindow.h
+++ b/dom/base/nsPIDOMWindow.h
@@ -8,16 +8,18 @@
 #define nsPIDOMWindow_h__
 
 #include "nsIDOMWindow.h"
 #include "mozIDOMWindow.h"
 
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "mozilla/dom/EventTarget.h"
+#include "mozilla/AntiTrackingCommon.h"
+#include "mozilla/Maybe.h"
 #include "mozilla/TaskCategory.h"
 #include "js/TypeDecls.h"
 #include "nsRefPtrHashtable.h"
 
 // Only fired for inner windows.
 #define DOM_WINDOW_DESTROYED_TOPIC "dom-window-destroyed"
 #define DOM_WINDOW_FROZEN_TOPIC "dom-window-frozen"
 #define DOM_WINDOW_THAWED_TOPIC "dom-window-thawed"
@@ -997,18 +999,21 @@ class nsPIDOMWindowOuter : public mozIDO
 
   /**
    * Fire a popup blocked event on the document.
    */
   virtual void FirePopupBlockedEvent(Document* aDoc, nsIURI* aPopupURI,
                                      const nsAString& aPopupWindowName,
                                      const nsAString& aPopupWindowFeatures) = 0;
 
-  virtual void NotifyContentBlockingEvent(unsigned aEvent, nsIChannel* aChannel,
-                                          bool aBlocked, nsIURI* aURIHint) = 0;
+  virtual void NotifyContentBlockingEvent(
+      unsigned aEvent, nsIChannel* aChannel, bool aBlocked, nsIURI* aURIHint,
+      const mozilla::Maybe<
+          mozilla::AntiTrackingCommon::StorageAccessGrantedReason>& aReason =
+          mozilla::Nothing()) = 0;
 
   // WebIDL-ish APIs
   void MarkUncollectableForCCGeneration(uint32_t aGeneration) {
     mMarkedCCGeneration = aGeneration;
   }
 
   uint32_t GetMarkedCCGeneration() { return mMarkedCCGeneration; }
 
--- a/dom/ipc/WindowGlobalChild.h
+++ b/dom/ipc/WindowGlobalChild.h
@@ -4,16 +4,17 @@
  * 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_dom_WindowGlobalChild_h
 #define mozilla_dom_WindowGlobalChild_h
 
 #include "mozilla/RefPtr.h"
 #include "mozilla/dom/PWindowGlobalChild.h"
+#include "nsRefPtrHashtable.h"
 #include "nsWrapperCache.h"
 
 class nsGlobalWindowInner;
 class nsDocShell;
 
 namespace mozilla {
 namespace dom {
 
--- a/dom/ipc/WindowGlobalParent.h
+++ b/dom/ipc/WindowGlobalParent.h
@@ -4,16 +4,17 @@
  * 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_dom_WindowGlobalParent_h
 #define mozilla_dom_WindowGlobalParent_h
 
 #include "mozilla/RefPtr.h"
 #include "mozilla/dom/PWindowGlobalParent.h"
+#include "nsRefPtrHashtable.h"
 #include "nsWrapperCache.h"
 #include "nsISupports.h"
 
 class nsIPrincipal;
 class nsIURI;
 class nsFrameLoader;
 
 namespace mozilla {
--- a/js/xpconnect/src/xpcpublic.h
+++ b/js/xpconnect/src/xpcpublic.h
@@ -14,28 +14,28 @@
 #include "js/Proxy.h"
 #include "js/Wrapper.h"
 
 #include "nsAtom.h"
 #include "nsISupports.h"
 #include "nsIURI.h"
 #include "nsIPrincipal.h"
 #include "nsIGlobalObject.h"
-#include "nsPIDOMWindow.h"
 #include "nsWrapperCache.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "mozilla/dom/JSSlots.h"
 #include "mozilla/fallible.h"
 #include "nsMathUtils.h"
 #include "nsStringBuffer.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/Preferences.h"
 
 class nsGlobalWindowInner;
+class nsIGlobalObject;
 class nsIPrincipal;
 class nsIHandleReportCallback;
 struct nsXPTInterfaceInfo;
 
 namespace mozilla {
 class BasePrincipal;
 
 namespace dom {
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -891,17 +891,18 @@ AntiTrackingCommon::AddFirstPartyStorage
     topInnerWindow->SaveStorageAccessGranted(permissionKey);
 
     // Let's inform the parent window.
     parentWindow->StorageAccessGranted();
 
     nsIChannel* channel =
         pwin->GetCurrentInnerWindow()->GetExtantDoc()->GetChannel();
 
-    pwin->NotifyContentBlockingEvent(blockReason, channel, false, trackingURI);
+    pwin->NotifyContentBlockingEvent(blockReason, channel, false, trackingURI,
+                                     Some(aReason));
 
     ReportUnblockingToConsole(parentWindow,
                               NS_ConvertUTF8toUTF16(trackingOrigin),
                               NS_ConvertUTF8toUTF16(origin), aReason);
 
     if (XRE_IsParentProcess()) {
       LOG(("Saving the permission: trackingOrigin=%s, grantedOrigin=%s",
            trackingOrigin.get(), origin.get()));
--- a/toolkit/components/perfmonitoring/PerformanceUtils.h
+++ b/toolkit/components/perfmonitoring/PerformanceUtils.h
@@ -3,16 +3,18 @@
  * 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 PerformanceUtils_h
 #define PerformanceUtils_h
 
 #include "mozilla/PerformanceTypes.h"
 
+class nsPIDOMWindowOuter;
+
 namespace mozilla {
 
 /**
  * Returns an array of promises to asynchronously collect all performance
  * info in the current process.
  */
 nsTArray<RefPtr<PerformanceInfoPromise>> CollectPerformanceInfo();
 
--- a/toolkit/components/remote/nsGTKRemoteServer.cpp
+++ b/toolkit/components/remote/nsGTKRemoteServer.cpp
@@ -8,17 +8,16 @@
 #include "nsGTKRemoteServer.h"
 
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 
 #include "nsIBaseWindow.h"
 #include "nsIDocShell.h"
-#include "nsPIDOMWindow.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsIServiceManager.h"
 #include "nsIAppShellService.h"
 #include "nsAppShellCID.h"
 
 #include "nsCOMPtr.h"
 
 #include "nsGTKToolkit.h"
--- a/toolkit/components/remote/nsRemoteService.cpp
+++ b/toolkit/components/remote/nsRemoteService.cpp
@@ -18,16 +18,17 @@
 #    include "nsDBusRemoteClient.h"
 #  endif
 #elif defined(XP_WIN)
 #  include "nsWinRemoteServer.h"
 #  include "nsWinRemoteClient.h"
 #endif
 #include "nsRemoteService.h"
 
+#include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/ModuleUtils.h"
 #include "SpecialSystemDirectory.h"
 #include "mozilla/CmdLineAndEnvUtils.h"
 
 // Time to wait for the remoting service to start
 #define START_TIMEOUT_SEC 5
--- a/toolkit/components/remote/nsRemoteService.h
+++ b/toolkit/components/remote/nsRemoteService.h
@@ -6,17 +6,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __nsRemoteService_h__
 #define __nsRemoteService_h__
 
 #include "nsRemoteServer.h"
 #include "nsIObserverService.h"
 #include "nsIObserver.h"
-#include "nsPIDOMWindow.h"
 #include "mozilla/UniquePtr.h"
 #include "nsIFile.h"
 #include "nsProfileLock.h"
 
 enum RemoteResult {
   REMOTE_NOT_FOUND = 0,
   REMOTE_FOUND = 1,
   REMOTE_ARG_BAD = 2
--- a/toolkit/components/telemetry/TelemetryOriginEnums.h
+++ b/toolkit/components/telemetry/TelemetryOriginEnums.h
@@ -10,31 +10,39 @@
 #include <stdint.h>
 
 namespace mozilla {
 namespace Telemetry {
 
 enum class OriginMetricID : uint32_t {
   // category: content.blocking
   ContentBlocking_Blocked = 0,
-  ContentBlocking_Exempt = 1,
-  ContentBlocking_Blocked_TestOnly = 2,
-  ContentBlocking_Exempt_TestOnly = 3,
+  ContentBlocking_Blocked_TestOnly = 1,
+  ContentBlocking_StorageAccessAPIExempt = 2,
+  ContentBlocking_StorageAccessAPIExempt_TestOnly = 3,
+  ContentBlocking_OpenerAfterUserInteractionExempt = 4,
+  ContentBlocking_OpenerAfterUserInteractionExempt_TestOnly = 5,
+  ContentBlocking_OpenerExempt = 6,
+  ContentBlocking_OpenerExempt_TestOnly = 7,
   // category: telemetry.test
-  TelemetryTest_Test1 = 4,
-  TelemetryTest_Test2 = 5,
+  TelemetryTest_Test1 = 8,
+  TelemetryTest_Test2 = 9,
   // meta
-  Count = 6,
+  Count = 10,
 };
 
-static const char* const MetricIDToString[6] = {
+static const char* const MetricIDToString[10] = {
     "content.blocking_blocked",
-    "content.blocking_exempt",
     "content.blocking_blocked_TESTONLY",
-    "content.blocking_exempt_TESTONLY",
+    "content.blocking_storage_access_api_exempt",
+    "content.blocking_storage_access_api_exempt_TESTONLY",
+    "content.blocking_opener_after_user_interaction_exempt",
+    "content.blocking_opener_after_user_interaction_exempt_TESTONLY",
+    "content.blocking_opener_exempt",
+    "content.blocking_opener_exempt_TESTONLY",
     "telemetry.test_test1",
     "telemetry.test_test2",
 };
 
 }  // namespace Telemetry
 }  // namespace mozilla
 
 #endif  // mozilla_TelemetryOriginEnums_h