Bug 1446568: Move the blocked tracking nodes methods to nsIDocument. r=smaug
MozReview-Commit-ID: LuvoFP8UyNg
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -5946,24 +5946,18 @@ nsIDocument::ResolveScheduledSVGPresAttr
{
for (auto iter = mLazySVGPresElements.Iter(); !iter.Done(); iter.Next()) {
nsSVGElement* svg = iter.Get()->GetKey();
svg->UpdateContentDeclarationBlock(StyleBackendType::Servo);
}
mLazySVGPresElements.Clear();
}
-long
-nsDocument::BlockedTrackingNodeCount() const
-{
- return mBlockedTrackingNodes.Length();
-}
-
already_AddRefed<nsSimpleContentList>
-nsDocument::BlockedTrackingNodes() const
+nsIDocument::BlockedTrackingNodes() const
{
RefPtr<nsSimpleContentList> list = new nsSimpleContentList(nullptr);
nsTArray<nsWeakPtr> blockedTrackingNodes;
blockedTrackingNodes = mBlockedTrackingNodes;
for (unsigned long i = 0; i < blockedTrackingNodes.Length(); i++) {
nsWeakPtr weakNode = blockedTrackingNodes[i];
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -287,42 +287,16 @@ public:
nsresult CloneDocHelper(nsDocument* clone, bool aPreallocateChildren) const;
void MaybeEndOutermostXBLUpdate();
// Only BlockOnload should call this!
void AsyncBlockOnload();
- // Returns the size of the mBlockedTrackingNodes array. (nsIDocument.h)
- //
- // This array contains nodes that have been blocked to prevent
- // user tracking. They most likely have had their nsIChannel
- // canceled by the URL classifier (Safebrowsing).
- //
- // A script can subsequently use GetBlockedTrackingNodes()
- // to get a list of references to these nodes.
- //
- // Note:
- // This expresses how many tracking nodes have been blocked for this
- // document since its beginning, not how many of them are still around
- // in the DOM tree. Weak references to blocked nodes are added in the
- // mBlockedTrackingNodesArray but they are not removed when those nodes
- // are removed from the tree or even garbage collected.
- long BlockedTrackingNodeCount() const;
-
- //
- // Returns strong references to mBlockedTrackingNodes. (nsIDocument.h)
- //
- // This array contains nodes that have been blocked to prevent
- // user tracking. They most likely have had their nsIChannel
- // canceled by the URL classifier (Safebrowsing).
- //
- already_AddRefed<nsSimpleContentList> BlockedTrackingNodes() const;
-
virtual void DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const override;
// DocAddSizeOfIncludingThis is inherited from nsIDocument.
virtual nsIDOMNode* AsDOMNode() override { return this; }
protected:
friend class nsNodeUtils;
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -1400,16 +1400,45 @@ public:
// Resolve all SVG pres attrs scheduled in ScheduleSVGForPresAttrEvaluation
void ResolveScheduledSVGPresAttrs();
mozilla::Maybe<mozilla::dom::ClientInfo> GetClientInfo() const;
mozilla::Maybe<mozilla::dom::ClientState> GetClientState() const;
mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor> GetController() const;
+ // Returns the size of the mBlockedTrackingNodes array.
+ //
+ // This array contains nodes that have been blocked to prevent
+ // user tracking. They most likely have had their nsIChannel
+ // canceled by the URL classifier (Safebrowsing).
+ //
+ // A script can subsequently use GetBlockedTrackingNodes()
+ // to get a list of references to these nodes.
+ //
+ // Note:
+ // This expresses how many tracking nodes have been blocked for this
+ // document since its beginning, not how many of them are still around
+ // in the DOM tree. Weak references to blocked nodes are added in the
+ // mBlockedTrackingNodesArray but they are not removed when those nodes
+ // are removed from the tree or even garbage collected.
+ long BlockedTrackingNodeCount() const
+ {
+ return mBlockedTrackingNodes.Length();
+ }
+
+ //
+ // Returns strong references to mBlockedTrackingNodes. (nsIDocument.h)
+ //
+ // This array contains nodes that have been blocked to prevent
+ // user tracking. They most likely have had their nsIChannel
+ // canceled by the URL classifier (Safebrowsing).
+ //
+ already_AddRefed<nsSimpleContentList> BlockedTrackingNodes() const;
+
protected:
void DispatchContentLoadedEvents();
void DispatchPageTransition(mozilla::dom::EventTarget* aDispatchTarget,
const nsAString& aType,
bool aPersisted);
// Call this before the document does something that will unbind all content.