Bug 1211485 - Disable set-as-default context menu item when the target engine is already the default. r=florian draft
authorNihanth Subramanya <nhnt11@gmail.com>
Wed, 16 Dec 2015 19:44:07 +0530
changeset 338867 aa037f8918b7688c643a45e859bbe34da465b71f
parent 338865 9643098c3d8468e9fd60981ea207fa8a3d03c1ec
child 515868 0996f0295989ce6a025f8bf94e31ba10c8928e20
push id12592
push usernhnt11@gmail.com
push dateThu, 10 Mar 2016 02:28:30 +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");