Bug 1325535 - Don't copy the hidden about:home URL from the location bar when focusing it. r?dao draft
authorCameron McCormack <cam@mcc.id.au>
Tue, 10 Jan 2017 15:11:04 +0800
changeset 458384 c142736735de59c30156971b1a2126c30d7295dc
parent 458383 92b3a12591d1914c8073ec82f2546ae23a72c48f
child 541628 2c7d25f88c6aa29fb75d805820941538933c33b1
push id40935
push userbmo:cam@mcc.id.au
push dateTue, 10 Jan 2017 07:11:37 +0000
reviewersdao
bugs1325535
milestone53.0a1
Bug 1325535 - Don't copy the hidden about:home URL from the location bar when focusing it. r?dao MozReview-Commit-ID: 1B8E4NeTsb2
browser/base/content/urlbarBindings.xml
--- 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;
           }