From 74f929ccaf8fd8dbe96ed5f4bf99c1abd9965abe Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Wed, 26 Feb 2014 17:12:16 +1100 Subject: [PATCH] Bug 932759 (part 2) - Have form sync work correctly if FormHistory is disabled. r=rnewman --- services/sync/modules/engines/forms.js | 3 +++ services/sync/tests/unit/test_forms_store.js | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/services/sync/modules/engines/forms.js b/services/sync/modules/engines/forms.js index 5d984028207..37d78dd423b 100644 --- a/services/sync/modules/engines/forms.js +++ b/services/sync/modules/engines/forms.js @@ -53,6 +53,9 @@ let FormWrapper = { }, _updateSpinningly: function(changes) { + if (!Svc.FormHistory.enabled) { + return; // update isn't going to do anything. + } let cb = Async.makeSpinningCallback(); let callbacks = { handleCompletion: function(reason) { diff --git a/services/sync/tests/unit/test_forms_store.js b/services/sync/tests/unit/test_forms_store.js index 865ba4d63aa..6963df1c0b0 100644 --- a/services/sync/tests/unit/test_forms_store.js +++ b/services/sync/tests/unit/test_forms_store.js @@ -5,6 +5,7 @@ _("Make sure the form store follows the Store api and correctly accesses the bac Cu.import("resource://services-sync/engines/forms.js"); Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/util.js"); +Cu.import("resource://gre/modules/Services.jsm"); function run_test() { let baseuri = "http://fake/uri/"; @@ -129,4 +130,22 @@ function run_test() { for (let id in store.getAllIDs()) { do_throw("Shouldn't get any ids!"); } + + _("Ensure we work if formfill is disabled."); + Services.prefs.setBoolPref("browser.formfill.enable", false); + try { + // a search + for (let id in store.getAllIDs()) { + do_throw("Shouldn't get any ids!"); + } + // an update. + applyEnsureNoFailures([{ + id: Utils.makeGUID(), + name: "some", + value: "entry" + }]); + } finally { + Services.prefs.clearUserPref("browser.formfill.enable"); + store.wipe(); + } }