Backout 691af0af89da (bug 720501) for test failures
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 26 Jan 2012 02:21:44 +0100
changeset 86643 bcfd8414a0d2a43398f9a5e780bfc9549f9225c2
parent 86642 d49eb8c7238f7d08332e3e0c64ba05260c2ea5c6
child 86644 6f90007540121c7346d44e7941c1a27db5f960d9
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs720501
milestone12.0a1
backs out691af0af89da90c91ae9c007c4567ca3815b93ba
Backout 691af0af89da (bug 720501) for test failures
toolkit/components/places/nsPlacesAutoComplete.js
toolkit/components/places/tests/inline/head_autocomplete.js
toolkit/components/places/tests/inline/test_casing.js
toolkit/components/places/tests/inline/xpcshell.ini
--- a/toolkit/components/places/nsPlacesAutoComplete.js
+++ b/toolkit/components/places/nsPlacesAutoComplete.js
@@ -1414,17 +1414,18 @@ urlInlineComplete.prototype = {
           domain = query.getString(0);
         }
       } finally {
         query.reset();
       }
 
       if (hasDomainResult) {
         // We got a match for a domain, we can add it immediately.
-        result.appendMatch(domain, "");
+        let appendResult = domain.slice(this._currentSearchString.length);
+        result.appendMatch(aSearchString + appendResult, "");
 
         this._finishSearch();
         return;
       }
     }
 
     // We did not get a result from the synchronous domain search.
     // We now do an asynchronous search through places, and complete
@@ -1487,28 +1488,27 @@ urlInlineComplete.prototype = {
   //// mozIStorageStatementCallback
 
   handleResult: function UIC_handleResult(aResultSet)
   {
     let row = aResultSet.getNextRow();
     let url = fixupSearchText(row.getResultByIndex(0));
 
     // We must complete the URL up to the next separator (which is /, ? or #).
-    let separatorIndex = url.slice(this._currentSearchString.length)
-                            .search(/[\/\?\#]/);
+    let appendText = url.slice(this._currentSearchString.length);
+    let separatorIndex = appendText.search(/[\/\?\#]/);
     if (separatorIndex != -1) {
-      separatorIndex += this._currentSearchString.length;
-      if (url[separatorIndex] == "/") {
+      if (appendText[separatorIndex] == "/") {
         separatorIndex++; // Include the "/" separator
       }
-      url = url.slice(0, separatorIndex);
+      appendText = appendText.slice(0, separatorIndex);
     }
 
     // Add the result
-    this._result.appendMatch(url, "");
+    this._result.appendMatch(this._originalSearchString + appendText, "");
 
     // handleCompletion() will cause the result listener to be called, and
     // will display the result in the UI.
   },
 
   handleError: function UIC_handleError(aError)
   {
     Components.utils.reportError("URL Inline Complete: An async statement encountered an " +
--- a/toolkit/components/places/tests/inline/head_autocomplete.js
+++ b/toolkit/components/places/tests/inline/head_autocomplete.js
@@ -48,64 +48,45 @@ AutoCompleteInput.prototype = {
   get selectionEnd() {
     return this._selEnd;
   },
   selectTextRange: function(aStart, aEnd) {
     this._selStart = aStart;
     this._selEnd = aEnd;
   },
 
-  onTextEntered: function() false,
-  onTextReverted: function() false,
-
   get searchCount() {
     return this.searches.length;
   },
   getSearchAt: function(aIndex) {
     return this.searches[aIndex];
   },
 
   onSearchBegin: function () {},
   onSearchComplete: function () {},
 
   popupOpen: false,
 
   popup: {
-    selectedIndex: -1,
+    selectedIndex: 0,
     invalidate: function () {},
 
     QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompletePopup])
   },
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteInput])
 }
 
 /**
  * @param aSearchString
  *        String to search.
  * @param aExpectedValue
  *        Expected value returned by autoFill.
- *        May be a string, or an object like
- *        {
- *          autoFilled: the value suggested by autofill,
- *          completed: the value completed on user's confirmation
- *        }
- *        In the latter case this will also check that on user's confirmation
- *        the result's casing is correctly applied.
  */
 function ensure_results(aSearchString, aExpectedValue) {
-  let autoFilledValue, completedValue;
-  if (typeof(aExpectedValue) == "string") {
-    autoFilledValue = aExpectedValue;
-  }
-  else {
-    autoFilledValue = aExpectedValue.autoFilled;
-    completedValue = aExpectedValue.completed;
-  }
-
   // Make an AutoCompleteInput that uses our searches and confirms results.
   let input = new AutoCompleteInput(["urlinline"]);
   input.textValue = aSearchString;
 
   // Caret must be at the end for autoFill to happen.
   let strLen = aSearchString.length;
   input.selectTextRange(strLen, strLen);
   do_check_eq(input.selectionStart, strLen);
@@ -121,25 +102,17 @@ function ensure_results(aSearchString, a
     do_check_eq(numSearchesStarted, 1);
   };
 
   input.onSearchComplete = function() {
     // We should be running only one query.
     do_check_eq(numSearchesStarted, 1);
 
     // Check the autoFilled result.
-    do_check_eq(input.textValue, autoFilledValue);
-
-    if (completedValue) {
-      // Now force completion and check correct casing of the result.
-      // This ensures the controller is able to do its magic case-preserving
-      // stuff and correct replacement of the user's casing with result's one.
-      controller.handleEnter(false);
-      do_check_eq(input.textValue, completedValue);
-    }
+    do_check_eq(input.textValue, aExpectedValue);
 
     waitForCleanup(run_next_test);
   };
 
   do_log_info("Searching for: '" + aSearchString + "'");
   controller.startSearch(aSearchString);
 }
 
deleted file mode 100644
--- a/toolkit/components/places/tests/inline/test_casing.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-add_autocomplete_test([
-  "Searching for cased entry",
-  "MOZ",
-  { autoFilled: "MOZilla.org/", completed: "mozilla.org/"},
-  function () {
-    addBookmark({ url: "http://mozilla.org/test/" });
-  }
-]);
-
-add_autocomplete_test([
-  "Searching for cased entry",
-  "mozilla.org/T",
-  { autoFilled: "mozilla.org/Test/", completed: "mozilla.org/test/"},
-  function () {
-    addBookmark({ url: "http://mozilla.org/test/" });
-  }
-]);
-
-add_autocomplete_test([
-  "Searching for cased entry",
-  "mOzilla.org/t",
-  { autoFilled: "mOzilla.org/test/", completed: "mozilla.org/Test/"},
-  function () {
-    addBookmark({ url: "http://mozilla.org/Test/" });
-  },
-]);
--- a/toolkit/components/places/tests/inline/xpcshell.ini
+++ b/toolkit/components/places/tests/inline/xpcshell.ini
@@ -1,6 +1,5 @@
 [DEFAULT]
 head = head_autocomplete.js
 tail = 
 
-[test_casing.js]
 [test_keywords.js]