From e47ee1057d7d5688d68a176512010bb7543ce0f5 Mon Sep 17 00:00:00 2001 From: Geoff Lankow Date: Tue, 12 Nov 2019 14:55:23 +1300 Subject: [PATCH] Bug 1595649 - Fix disabling auto-completion on a per-directory basis; r=mkmelin --HG-- extra : rebase_source : 6ae1801d6d191f7fd7d3646501a787f9018e08dc extra : histedit_source : 00de02ff98bafad495072221ec27bad040d4976f --- mailnews/addrbook/jsaddrbook/AddrBookDirectory.jsm | 5 ++++- mailnews/addrbook/test/unit/test_basic_nsIAbDirectory.js | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mailnews/addrbook/jsaddrbook/AddrBookDirectory.jsm b/mailnews/addrbook/jsaddrbook/AddrBookDirectory.jsm index 69ce69018f..fb1d1f3767 100644 --- a/mailnews/addrbook/jsaddrbook/AddrBookDirectory.jsm +++ b/mailnews/addrbook/jsaddrbook/AddrBookDirectory.jsm @@ -770,7 +770,10 @@ var bookPrototype = { return newCard; }, useForAutocomplete(identityKey) { - return Services.prefs.getBoolPref("mail.enable_autocomplete"); + return ( + Services.prefs.getBoolPref("mail.enable_autocomplete") && + this.getBoolValue("enable_autocomplete", true) + ); }, addMailList(list) { if (!list.isMailList) { diff --git a/mailnews/addrbook/test/unit/test_basic_nsIAbDirectory.js b/mailnews/addrbook/test/unit/test_basic_nsIAbDirectory.js index 9a9d2137a1..e8cc82f4ad 100644 --- a/mailnews/addrbook/test/unit/test_basic_nsIAbDirectory.js +++ b/mailnews/addrbook/test/unit/test_basic_nsIAbDirectory.js @@ -59,11 +59,15 @@ function check_ab(abConfig) { Assert.equal(AB.useForAutocomplete(""), true); Services.prefs.setBoolPref("mail.enable_autocomplete", false); - Assert.equal(AB.useForAutocomplete(""), false); Services.prefs.setBoolPref("mail.enable_autocomplete", true); + Assert.equal(AB.useForAutocomplete(""), true); + AB.setBoolValue("enable_autocomplete", false); + Assert.equal(AB.useForAutocomplete(""), false); + + AB.setBoolValue("enable_autocomplete", true); Assert.equal(AB.useForAutocomplete(""), true); // Test - check getting default preferences