Bug 1520912 - remove 'mUserGestureActivated' from Document. r=nika
authoralwu <alwu@mozilla.com>
Fri, 18 Jan 2019 02:41:15 +0000
changeset 514368 f34a165f5aff3b051da1b06fd768fcb74200988a
parent 514367 a15dd0f8abd30f7d78faaa9596533f2cd950788e
child 514369 fd6b8be34aed51a18d91261abeb586bbbf350e50
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1520912
milestone66.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 1520912 - remove 'mUserGestureActivated' from Document. r=nika We've changed the way to set `userGestureActivation` flag which will be set in `BrowsingContext`, so we should remove `mUserGestureActivated` flag from Document. Differential Revision: https://phabricator.services.mozilla.com/D16900
dom/base/Document.cpp
dom/base/Document.h
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -1318,17 +1318,16 @@ Document::Document(const char* aContentT
       mBFCacheEntry(nullptr),
       mInSyncOperationCount(0),
       mBlockDOMContentLoaded(0),
       mUseCounters(0),
       mChildDocumentUseCounters(0),
       mNotifiedPageForUseCounter(0),
       mUserHasInteracted(false),
       mHasUserInteractionTimerScheduled(false),
-      mUserGestureActivated(false),
       mStackRefCnt(0),
       mUpdateNestLevel(0),
       mViewportType(Unknown),
       mViewportOverflowType(ViewportOverflowType::NoOverflow),
       mSubDocuments(nullptr),
       mHeaderData(nullptr),
       mFlashClassification(FlashClassification::Unknown),
       mScrollAnchorAdjustmentLength(0),
@@ -11712,23 +11711,24 @@ void Document::MaybeNotifyAutoplayBlocke
   // so front-end side should show blocking icon as well.
   RefPtr<AsyncEventDispatcher> asyncDispatcher = new AsyncEventDispatcher(
       topLevelDoc, NS_LITERAL_STRING("GloballyAutoplayBlocked"),
       CanBubble::eYes, ChromeOnlyDispatch::eYes);
   asyncDispatcher->PostDOMEvent();
 }
 
 void Document::ClearUserGestureActivation() {
-  Document* doc = this;
-  while (doc) {
-    MOZ_LOG(gUserInteractionPRLog, LogLevel::Debug,
-            ("Reset user activation flag for document %p.", this));
-    doc->mUserGestureActivated = false;
-    doc = doc->GetSameTypeParentDocument();
-  }
+  if (!HasBeenUserGestureActivated()) {
+    return;
+  }
+  RefPtr<BrowsingContext> bc = GetBrowsingContext();
+  if (!bc) {
+    return;
+  }
+  bc->NotifyResetUserGestureActivation();
 }
 
 void Document::SetDocTreeHadAudibleMedia() {
   Document* topLevelDoc = GetTopLevelContentDocument();
   if (!topLevelDoc) {
     return;
   }
 
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -4245,23 +4245,16 @@ class Document : public nsINode,
   // Whether the user has interacted with the document or not:
   bool mUserHasInteracted;
 
   // We constantly update the user-interaction anti-tracking permission at any
   // user-interaction using a timer. This boolean value is set to true when this
   // timer is scheduled.
   bool mHasUserInteractionTimerScheduled;
 
-  // Whether the user has interacted with the document via a restricted
-  // set of gestures which are likely to be interaction with the document,
-  // and not events that are fired as a byproduct of the user interacting
-  // with the browser (events for like scrolling the page, keyboard short
-  // cuts, etc).
-  bool mUserGestureActivated;
-
   mozilla::TimeStamp mPageUnloadingEventTimeStamp;
 
   RefPtr<mozilla::dom::DocGroup> mDocGroup;
 
   // The set of all the tracking script URLs.  URLs are added to this set by
   // calling NoteScriptTrackingStatus().  Currently we assume that a URL not
   // existing in the set means the corresponding script isn't a tracking script.
   nsTHashtable<nsCStringHashKey> mTrackingScripts;