Bug 1211485 - Disable set-as-default context menu item when the target engine is already the default. r=florian
authorNihanth Subramanya <nhnt11@gmail.com>
Wed, 16 Dec 2015 19:44:07 +0530
changeset 326584 947c1a6bee31e13736c8a6a6739ccdca3c641397
parent 326439 4adc4cef81179df18fe4e7e8463e4240aca3ae95
child 326585 eb2c4646b5a6a3d8b2c5f86d47d0d32fc2be771c
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1211485
milestone48.0a1
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
Bug 1211485 - Disable set-as-default context menu item when the target engine is already the default. r=florian MozReview-Commit-ID: BhYao9GOKak
browser/components/search/content/search.xml
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -1147,16 +1147,19 @@
       <handler event="contextmenu"><![CDATA[
         let target = event.originalTarget;
         // Prevent the context menu from appearing except on the one off buttons.
         if (!target.classList.contains("searchbar-engine-one-off-item") ||
             target.classList.contains("dummy")) {
           event.preventDefault();
           return;
         }
+        document.getAnonymousElementByAttribute(this, "anonid", "search-one-offs-context-set-default")
+                .setAttribute("disabled", target.engine == Services.search.currentEngine);
+
         this._contextEngine = target.engine;
       ]]></handler>
 
       <handler event="popupshowing"><![CDATA[
         // First handle deciding if we are showing the reduced version of the
         // popup containing only the preferences button. We do this if the
         // glass icon has been clicked if the text field is empty.
         let searchbar = document.getElementById("searchbar");