Bug 1620322 - Part 9: Move ContentBlockingLog to antitracking to keep all related code together in the same place; r=baku

Differential Revision: https://phabricator.services.mozilla.com/D65822

--HG--
rename : dom/base/ContentBlockingLog.cpp => toolkit/components/antitracking/ContentBlockingLog.cpp
rename : dom/base/ContentBlockingLog.h => toolkit/components/antitracking/ContentBlockingLog.h
extra : moz-landing-system : lando
This commit is contained in:
Ehsan Akhgari 2020-03-09 10:23:30 +00:00
parent 1195c302a4
commit 271a1e1e51
12 changed files with 14 additions and 14 deletions

View File

@ -48,11 +48,11 @@
#include "nsContentListDeclarations.h"
#include "nsExpirationTracker.h"
#include "nsClassHashtable.h"
#include "nsWindowSizes.h"
#include "ReferrerInfo.h"
#include "mozilla/Attributes.h"
#include "mozilla/CallState.h"
#include "mozilla/CORSMode.h"
#include "mozilla/dom/ContentBlockingLog.h"
#include "mozilla/dom/DispatcherTrait.h"
#include "mozilla/dom/DocumentOrShadowRoot.h"
#include "mozilla/dom/ViewportMetaData.h"

View File

@ -156,7 +156,6 @@ EXPORTS.mozilla.dom += [
'ChromeNodeList.h',
'ChromeUtils.h',
'Comment.h',
'ContentBlockingLog.h',
'ContentFrameMessageManager.h',
'ContentProcessMessageManager.h',
'CustomElementRegistry.h',
@ -280,7 +279,6 @@ UNIFIED_SOURCES += [
'ChromeNodeList.cpp',
'ChromeUtils.cpp',
'Comment.cpp',
'ContentBlockingLog.cpp',
'ContentFrameMessageManager.cpp',
'ContentIterator.cpp',
'ContentProcessMessageManager.cpp',

View File

@ -7,6 +7,7 @@
#include "mozilla/BasicEvents.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/dom/WindowRootBinding.h"
#include "nsCOMPtr.h"
#include "nsWindowRoot.h"

View File

@ -7,6 +7,7 @@
#ifndef mozilla_dom_WindowGlobalParent_h
#define mozilla_dom_WindowGlobalParent_h
#include "mozilla/ContentBlockingLog.h"
#include "mozilla/ContentBlockingNotifier.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/DOMRect.h"
@ -18,7 +19,6 @@
#include "nsISupports.h"
#include "mozilla/dom/WindowGlobalActor.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/ContentBlockingLog.h"
class nsIPrincipal;
class nsIURI;

View File

@ -19,6 +19,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/Telemetry.h"

View File

@ -9,6 +9,7 @@
#include "mozilla/dom/Navigator.h"
#include "mozilla/dom/ReportingHeader.h"
#include "mozilla/dom/ReportDeliver.h"
#include "mozilla/JSONWriter.h"
#include "nsIPrincipal.h"
#include "nsIURIMutator.h"
#include "nsString.h"

View File

@ -27,6 +27,7 @@
#include "mozilla/layers/SourceSurfaceVolatileData.h"
#include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/StaticPrefs_browser.h"
#include "nsMargin.h"
#include "nsRefreshDriver.h"
#include "nsThreadUtils.h"

View File

@ -28,6 +28,7 @@
#ifdef FUZZING
# include "mozilla/StaticPrefs_fuzzing.h"
#endif
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_javascript.h"
#include "mozilla/dom/ScriptSettings.h"

View File

@ -30,8 +30,6 @@ static LazyLogModule gContentBlockingLog("ContentBlockingLog");
typedef Telemetry::OriginMetricID OriginMetricID;
namespace dom {
// sync with TelemetryOriginData.inc
NS_NAMED_LITERAL_CSTRING(ContentBlockingLog::kDummyOriginHash, "PAGELOAD");
@ -293,5 +291,4 @@ void ContentBlockingLog::ReportOrigins() {
}
}
} // namespace dom
} // namespace mozilla

View File

@ -4,8 +4,8 @@
* 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
#ifndef mozilla_ContentBlockingLog_h
#define mozilla_ContentBlockingLog_h
#include "mozilla/ContentBlockingNotifier.h"
#include "mozilla/JSONWriter.h"
@ -21,7 +21,6 @@
class nsIPrincipal;
namespace mozilla {
namespace dom {
class ContentBlockingLog final {
typedef ContentBlockingNotifier::StorageAccessGrantedReason
@ -426,7 +425,6 @@ class ContentBlockingLog final {
OriginDataTable mLog;
};
} // namespace dom
} // namespace mozilla
#endif

View File

@ -36,6 +36,7 @@ EXPORTS.mozilla = [
'AntiTrackingUtils.h',
'ContentBlocking.h',
'ContentBlockingAllowList.h',
'ContentBlockingLog.h',
'ContentBlockingNotifier.h',
'ContentBlockingUserInteraction.h',
'StorageAccess.h',
@ -48,6 +49,7 @@ UNIFIED_SOURCES += [
'AntiTrackingUtils.cpp',
'ContentBlocking.cpp',
'ContentBlockingAllowList.cpp',
'ContentBlockingLog.cpp',
'ContentBlockingNotifier.cpp',
'ContentBlockingUserInteraction.cpp',
'SettingsChangeObserver.cpp',

View File

@ -6,7 +6,7 @@
#include "core/TelemetryOrigin.h"
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "mozilla/dom/ContentBlockingLog.h"
#include "mozilla/ContentBlockingLog.h"
#include "mozilla/Services.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Unused.h"
@ -48,7 +48,7 @@ TEST_F(TelemetryTestFixture, RecordOrigin) {
Unused << mTelemetry->ClearOrigins();
Telemetry::RecordOrigin(OriginMetricID::TelemetryTest_Test1,
mozilla::dom::ContentBlockingLog::kDummyOriginHash);
mozilla::ContentBlockingLog::kDummyOriginHash);
JS::RootedValue originSnapshot(aCx);
GetOriginSnapshot(aCx, &originSnapshot);
@ -65,7 +65,7 @@ TEST_F(TelemetryTestFixture, RecordOrigin) {
JS::RootedObject originsObj(aCx, &origins.toObject());
JS::RootedValue count(aCx);
ASSERT_TRUE(JS_GetProperty(
aCx, originsObj, mozilla::dom::ContentBlockingLog::kDummyOriginHash.get(),
aCx, originsObj, mozilla::ContentBlockingLog::kDummyOriginHash.get(),
&count));
ASSERT_TRUE(count.isInt32() && count.toInt32() == 1)
<< "Must have recorded the origin exactly once.";