Loading toolkit/components/places/nsPlacesAutoComplete.js +15 −7 Original line number Diff line number Diff line Loading @@ -103,7 +103,8 @@ const kQueryTypeFiltered = 1; const kTitleTagsSeparator = " \u2013 "; const kBrowserUrlbarBranch = "browser.urlbar."; // Toggle autocomplete. const kBrowserUrlbarAutocompleteEnabledPref = "autocomplete.enabled"; // Toggle autoFill. const kBrowserUrlbarAutofillPref = "autoFill"; // Whether to search only typed entries. Loading Loading @@ -845,7 +846,9 @@ nsPlacesAutoComplete.prototype = { */ _loadPrefs: function PAC_loadPrefs(aRegisterObserver) { this._enabled = safePrefGetter(this._prefs, "autocomplete.enabled", true); this._enabled = safePrefGetter(this._prefs, kBrowserUrlbarAutocompleteEnabledPref, true); this._matchBehavior = safePrefGetter(this._prefs, "matchBehavior", MATCH_BOUNDARY_ANYWHERE); Loading Loading @@ -1301,7 +1304,7 @@ urlInlineComplete.prototype = { get _db() { if (!this.__db && this._autofill) { if (!this.__db && this._autofillEnabled) { this.__db = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase). DBConnection.clone(true); } Loading Loading @@ -1486,9 +1489,13 @@ urlInlineComplete.prototype = { _loadPrefs: function UIC_loadPrefs(aRegisterObserver) { let prefBranch = Services.prefs.getBranch(kBrowserUrlbarBranch); this._autofill = safePrefGetter(prefBranch, let autocomplete = safePrefGetter(prefBranch, kBrowserUrlbarAutocompleteEnabledPref, true); let autofill = safePrefGetter(prefBranch, kBrowserUrlbarAutofillPref, true); this._autofillEnabled = autocomplete && autofill; this._autofillTyped = safePrefGetter(prefBranch, kBrowserUrlbarAutofillTypedPref, true); Loading Loading @@ -1548,10 +1555,11 @@ urlInlineComplete.prototype = { } else if (aTopic == kPrefChanged && (aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutofillPref || aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutocompleteEnabledPref || aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutofillTypedPref)) { let previousAutofillTyped = this._autofillTyped; this._loadPrefs(); if (!this._autofill) { if (!this._autofillEnabled) { this.stopSearch(); this._closeDatabase(); } Loading toolkit/components/places/tests/inline/head_autocomplete.js +5 −2 Original line number Diff line number Diff line Loading @@ -144,9 +144,8 @@ function ensure_results(aSearchString, aExpectedValue) { } function run_test() { Services.prefs.setBoolPref("browser.urlbar.autoFill", true); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); do_register_cleanup(function () { Services.prefs.clearUserPref("browser.urlbar.autocomplete.enabled"); Services.prefs.clearUserPref("browser.urlbar.autoFill"); Services.prefs.clearUserPref("browser.urlbar.autoFill.typed"); }); Loading @@ -155,6 +154,10 @@ function run_test() { let [description, searchString, expectedValue, setupFunc] = testData; add_test(function () { do_log_info(description); Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true); Services.prefs.setBoolPref("browser.urlbar.autoFill", true); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); if (setupFunc) { setupFunc(); } Loading toolkit/components/places/tests/inline/test_autocomplete_functional.js +24 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,30 @@ // Functional tests for inline autocomplete add_autocomplete_test([ "Check disabling autocomplete disables autofill", "vis", "vis", function () { Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false); addVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"), transition: TRANSITION_TYPED }); } ]); add_autocomplete_test([ "Check disabling autofill disables autofill", "vis", "vis", function () { Services.prefs.setBoolPref("browser.urlbar.autoFill", false); addVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"), transition: TRANSITION_TYPED }); } ]); add_autocomplete_test([ "Add urls, check for correct order", "vis", Loading Loading
toolkit/components/places/nsPlacesAutoComplete.js +15 −7 Original line number Diff line number Diff line Loading @@ -103,7 +103,8 @@ const kQueryTypeFiltered = 1; const kTitleTagsSeparator = " \u2013 "; const kBrowserUrlbarBranch = "browser.urlbar."; // Toggle autocomplete. const kBrowserUrlbarAutocompleteEnabledPref = "autocomplete.enabled"; // Toggle autoFill. const kBrowserUrlbarAutofillPref = "autoFill"; // Whether to search only typed entries. Loading Loading @@ -845,7 +846,9 @@ nsPlacesAutoComplete.prototype = { */ _loadPrefs: function PAC_loadPrefs(aRegisterObserver) { this._enabled = safePrefGetter(this._prefs, "autocomplete.enabled", true); this._enabled = safePrefGetter(this._prefs, kBrowserUrlbarAutocompleteEnabledPref, true); this._matchBehavior = safePrefGetter(this._prefs, "matchBehavior", MATCH_BOUNDARY_ANYWHERE); Loading Loading @@ -1301,7 +1304,7 @@ urlInlineComplete.prototype = { get _db() { if (!this.__db && this._autofill) { if (!this.__db && this._autofillEnabled) { this.__db = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase). DBConnection.clone(true); } Loading Loading @@ -1486,9 +1489,13 @@ urlInlineComplete.prototype = { _loadPrefs: function UIC_loadPrefs(aRegisterObserver) { let prefBranch = Services.prefs.getBranch(kBrowserUrlbarBranch); this._autofill = safePrefGetter(prefBranch, let autocomplete = safePrefGetter(prefBranch, kBrowserUrlbarAutocompleteEnabledPref, true); let autofill = safePrefGetter(prefBranch, kBrowserUrlbarAutofillPref, true); this._autofillEnabled = autocomplete && autofill; this._autofillTyped = safePrefGetter(prefBranch, kBrowserUrlbarAutofillTypedPref, true); Loading Loading @@ -1548,10 +1555,11 @@ urlInlineComplete.prototype = { } else if (aTopic == kPrefChanged && (aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutofillPref || aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutocompleteEnabledPref || aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutofillTypedPref)) { let previousAutofillTyped = this._autofillTyped; this._loadPrefs(); if (!this._autofill) { if (!this._autofillEnabled) { this.stopSearch(); this._closeDatabase(); } Loading
toolkit/components/places/tests/inline/head_autocomplete.js +5 −2 Original line number Diff line number Diff line Loading @@ -144,9 +144,8 @@ function ensure_results(aSearchString, aExpectedValue) { } function run_test() { Services.prefs.setBoolPref("browser.urlbar.autoFill", true); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); do_register_cleanup(function () { Services.prefs.clearUserPref("browser.urlbar.autocomplete.enabled"); Services.prefs.clearUserPref("browser.urlbar.autoFill"); Services.prefs.clearUserPref("browser.urlbar.autoFill.typed"); }); Loading @@ -155,6 +154,10 @@ function run_test() { let [description, searchString, expectedValue, setupFunc] = testData; add_test(function () { do_log_info(description); Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true); Services.prefs.setBoolPref("browser.urlbar.autoFill", true); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); if (setupFunc) { setupFunc(); } Loading
toolkit/components/places/tests/inline/test_autocomplete_functional.js +24 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,30 @@ // Functional tests for inline autocomplete add_autocomplete_test([ "Check disabling autocomplete disables autofill", "vis", "vis", function () { Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false); addVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"), transition: TRANSITION_TYPED }); } ]); add_autocomplete_test([ "Check disabling autofill disables autofill", "vis", "vis", function () { Services.prefs.setBoolPref("browser.urlbar.autoFill", false); addVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"), transition: TRANSITION_TYPED }); } ]); add_autocomplete_test([ "Add urls, check for correct order", "vis", Loading