Bug 1211485 - Disable set-as-default context menu item when the target engine is already the default. r=florian
MozReview-Commit-ID: BhYao9GOKak
--- 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");