[tor-commits] [tor-messenger-build/master] Disable 'Search with...' context menu (closes #16477)

sukhbir at torproject.org sukhbir at torproject.org
Wed Jul 8 17:54:19 UTC 2015


commit 7cd77ca26c2ee1f0565382a6e9c2a66d04caf4ec
Author: Sukhbir Singh <sukhbir at torproject.org>
Date:   Wed Jul 8 13:51:29 2015 -0400

    Disable 'Search with...' context menu (closes #16477)
    
    In addition to disabling the context menu, remove the 'Manage Search
    Engines' option in the preferences window.
---
 projects/instantbird/config                       |    2 ++
 projects/instantbird/search-context-menu.patch    |   38 +++++++++++++++++++++
 projects/instantbird/search-preferences-xul.patch |   21 ++++++++++++
 3 files changed, 61 insertions(+)

diff --git a/projects/instantbird/config b/projects/instantbird/config
index 1e17ae9..80575fa 100644
--- a/projects/instantbird/config
+++ b/projects/instantbird/config
@@ -86,6 +86,8 @@ input_files:
   - filename: xmpp-resource.patch
   - filename: xmpp-username-split.patch
   - filename: version.patch
+  - filename: search-context-menu.patch
+  - filename: search-preferences-xul.patch
   - filename: branding/blistWindow.png
   - filename: branding/blistWindow16.png
   - filename: branding/blistWindow48.png
diff --git a/projects/instantbird/search-context-menu.patch b/projects/instantbird/search-context-menu.patch
new file mode 100644
index 0000000..20056c2
--- /dev/null
+++ b/projects/instantbird/search-context-menu.patch
@@ -0,0 +1,38 @@
+diff --git a/im/content/nsContextMenu.js b/im/content/nsContextMenu.js
+--- a/im/content/nsContextMenu.js
++++ b/im/content/nsContextMenu.js
+@@ -462,33 +462,17 @@ nsContextMenu.prototype = {
+     var selectedText = getBrowserSelection(16);
+ 
+     if (!selectedText)
+       return false;
+ 
+     if (selectedText.length > 15)
+       selectedText = selectedText.substr(0,15) + this.ellipsis;
+ 
+-    var engine = Services.search.defaultEngine;
+-    if (!engine)
+-      return false;
+-
+-    // format "Search <engine> for <selection>" string to show in menu
+-    var bundle = document.getElementById("bundle_instantbird");
+-    var menuLabel = bundle.getFormattedString("contextMenuSearchText",
+-                                              [engine.name,
+-                                               selectedText]);
+-    document.getElementById("context-searchselect").label = menuLabel;
+-    document.getElementById("context-searchselect").accessKey =
+-      bundle.getString("contextMenuSearchText.accesskey");
+-    menuLabel = bundle.getFormattedString("contextMenuSearchWith",
+-                                          [selectedText]);
+-    document.getElementById("context-searchselect-with").label = menuLabel;
+-
+-    return true;
++    return false;
+   },
+ 
+   // Returns true if anything is selected.
+   isContentSelection: function() {
+     return !document.commandDispatcher.focusedWindow.getSelection().isCollapsed;
+   }
+ };
+ 
diff --git a/projects/instantbird/search-preferences-xul.patch b/projects/instantbird/search-preferences-xul.patch
new file mode 100644
index 0000000..647d9a5
--- /dev/null
+++ b/projects/instantbird/search-preferences-xul.patch
@@ -0,0 +1,21 @@
+diff --git a/im/content/preferences/advanced.xul b/im/content/preferences/advanced.xul
+--- a/im/content/preferences/advanced.xul
++++ b/im/content/preferences/advanced.xul
+@@ -135,17 +135,6 @@
+                       preference="layout.spellcheckDefault"/>
+           </groupbox>
+ 
+-          <!-- Search engines -->
+-          <groupbox id="searchEnginesGroup" orient="horizontal" align="center">
+-            <caption label="&searchEnginesGroup.label;"/>
+-
+-            <description control="manageSearchEnginesButton"
+-                         flex="1">&searchEnginesDesc.label;</description>
+-            <button id="manageSearchEnginesButton" label="&searchEngines.label;"
+-                    accesskey="&searchEngines.accesskey;"
+-                    oncommand="gAdvancedPane.showSearchEngineManager();"/>
+-          </groupbox>
+-
+ #ifdef HAVE_SHELL_SERVICE
+           <!-- System Defaults -->
+           <groupbox id="systemDefaultsGroup" orient="horizontal">



More information about the tor-commits mailing list