Bug 1515073 - Part 3 - Add support for skipping session entries without user interaction on desktop. r=JanH,Gijs
Depends on D27586 Differential Revision: https://phabricator.services.mozilla.com/D27587
This commit is contained in:
@@ -1693,6 +1693,12 @@ pref("browser.tabs.crashReporting.requestEmail", false);
|
||||
pref("browser.tabs.crashReporting.emailMe", false);
|
||||
pref("browser.tabs.crashReporting.email", "");
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
pref("browser.navigation.requireUserInteraction", true);
|
||||
#else
|
||||
pref("browser.navigation.requireUserInteraction", false);
|
||||
#endif
|
||||
|
||||
// If true, unprivileged extensions may use experimental APIs on
|
||||
// nightly and developer edition.
|
||||
pref("extensions.experiments.enabled", false);
|
||||
|
||||
@@ -4549,6 +4549,17 @@ function FillHistoryMenu(aParent) {
|
||||
|
||||
for (let j = end - 1; j >= start; j--) {
|
||||
let entry = sessionHistory.entries[j];
|
||||
// Explicitly check for "false" to stay backwards-compatible with session histories
|
||||
// from before the hasUserInteraction was implemented.
|
||||
if (
|
||||
BrowserUtils.navigationRequireUserInteraction &&
|
||||
entry.hasUserInteraction === false &&
|
||||
// Always allow going to the first and last navigation points.
|
||||
j != end - 1 &&
|
||||
j != start
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
let uri = entry.url;
|
||||
|
||||
let item =
|
||||
|
||||
@@ -441,12 +441,12 @@
|
||||
return this.selectedBrowser.canGoForward;
|
||||
},
|
||||
|
||||
goBack() {
|
||||
return this.selectedBrowser.goBack();
|
||||
goBack(requireUserInteraction) {
|
||||
return this.selectedBrowser.goBack(requireUserInteraction);
|
||||
},
|
||||
|
||||
goForward() {
|
||||
return this.selectedBrowser.goForward();
|
||||
goForward(requireUserInteraction) {
|
||||
return this.selectedBrowser.goForward(requireUserInteraction);
|
||||
},
|
||||
|
||||
reload() {
|
||||
|
||||
@@ -208,8 +208,9 @@ class SessionHistoryListener extends Handler {
|
||||
}
|
||||
|
||||
OnHistoryNewEntry(newURI, oldIndex) {
|
||||
// We ought to collect the previously current entry as well, see bug 1350567.
|
||||
this.collectFrom(oldIndex);
|
||||
// Collect the current entry as well, to make sure to collect any changes
|
||||
// that were made to the entry while the document was active.
|
||||
this.collectFrom(oldIndex == -1 ? oldIndex : oldIndex - 1);
|
||||
}
|
||||
|
||||
OnHistoryGotoIndex() {
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
|
||||
const { BrowserUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/BrowserUtils.jsm"
|
||||
);
|
||||
|
||||
let LazyModules = {};
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
@@ -855,7 +859,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
goBack(requireUserInteraction = false) {
|
||||
goBack(
|
||||
requireUserInteraction = BrowserUtils.navigationRequireUserInteraction
|
||||
) {
|
||||
var webNavigation = this.webNavigation;
|
||||
if (webNavigation.canGoBack) {
|
||||
this._wrapURIChangeCall(() =>
|
||||
@@ -864,7 +870,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
goForward(requireUserInteraction = false) {
|
||||
goForward(
|
||||
requireUserInteraction = BrowserUtils.navigationRequireUserInteraction
|
||||
) {
|
||||
var webNavigation = this.webNavigation;
|
||||
if (webNavigation.canGoForward) {
|
||||
this._wrapURIChangeCall(() =>
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
var EXPORTED_SYMBOLS = ["BrowserUtils"];
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"PlacesUtils",
|
||||
@@ -959,3 +962,10 @@ var BrowserUtils = {
|
||||
return bag;
|
||||
},
|
||||
};
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
BrowserUtils,
|
||||
"navigationRequireUserInteraction",
|
||||
"browser.navigation.requireUserInteraction",
|
||||
false
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user