diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2017-07-07 08:21:31 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2017-07-07 08:21:31 +0200 |
commit | c7425d3efb076a58bd3f3aa6c0409eae6a461408 (patch) | |
tree | e5ee146957fb7d15b36fb5879eefe1bc39a15324 | |
parent | 42984a2029c4161ca4f56b8094abbdec4f547d75 (diff) | |
download | palemoon-gre-c7425d3efb076a58bd3f3aa6c0409eae6a461408.tar.gz |
[minor fix] Search box - browser.urlbar.clickSelectsAll - add an observer
-rw-r--r-- | browser/components/search/content/search.xml | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/browser/components/search/content/search.xml b/browser/components/search/content/search.xml index d1f5521c4..06a845713 100644 --- a/browser/components/search/content/search.xml +++ b/browser/components/search/content/search.xml @@ -564,9 +564,10 @@ .getService(Components.interfaces.nsIPrefBranch); this._suggestEnabled = this._prefBranch.getBoolPref("browser.search.suggest.enabled"); + this._clickSelectsAll = + this._prefBranch.getBoolPref("browser.urlbar.clickSelectsAll"); - if (this._prefBranch.getBoolPref("browser.urlbar.clickSelectsAll")) - this.setAttribute("clickSelectsAll", true); + this.setAttribute("clickSelectsAll", this._clickSelectsAll); // Add items to context menu and attach controller to handle them var textBox = document.getAnonymousElementByAttribute(this, @@ -632,12 +633,14 @@ var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefBranch); prefs.addObserver("browser.search.suggest.enabled", this, false); + prefs.addObserver("browser.urlbar.clickSelectsAll", this, false); ]]></constructor> <destructor><![CDATA[ var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefBranch); prefs.removeObserver("browser.search.suggest.enabled", this); + prefs.removeObserver("browser.urlbar.clickSelectsAll", this); // Because XBL and the customize toolbar code interacts poorly, // there may not be anything to remove here @@ -716,9 +719,19 @@ <parameter name="aData"/> <body><![CDATA[ if (aTopic == "nsPref:changed") { - this._suggestEnabled = - this._prefBranch.getBoolPref("browser.search.suggest.enabled"); - this._suggestMenuItem.setAttribute("checked", this._suggestEnabled); + switch (aData) { + case "browser.search.suggest.enabled": + this._suggestEnabled = + this._prefBranch.getBoolPref(aData); + this._suggestMenuItem.setAttribute( + "checked", this._suggestEnabled); + break; + case "browser.urlbar.clickSelectsAll": + this._clickSelectsAll = + this._prefBranch.getBoolPref(aData); + this.setAttribute("clickSelectsAll", this._clickSelectsAll); + break; + } } ]]></body> </method> |