Bug 1491835 - Store User-Interaction for AntiTracking purposes - part 1 - nsIDocument::SetUserHasInteracted should not receive a parameter, r=ehsan

This commit is contained in:
Andrea Marchesini 2018-09-24 12:54:54 +02:00
Родитель 68a73ded70
Коммит 55aa7576b0
4 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -12622,20 +12622,22 @@ nsIDocument::ReportHasScrollLinkedEffect()
}
void
nsIDocument::SetUserHasInteracted(bool aUserHasInteracted)
nsIDocument::SetUserHasInteracted()
{
MOZ_LOG(gUserInteractionPRLog, LogLevel::Debug,
("Document %p has been interacted by user.", this));
mUserHasInteracted = aUserHasInteracted;
if (mUserHasInteracted) {
return;
}
mUserHasInteracted = true;
nsCOMPtr<nsILoadInfo> loadInfo = mChannel ? mChannel->GetLoadInfo() : nullptr;
if (loadInfo) {
loadInfo->SetDocumentHasUserInteracted(aUserHasInteracted);
loadInfo->SetDocumentHasUserInteracted(true);
}
if (aUserHasInteracted) {
MaybeAllowStorageForOpener();
}
MaybeAllowStorageForOpener();
}
void

Просмотреть файл

@ -3500,7 +3500,7 @@ public:
// Called to track whether this document has had any interaction.
// This is used to track whether we should permit "beforeunload".
void SetUserHasInteracted(bool aUserHasInteracted);
void SetUserHasInteracted();
bool UserHasInteracted()
{
return mUserHasInteracted;

Просмотреть файл

@ -505,7 +505,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
aEvent->mMessage == ePointerUp)) {
nsIDocument* doc = node->OwnerDoc();
while (doc && !doc->UserHasInteracted()) {
doc->SetUserHasInteracted(true);
doc->SetUserHasInteracted();
doc = nsContentUtils::IsChildOfSameType(doc) ?
doc->GetParentDocument() : nullptr;
}

Просмотреть файл

@ -3418,7 +3418,5 @@ nsHTMLDocument::GetFormsAndFormControls(nsContentList** aFormList,
void
nsHTMLDocument::UserInteractionForTesting()
{
if (!UserHasInteracted()) {
SetUserHasInteracted(true);
}
SetUserHasInteracted();
}