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 340461 947c1a6bee31e13736c8a6a6739ccdca3c641397
parent 340460 4adc4cef81179df18fe4e7e8463e4240aca3ae95
child 340462 eb2c4646b5a6a3d8b2c5f86d47d0d32fc2be771c
push id12971
push userbmo:bob.silverberg@gmail.com
push dateTue, 15 Mar 2016 10:57:24 +0000
reviewersflorian
bugs1211485
milestone48.0a1
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");