Skip to content

Commit a48b346

Browse files
author
agoloman
committed
Revert "Bug 1968644 - Part 10: Store JSCallingLocation and set the JSCallingLocation fallback for Media loads. r=emilio" for causing valgrid failures.
This reverts commit efd9a5b. Revert "Bug 1968644 - Part 9: Add more tests for loads triggered by tracking scripts. r=valentin,anti-tracking-reviewers,emz" This reverts commit 7d5c3e1. Revert "Bug 1968644 - Part 8: Populate the triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags for WebSocket requests. r=valentin,necko-reviewers" This reverts commit 53a783a. Revert "Bug 1968644 - Part 7: Add tests. r=necko-reviewers,anti-tracking-reviewers,emz,valentin" This reverts commit e52f034. Revert "Bug 1968644 - Part 6: Populate triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags during channel creation. r=necko-reviewers,kershaw" This reverts commit f564c21. Revert "Bug 1968644 - Part 5: Populate triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags for CSS loads. r=emilio" This reverts commit 8a8fd7b. Revert "Bug 1968644 - Part 4: Populate triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags for loads. r=smaug,necko-reviewers" This reverts commit 7b3ba3b. Revert "Bug 1968644 - Part 3: Populate the triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags for fetch requests. r=valentin,smaug" This reverts commit 08f0902. Revert "Bug 1968644 - Part 2: Intorduce the ClassificationFlags to nsIClassifiedChannel.idl. r=dimi,necko-reviewers,valentin" This reverts commit b8c01cd. Revert "Bug 1968644 - Part 1: Introduce triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags to LoadInfo. r=necko-reviewers,kershaw" This reverts commit a7619a7.
1 parent f10ebf8 commit a48b346

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+75
-940
lines changed

