summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-05-14 10:50:01 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-05-14 10:50:01 +0200
commite9dd029f5d00590e1a53e63b0ab805110a10b54c (patch)
tree1126ca5dda925a62be3dc12c99c90e953d08afcf /application/palemoon/base
parent9d6a7ae25d7f5da855a8f8df884de483b4e2a538 (diff)
parent36b8fd734f590eb726ca2e50f8d1ff9cc968b8e1 (diff)
downloadUXP-e9dd029f5d00590e1a53e63b0ab805110a10b54c.tar
UXP-e9dd029f5d00590e1a53e63b0ab805110a10b54c.tar.gz
UXP-e9dd029f5d00590e1a53e63b0ab805110a10b54c.tar.lz
UXP-e9dd029f5d00590e1a53e63b0ab805110a10b54c.tar.xz
UXP-e9dd029f5d00590e1a53e63b0ab805110a10b54c.zip
Merge branch 'master' into Basilisk-release
Diffstat (limited to 'application/palemoon/base')
-rw-r--r--application/palemoon/base/content/browser-fullScreen.js306
-rw-r--r--application/palemoon/base/content/browser-plugins.js20
-rw-r--r--application/palemoon/base/content/browser.css17
-rw-r--r--application/palemoon/base/content/browser.js393
-rw-r--r--application/palemoon/base/content/browser.xul14
-rw-r--r--application/palemoon/base/content/newtab/grid.js7
-rw-r--r--application/palemoon/base/content/nsContextMenu.js7
-rw-r--r--application/palemoon/base/content/openLocation.js77
-rw-r--r--application/palemoon/base/content/pageinfo/pageInfo.js3
-rw-r--r--application/palemoon/base/content/pageinfo/pageInfo.xul29
-rw-r--r--application/palemoon/base/content/pageinfo/permissions.js18
-rw-r--r--application/palemoon/base/content/tabbrowser.xml167
-rw-r--r--application/palemoon/base/content/urlbarBindings.xml160
-rw-r--r--application/palemoon/base/content/utilityOverlay.js54
-rw-r--r--application/palemoon/base/jar.mn2
15 files changed, 644 insertions, 630 deletions
diff --git a/application/palemoon/base/content/browser-fullScreen.js b/application/palemoon/base/content/browser-fullScreen.js
index 400340e77..6afd247be 100644
--- a/application/palemoon/base/content/browser-fullScreen.js
+++ b/application/palemoon/base/content/browser-fullScreen.js
@@ -5,16 +5,9 @@
var FullScreen = {
_XULNS: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
- get _fullScrToggler() {
- delete this._fullScrToggler;
- return this._fullScrToggler = document.getElementById("fullscr-toggler");
- },
- toggle: function (event) {
- var enterFS = window.fullScreen;
- // We get the fullscreen event _before_ the window transitions into or out of FS mode.
- if (event && event.type == "fullscreen")
- enterFS = !enterFS;
+ toggle: function () {
+ var enterFS = window.fullScreen;
// Toggle the View:FullScreen command, which controls elements like the
// fullscreen menuitem, menubars, and the appmenu.
@@ -31,6 +24,12 @@ var FullScreen = {
document.getElementById("exitFullScreenItem").hidden = !enterFS;
#endif
+ if (!this._fullScrToggler) {
+ this._fullScrToggler = document.getElementById("fullscr-toggler");
+ this._fullScrToggler.addEventListener("mouseover", this._expandCallback, false);
+ this._fullScrToggler.addEventListener("dragenter", this._expandCallback, false);
+ }
+
// On OS X Lion we don't want to hide toolbars when entering fullscreen, unless
// we're entering DOM fullscreen, in which case we should hide the toolbars.
// If we're leaving fullscreen, then we'll go through the exit code below to
@@ -50,36 +49,17 @@ var FullScreen = {
this.showXULChrome("toolbar", !enterFS);
if (enterFS) {
- // Add a tiny toolbar to receive mouseover and dragenter events, and provide affordance.
- // This will help simulate the "collapse" metaphor while also requiring less code and
- // events than raw listening of mouse coords. We don't add the toolbar in DOM full-screen
- // mode, only browser full-screen mode.
- if (!document.mozFullScreen) {
- this._fullScrToggler.addEventListener("mouseover", this._expandCallback, false);
- this._fullScrToggler.addEventListener("dragenter", this._expandCallback, false);
- }
- if (gPrefService.getBoolPref("browser.fullscreen.autohide"))
- gBrowser.mPanelContainer.addEventListener("mousemove",
- this._collapseCallback, false);
-
document.addEventListener("keypress", this._keyToggleCallback, false);
document.addEventListener("popupshown", this._setPopupOpen, false);
document.addEventListener("popuphidden", this._setPopupOpen, false);
+ this._shouldAnimate = true;
// We don't animate the toolbar collapse if in DOM full-screen mode,
// as the size of the content area would still be changing after the
// mozfullscreenchange event fired, which could confuse content script.
- this._shouldAnimate = !document.mozFullScreen;
- this.mouseoverToggle(false);
-
- // Autohide prefs
- gPrefService.addObserver("browser.fullscreen", this, false);
+ this.hideNavToolbox(document.mozFullScreen);
}
else {
- // The user may quit fullscreen during an animation
- this._cancelAnimation();
- gNavToolbox.style.marginTop = "";
- if (this._isChromeCollapsed)
- this.mouseoverToggle(true);
+ this.showNavToolbox(false);
// This is needed if they use the context menu to quit fullscreen
this._isPopupOpen = false;
@@ -111,7 +91,7 @@ var FullScreen = {
if (!document.mozFullScreen)
return;
- // However, if we receive a "MozEnteredDomFullScreen" event for a document
+ // However, if we receive a "MozDOMFullscreen:NewOrigin" event for a document
// which is not a subdocument of a currently active (ie. visible) browser
// or iframe, we know that we've switched to a different frame since the
// request to enter full-screen was made, so we should exit full-screen
@@ -152,26 +132,16 @@ var FullScreen = {
// Cancel any "hide the toolbar" animation which is in progress, and make
// the toolbar hide immediately.
- this._cancelAnimation();
- this.mouseoverToggle(false);
-
- // Remove listeners on the full-screen toggler, so that mouseover
- // the top of the screen will not cause the toolbar to re-appear.
- this._fullScrToggler.removeEventListener("mouseover", this._expandCallback, false);
- this._fullScrToggler.removeEventListener("dragenter", this._expandCallback, false);
+ this.hideNavToolbox(true);
},
cleanup: function () {
- if (window.fullScreen) {
- gBrowser.mPanelContainer.removeEventListener("mousemove",
- this._collapseCallback, false);
+ if (!window.fullScreen) {
+ MousePosTracker.removeListener(this);
document.removeEventListener("keypress", this._keyToggleCallback, false);
document.removeEventListener("popupshown", this._setPopupOpen, false);
document.removeEventListener("popuphidden", this._setPopupOpen, false);
- gPrefService.removeObserver("browser.fullscreen", this);
- this._fullScrToggler.removeEventListener("mouseover", this._expandCallback, false);
- this._fullScrToggler.removeEventListener("dragenter", this._expandCallback, false);
this.cancelWarning();
gBrowser.tabContainer.removeEventListener("TabOpen", this.exitDomFullScreen);
gBrowser.tabContainer.removeEventListener("TabClose", this.exitDomFullScreen);
@@ -182,40 +152,30 @@ var FullScreen = {
}
},
- observe: function(aSubject, aTopic, aData)
+ getMouseTargetRect: function()
{
- if (aData == "browser.fullscreen.autohide") {
- if (gPrefService.getBoolPref("browser.fullscreen.autohide")) {
- gBrowser.mPanelContainer.addEventListener("mousemove",
- this._collapseCallback, false);
- }
- else {
- gBrowser.mPanelContainer.removeEventListener("mousemove",
- this._collapseCallback, false);
- }
- }
+ return this._mouseTargetRect;
},
// Event callbacks
_expandCallback: function()
{
- FullScreen.mouseoverToggle(true);
+ FullScreen.showNavToolbox();
},
- _collapseCallback: function()
+ onMouseEnter: function()
{
- FullScreen.mouseoverToggle(false);
+ FullScreen.hideNavToolbox();
},
_keyToggleCallback: function(aEvent)
{
// if we can use the keyboard (eg Ctrl+L or Ctrl+E) to open the toolbars, we
// should provide a way to collapse them too.
if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE) {
- FullScreen._shouldAnimate = false;
- FullScreen.mouseoverToggle(false, true);
+ FullScreen.hideNavToolbox(true);
}
// F6 is another shortcut to the address bar, but its not covered in OpenLocation()
else if (aEvent.keyCode == aEvent.DOM_VK_F6)
- FullScreen.mouseoverToggle(true);
+ FullScreen.showNavToolbox();
},
// Checks whether we are allowed to collapse the chrome
@@ -269,47 +229,6 @@ var FullScreen = {
// Animate the toolbars disappearing
_shouldAnimate: true,
- _isAnimating: false,
- _animationTimeout: 0,
- _animationHandle: 0,
- _animateUp: function() {
- // check again, the user may have done something before the animation was due to start
- if (!window.fullScreen || !this._safeToCollapse(false)) {
- this._isAnimating = false;
- this._shouldAnimate = true;
- return;
- }
-
- this._animateStartTime = window.mozAnimationStartTime;
- if (!this._animationHandle)
- this._animationHandle = window.mozRequestAnimationFrame(this);
- },
-
- sample: function (timeStamp) {
- const duration = 1500;
- const timePassed = timeStamp - this._animateStartTime;
- const pos = timePassed >= duration ? 1 :
- 1 - Math.pow(1 - timePassed / duration, 4);
-
- if (pos >= 1) {
- // We've animated enough
- this._cancelAnimation();
- gNavToolbox.style.marginTop = "";
- this.mouseoverToggle(false);
- return;
- }
-
- gNavToolbox.style.marginTop = (gNavToolbox.boxObject.height * pos * -1) + "px";
- this._animationHandle = window.mozRequestAnimationFrame(this);
- },
-
- _cancelAnimation: function() {
- window.cancelAnimationFrame(this._animationHandle);
- this._animationHandle = 0;
- clearTimeout(this._animationTimeout);
- this._isAnimating = false;
- this._shouldAnimate = false;
- },
cancelWarning: function(event) {
if (!this.warningBox)
@@ -328,67 +247,20 @@ var FullScreen = {
this.warningBox.setAttribute("hidden", true);
this.warningBox.removeAttribute("fade-warning-out");
- this.warningBox.removeAttribute("obscure-browser");
this.warningBox = null;
},
- setFullscreenAllowed: function(isApproved) {
- // The "remember decision" checkbox is hidden when showing for documents that
- // the permission manager can't handle (documents with URIs without a host).
- // We simply require those to be approved every time instead.
- let rememberCheckbox = document.getElementById("full-screen-remember-decision");
- let uri = this.fullscreenDoc.nodePrincipal.URI;
- if (!rememberCheckbox.hidden) {
- if (rememberCheckbox.checked)
- Services.perms.add(uri,
- "fullscreen",
- isApproved ? Services.perms.ALLOW_ACTION : Services.perms.DENY_ACTION,
- Services.perms.EXPIRE_NEVER);
- else if (isApproved) {
- // The user has only temporarily approved fullscren for this fullscreen
- // session only. Add the permission (so Goanna knows to approve any further
- // fullscreen requests for this host in this fullscreen session) but add
- // a listener to revoke the permission when the chrome document exits
- // fullscreen.
- Services.perms.add(uri,
- "fullscreen",
- Services.perms.ALLOW_ACTION,
- Services.perms.EXPIRE_SESSION);
- let host = uri.host;
- var onFullscreenchange = function onFullscreenchange(event) {
- if (event.target == document && document.mozFullScreenElement == null) {
- // The chrome document has left fullscreen. Remove the temporary permission grant.
- Services.perms.remove(host, "fullscreen");
- document.removeEventListener("mozfullscreenchange", onFullscreenchange);
- }
- }
- document.addEventListener("mozfullscreenchange", onFullscreenchange);
- }
- }
- if (this.warningBox)
- this.warningBox.setAttribute("fade-warning-out", "true");
- // If the document has been granted fullscreen, notify Goanna so it can resume
- // any pending pointer lock requests, otherwise exit fullscreen; the user denied
- // the fullscreen request.
- if (isApproved)
- Services.obs.notifyObservers(this.fullscreenDoc, "fullscreen-approved", "");
- else
- document.mozCancelFullScreen();
- },
-
warningBox: null,
warningFadeOutTimeout: null,
fullscreenDoc: null,
- // Shows the fullscreen approval UI, or if the domain has already been approved
- // for fullscreen, shows a warning that the site has entered fullscreen for a short
- // duration.
+ // Shows a warning that the site has entered fullscreen for a short duration.
showWarning: function(targetDoc) {
- if (!document.mozFullScreen ||
- !gPrefService.getBoolPref("full-screen-api.approval-required"))
+ let timeout = gPrefService.getIntPref("full-screen-api.warning.timeout");
+ if (!document.mozFullScreen || timeout <= 0)
return;
- // Set the strings on the fullscreen approval UI.
+ // Set the strings on the fullscreen warning UI.
this.fullscreenDoc = targetDoc;
let uri = this.fullscreenDoc.nodePrincipal.URI;
let host = null;
@@ -396,11 +268,8 @@ var FullScreen = {
host = uri.host;
} catch (e) { }
let hostLabel = document.getElementById("full-screen-domain-text");
- let rememberCheckbox = document.getElementById("full-screen-remember-decision");
- let isApproved = false;
if (host) {
- // Document's principal's URI has a host. Display a warning including the hostname and
- // show UI to enable the user to permanently grant this host permission to enter fullscreen.
+ // Document's principal's URI has a host. Display a warning including the hostname.
let utils = {};
Cu.import("resource://gre/modules/DownloadUtils.jsm", utils);
let displayHost = utils.DownloadUtils.getURIHost(uri.spec)[0];
@@ -408,17 +277,8 @@ var FullScreen = {
hostLabel.textContent = bundle.formatStringFromName("fullscreen.entered", [displayHost], 1);
hostLabel.removeAttribute("hidden");
-
- rememberCheckbox.label = bundle.formatStringFromName("fullscreen.rememberDecision", [displayHost], 1);
- rememberCheckbox.checked = false;
- rememberCheckbox.removeAttribute("hidden");
-
- // Note we only allow documents whose principal's URI has a host to
- // store permission grants.
- isApproved = Services.perms.testPermission(uri, "fullscreen") == Services.perms.ALLOW_ACTION;
} else {
hostLabel.setAttribute("hidden", "true");
- rememberCheckbox.setAttribute("hidden", "true");
}
// Note: the warning box can be non-null if the warning box from the previous request
@@ -436,77 +296,77 @@ var FullScreen = {
this.warningBox.removeAttribute("fade-warning-out");
}
- // If fullscreen mode has not yet been approved for the fullscreen
- // document's domain, show the approval UI and don't auto fade out the
- // fullscreen warning box. Otherwise, we're just notifying of entry into
- // fullscreen mode. Note if the resource's host is null, we must be
- // showing a local file or a local data URI, and we require explicit
- // approval every time.
- let authUI = document.getElementById("full-screen-approval-pane");
- if (isApproved) {
- authUI.setAttribute("hidden", "true");
- this.warningBox.removeAttribute("obscure-browser");
- } else {
- // Partially obscure the <browser> element underneath the approval UI.
- this.warningBox.setAttribute("obscure-browser", "true");
- authUI.removeAttribute("hidden");
+ // Set a timeout to fade the warning out after a few moments.
+ this.warningFadeOutTimeout = setTimeout(() => {
+ if (this.warningBox) {
+ this.warningBox.setAttribute("fade-warning-out", "true");
+ }
+ }, timeout);
+ },
+
+ showNavToolbox: function(trackMouse = true) {
+ this._fullScrToggler.hidden = true;
+ gNavToolbox.removeAttribute("fullscreenShouldAnimate");
+ gNavToolbox.style.marginTop = "";
+
+ if (!this._isChromeCollapsed) {
+ return;
}
- // If we're not showing the fullscreen approval UI, we're just notifying the user
- // of the transition, so set a timeout to fade the warning out after a few moments.
- if (isApproved)
- this.warningFadeOutTimeout =
- setTimeout(
- function() {
- if (this.warningBox)
- this.warningBox.setAttribute("fade-warning-out", "true");
- }.bind(this),
- 3000);
+ // Track whether mouse is near the toolbox
+ this._isChromeCollapsed = false;
+ if (trackMouse) {
+ let rect = gBrowser.mPanelContainer.getBoundingClientRect();
+ this._mouseTargetRect = {
+ top: rect.top + 50,
+ bottom: rect.bottom,
+ left: rect.left,
+ right: rect.right
+ };
+ MousePosTracker.addListener(this);
+ }
},
- mouseoverToggle: function(aShow, forceHide)
- {
- // Don't do anything if:
- // a) we're already in the state we want,
- // b) we're animating and will become collapsed soon, or
- // c) we can't collapse because it would be undesirable right now
- if (aShow != this._isChromeCollapsed || (!aShow && this._isAnimating) ||
- (!aShow && !this._safeToCollapse(forceHide)))
+ hideNavToolbox: function(forceHide = false) {
+ this._fullScrToggler.hidden = document.mozFullScreen;
+ if (this._isChromeCollapsed) {
+ if (forceHide) {
+ gNavToolbox.removeAttribute("fullscreenShouldAnimate");
+ }
return;
+ }
+ if (!this._safeToCollapse(forceHide)) {
+ this._fullScrToggler.hidden = true;
+ return;
+ }
// browser.fullscreen.animateUp
// 0 - never animate up
// 1 - animate only for first collapse after entering fullscreen (default for perf's sake)
// 2 - animate every time it collapses
- if (gPrefService.getIntPref("browser.fullscreen.animateUp") == 0)
+ let animateUp = gPrefService.getIntPref("browser.fullscreen.animateUp");
+ if (animateUp == 0) {
this._shouldAnimate = false;
-
- if (!aShow && this._shouldAnimate) {
- this._isAnimating = true;
- this._shouldAnimate = false;
- this._animationTimeout = setTimeout(this._animateUp.bind(this), 800);
- return;
- }
-
- // The chrome is collapsed so don't spam needless mousemove events
- if (aShow) {
- gBrowser.mPanelContainer.addEventListener("mousemove",
- this._collapseCallback, false);
+ } else if (animateUp == 2) {
+ this._shouldAnimate = true;
}
- else {
- gBrowser.mPanelContainer.removeEventListener("mousemove",
- this._collapseCallback, false);
+ if (this._shouldAnimate && !forceHide) {
+ gNavToolbox.setAttribute("fullscreenShouldAnimate", true);
+ this._shouldAnimate = false;
+ // Hide the fullscreen toggler until the transition ends.
+ let listener = () => {
+ gNavToolbox.removeEventListener("transitionend", listener, true);
+ if (this._isChromeCollapsed)
+ this._fullScrToggler.hidden = false;
+ };
+ gNavToolbox.addEventListener("transitionend", listener, true);
+ this._fullScrToggler.hidden = true;
}
- // Hiding/collapsing the toolbox interferes with the tab bar's scrollbox,
- // so we just move it off-screen instead. See bug 430687.
gNavToolbox.style.marginTop =
- aShow ? "" : -gNavToolbox.getBoundingClientRect().height + "px";
-
- this._fullScrToggler.collapsed = aShow;
- this._isChromeCollapsed = !aShow;
- if (gPrefService.getIntPref("browser.fullscreen.animateUp") == 2)
- this._shouldAnimate = true;
+ -gNavToolbox.getBoundingClientRect().height + "px";
+ this._isChromeCollapsed = true;
+ MousePosTracker.removeListener(this);
},
showXULChrome: function(aTag, aShow)
diff --git a/application/palemoon/base/content/browser-plugins.js b/application/palemoon/base/content/browser-plugins.js
index 769ac6d8a..838268203 100644
--- a/application/palemoon/base/content/browser-plugins.js
+++ b/application/palemoon/base/content/browser-plugins.js
@@ -470,28 +470,12 @@ var gPluginHandler = {
}
},
- // Match the behaviour of nsPermissionManager
- _getHostFromPrincipal: function PH_getHostFromPrincipal(principal) {
- if (!principal.URI || principal.URI.schemeIs("moz-nullprincipal")) {
- return "(null)";
- }
-
- try {
- if (principal.URI.host)
- return principal.URI.host;
- } catch (e) {}
-
- return principal.origin;
- },
-
_makeCenterActions: function PH_makeCenterActions(notification) {
let contentWindow = notification.browser.contentWindow;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let principal = contentWindow.document.nodePrincipal;
- // This matches the behavior of nsPermssionManager, used for display purposes only
- let principalHost = this._getHostFromPrincipal(principal);
let centerActions = [];
let pluginsFound = new Set();
@@ -517,11 +501,11 @@ var gPluginHandler = {
let permissionObj = Services.perms.
getPermissionObject(principal, pluginInfo.permissionString, false);
if (permissionObj) {
- pluginInfo.pluginPermissionHost = permissionObj.host;
+ pluginInfo.pluginPermissionPrePath = permissionObj.principal.originNoSuffix;
pluginInfo.pluginPermissionType = permissionObj.expireType;
}
else {
- pluginInfo.pluginPermissionHost = principalHost;
+ pluginInfo.pluginPermissionPrePath = principal.originNoSuffix;
pluginInfo.pluginPermissionType = undefined;
}
diff --git a/application/palemoon/base/content/browser.css b/application/palemoon/base/content/browser.css
index 658655970..a2970aefc 100644
--- a/application/palemoon/base/content/browser.css
+++ b/application/palemoon/base/content/browser.css
@@ -504,6 +504,7 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(#nav-bar):not(
width: 100%;
height: 100%;
z-index: 2147483647 !important;
+ pointer-events: none;
}
#full-screen-warning-container[fade-warning-out] {
@@ -512,22 +513,13 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(#nav-bar):not(
opacity: 0.0;
}
-/* When the modal fullscreen approval UI is showing, don't allow interaction
- with the page, but when we're just showing the warning upon entering
- fullscreen on an already approved page, do allow interaction with the page.
- */
-#full-screen-warning-container:not([obscure-browser]) {
- pointer-events: none;
-}
-
#full-screen-warning-message {
/* We must specify a max-width, otherwise word-wrap:break-word doesn't
work in descendant <description> and <label> elements. Bug 630864. */
max-width: 800px;
}
-#full-screen-domain-text,
-#full-screen-remember-decision > .checkbox-label-box > .checkbox-label {
+#full-screen-domain-text {
word-wrap: break-word;
/* We must specify a min-width, otherwise word-wrap:break-word doesn't work. Bug 630864. */
min-width: 1px;
@@ -760,3 +752,8 @@ toolbarbutton[pmkit-button="true"] > .toolbarbutton-badge-stack > .toolbarbutton
#main-window[inFullscreen] #high-priority-global-notificationbox {
visibility: collapse;
}
+
+#navigator-toolbox[fullscreenShouldAnimate] {
+ transition: 0.7s margin-top ease-out;
+ transition-delay: 0.8s;
+}
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js
index c9f0aa4aa..c1643caa4 100644
--- a/application/palemoon/base/content/browser.js
+++ b/application/palemoon/base/content/browser.js
@@ -10,6 +10,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/RecentWindow.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "Task",
+ "resource://gre/modules/Task.jsm");
+
XPCOMUtils.defineLazyModuleGetter(this, "CharsetMenu",
"resource:///modules/CharsetMenu.jsm");
@@ -83,14 +86,8 @@ this.__defineSetter__("AddonManager", function (val) {
return this.AddonManager = val;
});
-this.__defineGetter__("PluralForm", function() {
- Cu.import("resource://gre/modules/PluralForm.jsm");
- return this.PluralForm;
-});
-this.__defineSetter__("PluralForm", function (val) {
- delete this.PluralForm;
- return this.PluralForm = val;
-});
+XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
+ "resource://gre/modules/PluralForm.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AboutHomeUtils",
"resource:///modules/AboutHomeUtils.jsm");
@@ -125,7 +122,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
XPCOMUtils.defineLazyModuleGetter(this, "FormValidationHandler",
"resource:///modules/FormValidationHandler.jsm");
-let gInitialPages = [
+var gInitialPages = [
"about:blank",
"about:newtab",
"about:home",
@@ -993,12 +990,23 @@ var gBrowserInit = {
gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, uriToLoad);
}
- // window.arguments[2]: referrer (nsIURI)
+ // window.arguments[2]: referrer (nsIURI | string)
// [3]: postData (nsIInputStream)
// [4]: allowThirdPartyFixup (bool)
+ // [5]: referrerPolicy (int)
else if (window.arguments.length >= 3) {
- loadURI(uriToLoad, window.arguments[2], window.arguments[3] || null,
- window.arguments[4] || false);
+ let referrerURI = window.arguments[2];
+ if (typeof(referrerURI) == "string") {
+ try {
+ referrerURI = makeURI(referrerURI);
+ } catch (e) {
+ referrerURI = null;
+ }
+ }
+ let referrerPolicy = (window.arguments[5] != undefined ?
+ window.arguments[5] : Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT);
+ loadURI(uriToLoad, referrerURI, window.arguments[3] || null,
+ window.arguments[4] || false, referrerPolicy);
window.focus();
}
// Note: loadOneOrMoreURIs *must not* be called if window.arguments.length >= 3.
@@ -1149,7 +1157,7 @@ var gBrowserInit = {
// Called when we enter DOM full-screen mode. Note we can already be in browser
// full-screen mode when we enter DOM full-screen mode.
- window.addEventListener("MozEnteredDomFullscreen", onMozEnteredDomFullscreen, true);
+ window.addEventListener("MozDOMFullscreen:NewOrigin", onMozEnteredDomFullscreen, true);
if (window.fullScreen)
onFullScreen();
@@ -1733,7 +1741,7 @@ function loadOneOrMoreURIs(aURIString)
function focusAndSelectUrlBar() {
if (gURLBar) {
if (window.fullScreen)
- FullScreen.mouseoverToggle(true);
+ FullScreen.showNavToolbox();
gURLBar.select();
if (document.activeElement == gURLBar.inputField)
@@ -1886,7 +1894,7 @@ function BrowserTryToCloseWindow()
window.close(); // WindowIsClosing does all the necessary checks
}
-function loadURI(uri, referrer, postData, allowThirdPartyFixup) {
+function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy) {
if (postData === undefined)
postData = null;
@@ -1897,92 +1905,135 @@ function loadURI(uri, referrer, postData, allowThirdPartyFixup) {
}
try {
- gBrowser.loadURIWithFlags(uri, flags, referrer, null, postData);
+ gBrowser.loadURIWithFlags(uri, {
+ flags: flags,
+ referrerURI: referrer,
+ referrerPolicy: referrerPolicy,
+ postData: postData,
+ });
} catch (e) {}
}
-function getShortcutOrURI(aURL, aPostDataRef, aMayInheritPrincipal) {
- // Initialize outparam to false
- if (aMayInheritPrincipal)
- aMayInheritPrincipal.value = false;
+/**
+ * Given a urlbar value, discerns between URIs, keywords and aliases.
+ *
+ * @param url
+ * The urlbar value.
+ * @param callback (optional, deprecated)
+ * The callback function invoked when done. This parameter is
+ * deprecated, please use the Promise that is returned.
+ *
+ * @return Promise<{ postData, url, mayInheritPrincipal }>
+ */
+function getShortcutOrURIAndPostData(url, callback = null) {
+ if (callback) {
+ Deprecated.warning("Please use the Promise returned by " +
+ "getShortcutOrURIAndPostData() instead of passing a " +
+ "callback",
+ "https://bugzilla.mozilla.org/show_bug.cgi?id=1100294");
+ }
- var shortcutURL = null;
- var keyword = aURL;
- var param = "";
+ return Task.spawn(function* () {
+ let mayInheritPrincipal = false;
+ let postData = null;
+ let shortcutURL = null;
+ let keyword = url;
+ let param = "";
- var offset = aURL.indexOf(" ");
- if (offset > 0) {
- keyword = aURL.substr(0, offset);
- param = aURL.substr(offset + 1);
- }
+ let offset = url.indexOf(" ");
+ if (offset > 0) {
+ keyword = url.substr(0, offset);
+ param = url.substr(offset + 1);
+ }
- if (!aPostDataRef)
- aPostDataRef = {};
+ let engine = Services.search.getEngineByAlias(keyword);
+ if (engine) {
+ let submission = engine.getSubmission(param, null, "keyword");
+ postData = submission.postData;
+ return { postData: submission.postData, url: submission.uri.spec,
+ mayInheritPrincipal };
+ }
- var engine = Services.search.getEngineByAlias(keyword);
- if (engine) {
- var submission = engine.getSubmission(param);
- aPostDataRef.value = submission.postData;
- return submission.uri.spec;
- }
+ let entry = yield PlacesUtils.keywords.fetch(keyword);
+ if (entry) {
+ shortcutURL = entry.url.href;
+ postData = entry.postData;
+ }
- [shortcutURL, aPostDataRef.value] =
- PlacesUtils.getURLAndPostDataForKeyword(keyword);
+ if (!shortcutURL) {
+ return { postData, url, mayInheritPrincipal };
+ }
- if (!shortcutURL)
- return aURL;
+ let escapedPostData = "";
+ if (postData)
+ escapedPostData = unescape(postData);
- var postData = "";
- if (aPostDataRef.value)
- postData = unescape(aPostDataRef.value);
+ if (/%s/i.test(shortcutURL) || /%s/i.test(escapedPostData)) {
+ let charset = "";
+ const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/;
+ let matches = shortcutURL.match(re);
- if (/%s/i.test(shortcutURL) || /%s/i.test(postData)) {
- var charset = "";
- const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/;
- var matches = shortcutURL.match(re);
- if (matches)
- [, shortcutURL, charset] = matches;
- else {
- // Try to get the saved character-set.
- try {
- // makeURI throws if URI is invalid.
- // Will return an empty string if character-set is not found.
- charset = PlacesUtils.history.getCharsetForURI(makeURI(shortcutURL));
- } catch (e) {}
- }
+ if (matches) {
+ [, shortcutURL, charset] = matches;
+ } else {
+ let uri;
+ try {
+ // makeURI() throws if URI is invalid.
+ uri = makeURI(shortcutURL);
+ } catch (ex) {}
+
+ if (uri) {
+ // Try to get the saved character-set.
+ // Will return an empty string if character-set is not found.
+ charset = yield PlacesUtils.getCharsetForURI(uri);
+ }
+ }
- // encodeURIComponent produces UTF-8, and cannot be used for other charsets.
- // escape() works in those cases, but it doesn't uri-encode +, @, and /.
- // Therefore we need to manually replace these ASCII characters by their
- // encodeURIComponent result, to match the behavior of nsEscape() with
- // url_XPAlphas
- var encodedParam = "";
- if (charset && charset != "UTF-8")
- encodedParam = escape(convertFromUnicode(charset, param)).
- replace(/[+@\/]+/g, encodeURIComponent);
- else // Default charset is UTF-8
- encodedParam = encodeURIComponent(param);
+ // encodeURIComponent produces UTF-8, and cannot be used for other charsets.
+ // escape() works in those cases, but it doesn't uri-encode +, @, and /.
+ // Therefore we need to manually replace these ASCII characters by their
+ // encodeURIComponent result, to match the behavior of nsEscape() with
+ // url_XPAlphas
+ let encodedParam = "";
+ if (charset && charset != "UTF-8")
+ encodedParam = escape(convertFromUnicode(charset, param)).
+ replace(/[+@\/]+/g, encodeURIComponent);
+ else // Default charset is UTF-8
+ encodedParam = encodeURIComponent(param);
- shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param);
+ shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param);
- if (/%s/i.test(postData)) // POST keyword
- aPostDataRef.value = getPostDataStream(postData, param, encodedParam,
- "application/x-www-form-urlencoded");
- }
- else if (param) {
- // This keyword doesn't take a parameter, but one was provided. Just return
- // the original URL.
- aPostDataRef.value = null;
+ if (/%s/i.test(escapedPostData)) // POST keyword
+ postData = getPostDataStream(escapedPostData, param, encodedParam,
+ "application/x-www-form-urlencoded");
- return aURL;
- }
+ // This URL came from a bookmark, so it's safe to let it inherit the current
+ // document's principal.
+ mayInheritPrincipal = true;
+
+ return { postData, url: shortcutURL, mayInheritPrincipal };
+ }
+
+ if (param) {
+ // This keyword doesn't take a parameter, but one was provided. Just return
+ // the original URL.
+ postData = null;
- // This URL came from a bookmark, so it's safe to let it inherit the current
- // document's principal.
- if (aMayInheritPrincipal)
- aMayInheritPrincipal.value = true;
+ return { postData, url, mayInheritPrincipal };
+ }
+
+ // This URL came from a bookmark, so it's safe to let it inherit the current
+ // document's principal.
+ mayInheritPrincipal = true;
- return shortcutURL;
+ return { postData, url: shortcutURL, mayInheritPrincipal };
+ }).then(data => {
+ if (callback) {
+ callback(data);
+ }
+
+ return data;
+ });
}
function getPostDataStream(aStringData, aKeyword, aEncKeyword, aType) {
@@ -2482,8 +2533,8 @@ function BrowserFullScreen()
window.fullScreen = !window.fullScreen;
}
-function onFullScreen(event) {
- FullScreen.toggle(event);
+function onFullScreen() {
+ FullScreen.toggle();
}
function onMozEnteredDomFullscreen(event) {
@@ -2641,8 +2692,8 @@ var browserDragAndDrop = {
}
},
- drop: function (aEvent, aName, aDisallowInherit) {
- return Services.droppedLinkHandler.dropLink(aEvent, aName, aDisallowInherit);
+ dropLinks: function (aEvent, aDisallowInherit) {
+ return Services.droppedLinkHandler.dropLinks(aEvent, aDisallowInherit);
}
};
@@ -2650,8 +2701,10 @@ var homeButtonObserver = {
onDrop: function (aEvent)
{
// disallow setting home pages that inherit the principal
- let url = browserDragAndDrop.drop(aEvent, {}, true);
- setTimeout(openHomeDialog, 0, url);
+ let links = browserDragAndDrop.dropLinks(aEvent, true);
+ if (links.length) {
+ setTimeout(openHomeDialog, 0, links.map(link => link.url).join("|"));
+ }
},
onDragOver: function (aEvent)
@@ -2667,18 +2720,24 @@ var homeButtonObserver = {
function openHomeDialog(aURL)
{
var promptTitle = gNavigatorBundle.getString("droponhometitle");
- var promptMsg = gNavigatorBundle.getString("droponhomemsg");
+ var promptMsg;
+ if (aURL.includes("|")) {
+ promptMsg = gNavigatorBundle.getString("droponhomemsgMultiple");
+ } else {
+ promptMsg = gNavigatorBundle.getString("droponhomemsg");
+ }
+
var pressedVal = Services.prompt.confirmEx(window, promptTitle, promptMsg,
Services.prompt.STD_YES_NO_BUTTONS,
null, null, null, null, {value:0});
if (pressedVal == 0) {
try {
- var str = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
- str.data = aURL;
+ var homepageStr = Components.classes["@mozilla.org/supports-string;1"]
+ .createInstance(Components.interfaces.nsISupportsString);
+ homepageStr.data = aURL;
gPrefService.setComplexValue("browser.startup.homepage",
- Components.interfaces.nsISupportsString, str);
+ Components.interfaces.nsISupportsString, homepageStr);
} catch (ex) {
dump("Failed to set the home page.\n"+ex+"\n");
}
@@ -2726,13 +2785,16 @@ var newTabButtonObserver = {
onDrop: function (aEvent)
{
- let url = browserDragAndDrop.drop(aEvent, { });
- var postData = {};
- url = getShortcutOrURI(url, postData);
- if (url) {
- // allow third-party services to fixup this URL
- openNewTabWith(url, null, postData.value, aEvent, true);
- }
+ let links = browserDragAndDrop.dropLinks(aEvent);
+ Task.spawn(function*() {
+ for (let link of links) {
+ let data = yield getShortcutOrURIAndPostData(link.url);
+ if (data.url) {
+ // allow third-party services to fixup this URL
+ openNewTabWith(data.url, null, data.postData, aEvent, true);
+ }
+ }
+ });
}
}
@@ -2746,13 +2808,16 @@ var newWindowButtonObserver = {
},
onDrop: function (aEvent)
{
- let url = browserDragAndDrop.drop(aEvent, { });
- var postData = {};
- url = getShortcutOrURI(url, postData);
- if (url) {
- // allow third-party services to fixup this URL
- openNewWindowWith(url, null, postData.value, true);
- }
+ let links = browserDragAndDrop.dropLinks(aEvent);
+ Task.spawn(function*() {
+ for (let link of links) {
+ let data = yield getShortcutOrURIAndPostData(link.url);
+ if (data.url) {
+ // allow third-party services to fixup this URL
+ openNewWindowWith(data.url, null, data.postData, true);
+ }
+ }
+ });
}
}
@@ -2950,7 +3015,7 @@ const BrowserSearch = {
#endif
var searchBar = this.searchBar;
if (searchBar && window.fullScreen)
- FullScreen.mouseoverToggle(true);
+ FullScreen.showNavToolbox();
if (searchBar)
searchBar.select();
if (!searchBar || document.activeElement != searchBar.textbox.inputField)
@@ -4239,6 +4304,13 @@ nsBrowserAccess.prototype = {
else
aWhere = gPrefService.getIntPref("browser.link.open_newwindow");
}
+
+ let referrer = aOpener ? makeURI(aOpener.location.href) : null;
+ let referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT;
+ if (aOpener && aOpener.document) {
+ referrerPolicy = aOpener.document.referrerPolicy;
+ }
+
switch (aWhere) {
case Ci.nsIBrowserDOMWindow.OPEN_NEWWINDOW :
// FIXME: Bug 408379. So how come this doesn't send the
@@ -4277,6 +4349,7 @@ nsBrowserAccess.prototype = {
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank", {
referrerURI: referrer,
+ referrerPolicy: referrerPolicy,
fromExternal: isExternal,
inBackground: loadInBackground});
let browser = win.gBrowser.getBrowserForTab(tab);
@@ -4292,11 +4365,14 @@ nsBrowserAccess.prototype = {
default : // OPEN_CURRENTWINDOW or an illegal value
newWindow = content;
if (aURI) {
- let referrer = aOpener ? makeURI(aOpener.location.href) : null;
let loadflags = isExternal ?
Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
- gBrowser.loadURIWithFlags(aURI.spec, loadflags, referrer, null, null);
+ gBrowser.loadURIWithFlags(aURI.spec, {
+ flags: loadflags,
+ referrerURI: referrer,
+ referrerPolicy: referrerPolicy,
+ });
}
if (!gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground"))
window.focus();
@@ -5026,7 +5102,8 @@ function handleLinkClick(event, href, linkNode) {
urlSecurityCheck(href, doc.nodePrincipal);
openLinkIn(href, where, { referrerURI: doc.documentURIObject,
- charset: doc.characterSet });
+ charset: doc.characterSet,
+ referrerPolicy: doc.referrerPolicy });
event.preventDefault();
return true;
}
@@ -5040,36 +5117,81 @@ function middleMousePaste(event) {
// bar's behavior (stripsurroundingwhitespace)
clipboard = clipboard.replace(/\s*\n\s*/g, "");
- let mayInheritPrincipal = { value: false };
- let url = getShortcutOrURI(clipboard, mayInheritPrincipal);
- try {
- makeURI(url);
- } catch (ex) {
- // Not a valid URI.
- return;
+ // if it's not the current tab, we don't need to do anything because the
+ // browser doesn't exist.
+ let where = whereToOpenLink(event, true, false);
+ let lastLocationChange;
+ if (where == "current") {
+ lastLocationChange = gBrowser.selectedBrowser.lastLocationChange;
}
- try {
- addToUrlbarHistory(url);
- } catch (ex) {
- // Things may go wrong when adding url to session history,
- // but don't let that interfere with the loading of the url.
- Cu.reportError(ex);
- }
+ getShortcutOrURIAndPostData(clipboard).then(data => {
+ try {
+ makeURI(data.url);
+ } catch (ex) {
+ // Not a valid URI.
+ return;
+ }
+
+ try {
+ addToUrlbarHistory(data.url);
+ } catch (ex) {
+ // Things may go wrong when adding url to session history,
+ // but don't let that interfere with the loading of the url.
+ Cu.reportError(ex);
+ }
- openUILink(url, event,
- { ignoreButton: true,
- disallowInheritPrincipal: !mayInheritPrincipal.value });
+ if (where != "current" ||
+ lastLocationChange == gBrowser.selectedBrowser.lastLocationChange) {
+ openUILink(data.url, event,
+ { ignoreButton: true,
+ disallowInheritPrincipal: !data.mayInheritPrincipal,
+ initiatingDoc: event ? event.target.ownerDocument : null });
+ }
+ });
event.stopPropagation();
}
-function handleDroppedLink(event, url, name)
+// handleDroppedLink has the following 2 overloads:
+// handleDroppedLink(event, url, name)
+// handleDroppedLink(event, links)
+function handleDroppedLink(event, urlOrLinks, name)
{
- let postData = { };
- let uri = getShortcutOrURI(url, postData);
- if (uri)
- loadURI(uri, null, postData.value, false);
+ let links;
+ if (Array.isArray(urlOrLinks)) {
+ links = urlOrLinks;
+ } else {
+ links = [{ url: urlOrLinks, name, type: "" }];
+ }
+
+ let lastLocationChange = gBrowser.selectedBrowser.lastLocationChange;
+
+ let userContextId = gBrowser.selectedBrowser
+ .getAttribute("usercontextid") || 0;
+
+ let inBackground = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
+ if (event.shiftKey)
+ inBackground = !inBackground;
+
+ Task.spawn(function*() {
+ let urls = [];
+ let postDatas = [];
+ for (let link of links) {
+ let data = yield getShortcutOrURIAndPostData(link.url);
+ urls.push(data.url);
+ postDatas.push(data.postData);
+ }
+ if (lastLocationChange == gBrowser.selectedBrowser.lastLocationChange) {
+ gBrowser.loadTabs(urls, {
+ inBackground,
+ replace: true,
+ allowThirdPartyFixup: false,
+ postDatas,
+ userContextId,
+ });
+ }
+ });
// Keep the event from being handled by the dragDrop listeners
// built-in to goanna if they happen to be above us.
@@ -5184,7 +5306,6 @@ function charsetLoadListener() {
}
}
-
var gPageStyleMenu = {
_getAllStyleSheets: function (frameset) {
diff --git a/application/palemoon/base/content/browser.xul b/application/palemoon/base/content/browser.xul
index c2553f295..f9030056e 100644
--- a/application/palemoon/base/content/browser.xul
+++ b/application/palemoon/base/content/browser.xul
@@ -941,7 +941,7 @@
</toolbarpalette>
</toolbox>
- <hbox id="fullscr-toggler" collapsed="true"/>
+ <hbox id="fullscr-toggler" hidden="true"/>
<hbox flex="1" id="browser">
<vbox id="browser-border-start" hidden="true" layer="true"/>
@@ -974,18 +974,6 @@
<vbox id="full-screen-warning-message" align="center">
<description id="full-screen-domain-text"/>
<description class="full-screen-description" value="&fullscreenExitHint.value;"/>
- <vbox id="full-screen-approval-pane" align="center">
- <description class="full-screen-description" value="&fullscreenApproval.value;"/>
- <hbox>
- <button label="&fullscreenAllowButton.label;"
- oncommand="FullScreen.setFullscreenAllowed(true);"
- class="full-screen-approval-button"/>
- <button label="&fullscreenExitButton.label;"
- oncommand="FullScreen.setFullscreenAllowed(false);"
- class="full-screen-approval-button"/>
- </hbox>
- <checkbox id="full-screen-remember-decision"/>
- </vbox>
</vbox>
</hbox>
</hbox>
diff --git a/application/palemoon/base/content/newtab/grid.js b/application/palemoon/base/content/newtab/grid.js
index 46e0b804b..a614d0396 100644
--- a/application/palemoon/base/content/newtab/grid.js
+++ b/application/palemoon/base/content/newtab/grid.js
@@ -59,8 +59,13 @@ var gGrid = {
* Refreshes the grid and re-creates all sites.
*/
refresh: function Grid_refresh() {
+ let cells = this.cells;
+ if (!cells) {
+ return;
+ }
+
// Remove all sites.
- this.cells.forEach(function (cell) {
+ cells.forEach(function (cell) {
let node = cell.node;
let child = node.firstElementChild;
diff --git a/application/palemoon/base/content/nsContextMenu.js b/application/palemoon/base/content/nsContextMenu.js
index 830c20998..f389491d3 100644
--- a/application/palemoon/base/content/nsContextMenu.js
+++ b/application/palemoon/base/content/nsContextMenu.js
@@ -753,7 +753,8 @@ nsContextMenu.prototype = {
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
openLinkIn(this.linkURL, "window",
{ charset: doc.characterSet,
- referrerURI: doc.documentURIObject });
+ referrerURI: doc.documentURIObject,
+ referrerPolicy: doc.referrerPolicy });
},
// Open linked-to URL in a new private window.
@@ -763,6 +764,7 @@ nsContextMenu.prototype = {
openLinkIn(this.linkURL, "window",
{ charset: doc.characterSet,
referrerURI: doc.documentURIObject,
+ referrerPolicy: doc.referrerPolicy,
private: true });
},
@@ -772,7 +774,8 @@ nsContextMenu.prototype = {
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
openLinkIn(this.linkURL, "tab",
{ charset: doc.characterSet,
- referrerURI: doc.documentURIObject });
+ referrerURI: doc.documentURIObject,
+ referrerPolicy: doc.referrerPolicy });
},
// open URL in current tab
diff --git a/application/palemoon/base/content/openLocation.js b/application/palemoon/base/content/openLocation.js
index 316dfac70..f39e34666 100644
--- a/application/palemoon/base/content/openLocation.js
+++ b/application/palemoon/base/content/openLocation.js
@@ -61,45 +61,52 @@ function doEnabling()
function open()
{
- var url;
- var postData = {};
- var mayInheritPrincipal = {value: false};
- if (browser)
- url = browser.getShortcutOrURI(dialog.input.value, postData, mayInheritPrincipal);
- else
- url = dialog.input.value;
+ getShortcutOrURIAndPostData(dialog.input.value).then(data => {
+ let url;
+ let postData = null;
+ let mayInheritPrincipal = false;
+
+ if (browser) {
+ url = data.url;
+ postData = data.postData;
+ mayInheritPrincipal = data.mayInheritPrincipal;
+ } else {
+ url = dialog.input.value;
+ }
- try {
- // Whichever target we use for the load, we allow third-party services to
- // fixup the URI
- switch (dialog.openWhereList.value) {
- case "0":
- var webNav = Components.interfaces.nsIWebNavigation;
- var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
- webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
- if (!mayInheritPrincipal.value)
- flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
- browser.gBrowser.loadURIWithFlags(url, flags, null, null, postData.value);
- break;
- case "1":
- window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no",
- url, postData.value, null, null, true);
- break;
- case "3":
- browser.delayedOpenTab(url, null, null, postData.value, true);
- break;
+ try {
+ // Whichever target we use for the load, we allow third-party services to
+ // fixup the URI
+ switch (dialog.openWhereList.value) {
+ case "0":
+ var webNav = Components.interfaces.nsIWebNavigation;
+ var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
+ webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
+ if (!mayInheritPrincipal)
+ flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
+ browser.gBrowser.loadURIWithFlags(url, flags, null, null, postData);
+ break;
+ case "1":
+ window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no",
+ url, postData, null, null, true);
+ break;
+ case "3":
+ browser.delayedOpenTab(url, null, null, postData, true);
+ break;
+ }
+ }
+ catch(exception) {
}
- }
- catch(exception) {
- }
- if (pref) {
- gOpenLocationLastURL.value = dialog.input.value;
- pref.setIntPref("general.open_location.last_window_choice", dialog.openWhereList.value);
- }
+ if (pref) {
+ gOpenLocationLastURL.value = dialog.input.value;
+ pref.setIntPref("general.open_location.last_window_choice", dialog.openWhereList.value);
+ }
+
+ // Delay closing slightly to avoid timing bug on Linux.
+ window.close();
+ });
- // Delay closing slightly to avoid timing bug on Linux.
- window.close();
return false;
}
diff --git a/application/palemoon/base/content/pageinfo/pageInfo.js b/application/palemoon/base/content/pageinfo/pageInfo.js
index 83f0ddb91..6b02bc370 100644
--- a/application/palemoon/base/content/pageinfo/pageInfo.js
+++ b/application/palemoon/base/content/pageinfo/pageInfo.js
@@ -1112,8 +1112,9 @@ var imagePermissionObserver = {
var row = getSelectedRow(imageTree);
var item = gImageView.data[row][COL_IMAGE_NODE];
var url = gImageView.data[row][COL_IMAGE_ADDRESS];
- if (makeURI(url).host == permission.host)
+ if (permission.matchesURI(makeURI(url), true)) {
makeBlockImage(url);
+ }
}
}
}
diff --git a/application/palemoon/base/content/pageinfo/pageInfo.xul b/application/palemoon/base/content/pageinfo/pageInfo.xul
index 5bca1b495..943fa805c 100644
--- a/application/palemoon/base/content/pageinfo/pageInfo.xul
+++ b/application/palemoon/base/content/pageinfo/pageInfo.xul
@@ -52,7 +52,6 @@
<command id="cmd_cookieDef" oncommand="onCheckboxClick('cookie');"/>
<command id="cmd_desktop-notificationDef" oncommand="onCheckboxClick('desktop-notification');"/>
<command id="cmd_installDef" oncommand="onCheckboxClick('install');"/>
- <command id="cmd_fullscreenDef" oncommand="onCheckboxClick('fullscreen');"/>
<command id="cmd_geoDef" oncommand="onCheckboxClick('geo');"/>
<command id="cmd_indexedDBDef" oncommand="onCheckboxClick('indexedDB');"/>
<command id="cmd_pluginsDef" oncommand="onCheckboxClick('plugins');"/>
@@ -61,12 +60,9 @@
<command id="cmd_cookieToggle" oncommand="onRadioClick('cookie');"/>
<command id="cmd_desktop-notificationToggle" oncommand="onRadioClick('desktop-notification');"/>
<command id="cmd_installToggle" oncommand="onRadioClick('install');"/>
- <command id="cmd_fullscreenToggle" oncommand="onRadioClick('fullscreen');"/>
<command id="cmd_geoToggle" oncommand="onRadioClick('geo');"/>
<command id="cmd_indexedDBToggle" oncommand="onRadioClick('indexedDB');"/>
<command id="cmd_pluginsToggle" oncommand="onPluginRadioClick(event);"/>
- <command id="cmd_pointerLockDef" oncommand="onCheckboxClick('pointerLock');"/>
- <command id="cmd_pointerLockToggle" oncommand="onRadioClick('pointerLock');"/>
</commandset>
<keyset id="pageInfoKeySet">
@@ -405,31 +401,6 @@
</radiogroup>
</hbox>
</vbox>
- <vbox class="permission" id="permFullscreenRow">
- <label class="permissionLabel" id="permFullscreenLabel"
- value="&permFullscreen;" control="fullscreenRadioGroup"/>
- <hbox id="permFullscreenBox" role="group" aria-labelledby="permFullscreenLabel">
- <checkbox id="fullscreenDef" command="cmd_fullscreenDef" label="&permUseDefault;"/>
- <spacer flex="1"/>
- <radiogroup id="fullscreenRadioGroup" orient="horizontal">
- <radio id="fullscreen#0" command="cmd_fullscreenToggle" label="&permAskAlways;"/>
- <radio id="fullscreen#1" command="cmd_fullscreenToggle" label="&permAllow;"/>
- <radio id="fullscreen#2" command="cmd_fullscreenToggle" label="&permBlock;"/>
- </radiogroup>
- </hbox>
- </vbox>
- <vbox class="permission" id="permPointerLockRow" >
- <label class="permissionLabel" id="permPointerLockLabel"
- value="&permPointerLock2;" control="pointerLockRadioGroup"/>
- <hbox id="permPointerLockBox" role="group" aria-labelledby="permPointerLockLabel">
- <checkbox id="pointerLockDef" command="cmd_pointerLockDef" label="&permAskAlways;"/>
- <spacer flex="1"/>
- <radiogroup id="pointerLockRadioGroup" orient="horizontal">
- <radio id="pointerLock#1" command="cmd_pointerLockToggle" label="&permAllow;"/>
- <radio id="pointerLock#2" command="cmd_pointerLockToggle" label="&permBlock;"/>
- </radiogroup>
- </hbox>
- </vbox>
</vbox>
</vbox>
diff --git a/application/palemoon/base/content/pageinfo/permissions.js b/application/palemoon/base/content/pageinfo/permissions.js
index 2fa0cc303..e0fb01f76 100644
--- a/application/palemoon/base/content/pageinfo/permissions.js
+++ b/application/palemoon/base/content/pageinfo/permissions.js
@@ -76,20 +76,6 @@ var gPermObj = {
{
return UNKNOWN;
},
- fullscreen: function getFullscreenDefaultPermissions()
- {
- if (!gPrefs.getBoolPref("full-screen-api.enabled")) {
- return DENY;
- }
- return UNKNOWN;
- },
- pointerLock: function getPointerLockPermissions()
- {
- if (!gPrefs.getBoolPref("full-screen-api.pointer-lock.enabled")) {
- return DENY;
- }
- return ALLOW;
- },
};
var permissionObserver = {
@@ -98,7 +84,7 @@ var permissionObserver = {
if (aTopic == "perm-changed") {
var permission = aSubject.QueryInterface(
Components.interfaces.nsIPermission);
- if (permission.host == gPermURI.host) {
+ if (permission.matchesURI(gPermURI, true)) {
if (permission.type in gPermObj)
initRow(permission.type);
else if (permission.type.startsWith("plugin"))
@@ -119,7 +105,7 @@ function onLoadPermission(principal)
gPermURI = uri;
gPermPrincipal = principal;
var hostText = document.getElementById("hostText");
- hostText.value = gPermURI.host;
+ hostText.value = gPermURI.prePath;
for (var i in gPermObj)
initRow(i);
diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml
index a7cc6deea..1b8099785 100644
--- a/application/palemoon/base/content/tabbrowser.xml
+++ b/application/palemoon/base/content/tabbrowser.xml
@@ -570,6 +570,12 @@
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
const nsIChannel = Components.interfaces.nsIChannel;
+ let location, originalLocation;
+ try {
+ aRequest.QueryInterface(nsIChannel)
+ location = aRequest.URI;
+ originalLocation = aRequest.originalURI;
+ } catch (ex) {}
if (aStateFlags & nsIWebProgressListener.STATE_START) {
this.mRequestCount++;
@@ -588,16 +594,8 @@
if (aStateFlags & nsIWebProgressListener.STATE_START &&
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
- // It's okay to clear what the user typed when we start
- // loading a document. If the user types, this counter gets
- // set to zero, if the document load ends without an
- // onLocationChange, this counter gets decremented
- // (so we keep it while switching tabs after failed loads)
- // We need to add 2 because loadURIWithFlags may have
- // cancelled a pending load which would have cleared
- // its anchor scroll detection temporary increment.
if (aWebProgress.isTopLevel)
- this.mBrowser.userTypedClear += 2;
+ this.mBrowser.urlbarChangeTracker.startedLoad();
if (this._shouldShowProgress(aRequest)) {
if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
@@ -625,8 +623,8 @@
this.mTab.removeAttribute("progress");
if (aWebProgress.isTopLevel) {
- if (!Components.isSuccessCode(aStatus) &&
- !isTabEmpty(this.mTab)) {
+ let isSuccessful = Components.isSuccessCode(aStatus);
+ if (!isSuccessful && !isTabEmpty(this.mTab)) {
// Restore the current document's location in case the
// request was stopped (possibly from a content script)
// before the location changed.
@@ -635,14 +633,8 @@
if (this.mTab.selected && gURLBar)
URLBarSetURI();
- } else {
- // The document is done loading, we no longer want the
- // value cleared.
-
- if (this.mBrowser.userTypedClear > 1)
- this.mBrowser.userTypedClear -= 2;
- else if (this.mBrowser.userTypedClear > 0)
- this.mBrowser.userTypedClear--;
+ } else if (isSuccessful) {
+ this.mBrowser.urlbarChangeTracker.finishedLoad();
}
if (!this.mBrowser.mIconURL)
@@ -652,8 +644,6 @@
if (this.mBlank)
this.mBlank = false;
- var location = aRequest.QueryInterface(nsIChannel).URI;
-
// For keyword URIs clear the user typed value since they will be changed into real URIs
if (location.scheme == "keyword")
this.mBrowser.userTypedValue = null;
@@ -696,13 +686,12 @@
let topLevel = aWebProgress.isTopLevel;
if (topLevel) {
- // If userTypedClear > 0, the document loaded correctly and we should be
- // clearing the user typed value. We also need to clear the typed value
+ // We need to clear the typed value
// if the document failed to load, to make sure the urlbar reflects the
// failed URI (particularly for SSL errors). However, don't clear the value
// if the error page's URI is about:blank, because that causes complete
// loss of urlbar contents for invalid URI errors (see bug 867957).
- if (this.mBrowser.userTypedClear > 0 ||
+ if (this.mBrowser.didStartLoadSinceLastUserTyping() ||
((aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) &&
aLocation.spec != "about:blank"))
this.mBrowser.userTypedValue = null;
@@ -738,8 +727,10 @@
aFlags]);
}
- if (topLevel)
+ if (topLevel) {
this.mBrowser.lastURI = aLocation;
+ this.mBrowser.lastLocationChange = Date.now();
+ }
},
onStatusChange: function (aWebProgress, aRequest, aStatus, aMessage) {
@@ -1273,6 +1264,7 @@
<parameter name="aAllowThirdPartyFixup"/>
<body>
<![CDATA[
+ var aReferrerPolicy;
var aFromExternal;
var aRelatedToCurrent;
if (arguments.length == 2 &&
@@ -1280,6 +1272,7 @@
!(arguments[1] instanceof Ci.nsIURI)) {
let params = arguments[1];
aReferrerURI = params.referrerURI;
+ aReferrerPolicy = params.referrerPolicy;
aCharset = params.charset;
aPostData = params.postData;
aLoadInBackground = params.inBackground;
@@ -1293,6 +1286,7 @@
var owner = bgLoad ? null : this.selectedTab;
var tab = this.addTab(aURI, {
referrerURI: aReferrerURI,
+ referrerPolicy: aReferrerPolicy,
charset: aCharset,
postData: aPostData,
ownerTab: owner,
@@ -1312,6 +1306,24 @@
<parameter name="aLoadInBackground"/>
<parameter name="aReplace"/>
<body><![CDATA[
+ let aAllowThirdPartyFixup;
+ let aTargetTab;
+ let aNewIndex = -1;
+ let aPostDatas = [];
+ let aUserContextId;
+ if (arguments.length == 2 &&
+ typeof arguments[1] == "object") {
+ let params = arguments[1];
+ aLoadInBackground = params.inBackground;
+ aReplace = params.replace;
+ aAllowThirdPartyFixup = params.allowThirdPartyFixup;
+ aTargetTab = params.targetTab;
+ aNewIndex = typeof params.newIndex === "number" ?
+ params.newIndex : aNewIndex;
+ aPostDatas = params.postDatas || aPostDatas;
+ aUserContextId = params.userContextId;
+ }
+
if (!aURIs.length)
return;
@@ -1329,22 +1341,53 @@
var multiple = aURIs.length > 1;
var owner = multiple || aLoadInBackground ? null : this.selectedTab;
var firstTabAdded = null;
+ var targetTabIndex = -1;
if (aReplace) {
+ let browser;
+ if (aTargetTab) {
+ browser = this.getBrowserForTab(aTargetTab);
+ targetTabIndex = aTargetTab._tPos;
+ } else {
+ browser = this.mCurrentBrowser;
+ targetTabIndex = this.tabContainer.selectedIndex;
+ }
+ let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
+ if (aAllowThirdPartyFixup) {
+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
+ Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
+ }
try {
- this.loadURI(aURIs[0], null, null);
+ browser.loadURIWithFlags(aURIs[0], {
+ flags, postData: aPostDatas[0]
+ });
} catch (e) {
// Ignore failure in case a URI is wrong, so we can continue
// opening the next ones.
}
+ } else {
+ firstTabAdded = this.addTab(aURIs[0], {
+ ownerTab: owner,
+ skipAnimation: multiple,
+ allowThirdPartyFixup: aAllowThirdPartyFixup,
+ postData: aPostDatas[0],
+ userContextId: aUserContextId
+ });
+ if (aNewIndex !== -1) {
+ this.moveTabTo(firstTabAdded, aNewIndex);
+ targetTabIndex = firstTabAdded._tPos;
+ }
}
- else
- firstTabAdded = this.addTab(aURIs[0], {ownerTab: owner, skipAnimation: multiple});
- var tabNum = this.tabContainer.selectedIndex;
+ let tabNum = targetTabIndex;
for (let i = 1; i < aURIs.length; ++i) {
- let tab = this.addTab(aURIs[i], {skipAnimation: true});
- if (aReplace)
+ let tab = this.addTab(aURIs[i], {
+ skipAnimation: true,
+ allowThirdPartyFixup: aAllowThirdPartyFixup,
+ postData: aPostDatas[i],
+ userContextId: aUserContextId
+ });
+ if (targetTabIndex !== -1)
this.moveTabTo(tab, ++tabNum);
}
@@ -1369,6 +1412,7 @@
<body>
<![CDATA[
const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ var aReferrerPolicy;
var aFromExternal;
var aRelatedToCurrent;
var aSkipAnimation;
@@ -1377,6 +1421,7 @@
!(arguments[1] instanceof Ci.nsIURI)) {
let params = arguments[1];
aReferrerURI = params.referrerURI;
+ aReferrerPolicy = params.referrerPolicy;
aCharset = params.charset;
aPostData = params.postData;
aOwner = params.ownerTab;
@@ -1548,7 +1593,13 @@
if (aFromExternal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
try {
- b.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset, aPostData);
+ b.loadURIWithFlags(aURI, {
+ flags: flags,
+ referrerURI: aReferrerURI,
+ referrerPolicy: aReferrerPolicy,
+ charset: aCharset,
+ postData: aPostData,
+ });
} catch (ex) {
Cu.reportError(ex);
}
@@ -2660,6 +2711,11 @@
<parameter name="aPostData"/>
<body>
<![CDATA[
+ // Note - the callee understands both:
+ // (a) loadURIWithFlags(aURI, aFlags, ...)
+ // (b) loadURIWithFlags(aURI, { flags: aFlags, ... })
+ // Forwarding it as (a) here actually supports both (a) and (b),
+ // so you can call us either way too.
return this.mCurrentBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData);
]]>
</body>
@@ -2976,10 +3032,6 @@
]]></body>
</method>
- <property name="userTypedClear"
- onget="return this.mCurrentBrowser.userTypedClear;"
- onset="return this.mCurrentBrowser.userTypedClear = val;"/>
-
<property name="userTypedValue"
onget="return this.mCurrentBrowser.userTypedValue;"
onset="return this.mCurrentBrowser.userTypedValue = val;"/>
@@ -4456,40 +4508,35 @@
this.tabbrowser.updateCurrentBrowser(true);
} else {
// Pass true to disallow dropping javascript: or data: urls
- let url;
+ let links;
try {
- url = browserDragAndDrop.drop(event, { }, true);
+ links = browserDragAndDrop.dropLinks(event, true);
} catch (ex) {}
// // valid urls don't contain spaces ' '; if we have a space it isn't a valid url.
// if (!url || url.includes(" ")) //PMed
- if (!url) //FF
+ if (!links || links.length === 0) //FF
return;
- let bgLoad = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
+ let inBackground = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
if (event.shiftKey)
- bgLoad = !bgLoad;
+ inBackground = !inBackground;
- let tab = this._getDragTargetTab(event);
- if (!tab || dropEffect == "copy") {
- // We're adding a new tab.
- let newIndex = this._getDropIndex(event);
- let newTab = this.tabbrowser.loadOneTab(url, {inBackground: bgLoad, allowThirdPartyFixup: true});
- this.tabbrowser.moveTabTo(newTab, newIndex);
- } else {
- // Load in an existing tab.
- try {
- let webNav = Ci.nsIWebNavigation;
- let flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
- webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
- this.tabbrowser.getBrowserForTab(tab).loadURIWithFlags(url, flags);
- if (!bgLoad)
- this.selectedItem = tab;
- } catch(ex) {
- // Just ignore invalid urls
- }
- }
+ let targetTab = this._getDragTargetTab(event);
+ let userContextId = this.selectedItem
+ .getAttribute("usercontextid") || 0;
+ let replace = !(!targetTab || dropEffect == "copy");
+ let newIndex = this._getDropIndex(event);
+ let urls = links.map(link => link.url);
+ this.tabbrowser.loadTabs(urls, {
+ inBackground,
+ replace,
+ allowThirdPartyFixup: true,
+ targetTab,
+ newIndex,
+ userContextId,
+ });
}
if (draggedTab) {
diff --git a/application/palemoon/base/content/urlbarBindings.xml b/application/palemoon/base/content/urlbarBindings.xml
index bf59ea164..d188e6658 100644
--- a/application/palemoon/base/content/urlbarBindings.xml
+++ b/application/palemoon/base/content/urlbarBindings.xml
@@ -263,6 +263,9 @@
var postData = null;
var action = this._parseActionUrl(url);
+ let lastLocationChange = gBrowser.selectedBrowser.lastLocationChange;
+
+ let matchLastLocationChange = true;
if (action) {
url = action.param;
if (this.hasAttribute("actiontype")) {
@@ -275,82 +278,94 @@
}
return;
}
+ continueOperation.call(this);
}
else {
- [url, postData, mayInheritPrincipal] = this._canonizeURL(aTriggeringEvent);
- if (!url)
- return;
- }
-
- this.value = url;
- gBrowser.userTypedValue = url;
- try {
- addToUrlbarHistory(url);
- } catch (ex) {
- // Things may go wrong when adding url to session history,
- // but don't let that interfere with the loading of the url.
- Cu.reportError(ex);
+ this._canonizeURL(aTriggeringEvent, response => {
+ [url, postData, mayInheritPrincipal] = response;
+ if (url) {
+ matchLastLocationChange = (lastLocationChange ==
+ gBrowser.selectedBrowser.lastLocationChange);
+ continueOperation.call(this);
+ }
+ });
}
- function loadCurrent() {
- let webnav = Ci.nsIWebNavigation;
- let flags = webnav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
- webnav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
- // Pass LOAD_FLAGS_DISALLOW_INHERIT_OWNER to prevent any loads from
- // inheriting the currently loaded document's principal, unless this
- // URL is marked as safe to inherit (e.g. came from a bookmark
- // keyword).
- if (!mayInheritPrincipal)
- flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
- gBrowser.loadURIWithFlags(url, flags, null, null, postData);
- }
+ function continueOperation()
+ {
+ this.value = url;
+ gBrowser.userTypedValue = url;
+ try {
+ addToUrlbarHistory(url);
+ } catch (ex) {
+ // Things may go wrong when adding url to session history,
+ // but don't let that interfere with the loading of the url.
+ Cu.reportError(ex);
+ }
- // Focus the content area before triggering loads, since if the load
- // occurs in a new tab, we want focus to be restored to the content
- // area when the current tab is re-selected.
- gBrowser.selectedBrowser.focus();
+ function loadCurrent() {
+ let flags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
+ // Pass LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL to prevent any loads from
+ // inheriting the currently loaded document's principal, unless this
+ // URL is marked as safe to inherit (e.g. came from a bookmark
+ // keyword).
+ if (!mayInheritPrincipal)
+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
+ // If the value wasn't typed, we know that we decoded the value as
+ // UTF-8 (see losslessDecodeURI)
+ if (!this.valueIsTyped)
+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_URI_IS_UTF8;
+ gBrowser.loadURIWithFlags(url, flags, null, null, postData);
+ }
- let isMouseEvent = aTriggeringEvent instanceof MouseEvent;
- let altEnter = !isMouseEvent && aTriggeringEvent && aTriggeringEvent.altKey;
+ // Focus the content area before triggering loads, since if the load
+ // occurs in a new tab, we want focus to be restored to the content
+ // area when the current tab is re-selected.
+ gBrowser.selectedBrowser.focus();
- if (altEnter) {
- // XXX This was added a long time ago, and I'm not sure why it is
- // necessary. Alt+Enter's default action might cause a system beep,
- // or something like that?
- aTriggeringEvent.preventDefault();
- aTriggeringEvent.stopPropagation();
- }
+ let isMouseEvent = aTriggeringEvent instanceof MouseEvent;
- // If the current tab is empty, ignore Alt+Enter (just reuse this tab)
- altEnter = altEnter && !isTabEmpty(gBrowser.selectedTab);
+ // If the current tab is empty, ignore Alt+Enter (just reuse this tab)
+ let altEnter = !isMouseEvent && aTriggeringEvent &&
+ aTriggeringEvent.altKey && !isTabEmpty(gBrowser.selectedTab);
- if (isMouseEvent || altEnter) {
- // Use the standard UI link behaviors for clicks or Alt+Enter
- let where = "tab";
- if (isMouseEvent)
- where = whereToOpenLink(aTriggeringEvent, false, false);
+ if (isMouseEvent || altEnter) {
+ // Use the standard UI link behaviors for clicks or Alt+Enter
+ let where = "tab";
+ if (isMouseEvent)
+ where = whereToOpenLink(aTriggeringEvent, false, false);
- if (where == "current") {
- loadCurrent();
+ if (where == "current") {
+ if (matchLastLocationChange) {
+ loadCurrent();
+ }
+ } else {
+ this.handleRevert();
+ let params = { allowThirdPartyFixup: true,
+ postData: postData,
+ initiatingDoc: document };
+ if (!this.valueIsTyped)
+ params.isUTF8 = true;
+ openUILinkIn(url, where, params);
+ }
} else {
- this.handleRevert();
- let params = { allowThirdPartyFixup: true,
- postData: postData,
- initiatingDoc: document };
- openUILinkIn(url, where, params);
+ if (matchLastLocationChange) {
+ loadCurrent();
+ }
}
- } else {
- loadCurrent();
}
]]></body>
</method>
<method name="_canonizeURL">
<parameter name="aTriggeringEvent"/>
+ <parameter name="aCallback"/>
<body><![CDATA[
var url = this.value;
- if (!url)
- return ["", null, false];
+ if (!url) {
+ aCallback(["", null, false]);
+ return;
+ }
// Only add the suffix when the URL bar value isn't already "URL-like",
// and only if we get a keyboard event, to match user expectations.
@@ -403,11 +418,9 @@
}
}
- var postData = {};
- var mayInheritPrincipal = { value: false };
- url = getShortcutOrURI(url, postData, mayInheritPrincipal);
-
- return [url, postData.value, mayInheritPrincipal.value];
+ getShortcutOrURIAndPostData(url).then(data => {
+ aCallback([data.url, data.postData, data.mayInheritPrincipal]);
+ });
]]></body>
</method>
@@ -442,11 +455,12 @@
<method name="onDrop">
<parameter name="aEvent"/>
<body><![CDATA[
- let url = browserDragAndDrop.drop(aEvent, { })
+ let links = browserDragAndDrop.dropLinks(aEvent);
// The URL bar automatically handles inputs with newline characters,
// so we can get away with treating text/x-moz-url flavours as text/plain.
- if (url) {
+ if (links.length > 0 && links[0].url) {
+ let url = links[0].url;
aEvent.preventDefault();
this.value = url;
SetPageProxyState("invalid");
@@ -1356,8 +1370,8 @@
return;
}
- let host = gPluginHandler._getHostFromPrincipal(this.notification.browser.contentWindow.document.nodePrincipal);
- this._setupDescription("pluginActivateMultiple.message", null, host);
+ let prePath = this.notification.browser.contentWindow.document.nodePrincipal.URI.prePath;
+ this._setupDescription("pluginActivateMultiple.message", null, prePath);
var showBox = document.getAnonymousElementByAttribute(this, "anonid", "plugin-notification-showbox");
@@ -1396,7 +1410,7 @@
<method name="_setupSingleState">
<body><![CDATA[
var action = this.notification.options.centerActions[0];
- var host = action.pluginPermissionHost;
+ var prePath = action.pluginPermissionPrePath;
let label, linkLabel, linkUrl, button1, button2;
@@ -1491,7 +1505,7 @@
Cu.reportError(Error("Unexpected blocklist state"));
}
}
- this._setupDescription(label, action.pluginName, host);
+ this._setupDescription(label, action.pluginName, prePath);
this._setupLink(linkLabel, action.detailsLink);
this._primaryButton.label = gNavigatorBundle.getString(button1.label);
@@ -1512,7 +1526,7 @@
<method name="_setupDescription">
<parameter name="baseString" />
<parameter name="pluginName" /> <!-- null for the multiple-plugin case -->
- <parameter name="host" />
+ <parameter name="prePath" />
<body><![CDATA[
var bsn = this._brandShortName;
var span = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-description");
@@ -1520,17 +1534,17 @@
span.removeChild(span.lastChild);
}
- var args = ["__host__", this._brandShortName];
+ var args = ["__prepath__", this._brandShortName];
if (pluginName) {
args.unshift(pluginName);
}
var bases = gNavigatorBundle.getFormattedString(baseString, args).
- split("__host__", 2);
+ split("__prepath__", 2);
span.appendChild(document.createTextNode(bases[0]));
- var hostSpan = document.createElementNS("http://www.w3.org/1999/xhtml", "em");
- hostSpan.appendChild(document.createTextNode(host));
- span.appendChild(hostSpan);
+ var prePathSpan = document.createElementNS("http://www.w3.org/1999/xhtml", "em");
+ prePathSpan.appendChild(document.createTextNode(prePath));
+ span.appendChild(prePathSpan);
span.appendChild(document.createTextNode(bases[1] + " "));
]]></body>
</method>
diff --git a/application/palemoon/base/content/utilityOverlay.js b/application/palemoon/base/content/utilityOverlay.js
index 86cc5cea5..633cb8853 100644
--- a/application/palemoon/base/content/utilityOverlay.js
+++ b/application/palemoon/base/content/utilityOverlay.js
@@ -104,7 +104,8 @@ function openUILink(url, event, aIgnoreButton, aIgnoreAlt, aAllowThirdPartyFixup
allowThirdPartyFixup: aAllowThirdPartyFixup,
postData: aPostData,
referrerURI: aReferrerURI,
- initiatingDoc: event ? event.target.ownerDocument : null
+ referrerPolicy: Components.interfaces.nsIHttpChannel.REFERRER_POLICY_DEFAULT,
+ initiatingDoc: event ? event.target.ownerDocument : null,
};
}
@@ -196,7 +197,8 @@ function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI
params = {
allowThirdPartyFixup: aAllowThirdPartyFixup,
postData: aPostData,
- referrerURI: aReferrerURI
+ referrerURI: aReferrerURI,
+ referrerPolicy: Components.interfaces.nsIHttpChannel.REFERRER_POLICY_DEFAULT,
};
}
@@ -209,12 +211,16 @@ function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI
function openLinkIn(url, where, params) {
if (!where || !url)
return;
+ const Cc = Components.classes;
+ const Ci = Components.interfaces;
var aFromChrome = params.fromChrome;
var aAllowThirdPartyFixup = params.allowThirdPartyFixup;
var aPostData = params.postData;
var aCharset = params.charset;
var aReferrerURI = params.referrerURI;
+ var aReferrerPolicy = ('referrerPolicy' in params ?
+ params.referrerPolicy : Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT);
var aRelatedToCurrent = params.relatedToCurrent;
var aForceAllowDataURI = params.forceAllowDataURI;
var aInBackground = params.inBackground;
@@ -229,11 +235,10 @@ function openLinkIn(url, where, params) {
"where == 'save' but without initiatingDoc. See bug 814264.");
return;
}
+ // TODO(1073187): propagate referrerPolicy.
saveURL(url, null, null, true, null, aReferrerURI, aInitiatingDoc);
return;
}
- const Cc = Components.classes;
- const Ci = Components.interfaces;
var w = getTopWin();
if ((where == "tab" || where == "tabshifted") &&
@@ -243,6 +248,7 @@ function openLinkIn(url, where, params) {
}
if (!w || where == "window") {
+ // This propagates to window.arguments.
// Strip referrer data when opening a new private window, to prevent
// regular browsing data from leaking into it.
if (aIsPrivate) {
@@ -267,12 +273,23 @@ function openLinkIn(url, where, params) {
createInstance(Ci.nsISupportsPRBool);
allowThirdPartyFixupSupports.data = aAllowThirdPartyFixup;
+ var referrerURISupports = null;
+ if (aReferrerURI && sendReferrerURI) {
+ referrerURISupports = Cc["@mozilla.org/supports-string;1"].
+ createInstance(Ci.nsISupportsString);
+ referrerURISupports.data = aReferrerURI.spec;
+ }
+
+ var referrerPolicySupports = Cc["@mozilla.org/supports-PRUint32;1"].
+ createInstance(Ci.nsISupportsPRUint32);
+ referrerPolicySupports.data = aReferrerPolicy;
+
sa.AppendElement(wuri);
sa.AppendElement(charset);
- if (sendReferrerURI)
- sa.AppendElement(aReferrerURI);
+ sa.AppendElement(referrerURISupports);
sa.AppendElement(aPostData);
sa.AppendElement(allowThirdPartyFixupSupports);
+ sa.AppendElement(referrerPolicySupports);
let features = "chrome,dialog=no,all";
if (aIsPrivate) {
@@ -316,11 +333,16 @@ function openLinkIn(url, where, params) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
if (aDisallowInheritPrincipal)
- flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
if (aForceAllowDataURI) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
}
- w.gBrowser.loadURIWithFlags(url, flags, aReferrerURI, null, aPostData);
+ w.gBrowser.loadURIWithFlags(url, {
+ flags: flags,
+ referrerURI: aReferrerURI,
+ referrerPolicy: aReferrerPolicy,
+ postData: aPostData,
+ });
break;
case "tabshifted":
loadInBackground = !loadInBackground;
@@ -329,6 +351,7 @@ function openLinkIn(url, where, params) {
let browser = w.gBrowser;
browser.loadOneTab(url, {
referrerURI: aReferrerURI,
+ referrerPolicy: aReferrerPolicy,
charset: aCharset,
postData: aPostData,
inBackground: loadInBackground,
@@ -577,9 +600,11 @@ function makeURLAbsolute(aBase, aUrl)
* @param [optional] aReferrer
* If aDocument is null, then this will be used as the referrer.
* There will be no security check.
+ * @param [optional] aReferrerPolicy
+ * Referrer policy - Ci.nsIHttpChannel.REFERRER_POLICY_*.
*/
function openNewTabWith(aURL, aDocument, aPostData, aEvent,
- aAllowThirdPartyFixup, aReferrer) {
+ aAllowThirdPartyFixup, aReferrer, aReferrerPolicy) {
if (aDocument)
urlSecurityCheck(aURL, aDocument.nodePrincipal);
@@ -594,10 +619,13 @@ function openNewTabWith(aURL, aDocument, aPostData, aEvent,
{ charset: originCharset,
postData: aPostData,
allowThirdPartyFixup: aAllowThirdPartyFixup,
- referrerURI: aDocument ? aDocument.documentURIObject : aReferrer });
+ referrerURI: aDocument ? aDocument.documentURIObject : aReferrer,
+ referrerPolicy: aReferrerPolicy,
+ });
}
-function openNewWindowWith(aURL, aDocument, aPostData, aAllowThirdPartyFixup, aReferrer) {
+function openNewWindowWith(aURL, aDocument, aPostData, aAllowThirdPartyFixup,
+ aReferrer, aReferrerPolicy) {
if (aDocument)
urlSecurityCheck(aURL, aDocument.nodePrincipal);
@@ -614,7 +642,9 @@ function openNewWindowWith(aURL, aDocument, aPostData, aAllowThirdPartyFixup, aR
{ charset: originCharset,
postData: aPostData,
allowThirdPartyFixup: aAllowThirdPartyFixup,
- referrerURI: aDocument ? aDocument.documentURIObject : aReferrer });
+ referrerURI: aDocument ? aDocument.documentURIObject : aReferrer,
+ referrerPolicy: aReferrerPolicy,
+ });
}
/**
diff --git a/application/palemoon/base/jar.mn b/application/palemoon/base/jar.mn
index fd2df79e1..622d8e0da 100644
--- a/application/palemoon/base/jar.mn
+++ b/application/palemoon/base/jar.mn
@@ -108,7 +108,7 @@ browser.jar:
* content/browser/sanitize.xul (content/sanitize.xul)
* content/browser/sanitizeDialog.js (content/sanitizeDialog.js)
content/browser/sanitizeDialog.css (content/sanitizeDialog.css)
-* content/browser/autocomplete.css (content/autocomplete.css)
+ content/browser/autocomplete.css (content/autocomplete.css)
* content/browser/autocomplete.xml (content/autocomplete.xml)
content/browser/tabbrowser.css (content/tabbrowser.css)
* content/browser/tabbrowser.xml (content/tabbrowser.xml)