Backed out changeset 553d26ab8ee8 (bug 1395427)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 27 Sep 2017 17:10:26 +0200
changeset 383294 583edc8f8c18deba37cf0bb1d9416d76ba0839de
parent 383293 366541968f60ab0c967a6bc9892fd2921dcf9959
child 383295 4f9b0c2f439dd1bb7a7c8542090b017e2e1ab177
push id95539
push userkwierso@gmail.com
push dateThu, 28 Sep 2017 00:01:12 +0000
treeherdermozilla-inbound@72de90e66155 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1395427
milestone58.0a1
backs out553d26ab8ee8641dd91972b43286d0ce9fc598dc
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 553d26ab8ee8 (bug 1395427)
toolkit/components/satchel/FormHistory.jsm
toolkit/components/satchel/FormHistoryStartup.js
toolkit/components/satchel/nsFormAutoComplete.js
toolkit/components/satchel/test/unit/test_notify.js
--- a/toolkit/components/satchel/FormHistory.jsm
+++ b/toolkit/components/satchel/FormHistory.jsm
@@ -1032,17 +1032,17 @@ this.FormHistory = {
      * 3) additional weight for aged entries surviving expiry - these entries are relevant
      *    since they have been used multiple times over a large time span so rank them higher
      * The score is then divided by the bucket size and we round the result so that entries
      * with a very similar frecency are bucketed together with an alphabetical sort. This is
      * to reduce the amount of moving around by entries while typing.
      */
 
     let query = "/* do not warn (bug 496471): can't use an index */ " +
-                "SELECT value, guid, " +
+                "SELECT value, " +
                 "ROUND( " +
                     "timesUsed / MAX(1.0, (lastUsed - firstUsed) / :timeGroupingSize) * " +
                     "MAX(1.0, :maxTimeGroupings - (:now - lastUsed) / :timeGroupingSize) * " +
                     "MAX(1.0, :agedWeight * (firstUsed < :expiryDate)) / " +
                     ":bucketSize " +
                 ", 3) AS frecency, " +
                 boundaryCalc + " AS boundaryBonuses " +
                 "FROM moz_formhistory " +
@@ -1068,21 +1068,19 @@ this.FormHistory = {
       // no additional params need to be substituted into the query when the
       // length is zero or one
     }
 
     let pending = stmt.executeAsync({
       handleResult(aResultSet) {
         for (let row = aResultSet.getNextRow(); row; row = aResultSet.getNextRow()) {
           let value = row.getResultByName("value");
-          let guid = row.getResultByName("guid");
           let frecency = row.getResultByName("frecency");
           let entry = {
             text:          value,
-            guid,
             textLowerCase: value.toLowerCase(),
             frecency,
             totalScore:    Math.round(frecency * row.getResultByName("boundaryBonuses")),
           };
           if (aCallbacks && aCallbacks.handleResult) {
             aCallbacks.handleResult(entry);
           }
         }
--- a/toolkit/components/satchel/FormHistoryStartup.js
+++ b/toolkit/components/satchel/FormHistoryStartup.js
@@ -121,22 +121,21 @@ FormHistoryStartup.prototype = {
         };
 
         query = FormHistory.getAutoCompleteResults(searchString, params, processResults);
         this.pendingQuery = query;
         break;
       }
 
       case "FormHistory:RemoveEntry": {
-        let { inputName, value, guid } = message.data;
+        let { inputName, value } = message.data;
         FormHistory.update({
           op: "remove",
           fieldname: inputName,
           value,
-          guid,
         });
         break;
       }
     }
   },
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FormHistoryStartup]);
--- a/toolkit/components/satchel/nsFormAutoComplete.js
+++ b/toolkit/components/satchel/nsFormAutoComplete.js
@@ -112,26 +112,21 @@ FormHistoryClient.prototype = {
 
   /**
    * Remove an item from FormHistory.
    *
    * @param {string} value
    *
    *        The value to remove for this particular
    *        field.
-   *
-   * @param guid (string)
-   *
-   *        The guid for the item being removed.
    */
-  remove(value, guid) {
+  remove(value) {
     this.mm.sendAsyncMessage("FormHistory:RemoveEntry", {
       inputName: this.inputName,
       value,
-      guid
     });
   },
 
   // Private methods
 
   receiveMessage(msg) {
     let { id, results } = msg.data;
     if (id != this.id) {
@@ -621,14 +616,14 @@ FormAutoCompleteResult.prototype = {
   },
 
   removeValueAt(index, removeFromDB) {
     this._checkIndexBounds(index);
 
     let [removedEntry] = this.entries.splice(index, 1);
 
     if (removeFromDB) {
-      this.client.remove(removedEntry.text, removedEntry.guid);
+      this.client.remove(removedEntry.text);
     }
   },
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FormAutoComplete]);
--- a/toolkit/components/satchel/test/unit/test_notify.js
+++ b/toolkit/components/satchel/test/unit/test_notify.js
@@ -2,39 +2,32 @@
  * Test suite for satchel notifications
  *
  * Tests notifications dispatched when modifying form history.
  *
  */
 
 let expectedNotification;
 let expectedData;
-let subjectIsGuid = false;
-let lastGUID;
 
 let TestObserver = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
 
   observe(subject, topic, data) {
     do_check_eq(topic, "satchel-storage-changed");
     do_check_eq(data, expectedNotification);
 
-    let verifySubjectIsGuid = () => {
-      do_check_true(subject instanceof Ci.nsISupportsString);
-      do_check_true(isGUID.test(subject.toString()));
-      lastGUID = subject.toString();
-    };
-
     switch (data) {
       case "formhistory-add":
       case "formhistory-update":
-        verifySubjectIsGuid();
+        do_check_true(subject instanceof Ci.nsISupportsString);
+        do_check_true(isGUID.test(subject.toString()));
         break;
       case "formhistory-remove":
-        subjectIsGuid ? verifySubjectIsGuid() : do_check_eq(null, subject);
+        do_check_eq(null, subject);
         break;
       default:
         do_throw("Unhandled notification: " + data + " / " + topic);
     }
 
     expectedNotification = null;
     expectedData = null;
   },
@@ -104,34 +97,17 @@ function* run_test_steps() {
     do_check_eq(expectedNotification, null);
 
     /* ========== 4 ========== */
     testnum++;
     testdesc = "removeEntry";
 
     expectedNotification = "formhistory-remove";
     expectedData = entry1;
-
-    subjectIsGuid = true;
-    yield FormHistory.update({
-      op: "remove",
-      fieldname: entry1[0],
-      value: entry1[1],
-      guid: lastGUID,
-    }, {
-      handleError(error) {
-        do_throw("Error occurred updating form history: " + error);
-      },
-      handleCompletion(reason) {
-        if (!reason) {
-          next_test();
-        }
-      },
-    });
-    subjectIsGuid = false;
+    yield updateEntry("remove", entry1[0], entry1[1], next_test);
 
     do_check_eq(expectedNotification, null);
     yield countEntries(entry1[0], entry1[1], function(num) {
       do_check_false(num, "doesn't exist after remove");
       next_test();
     });
 
     /* ========== 5 ========== */