Bug 1325535 - Don't copy the hidden about:home URL from the location bar when focusing it. r?dao
MozReview-Commit-ID: 1B8E4NeTsb2
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -756,18 +756,18 @@ file, You can obtain one at http://mozil
<method name="_getSelectedValueForClipboard">
<body><![CDATA[
// Grab the actual input field's value, not our value, which could include moz-action:
var inputVal = this.inputField.value;
var selectedVal = inputVal.substring(this.selectionStart, this.selectionEnd);
// If the selection doesn't start at the beginning or doesn't span the full domain or
- // the URL bar is modified, nothing else to do here.
- if (this.selectionStart > 0 || this.valueIsTyped)
+ // the URL bar is modified or there is no text at all, nothing else to do here.
+ if (this.selectionStart > 0 || this.valueIsTyped || selectedVal == "")
return selectedVal;
// The selection doesn't span the full domain if it doesn't contain a slash and is
// followed by some character other than a slash.
if (!selectedVal.includes("/")) {
let remainder = inputVal.replace(selectedVal, "");
if (remainder != "" && remainder[0] != "/")
return selectedVal;
}