Backed out changeset bf39866cc3a5 (bug 1047469) on a CLOSED TREE
authorTim Taubert <ttaubert@mozilla.com>
Thu, 04 Sep 2014 13:39:45 -0400
changeset 203541 3da93d34897d4654583a8a39c57b65f0f8113fed
parent 203540 42e164ec81d3016262ca1a26480c41c3d84d5cdf
child 203542 19000a7852c630436f96236f8642294d7c86265f
push idunknown
push userunknown
push dateunknown
bugs1047469
milestone35.0a1
backs outbf39866cc3a52d16735777ac0ed24991838f93ce
Backed out changeset bf39866cc3a5 (bug 1047469) on a CLOSED TREE
browser/base/content/urlbarBindings.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -181,23 +181,16 @@
 
           let controller = this.editor.selectionController;
           let selection = controller.getSelection(controller.SELECTION_URLSECONDARY);
           selection.removeAllRanges();
 
           let textNode = this.editor.rootElement.firstChild;
           let value = textNode.textContent;
 
-          function addSelectionRange(start, end) {
-            let range = document.createRange();
-            range.setStart(textNode, start);
-            range.setEnd(textNode, end);
-            selection.addRange(range);
-          }
-
           let protocol = value.match(/^[a-z\d.+\-]+:(?=[^\d])/);
           if (protocol &&
               ["http:", "https:", "ftp:"].indexOf(protocol[0]) == -1)
             return;
           let matchedURL = value.match(/^((?:[a-z]+:\/\/)?(?:[^\/]+@)?)(.+?)(?::\d+)?(?:\/|$)/);
           if (!matchedURL)
             return;
 
@@ -217,37 +210,29 @@
             } catch (e) {}
           }
           if (baseDomain != domain) {
             subDomain = domain.slice(0, -baseDomain.length);
           }
 
           let rangeLength = preDomain.length + subDomain.length;
           if (rangeLength) {
-            addSelectionRange(0, rangeLength);
+            let range = document.createRange();
+            range.setStart(textNode, 0);
+            range.setEnd(textNode, rangeLength);
+            selection.addRange(range);
           }
 
-          Services.search.init(() => {
-            // Bail out if the URL changed in the meantime.
-            if (value != textNode.textContent) {
-              return;
-            }
-
-            let startRest = preDomain.length + domain.length;
-            let result = Services.search.parseSubmissionURL(value);
-
-            if (result.termsOffset > -1 && result.termsLength) {
-              addSelectionRange(startRest, result.termsOffset);
-              startRest = result.termsOffset + result.termsLength;
-            }
-
-            if (startRest < value.length) {
-              addSelectionRange(startRest, value.length);
-            }
-          });
+          let startRest = preDomain.length + domain.length;
+          if (startRest < value.length) {
+            let range = document.createRange();
+            range.setStart(textNode, startRest);
+            range.setEnd(textNode, value.length);
+            selection.addRange(range);
+          }
         ]]></body>
       </method>
 
       <method name="_clearFormatting">
         <body><![CDATA[
           if (!this._formattingEnabled)
             return;