docshell/base/nsDocShell.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
#include "nsICaptivePortalService.h"
108108
#include "nsIChannel.h"
109109
#include "nsIChannelEventSink.h"
110-
#include "nsIClassifiedChannel.h"
111110
#include "nsIClassOfService.h"
112111
#include "nsIConsoleReportCollector.h"
113112
#include "nsIContent.h"
@@ -4134,8 +4133,6 @@ nsresult nsDocShell::ReloadDocument(nsDocShell* aDocShell, Document* aDocument,
41344133
uint32_t triggeringSandboxFlags = aDocument->GetSandboxFlags();
41354134
uint64_t triggeringWindowId = aDocument->InnerWindowID();
41364135
bool triggeringStorageAccess = aDocument->UsingStorageAccess();
4137-
net::ClassificationFlags triggeringClassificationFlags =
4138-
aDocument->GetScriptTrackingFlags();
41394136

41404137
nsAutoString contentTypeHint;
41414138
aDocument->GetContentType(contentTypeHint);
@@ -4184,7 +4181,6 @@ nsresult nsDocShell::ReloadDocument(nsDocShell* aDocShell, Document* aDocument,
41844181
loadState->SetTriggeringSandboxFlags(triggeringSandboxFlags);
41854182
loadState->SetTriggeringWindowId(triggeringWindowId);
41864183
loadState->SetTriggeringStorageAccess(triggeringStorageAccess);
4187-
loadState->SetTriggeringClassificationFlags(triggeringClassificationFlags);
41884184
loadState->SetPrincipalToInherit(triggeringPrincipal);
41894185
loadState->SetCsp(csp);
41904186
loadState->SetInternalLoadFlags(flags);
@@ -5167,7 +5163,6 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
51675163
loadState->SetTriggeringSandboxFlags(doc->GetSandboxFlags());
51685164
loadState->SetTriggeringWindowId(doc->InnerWindowID());
51695165
loadState->SetTriggeringStorageAccess(doc->UsingStorageAccess());
5170-
loadState->SetTriggeringClassificationFlags(doc->GetScriptTrackingFlags());
51715166

51725167
loadState->SetPrincipalIsExplicit(true);
51735168

@@ -6775,19 +6770,6 @@ nsresult nsDocShell::CreateAboutBlankDocumentViewer(
67756770
// after being set here.
67766771
blankDoc->SetSandboxFlags(sandboxFlags);
67776772

6778-
// We inherit the classification flags from the parent document if the
6779-
// principal matches.
6780-
nsCOMPtr<nsIDocShellTreeItem> parentItem;
6781-
GetInProcessSameTypeParent(getter_AddRefs(parentItem));
6782-
if (parentItem) {
6783-
RefPtr<Document> parentDocument = parentItem->GetDocument();
6784-
if (parentDocument && principal &&
6785-
principal->Equals(parentDocument->NodePrincipal())) {
6786-
blankDoc->SetClassificationFlags(
6787-
parentDocument->GetClassificationFlags());
6788-
}
6789-
}
6790-
67916773
// create a content viewer for us and the new document
67926774
docFactory->CreateInstanceForDocument(
67936775
NS_ISUPPORTS_CAST(nsIDocShell*, this), blankDoc, "view",
@@ -7989,19 +7971,6 @@ nsresult nsDocShell::CreateDocumentViewer(const nsACString& aContentType,
79897971
nullptr, nullptr, nullptr, true, false);
79907972
}
79917973

7992-
// We inherit the classification flags from the parent document if the
7993-
// document is about:blank and the principal matches.
7994-
nsCOMPtr<nsIDocShellTreeItem> parentItem;
7995-
GetInProcessSameTypeParent(getter_AddRefs(parentItem));
7996-
if (parentItem && finalURI && NS_IsAboutBlank(finalURI)) {
7997-
RefPtr<Document> doc = viewer->GetDocument();
7998-
RefPtr<Document> parentDocument = parentItem->GetDocument();
7999-
if (parentDocument && doc &&
8000-
doc->NodePrincipal()->Equals(parentDocument->NodePrincipal())) {
8001-
doc->SetClassificationFlags(parentDocument->GetClassificationFlags());
8002-
}
8003-
}
8004-
80057974
// let's try resetting the load group if we need to...
80067975
nsCOMPtr<nsILoadGroup> currentLoadGroup;
80077976
NS_ENSURE_SUCCESS(
@@ -8604,8 +8573,6 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
86048573
loadState->SetTriggeringWindowId(aLoadState->TriggeringWindowId());
86058574
loadState->SetTriggeringStorageAccess(
86068575
aLoadState->TriggeringStorageAccess());
8607-
loadState->SetTriggeringClassificationFlags(
8608-
aLoadState->TriggeringClassificationFlags());
86098576
loadState->SetCsp(aLoadState->Csp());
86108577
loadState->SetInheritPrincipal(aLoadState->HasInternalLoadFlags(
86118578
INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL));
@@ -10808,9 +10775,6 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
1080810775
loadInfo->SetTriggeringWindowId(aLoadState->TriggeringWindowId());
1080910776
loadInfo->SetTriggeringStorageAccess(aLoadState->TriggeringStorageAccess());
1081010777
loadInfo->SetTriggeringSandboxFlags(aLoadState->TriggeringSandboxFlags());
10811-
net::ClassificationFlags flags = aLoadState->TriggeringClassificationFlags();
10812-
loadInfo->SetTriggeringFirstPartyClassificationFlags(flags.firstPartyFlags);
10813-
loadInfo->SetTriggeringThirdPartyClassificationFlags(flags.thirdPartyFlags);
1081410778
loadInfo->SetIsMetaRefresh(aLoadState->IsMetaRefresh());
1081510779

1081610780
uint32_t cacheKey = 0;
@@ -13275,8 +13239,6 @@ nsresult nsDocShell::OnLinkClick(
1327513239
ownerDoc->ConsumeTextDirectiveUserActivation() ||
1327613240
hasValidUserGestureActivation);
1327713241
loadState->SetUserNavigationInvolvement(aUserInvolvement);
13278-
loadState->SetTriggeringClassificationFlags(
13279-
ownerDoc->GetScriptTrackingFlags());
1328013242

1328113243
nsCOMPtr<nsIRunnable> ev = new OnLinkClickEvent(
1328213244
this, aContent, loadState, noOpenerImplied, aTriggeringPrincipal);

docshell/base/nsDocShellLoadState.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ nsDocShellLoadState::nsDocShellLoadState(
9393
mTriggeringSandboxFlags = aLoadState.TriggeringSandboxFlags();
9494
mTriggeringWindowId = aLoadState.TriggeringWindowId();
9595
mTriggeringStorageAccess = aLoadState.TriggeringStorageAccess();
96-
mTriggeringClassificationFlags = aLoadState.TriggeringClassificationFlags();
9796
mTriggeringRemoteType = aLoadState.TriggeringRemoteType();
9897
mSchemelessInput = aLoadState.SchemelessInput();
9998
mHttpsUpgradeTelemetry = aLoadState.HttpsUpgradeTelemetry();
@@ -162,7 +161,6 @@ nsDocShellLoadState::nsDocShellLoadState(const nsDocShellLoadState& aOther)
162161
mTriggeringSandboxFlags(aOther.mTriggeringSandboxFlags),
163162
mTriggeringWindowId(aOther.mTriggeringWindowId),
164163
mTriggeringStorageAccess(aOther.mTriggeringStorageAccess),
165-
mTriggeringClassificationFlags(aOther.mTriggeringClassificationFlags),
166164
mCsp(aOther.mCsp),
167165
mKeepResultPrincipalURIIfSet(aOther.mKeepResultPrincipalURIIfSet),
168166
mLoadReplace(aOther.mLoadReplace),
@@ -224,7 +222,6 @@ nsDocShellLoadState::nsDocShellLoadState(nsIURI* aURI, uint64_t aLoadIdentifier)
224222
mTriggeringSandboxFlags(0),
225223
mTriggeringWindowId(0),
226224
mTriggeringStorageAccess(false),
227-
mTriggeringClassificationFlags({0, 0}),
228225
mKeepResultPrincipalURIIfSet(false),
229226
mLoadReplace(false),
230227
mInheritPrincipal(false),
@@ -483,9 +480,6 @@ nsresult nsDocShellLoadState::CreateFromLoadURIOptions(
483480
loadState->SetTriggeringWindowId(aLoadURIOptions.mTriggeringWindowId);
484481
loadState->SetTriggeringStorageAccess(
485482
aLoadURIOptions.mTriggeringStorageAccess);
486-
// The load is assumed to be first-party, so the triggering classification
487-
// should be both zero.
488-
loadState->SetTriggeringClassificationFlags({0, 0});
489483
loadState->SetPostDataStream(postData);
490484
loadState->SetHeadersStream(aLoadURIOptions.mHeaders);
491485
loadState->SetBaseURI(aLoadURIOptions.mBaseURI);
@@ -625,16 +619,6 @@ bool nsDocShellLoadState::TriggeringStorageAccess() const {
625619
return mTriggeringStorageAccess;
626620
}
627621

628-
mozilla::net::ClassificationFlags
629-
nsDocShellLoadState::TriggeringClassificationFlags() const {
630-
return mTriggeringClassificationFlags;
631-
}
632-
633-
void nsDocShellLoadState::SetTriggeringClassificationFlags(
634-
mozilla::net::ClassificationFlags aFlags) {
635-
mTriggeringClassificationFlags = aFlags;
636-
}
637-
638622
bool nsDocShellLoadState::InheritPrincipal() const { return mInheritPrincipal; }
639623

640624
void nsDocShellLoadState::SetInheritPrincipal(bool aInheritPrincipal) {
@@ -1380,7 +1364,6 @@ DocShellLoadStateInit nsDocShellLoadState::Serialize(
13801364
loadState.TriggeringSandboxFlags() = mTriggeringSandboxFlags;
13811365
loadState.TriggeringWindowId() = mTriggeringWindowId;
13821366
loadState.TriggeringStorageAccess() = mTriggeringStorageAccess;
1383-
loadState.TriggeringClassificationFlags() = mTriggeringClassificationFlags;
13841367
loadState.TriggeringRemoteType() = mTriggeringRemoteType;
13851368
loadState.SchemelessInput() = mSchemelessInput;
13861369
loadState.HttpsUpgradeTelemetry() = mHttpsUpgradeTelemetry;

docshell/base/nsDocShellLoadState.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "mozilla/dom/SessionHistoryEntry.h"
1313
#include "mozilla/dom/UserNavigationInvolvement.h"
1414

15-
#include "nsIClassifiedChannel.h"
1615
#include "nsILoadInfo.h"
1716

1817
// Helper Classes
@@ -128,10 +127,6 @@ class nsDocShellLoadState final {
128127

129128
void SetTriggeringStorageAccess(bool aTriggeringStorageAccess);
130129

131-
mozilla::net::ClassificationFlags TriggeringClassificationFlags() const;
132-
void SetTriggeringClassificationFlags(
133-
mozilla::net::ClassificationFlags aFlags);
134-
135130
nsIContentSecurityPolicy* Csp() const;
136131

137132
void SetCsp(nsIContentSecurityPolicy* aCsp);
@@ -489,10 +484,6 @@ class nsDocShellLoadState final {
489484
uint64_t mTriggeringWindowId;
490485
bool mTriggeringStorageAccess;
491486

492-
// The classification flags of the context responsible for causing
493-
// the load to start.
494-
mozilla::net::ClassificationFlags mTriggeringClassificationFlags;
495-
496487
// The CSP of the load, that is, the CSP of the entity responsible for causing
497488
// the load to occur. Most likely this is the CSP of the document that started
498489
// the load. In case the entity starting the load did not use a CSP, then mCsp

dom/base/Document.cpp

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@
342342
#include "nsICSSLoaderObserver.h"
343343
#include "nsICategoryManager.h"
344344
#include "nsICertOverrideService.h"
345-
#include "nsIClassifiedChannel.h"
346345
#include "nsIContent.h"
347346
#include "nsIContentInlines.h"
348347
#include "nsIContentPolicy.h"
@@ -1507,7 +1506,6 @@ Document::Document(const char* aContentType)
15071506
mThrowOnDynamicMarkupInsertionCounter(0),
15081507
mIgnoreOpensDuringUnloadCounter(0),
15091508
mSavedResolution(1.0f),
1510-
mClassificationFlags({0, 0}),
15111509
mGeneration(0),
15121510
mCachedTabSizeGeneration(0),
15131511
mNextFormNumber(0),
@@ -3671,15 +3669,6 @@ nsresult Document::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
36713669
WarnIfSandboxIneffective(docShell, mSandboxFlags, GetChannel());
36723670
}
36733671

3674-
nsCOMPtr<nsIClassifiedChannel> classifiedChannel =
3675-
do_QueryInterface(aChannel);
3676-
3677-
if (classifiedChannel) {
3678-
mClassificationFlags = {
3679-
classifiedChannel->GetFirstPartyClassificationFlags(),
3680-
classifiedChannel->GetThirdPartyClassificationFlags()};
3681-
}
3682-
36833672
// Set the opener policy for the top level content document.
36843673
nsCOMPtr<nsIHttpChannelInternal> httpChan = do_QueryInterface(mChannel);
36853674
nsILoadInfo::CrossOriginOpenerPolicy policy =
@@ -4538,10 +4527,9 @@ nsresult Document::Dispatch(already_AddRefed<nsIRunnable>&& aRunnable) const {
45384527
}
45394528

45404529
void Document::NoteScriptTrackingStatus(const nsACString& aURL,
4541-
net::ClassificationFlags& aFlags) {
4542-
// If the script is not tracking, we don't need to do anything.
4543-
if (aFlags.firstPartyFlags || aFlags.thirdPartyFlags) {
4544-
mTrackingScripts.InsertOrUpdate(aURL, aFlags);
4530+
bool aIsTracking) {
4531+
if (aIsTracking) {
4532+
mTrackingScripts.Insert(aURL);
45454533
}
45464534
// Ideally, whether a given script is tracking or not should be consistent,
45474535
// but there is a race so that it is not, when loading real sites in debug
@@ -4554,27 +4542,7 @@ bool Document::IsScriptTracking(JSContext* aCx) const {
45544542
if (!JS::DescribeScriptedCaller(&filename, aCx)) {
45554543
return false;
45564544
}
4557-
4558-
auto entry = mTrackingScripts.Lookup(nsDependentCString(filename.get()));
4559-
if (!entry) {
4560-
return false;
4561-
}
4562-
4563-
return net::UrlClassifierCommon::IsTrackingClassificationFlag(
4564-
entry.Data().thirdPartyFlags, IsInPrivateBrowsing());
4565-
}
4566-
4567-
net::ClassificationFlags Document::GetScriptTrackingFlags() const {
4568-
if (auto loc = JSCallingLocation::Get()) {
4569-
if (auto entry = mTrackingScripts.Lookup(loc.FileName())) {
4570-
return entry.Data();
4571-
}
4572-
}
4573-
4574-
// If the currently executing script is not a tracker, return the
4575-
// classification flags of the document.
4576-
4577-
return mClassificationFlags;
4545+
return mTrackingScripts.Contains(nsDependentCString(filename.get()));
45784546
}
45794547

45804548
void Document::GetContentType(nsAString& aContentType) {

dom/base/Document.h

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
#include "nsHashKeys.h"
7272
#include "nsIChannel.h"
7373
#include "nsIChannelEventSink.h"
74-
#include "nsIClassifiedChannel.h"
7574
#include "nsID.h"
7675
#include "nsIDocumentViewer.h"
7776
#include "nsIInterfaceRequestor.h"
@@ -3889,24 +3888,11 @@ class Document : public nsINode,
38893888
// The URLs passed to this function should match what
38903889
// JS::DescribeScriptedCaller() returns, since this API is used to
38913890
// determine whether some code is being called from a tracking script.
3892-
void NoteScriptTrackingStatus(const nsACString& aURL,
3893-
net::ClassificationFlags& aFlags);
3891+
void NoteScriptTrackingStatus(const nsACString& aURL, bool isTracking);
38943892
// The JSContext passed to this method represents the context that we want to
38953893
// determine if it belongs to a tracker.
38963894
bool IsScriptTracking(JSContext* aCx) const;
38973895

3898-
// Acquires the script tracking flags for the currently executing script. If
3899-
// the currently executing script is not a tracker, it will return the
3900-
// classification flags of the document.
3901-
net::ClassificationFlags GetScriptTrackingFlags() const;
3902-
3903-
net::ClassificationFlags GetClassificationFlags() {
3904-
return mClassificationFlags;
3905-
}
3906-
void SetClassificationFlags(net::ClassificationFlags aFlags) {
3907-
mClassificationFlags = aFlags;
3908-
}
3909-
39103896
// ResizeObserver usage.
39113897
void AddResizeObserver(ResizeObserver& aObserver) {
39123898
MOZ_ASSERT(!mResizeObservers.Contains(&aObserver));
@@ -5313,10 +5299,10 @@ class Document : public nsINode,
53135299

53145300
RefPtr<nsCommandManager> mMidasCommandManager;
53155301

5316-
// The hashmap of all the tracking script URLs. URLs are added to this map by
5302+
// The set of all the tracking script URLs. URLs are added to this set by
53175303
// calling NoteScriptTrackingStatus(). Currently we assume that a URL not
5318-
// existing in the map means the corresponding script isn't a tracking script.
5319-
nsTHashMap<nsCStringHashKey, net::ClassificationFlags> mTrackingScripts;
5304+
// existing in the set means the corresponding script isn't a tracking script.
5305+
nsTHashSet<nsCString> mTrackingScripts;
53205306

53215307
// Pointer to our parser if we're currently in the process of being
53225308
// parsed into.
@@ -5546,8 +5532,6 @@ class Document : public nsINode,
55465532

55475533
bool mHasStoragePermission;
55485534

5549-
net::ClassificationFlags mClassificationFlags;
5550-
55515535
// Document generation. Gets incremented everytime it changes.
55525536
int32_t mGeneration;
55535537

dom/base/LocationBase.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "mozilla/dom/LocationBase.h"
88
#include "nsIScriptSecurityManager.h"
99
#include "nsIScriptContext.h"
10-
#include "nsIClassifiedChannel.h"
1110
#include "nsDocShellLoadState.h"
1211
#include "nsIWebNavigation.h"
1312
#include "nsNetUtil.h"
@@ -114,7 +113,6 @@ already_AddRefed<nsDocShellLoadState> LocationBase::CheckURL(
114113
loadState->HasValidUserGestureActivation());
115114
loadState->SetTriggeringWindowId(doc->InnerWindowID());
116115
loadState->SetTriggeringStorageAccess(doc->UsingStorageAccess());
117-
loadState->SetTriggeringClassificationFlags(doc->GetScriptTrackingFlags());
118116

119117
return loadState.forget();
120118
}

dom/base/nsFrameLoader.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,6 @@ nsresult nsFrameLoader::ReallyStartLoadingInternal() {
715715
if (ownerDoc) {
716716
loadState->SetTriggeringStorageAccess(ownerDoc->UsingStorageAccess());
717717
loadState->SetTriggeringWindowId(ownerDoc->InnerWindowID());
718-
loadState->SetTriggeringClassificationFlags(
719-
ownerDoc->GetScriptTrackingFlags());
720718
}
721719

722720
// If we're loading the default about:blank document in a <browser> element,

0 commit comments

Comments
 (0)