Bug 1708150 - Add user activation flag to reload, goBack and goForward r=ckerschb,Gijs,smaug
Differential Revision: https://phabricator.services.mozilla.com/D110245
This commit is contained in:
@@ -920,7 +920,7 @@ void CanonicalBrowsingContext::RemoveFromSessionHistory(const nsID& aChangeID) {
|
||||
|
||||
void CanonicalBrowsingContext::HistoryGo(
|
||||
int32_t aOffset, uint64_t aHistoryEpoch, bool aRequireUserInteraction,
|
||||
Maybe<ContentParentId> aContentId,
|
||||
bool aUserActivation, Maybe<ContentParentId> aContentId,
|
||||
std::function<void(int32_t&&)>&& aResolver) {
|
||||
if (aRequireUserInteraction && aOffset != -1 && aOffset != 1) {
|
||||
NS_ERROR(
|
||||
@@ -976,7 +976,8 @@ void CanonicalBrowsingContext::HistoryGo(
|
||||
|
||||
// GoToIndex checks that index is >= 0 and < length.
|
||||
nsTArray<nsSHistory::LoadEntryResult> loadResults;
|
||||
nsresult rv = shistory->GotoIndex(index.value(), loadResults, sameEpoch);
|
||||
nsresult rv = shistory->GotoIndex(index.value(), loadResults, sameEpoch,
|
||||
aUserActivation);
|
||||
if (NS_FAILED(rv)) {
|
||||
MOZ_LOG(gSHLog, LogLevel::Debug,
|
||||
("Dropping HistoryGo - bad index or same epoch (not in same doc)"));
|
||||
@@ -1110,7 +1111,7 @@ void CanonicalBrowsingContext::LoadURI(const nsAString& aURI,
|
||||
|
||||
void CanonicalBrowsingContext::GoBack(
|
||||
const Optional<int32_t>& aCancelContentJSEpoch,
|
||||
bool aRequireUserInteraction) {
|
||||
bool aRequireUserInteraction, bool aUserActivation) {
|
||||
if (IsDiscarded()) {
|
||||
return;
|
||||
}
|
||||
@@ -1124,19 +1125,19 @@ void CanonicalBrowsingContext::GoBack(
|
||||
if (aCancelContentJSEpoch.WasPassed()) {
|
||||
docShell->SetCancelContentJSEpoch(aCancelContentJSEpoch.Value());
|
||||
}
|
||||
docShell->GoBack(aRequireUserInteraction);
|
||||
docShell->GoBack(aRequireUserInteraction, aUserActivation);
|
||||
} else if (ContentParent* cp = GetContentParent()) {
|
||||
Maybe<int32_t> cancelContentJSEpoch;
|
||||
if (aCancelContentJSEpoch.WasPassed()) {
|
||||
cancelContentJSEpoch = Some(aCancelContentJSEpoch.Value());
|
||||
}
|
||||
Unused << cp->SendGoBack(this, cancelContentJSEpoch,
|
||||
aRequireUserInteraction);
|
||||
aRequireUserInteraction, aUserActivation);
|
||||
}
|
||||
}
|
||||
void CanonicalBrowsingContext::GoForward(
|
||||
const Optional<int32_t>& aCancelContentJSEpoch,
|
||||
bool aRequireUserInteraction) {
|
||||
bool aRequireUserInteraction, bool aUserActivation) {
|
||||
if (IsDiscarded()) {
|
||||
return;
|
||||
}
|
||||
@@ -1150,18 +1151,19 @@ void CanonicalBrowsingContext::GoForward(
|
||||
if (aCancelContentJSEpoch.WasPassed()) {
|
||||
docShell->SetCancelContentJSEpoch(aCancelContentJSEpoch.Value());
|
||||
}
|
||||
docShell->GoForward(aRequireUserInteraction);
|
||||
docShell->GoForward(aRequireUserInteraction, aUserActivation);
|
||||
} else if (ContentParent* cp = GetContentParent()) {
|
||||
Maybe<int32_t> cancelContentJSEpoch;
|
||||
if (aCancelContentJSEpoch.WasPassed()) {
|
||||
cancelContentJSEpoch.emplace(aCancelContentJSEpoch.Value());
|
||||
}
|
||||
Unused << cp->SendGoForward(this, cancelContentJSEpoch,
|
||||
aRequireUserInteraction);
|
||||
aRequireUserInteraction, aUserActivation);
|
||||
}
|
||||
}
|
||||
void CanonicalBrowsingContext::GoToIndex(
|
||||
int32_t aIndex, const Optional<int32_t>& aCancelContentJSEpoch) {
|
||||
int32_t aIndex, const Optional<int32_t>& aCancelContentJSEpoch,
|
||||
bool aUserActivation) {
|
||||
if (IsDiscarded()) {
|
||||
return;
|
||||
}
|
||||
@@ -1175,13 +1177,14 @@ void CanonicalBrowsingContext::GoToIndex(
|
||||
if (aCancelContentJSEpoch.WasPassed()) {
|
||||
docShell->SetCancelContentJSEpoch(aCancelContentJSEpoch.Value());
|
||||
}
|
||||
docShell->GotoIndex(aIndex);
|
||||
docShell->GotoIndex(aIndex, aUserActivation);
|
||||
} else if (ContentParent* cp = GetContentParent()) {
|
||||
Maybe<int32_t> cancelContentJSEpoch;
|
||||
if (aCancelContentJSEpoch.WasPassed()) {
|
||||
cancelContentJSEpoch.emplace(aCancelContentJSEpoch.Value());
|
||||
}
|
||||
Unused << cp->SendGoToIndex(this, aIndex, cancelContentJSEpoch);
|
||||
Unused << cp->SendGoToIndex(this, aIndex, cancelContentJSEpoch,
|
||||
aUserActivation);
|
||||
}
|
||||
}
|
||||
void CanonicalBrowsingContext::Reload(uint32_t aReloadFlags) {
|
||||
|
||||
Reference in New Issue
Block a user