Backed out changeset b94afd94ed9c (bug 1924861) for causing multiple bc failures. CLOSED TREE
This commit is contained in:
@@ -2524,8 +2524,10 @@ function FillHistoryMenu(event) {
|
|||||||
if (
|
if (
|
||||||
BrowserUtils.navigationRequireUserInteraction &&
|
BrowserUtils.navigationRequireUserInteraction &&
|
||||||
entry.hasUserInteraction === false &&
|
entry.hasUserInteraction === false &&
|
||||||
// Always list the current and last navigation points.
|
// Always allow going to the first and last navigation points.
|
||||||
j != end - 1 &&
|
j != end - 1 &&
|
||||||
|
j != start &&
|
||||||
|
// Always display the current entry
|
||||||
j != index
|
j != index
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ add_task(async function checkReturnToAboutHome() {
|
|||||||
for (let useFrame of [false, true]) {
|
for (let useFrame of [false, true]) {
|
||||||
let tab = await openErrorPage(BAD_CERT, useFrame);
|
let tab = await openErrorPage(BAD_CERT, useFrame);
|
||||||
let browser = tab.linkedBrowser;
|
let browser = tab.linkedBrowser;
|
||||||
await SpecialPowers.spawn(browser, [], () => {
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
|
|
||||||
is(browser.webNavigation.canGoBack, false, "!webNavigation.canGoBack");
|
is(browser.webNavigation.canGoBack, false, "!webNavigation.canGoBack");
|
||||||
is(
|
is(
|
||||||
@@ -86,9 +83,6 @@ add_task(async function checkReturnToPreviousPage() {
|
|||||||
if (useFrame) {
|
if (useFrame) {
|
||||||
tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, GOOD_PAGE);
|
tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, GOOD_PAGE);
|
||||||
browser = tab.linkedBrowser;
|
browser = tab.linkedBrowser;
|
||||||
await SpecialPowers.spawn(browser, [], () => {
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
|
|
||||||
BrowserTestUtils.startLoadingURIString(browser, GOOD_PAGE_2);
|
BrowserTestUtils.startLoadingURIString(browser, GOOD_PAGE_2);
|
||||||
await BrowserTestUtils.browserLoaded(browser, false, GOOD_PAGE_2);
|
await BrowserTestUtils.browserLoaded(browser, false, GOOD_PAGE_2);
|
||||||
@@ -96,9 +90,6 @@ add_task(async function checkReturnToPreviousPage() {
|
|||||||
} else {
|
} else {
|
||||||
tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, GOOD_PAGE);
|
tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, GOOD_PAGE);
|
||||||
browser = gBrowser.selectedBrowser;
|
browser = gBrowser.selectedBrowser;
|
||||||
await SpecialPowers.spawn(browser, [], () => {
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
|
|
||||||
info("Loading and waiting for the cert error");
|
info("Loading and waiting for the cert error");
|
||||||
let certErrorLoaded = BrowserTestUtils.waitForErrorPage(browser);
|
let certErrorLoaded = BrowserTestUtils.waitForErrorPage(browser);
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ add_task(async function () {
|
|||||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, firstLocation);
|
await BrowserTestUtils.openNewForegroundTab(gBrowser, firstLocation);
|
||||||
|
|
||||||
await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function () {
|
await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function () {
|
||||||
// Mark the first entry as having been interacted with.
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
|
|
||||||
// Push the state before maximizing the window and clicking below.
|
// Push the state before maximizing the window and clicking below.
|
||||||
content.history.pushState("page2", "page2", "page2");
|
content.history.pushState("page2", "page2", "page2");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ add_task(async function () {
|
|||||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com");
|
await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com");
|
||||||
|
|
||||||
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () {
|
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () {
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
content.history.pushState({}, "2", "2.html");
|
content.history.pushState({}, "2", "2.html");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,6 @@ add_task(async function checkBackFromInvalidURI() {
|
|||||||
"about:robots",
|
"about:robots",
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function () {
|
|
||||||
// Mark the first entry as having been interacted with.
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
|
|
||||||
info("Loaded about:robots");
|
info("Loaded about:robots");
|
||||||
|
|
||||||
gURLBar.value = "::2600";
|
gURLBar.value = "::2600";
|
||||||
|
|||||||
@@ -36,12 +36,8 @@ for (let itemsToClear of prefs) {
|
|||||||
|
|
||||||
await SpecialPowers.spawn(browser, [], async function () {
|
await SpecialPowers.spawn(browser, [], async function () {
|
||||||
let startHistory = content.history.length;
|
let startHistory = content.history.length;
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
content.history.pushState({}, "");
|
content.history.pushState({}, "");
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
content.history.pushState({}, "");
|
content.history.pushState({}, "");
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
|
|
||||||
content.history.back();
|
content.history.back();
|
||||||
await new Promise(function (r) {
|
await new Promise(function (r) {
|
||||||
content.onpopstate = r;
|
content.onpopstate = r;
|
||||||
|
|||||||
@@ -254,11 +254,6 @@ add_task(async function test_aboutwelcome_addonspicker() {
|
|||||||
["button[data-l10n-id='btn-1-install']"]
|
["button[data-l10n-id='btn-1-install']"]
|
||||||
);
|
);
|
||||||
|
|
||||||
// Mark the first entry as having been interacted with.
|
|
||||||
SpecialPowers.spawn(browser, [], () => {
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Navigate to the next screen to test state on forward/back navigation
|
// Navigate to the next screen to test state on forward/back navigation
|
||||||
await clickVisibleButton(browser, "button[value='secondary_button']");
|
await clickVisibleButton(browser, "button[value='secondary_button']");
|
||||||
// Update the message stub to reflect the addon install
|
// Update the message stub to reflect the addon install
|
||||||
|
|||||||
@@ -159,10 +159,6 @@ async function openAboutWelcome() {
|
|||||||
"about:welcome",
|
"about:welcome",
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function () {
|
|
||||||
// Mark the first entry as having been interacted with.
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
registerCleanupFunction(() => {
|
registerCleanupFunction(() => {
|
||||||
BrowserTestUtils.removeTab(tab);
|
BrowserTestUtils.removeTab(tab);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -39,10 +39,6 @@ async function openMRAboutWelcome() {
|
|||||||
"about:welcome",
|
"about:welcome",
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function () {
|
|
||||||
// Mark the first entry as having been interacted with.
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
browser: tab.linkedBrowser,
|
browser: tab.linkedBrowser,
|
||||||
|
|||||||
@@ -23,11 +23,8 @@ async function createPrivateWindow() {
|
|||||||
privateWindow.gBrowser.selectedBrowser,
|
privateWindow.gBrowser.selectedBrowser,
|
||||||
[],
|
[],
|
||||||
async function () {
|
async function () {
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
content.history.pushState({}, "first item", "first-item.html");
|
content.history.pushState({}, "first item", "first-item.html");
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
content.history.pushState({}, "second item", "second-item.html");
|
content.history.pushState({}, "second item", "second-item.html");
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
content.history.pushState({}, "third item", "third-item.html");
|
content.history.pushState({}, "third item", "third-item.html");
|
||||||
content.history.back();
|
content.history.back();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,10 +157,6 @@ add_task(async function test_navigation_via_back_button() {
|
|||||||
false,
|
false,
|
||||||
serpUrl
|
serpUrl
|
||||||
);
|
);
|
||||||
await SpecialPowers.spawn(browser, [], () => {
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
|
|
||||||
BrowserTestUtils.startLoadingURIString(browser, serpUrl);
|
BrowserTestUtils.startLoadingURIString(browser, serpUrl);
|
||||||
await pageLoadPromise;
|
await pageLoadPromise;
|
||||||
info("Serp is now loaded.");
|
info("Serp is now loaded.");
|
||||||
|
|||||||
@@ -186,11 +186,6 @@ async function test_scroll_background_tabs(aURL) {
|
|||||||
let browser = tab.linkedBrowser;
|
let browser = tab.linkedBrowser;
|
||||||
await BrowserTestUtils.browserLoaded(browser);
|
await BrowserTestUtils.browserLoaded(browser);
|
||||||
|
|
||||||
// Add user interaction to the first entry.
|
|
||||||
await SpecialPowers.spawn(browser, [], () => {
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Scroll down a little.
|
// Scroll down a little.
|
||||||
await setScrollPosition(browser, SCROLL_X, SCROLL_Y);
|
await setScrollPosition(browser, SCROLL_X, SCROLL_Y);
|
||||||
await checkScroll(
|
await checkScroll(
|
||||||
|
|||||||
@@ -137,7 +137,6 @@ add_task(async function test_subframes() {
|
|||||||
|
|
||||||
// Navigate the subframe.
|
// Navigate the subframe.
|
||||||
await SpecialPowers.spawn(browser, [], async function () {
|
await SpecialPowers.spawn(browser, [], async function () {
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
content.document.querySelector("#a1").click();
|
content.document.querySelector("#a1").click();
|
||||||
});
|
});
|
||||||
await promiseBrowserLoaded(
|
await promiseBrowserLoaded(
|
||||||
|
|||||||
@@ -585,10 +585,6 @@
|
|||||||
return this.selectedBrowser.canGoBack;
|
return this.selectedBrowser.canGoBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
get canGoBackIgnoringUserInteraction() {
|
|
||||||
return this.selectedBrowser.canGoBackIgnoringUserInteraction;
|
|
||||||
}
|
|
||||||
|
|
||||||
get canGoForward() {
|
get canGoForward() {
|
||||||
return this.selectedBrowser.canGoForward;
|
return this.selectedBrowser.canGoForward;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ async function navigateTo(browser, urls, expectedPersist) {
|
|||||||
"pageshow"
|
"pageshow"
|
||||||
);
|
);
|
||||||
info(`Navigating back from uri=${browser.currentURI.spec}`);
|
info(`Navigating back from uri=${browser.currentURI.spec}`);
|
||||||
browser.goBack(false);
|
browser.goBack();
|
||||||
await pageShowPromise;
|
await pageShowPromise;
|
||||||
info(`Got pageshow event`);
|
info(`Got pageshow event`);
|
||||||
// Now go forward
|
// Now go forward
|
||||||
@@ -71,7 +71,7 @@ async function navigateTo(browser, urls, expectedPersist) {
|
|||||||
pageShowCheck
|
pageShowCheck
|
||||||
);
|
);
|
||||||
info(`Navigating back from uri=${browser.currentURI.spec}`);
|
info(`Navigating back from uri=${browser.currentURI.spec}`);
|
||||||
browser.goBack(false);
|
browser.goBack();
|
||||||
await pageShowPromise;
|
await pageShowPromise;
|
||||||
info(`Got pageshow event`);
|
info(`Got pageshow event`);
|
||||||
// Check that the page did not get persisted
|
// Check that the page did not get persisted
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ add_task(async function tabhistory_searchmode_non_default() {
|
|||||||
|
|
||||||
info(`Go back to ${expectedSearchUrl}`);
|
info(`Go back to ${expectedSearchUrl}`);
|
||||||
promise = BrowserTestUtils.waitForContentEvent(tab.linkedBrowser, "pageshow");
|
promise = BrowserTestUtils.waitForContentEvent(tab.linkedBrowser, "pageshow");
|
||||||
gBrowser.goBack(false);
|
gBrowser.goBack();
|
||||||
await promise;
|
await promise;
|
||||||
|
|
||||||
await TestUtils.waitForCondition(
|
await TestUtils.waitForCondition(
|
||||||
@@ -263,7 +263,7 @@ add_task(async function tabhistory_searchmode_default_engine() {
|
|||||||
tab.linkedBrowser,
|
tab.linkedBrowser,
|
||||||
"pageshow"
|
"pageshow"
|
||||||
);
|
);
|
||||||
gBrowser.goBack(false);
|
gBrowser.goBack();
|
||||||
await promise;
|
await promise;
|
||||||
|
|
||||||
await TestUtils.waitForCondition(
|
await TestUtils.waitForCondition(
|
||||||
@@ -275,7 +275,7 @@ add_task(async function tabhistory_searchmode_default_engine() {
|
|||||||
|
|
||||||
info(`Go forward to ${searchModeUrl}`);
|
info(`Go forward to ${searchModeUrl}`);
|
||||||
promise = BrowserTestUtils.waitForContentEvent(tab.linkedBrowser, "pageshow");
|
promise = BrowserTestUtils.waitForContentEvent(tab.linkedBrowser, "pageshow");
|
||||||
gBrowser.goForward(false);
|
gBrowser.goForward();
|
||||||
await promise;
|
await promise;
|
||||||
|
|
||||||
await TestUtils.waitForCondition(
|
await TestUtils.waitForCondition(
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ add_task(async function tabhistory() {
|
|||||||
tab.linkedBrowser,
|
tab.linkedBrowser,
|
||||||
"pageshow"
|
"pageshow"
|
||||||
);
|
);
|
||||||
tab.linkedBrowser.goBack(false);
|
tab.linkedBrowser.goBack();
|
||||||
await pageShowPromise;
|
await pageShowPromise;
|
||||||
|
|
||||||
scalars = TelemetryTestUtils.getProcessScalars("parent", false, true);
|
scalars = TelemetryTestUtils.getProcessScalars("parent", false, true);
|
||||||
|
|||||||
@@ -1223,6 +1223,14 @@ void CanonicalBrowsingContext::SetActiveSessionHistoryEntry(
|
|||||||
mActiveEntry->SharedInfo()->mCacheKey = aUpdatedCacheKey;
|
mActiveEntry->SharedInfo()->mCacheKey = aUpdatedCacheKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oldActiveEntry) {
|
||||||
|
// aInfo comes from the entry stored in the current document's docshell,
|
||||||
|
// whose interaction state does not get updated. So we instead propagate
|
||||||
|
// state from the previous canonical entry. See bug 1917369.
|
||||||
|
mActiveEntry->SetHasUserInteraction(
|
||||||
|
oldActiveEntry->GetHasUserInteraction());
|
||||||
|
}
|
||||||
|
|
||||||
if (IsTop()) {
|
if (IsTop()) {
|
||||||
Maybe<int32_t> previousEntryIndex, loadedEntryIndex;
|
Maybe<int32_t> previousEntryIndex, loadedEntryIndex;
|
||||||
shistory->AddToRootSessionHistory(
|
shistory->AddToRootSessionHistory(
|
||||||
|
|||||||
@@ -3075,8 +3075,7 @@ nsDocShell::GetCanGoBack(bool* aCanGoBack) {
|
|||||||
}
|
}
|
||||||
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
|
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
|
||||||
if (rootSH) {
|
if (rootSH) {
|
||||||
*aCanGoBack = rootSH->CanGo(
|
*aCanGoBack = rootSH->CanGo(-1);
|
||||||
-1, StaticPrefs::browser_navigation_requireUserInteraction());
|
|
||||||
MOZ_LOG(gSHLog, LogLevel::Verbose,
|
MOZ_LOG(gSHLog, LogLevel::Verbose,
|
||||||
("nsDocShell %p CanGoBack()->%d", this, *aCanGoBack));
|
("nsDocShell %p CanGoBack()->%d", this, *aCanGoBack));
|
||||||
|
|
||||||
@@ -3085,24 +3084,6 @@ nsDocShell::GetCanGoBack(bool* aCanGoBack) {
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDocShell::GetCanGoBackIgnoringUserInteraction(bool* aCanGoBack) {
|
|
||||||
*aCanGoBack = false;
|
|
||||||
if (!IsNavigationAllowed(false)) {
|
|
||||||
return NS_OK; // JS may not handle returning of an error code
|
|
||||||
}
|
|
||||||
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
|
|
||||||
if (rootSH) {
|
|
||||||
*aCanGoBack = rootSH->CanGo(-1, false);
|
|
||||||
MOZ_LOG(gSHLog, LogLevel::Verbose,
|
|
||||||
("nsDocShell %p CanGoBackIgnoringUserInteraction()->%d", this,
|
|
||||||
*aCanGoBack));
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::GetCanGoForward(bool* aCanGoForward) {
|
nsDocShell::GetCanGoForward(bool* aCanGoForward) {
|
||||||
*aCanGoForward = false;
|
*aCanGoForward = false;
|
||||||
@@ -3111,8 +3092,7 @@ nsDocShell::GetCanGoForward(bool* aCanGoForward) {
|
|||||||
}
|
}
|
||||||
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
|
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
|
||||||
if (rootSH) {
|
if (rootSH) {
|
||||||
*aCanGoForward = rootSH->CanGo(
|
*aCanGoForward = rootSH->CanGo(1);
|
||||||
1, StaticPrefs::browser_navigation_requireUserInteraction());
|
|
||||||
MOZ_LOG(gSHLog, LogLevel::Verbose,
|
MOZ_LOG(gSHLog, LogLevel::Verbose,
|
||||||
("nsDocShell %p CanGoForward()->%d", this, *aCanGoForward));
|
("nsDocShell %p CanGoForward()->%d", this, *aCanGoForward));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|||||||
@@ -42,13 +42,6 @@ interface nsIWebNavigation : nsISupports
|
|||||||
*/
|
*/
|
||||||
readonly attribute boolean canGoBack;
|
readonly attribute boolean canGoBack;
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if the object can go back. If true this indicates that
|
|
||||||
* there is back session history available for navigation, ignoring
|
|
||||||
* whether or not the history has been interacted with by the user.
|
|
||||||
*/
|
|
||||||
readonly attribute boolean canGoBackIgnoringUserInteraction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the object can go forward. If true this indicates that
|
* Indicates if the object can go forward. If true this indicates that
|
||||||
* there is forward session history available for navigation
|
* there is forward session history available for navigation
|
||||||
|
|||||||
@@ -124,24 +124,13 @@ void ChildSHistory::Reload(uint32_t aReloadFlags, ErrorResult& aRv) {
|
|||||||
aRv = shistory->Reload(aReloadFlags);
|
aRv = shistory->Reload(aReloadFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChildSHistory::CanGo(int32_t aOffset, bool aRequireUserInteraction) {
|
bool ChildSHistory::CanGo(int32_t aOffset) {
|
||||||
CheckedInt<int32_t> index = Index();
|
CheckedInt<int32_t> index = Index();
|
||||||
index += aOffset;
|
index += aOffset;
|
||||||
if (!index.isValid()) {
|
if (!index.isValid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return index.value() < Count() && index.value() >= 0;
|
||||||
if (!mHistory || aOffset >= 0) {
|
|
||||||
return index.value() < Count() && index.value() >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!aRequireUserInteraction) {
|
|
||||||
return index.value() >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool canGoBack;
|
|
||||||
mHistory->CanGoBackFromEntryAtIndex(Index(), &canGoBack);
|
|
||||||
return canGoBack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChildSHistory::Go(int32_t aOffset, bool aRequireUserInteraction,
|
void ChildSHistory::Go(int32_t aOffset, bool aRequireUserInteraction,
|
||||||
|
|||||||
@@ -63,14 +63,8 @@ class ChildSHistory : public nsISupports, public nsWrapperCache {
|
|||||||
* The CanGo and Go methods are called with an offset from the current index.
|
* The CanGo and Go methods are called with an offset from the current index.
|
||||||
* Positive numbers go forward in history, while negative numbers go
|
* Positive numbers go forward in history, while negative numbers go
|
||||||
* backwards.
|
* backwards.
|
||||||
* aRequireUserInteraction is used in order to enable the back-button
|
|
||||||
* intervention. This causes an additional check that there must be a previous
|
|
||||||
* entry that has been user-interacted. This check is unnecessary when going
|
|
||||||
* forwards as the latest entry is always available, whether it has been
|
|
||||||
* interacted with or not. This feature is gated by the
|
|
||||||
* browser.navigation.requireUserInteraction pref.
|
|
||||||
*/
|
*/
|
||||||
bool CanGo(int32_t aOffset, bool aRequireUserInteraction);
|
bool CanGo(int32_t aOffset);
|
||||||
MOZ_CAN_RUN_SCRIPT
|
MOZ_CAN_RUN_SCRIPT
|
||||||
void Go(int32_t aOffset, bool aRequireUserInteraction, bool aUserActivation,
|
void Go(int32_t aOffset, bool aRequireUserInteraction, bool aUserActivation,
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
|
|||||||
@@ -288,10 +288,4 @@ interface nsISHistory: nsISupports
|
|||||||
in BrowsingContext aRootBC, in boolean aCloneChildren);
|
in BrowsingContext aRootBC, in boolean aCloneChildren);
|
||||||
|
|
||||||
[noscript, notxpcom] boolean isEmptyOrHasEntriesForSingleTopLevelPage();
|
[noscript, notxpcom] boolean isEmptyOrHasEntriesForSingleTopLevelPage();
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if we can navigate back in history from the entry at aIndex
|
|
||||||
* to an entry that has user interaction.
|
|
||||||
*/
|
|
||||||
boolean canGoBackFromEntryAtIndex(in long aIndex);
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2060,24 +2060,6 @@ nsSHistory::HasUserInteractionAtIndex(int32_t aIndex) {
|
|||||||
return entry->GetHasUserInteraction();
|
return entry->GetHasUserInteraction();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSHistory::CanGoBackFromEntryAtIndex(int32_t aIndex, bool* aCanGoBack) {
|
|
||||||
*aCanGoBack = false;
|
|
||||||
if (!StaticPrefs::browser_navigation_requireUserInteraction()) {
|
|
||||||
*aCanGoBack = aIndex > 0;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = aIndex - 1; i >= 0; i--) {
|
|
||||||
if (HasUserInteractionAtIndex(i)) {
|
|
||||||
*aCanGoBack = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsSHistory::LoadNextPossibleEntry(
|
nsresult nsSHistory::LoadNextPossibleEntry(
|
||||||
int32_t aNewIndex, long aLoadType, uint32_t aHistCmd,
|
int32_t aNewIndex, long aLoadType, uint32_t aHistCmd,
|
||||||
nsTArray<LoadEntryResult>& aLoadResults, bool aLoadCurrentEntry,
|
nsTArray<LoadEntryResult>& aLoadResults, bool aLoadCurrentEntry,
|
||||||
|
|||||||
@@ -280,8 +280,6 @@ skip-if = ["os == 'mac'"]
|
|||||||
["browser_history_triggeringprincipal_viewsource.js"]
|
["browser_history_triggeringprincipal_viewsource.js"]
|
||||||
https_first_disabled = true
|
https_first_disabled = true
|
||||||
|
|
||||||
["browser_initial_entry_without_interaction.js"]
|
|
||||||
|
|
||||||
["browser_isInitialDocument.js"]
|
["browser_isInitialDocument.js"]
|
||||||
https_first_disabled = true
|
https_first_disabled = true
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,6 @@ function waitForPageShow(browser) {
|
|||||||
|
|
||||||
add_task(async function test_fragment_restore_urlbar() {
|
add_task(async function test_fragment_restore_urlbar() {
|
||||||
await BrowserTestUtils.withNewTab("https://example.com", async browser => {
|
await BrowserTestUtils.withNewTab("https://example.com", async browser => {
|
||||||
await SpecialPowers.spawn(browser, [], () => {
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
|
|
||||||
let loaded = BrowserTestUtils.browserLoaded(browser, false);
|
let loaded = BrowserTestUtils.browserLoaded(browser, false);
|
||||||
BrowserTestUtils.startLoadingURIString(browser, kURL);
|
BrowserTestUtils.startLoadingURIString(browser, kURL);
|
||||||
await loaded;
|
await loaded;
|
||||||
|
|||||||
@@ -81,15 +81,6 @@ async function runTopLevelTest(loadMethod, useHashes = false) {
|
|||||||
TEST_PAGE + p + "entry=0"
|
TEST_PAGE + p + "entry=0"
|
||||||
);
|
);
|
||||||
let browser = tab.linkedBrowser;
|
let browser = tab.linkedBrowser;
|
||||||
// Add some user interaction to entry 0
|
|
||||||
await BrowserTestUtils.synthesizeMouse(
|
|
||||||
"body",
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
{},
|
|
||||||
browser.browsingContext,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
assertBackForwardState(false, false);
|
assertBackForwardState(false, false);
|
||||||
|
|
||||||
@@ -205,15 +196,6 @@ async function runIframeTest(loadMethod) {
|
|||||||
IFRAME_PAGE + "?entry=0"
|
IFRAME_PAGE + "?entry=0"
|
||||||
);
|
);
|
||||||
let browser = tab.linkedBrowser;
|
let browser = tab.linkedBrowser;
|
||||||
// Add some user interaction to entry 0
|
|
||||||
await BrowserTestUtils.synthesizeMouse(
|
|
||||||
"body",
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
{},
|
|
||||||
browser.browsingContext,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
assertBackForwardState(false, false);
|
assertBackForwardState(false, false);
|
||||||
|
|
||||||
@@ -281,15 +263,6 @@ async function runIframeTest(loadMethod) {
|
|||||||
IFRAME_PAGE + "?entry=0"
|
IFRAME_PAGE + "?entry=0"
|
||||||
);
|
);
|
||||||
browser = tab.linkedBrowser;
|
browser = tab.linkedBrowser;
|
||||||
// Add some user interaction to entry 0
|
|
||||||
await BrowserTestUtils.synthesizeMouse(
|
|
||||||
"body",
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
{},
|
|
||||||
browser.browsingContext,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
await loadMethod(IFRAME_PAGE + "?entry=1");
|
await loadMethod(IFRAME_PAGE + "?entry=1");
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ add_task(async function test_about_back() {
|
|||||||
let browser = tab.linkedBrowser;
|
let browser = tab.linkedBrowser;
|
||||||
assertBackForwardState(false, false);
|
assertBackForwardState(false, false);
|
||||||
|
|
||||||
// Add some user interaction to the initial entry
|
|
||||||
await BrowserTestUtils.synthesizeMouse("body", 0, 0, {}, browser, true);
|
|
||||||
|
|
||||||
await followLink(TEST_PAGE + "?entry=1");
|
await followLink(TEST_PAGE + "?entry=1");
|
||||||
assertBackForwardState(true, false);
|
assertBackForwardState(true, false);
|
||||||
|
|
||||||
|
|||||||
@@ -31,12 +31,6 @@ async function runTest(privilegedLoad) {
|
|||||||
gBrowser,
|
gBrowser,
|
||||||
TEST_PAGE + "?entry=0"
|
TEST_PAGE + "?entry=0"
|
||||||
);
|
);
|
||||||
let browser = tab.linkedBrowser;
|
|
||||||
|
|
||||||
// Add some user interaction to the initial entry
|
|
||||||
await SpecialPowers.spawn(browser, [], () => {
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
|
|
||||||
assertBackForwardState(false, false);
|
assertBackForwardState(false, false);
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,11 @@ add_setup(async function () {
|
|||||||
add_task(async () => {
|
add_task(async () => {
|
||||||
await BrowserTestUtils.withNewTab(TEST_URI, async browser => {
|
await BrowserTestUtils.withNewTab(TEST_URI, async browser => {
|
||||||
// Navigate away, after causing a user interaction.
|
// Navigate away, after causing a user interaction.
|
||||||
await SpecialPowers.spawn(browser, [], async () => {
|
SpecialPowers.wrap(document).notifyUserGestureActivation();
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
});
|
|
||||||
await followLink(TEST_URI + "2.html");
|
await followLink(TEST_URI + "2.html");
|
||||||
|
|
||||||
// Navigate again, without causing a user interaction.
|
// Navigate again, without causing a user interaction.
|
||||||
await SpecialPowers.spawn(browser, [], async () => {
|
await SpecialPowers.spawn(browser, [], async function () {
|
||||||
content.history.pushState({}, "", "https://example.com/3.html");
|
content.history.pushState({}, "", "https://example.com/3.html");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -29,7 +27,7 @@ add_task(async () => {
|
|||||||
await assertMenulist([TEST_URI + "3.html", TEST_URI]);
|
await assertMenulist([TEST_URI + "3.html", TEST_URI]);
|
||||||
|
|
||||||
// Go back using history.back, which does not check for user interaction.
|
// Go back using history.back, which does not check for user interaction.
|
||||||
await SpecialPowers.spawn(browser, [], async () => {
|
await SpecialPowers.spawn(browser, [], async function () {
|
||||||
content.history.back();
|
content.history.back();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
const TEST_URI = "https://example.com/";
|
|
||||||
|
|
||||||
add_setup(async function () {
|
|
||||||
await SpecialPowers.pushPrefEnv({
|
|
||||||
set: [["browser.navigation.requireUserInteraction", true]],
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
add_task(async () => {
|
|
||||||
await BrowserTestUtils.withNewTab(TEST_URI, async () => {
|
|
||||||
// Navigate away, without causing a user interaction.
|
|
||||||
await followLink(TEST_URI + "2.html");
|
|
||||||
|
|
||||||
// Wait for the session data to be flushed before continuing the test
|
|
||||||
await new Promise(resolve =>
|
|
||||||
SessionStore.getSessionHistory(gBrowser.selectedTab, resolve)
|
|
||||||
);
|
|
||||||
|
|
||||||
// The entry with no interaction shouldn't appear.
|
|
||||||
await assertMenulist([TEST_URI + "2.html"]);
|
|
||||||
|
|
||||||
const backButton = document.getElementById("back-button");
|
|
||||||
ok(backButton.disabled, "The back button should be disabled.");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -28,6 +28,11 @@ add_task(async () => {
|
|||||||
// Navigate, causing a hashchange event to fire and call history.replaceState
|
// Navigate, causing a hashchange event to fire and call history.replaceState
|
||||||
await BrowserTestUtils.synthesizeMouseAtCenter("#link", {}, browser);
|
await BrowserTestUtils.synthesizeMouseAtCenter("#link", {}, browser);
|
||||||
|
|
||||||
await assertMenulist([TEST_URI_2 + "#1", TEST_URI_2, TEST_URI]);
|
await assertMenulist([
|
||||||
|
TEST_URI_2 + "#1",
|
||||||
|
TEST_URI_2 + "#inject",
|
||||||
|
TEST_URI_2,
|
||||||
|
TEST_URI,
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ add_task(async () => {
|
|||||||
// Navigate, causing a hashchange event to fire and call history.replaceState
|
// Navigate, causing a hashchange event to fire and call history.replaceState
|
||||||
await BrowserTestUtils.synthesizeMouseAtCenter("#link", {}, browser);
|
await BrowserTestUtils.synthesizeMouseAtCenter("#link", {}, browser);
|
||||||
|
|
||||||
await assertMenulist([TEST_URI + "#1", TEST_URI]);
|
await assertMenulist([TEST_URI + "#1", TEST_URI + "#inject", TEST_URI]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -51,8 +51,6 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
SpecialPowers.wrap(document).notifyUserGestureActivation();
|
|
||||||
|
|
||||||
if (opener) {
|
if (opener) {
|
||||||
opener.info("file_bug1300461.html test " + opener.testCount);
|
opener.info("file_bug1300461.html test " + opener.testCount);
|
||||||
testSteps[opener.testCount++]();
|
testSteps[opener.testCount++]();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
opener.is(index, -1, "check requestedIndex");
|
opener.is(index, -1, "check requestedIndex");
|
||||||
}
|
}
|
||||||
|
|
||||||
opener.ok(webNav.canGoBackIgnoringUserInteraction, "check canGoBackIgnoringUserInteraction");
|
opener.ok(webNav.canGoBack, "check canGoBack");
|
||||||
if (opener.testCount == 1) {
|
if (opener.testCount == 1) {
|
||||||
opener.info("replaceState to redirect.html");
|
opener.info("replaceState to redirect.html");
|
||||||
window.history.replaceState({}, "", "file_bug1300461_redirect.html");
|
window.history.replaceState({}, "", "file_bug1300461_redirect.html");
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ async function test_set_focus_after_reuse_bcg() {
|
|||||||
SITE_B_URL
|
SITE_B_URL
|
||||||
);
|
);
|
||||||
await SpecialPowers.spawn(tab.linkedBrowser, [], async function () {
|
await SpecialPowers.spawn(tab.linkedBrowser, [], async function () {
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
var button = content.document.querySelector("button");
|
var button = content.document.querySelector("button");
|
||||||
button.click();
|
button.click();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ interface ChildSHistory {
|
|||||||
[Pure]
|
[Pure]
|
||||||
readonly attribute long index;
|
readonly attribute long index;
|
||||||
|
|
||||||
boolean canGo(long aOffset, optional boolean aRequireUserInteraction = false);
|
boolean canGo(long aOffset);
|
||||||
[Throws] undefined go(long aOffset, optional boolean aRequireUserInteraction = false, optional boolean aUserActivation = false);
|
[Throws] undefined go(long aOffset, optional boolean aRequireUserInteraction = false, optional boolean aUserActivation = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -89,14 +89,10 @@ interface nsIBrowser : nsISupports
|
|||||||
*
|
*
|
||||||
* @param aCanGoBack whether or not the nsIWebNavigation can go backwards in
|
* @param aCanGoBack whether or not the nsIWebNavigation can go backwards in
|
||||||
* history
|
* history
|
||||||
* @param aCanGoBackIgnoringUserInteraction whether or not the nsIWebNavigation
|
|
||||||
* can go backwards in history regardless
|
|
||||||
* of user interactions
|
|
||||||
* @param aCanGoForward whether or not the nsIWebNavigation can go
|
* @param aCanGoForward whether or not the nsIWebNavigation can go
|
||||||
* forward in history
|
* forward in history
|
||||||
*/
|
*/
|
||||||
void updateWebNavigationForLocationChange(in boolean aCanGoBack,
|
void updateWebNavigationForLocationChange(in boolean aCanGoBack,
|
||||||
in boolean aCanGoBackIgnoringUserInteraction,
|
|
||||||
in boolean aCanGoForward);
|
in boolean aCanGoForward);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3732,12 +3732,9 @@ NS_IMETHODIMP BrowserChild::OnLocationChange(nsIWebProgress* aWebProgress,
|
|||||||
Maybe<WebProgressLocationChangeData> locationChangeData;
|
Maybe<WebProgressLocationChangeData> locationChangeData;
|
||||||
|
|
||||||
bool canGoBack = false;
|
bool canGoBack = false;
|
||||||
bool canGoBackIgnoringUserInteraction = false;
|
|
||||||
bool canGoForward = false;
|
bool canGoForward = false;
|
||||||
if (!mozilla::SessionHistoryInParent()) {
|
if (!mozilla::SessionHistoryInParent()) {
|
||||||
MOZ_TRY(WebNavigation()->GetCanGoBack(&canGoBack));
|
MOZ_TRY(WebNavigation()->GetCanGoBack(&canGoBack));
|
||||||
MOZ_TRY(WebNavigation()->GetCanGoBackIgnoringUserInteraction(
|
|
||||||
&canGoBackIgnoringUserInteraction));
|
|
||||||
MOZ_TRY(WebNavigation()->GetCanGoForward(&canGoForward));
|
MOZ_TRY(WebNavigation()->GetCanGoForward(&canGoForward));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3788,9 +3785,9 @@ NS_IMETHODIMP BrowserChild::OnLocationChange(nsIWebProgress* aWebProgress,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Unused << SendOnLocationChange(
|
Unused << SendOnLocationChange(webProgressData, requestData, aLocation,
|
||||||
webProgressData, requestData, aLocation, aFlags, canGoBack,
|
aFlags, canGoBack, canGoForward,
|
||||||
canGoBackIgnoringUserInteraction, canGoForward, locationChangeData);
|
locationChangeData);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2997,7 +2997,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvOnProgressChange(
|
|||||||
mozilla::ipc::IPCResult BrowserParent::RecvOnLocationChange(
|
mozilla::ipc::IPCResult BrowserParent::RecvOnLocationChange(
|
||||||
const WebProgressData& aWebProgressData, const RequestData& aRequestData,
|
const WebProgressData& aWebProgressData, const RequestData& aRequestData,
|
||||||
nsIURI* aLocation, const uint32_t aFlags, const bool aCanGoBack,
|
nsIURI* aLocation, const uint32_t aFlags, const bool aCanGoBack,
|
||||||
const bool aCanGoBackIgnoringUserInteraction, const bool aCanGoForward,
|
const bool aCanGoForward,
|
||||||
const Maybe<WebProgressLocationChangeData>& aLocationChangeData) {
|
const Maybe<WebProgressLocationChangeData>& aLocationChangeData) {
|
||||||
RefPtr<CanonicalBrowsingContext> browsingContext =
|
RefPtr<CanonicalBrowsingContext> browsingContext =
|
||||||
BrowsingContextForWebProgress(aWebProgressData);
|
BrowsingContextForWebProgress(aWebProgressData);
|
||||||
@@ -3017,8 +3017,8 @@ mozilla::ipc::IPCResult BrowserParent::RecvOnLocationChange(
|
|||||||
|
|
||||||
nsCOMPtr<nsIBrowser> browser = GetBrowser();
|
nsCOMPtr<nsIBrowser> browser = GetBrowser();
|
||||||
if (!mozilla::SessionHistoryInParent() && browser) {
|
if (!mozilla::SessionHistoryInParent() && browser) {
|
||||||
Unused << browser->UpdateWebNavigationForLocationChange(
|
Unused << browser->UpdateWebNavigationForLocationChange(aCanGoBack,
|
||||||
aCanGoBack, aCanGoBackIgnoringUserInteraction, aCanGoForward);
|
aCanGoForward);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aLocationChangeData.isSome()) {
|
if (aLocationChangeData.isSome()) {
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ class BrowserParent final : public PBrowserParent,
|
|||||||
mozilla::ipc::IPCResult RecvOnLocationChange(
|
mozilla::ipc::IPCResult RecvOnLocationChange(
|
||||||
const WebProgressData& aWebProgressData, const RequestData& aRequestData,
|
const WebProgressData& aWebProgressData, const RequestData& aRequestData,
|
||||||
nsIURI* aLocation, const uint32_t aFlags, const bool aCanGoBack,
|
nsIURI* aLocation, const uint32_t aFlags, const bool aCanGoBack,
|
||||||
const bool aCanGoBackIgnoringUserInteraction, const bool aCanGoForward,
|
const bool aCanGoForward,
|
||||||
const Maybe<WebProgressLocationChangeData>& aLocationChangeData);
|
const Maybe<WebProgressLocationChangeData>& aLocationChangeData);
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvOnStatusChange(const nsString& aMessage);
|
mozilla::ipc::IPCResult RecvOnStatusChange(const nsString& aMessage);
|
||||||
|
|||||||
@@ -529,7 +529,6 @@ parent:
|
|||||||
async OnLocationChange(WebProgressData aWebProgressData,
|
async OnLocationChange(WebProgressData aWebProgressData,
|
||||||
RequestData aRequestData, nullable nsIURI aLocation,
|
RequestData aRequestData, nullable nsIURI aLocation,
|
||||||
uint32_t aFlags, bool aCanGoBack,
|
uint32_t aFlags, bool aCanGoBack,
|
||||||
bool aCanGoBackIgnoringUserInteraction,
|
|
||||||
bool aCanGoForward,
|
bool aCanGoForward,
|
||||||
WebProgressLocationChangeData? aLocationChangeData);
|
WebProgressLocationChangeData? aLocationChangeData);
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,6 @@ add_task(async function doTests() {
|
|||||||
browser,
|
browser,
|
||||||
[TEST_URI, testDocDomain],
|
[TEST_URI, testDocDomain],
|
||||||
(aTestURI, aTestDocDomain) => {
|
(aTestURI, aTestDocDomain) => {
|
||||||
// Mark the first entry as having been interacted with.
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
|
|
||||||
content.name = "Test";
|
content.name = "Test";
|
||||||
|
|
||||||
if (aTestDocDomain) {
|
if (aTestDocDomain) {
|
||||||
|
|||||||
@@ -1168,7 +1168,7 @@ GeckoDriver.prototype.goBack = async function () {
|
|||||||
await this._handleUserPrompts();
|
await this._handleUserPrompts();
|
||||||
|
|
||||||
// If there is no history, just return
|
// If there is no history, just return
|
||||||
if (!browsingContext.embedderElement?.canGoBackIgnoringUserInteraction) {
|
if (!browsingContext.embedderElement?.canGoBack) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -445,13 +445,6 @@ nsWebBrowser::GetCanGoBack(bool* aCanGoBack) {
|
|||||||
return mDocShell->GetCanGoBack(aCanGoBack);
|
return mDocShell->GetCanGoBack(aCanGoBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsWebBrowser::GetCanGoBackIgnoringUserInteraction(bool* aCanGoBack) {
|
|
||||||
NS_ENSURE_STATE(mDocShell);
|
|
||||||
|
|
||||||
return mDocShell->GetCanGoBackIgnoringUserInteraction(aCanGoBack);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWebBrowser::GetCanGoForward(bool* aCanGoForward) {
|
nsWebBrowser::GetCanGoForward(bool* aCanGoForward) {
|
||||||
NS_ENSURE_STATE(mDocShell);
|
NS_ENSURE_STATE(mDocShell);
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ export class RemoteWebNavigation {
|
|||||||
this._cancelContentJSEpoch = 1;
|
this._cancelContentJSEpoch = 1;
|
||||||
this._currentURI = null;
|
this._currentURI = null;
|
||||||
this._canGoBack = false;
|
this._canGoBack = false;
|
||||||
this._canGoBackIgnoringUserInteraction = false;
|
|
||||||
this._canGoForward = false;
|
this._canGoForward = false;
|
||||||
this.referringURI = null;
|
this.referringURI = null;
|
||||||
}
|
}
|
||||||
@@ -35,20 +34,11 @@ export class RemoteWebNavigation {
|
|||||||
|
|
||||||
get canGoBack() {
|
get canGoBack() {
|
||||||
if (Services.appinfo.sessionHistoryInParent) {
|
if (Services.appinfo.sessionHistoryInParent) {
|
||||||
const sessionHistory = this._browser.browsingContext.sessionHistory;
|
return this._browser.browsingContext.sessionHistory?.index > 0;
|
||||||
return sessionHistory?.canGoBackFromEntryAtIndex(sessionHistory?.index);
|
|
||||||
}
|
}
|
||||||
return this._canGoBack;
|
return this._canGoBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
get canGoBackIgnoringUserInteraction() {
|
|
||||||
if (Services.appinfo.sessionHistoryInParent) {
|
|
||||||
const sessionHistory = this._browser.browsingContext.sessionHistory;
|
|
||||||
return sessionHistory?.index > 0;
|
|
||||||
}
|
|
||||||
return this._canGoBackIgnoringUserInteraction;
|
|
||||||
}
|
|
||||||
|
|
||||||
get canGoForward() {
|
get canGoForward() {
|
||||||
if (Services.appinfo.sessionHistoryInParent) {
|
if (Services.appinfo.sessionHistoryInParent) {
|
||||||
let sessionHistory = this._browser.browsingContext.sessionHistory;
|
let sessionHistory = this._browser.browsingContext.sessionHistory;
|
||||||
|
|||||||
@@ -486,10 +486,6 @@
|
|||||||
return this.webNavigation.canGoBack;
|
return this.webNavigation.canGoBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
get canGoBackIgnoringUserInteraction() {
|
|
||||||
return this.webNavigation.canGoBackIgnoringUserInteraction;
|
|
||||||
}
|
|
||||||
|
|
||||||
get canGoForward() {
|
get canGoForward() {
|
||||||
return this.webNavigation.canGoForward;
|
return this.webNavigation.canGoForward;
|
||||||
}
|
}
|
||||||
@@ -912,11 +908,7 @@
|
|||||||
.navigationRequireUserInteraction
|
.navigationRequireUserInteraction
|
||||||
) {
|
) {
|
||||||
var webNavigation = this.webNavigation;
|
var webNavigation = this.webNavigation;
|
||||||
if (
|
if (webNavigation.canGoBack) {
|
||||||
requireUserInteraction
|
|
||||||
? webNavigation.canGoBack
|
|
||||||
: webNavigation.canGoBackIgnoringUserInteraction
|
|
||||||
) {
|
|
||||||
this._wrapURIChangeCall(() =>
|
this._wrapURIChangeCall(() =>
|
||||||
webNavigation.goBack(requireUserInteraction)
|
webNavigation.goBack(requireUserInteraction)
|
||||||
);
|
);
|
||||||
@@ -1270,19 +1262,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWebNavigationForLocationChange(
|
updateWebNavigationForLocationChange(aCanGoBack, aCanGoForward) {
|
||||||
aCanGoBack,
|
|
||||||
aCanGoBackIgnoringUserInteraction,
|
|
||||||
aCanGoForward
|
|
||||||
) {
|
|
||||||
if (
|
if (
|
||||||
this.isRemoteBrowser &&
|
this.isRemoteBrowser &&
|
||||||
this.messageManager &&
|
this.messageManager &&
|
||||||
!Services.appinfo.sessionHistoryInParent
|
!Services.appinfo.sessionHistoryInParent
|
||||||
) {
|
) {
|
||||||
this._remoteWebNavigation._canGoBack = aCanGoBack;
|
this._remoteWebNavigation._canGoBack = aCanGoBack;
|
||||||
this._remoteWebNavigation._canGoBackIgnoringUserInteraction =
|
|
||||||
aCanGoBackIgnoringUserInteraction;
|
|
||||||
this._remoteWebNavigation._canGoForward = aCanGoForward;
|
this._remoteWebNavigation._canGoForward = aCanGoForward;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1329,7 +1315,6 @@
|
|||||||
purgeSessionHistory() {
|
purgeSessionHistory() {
|
||||||
if (this.isRemoteBrowser && !Services.appinfo.sessionHistoryInParent) {
|
if (this.isRemoteBrowser && !Services.appinfo.sessionHistoryInParent) {
|
||||||
this._remoteWebNavigation._canGoBack = false;
|
this._remoteWebNavigation._canGoBack = false;
|
||||||
this._remoteWebNavigation._canGoBackIgnoringUserInteraction = false;
|
|
||||||
this._remoteWebNavigation._canGoForward = false;
|
this._remoteWebNavigation._canGoForward = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -195,9 +195,6 @@ function test() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
BrowserTestUtils.openNewForegroundTab(gBrowser, "about:crashes").then(tab => {
|
BrowserTestUtils.openNewForegroundTab(gBrowser, "about:crashes").then(tab => {
|
||||||
// Mark the first entry as having been interacted with.
|
|
||||||
content.document.notifyUserGestureActivation();
|
|
||||||
|
|
||||||
SpecialPowers.spawn(tab.linkedBrowser, [crashes], check_crash_list).then(
|
SpecialPowers.spawn(tab.linkedBrowser, [crashes], check_crash_list).then(
|
||||||
() => check_submit_pending(tab, crashes)
|
() => check_submit_pending(tab, crashes)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user