[tbb-commits] [tor-browser/tor-browser-38.4.0esr-5.5-1] Bug 17502: Add a pref hiding the "Open with" option

gk at torproject.org gk at torproject.org
Wed Dec 9 13:45:11 UTC 2015


commit c3aafe32d28271e04b616eaf92f826fc70c4627a
Author: anonym <anonym at riseup.net>
Date:   Sun Nov 1 23:57:59 2015 +0100

    Bug 17502: Add a pref hiding the "Open with" option
    
    If browser.download.forbid_open_with is set to true (default: false)
    the download dialog will not ever show the "Open with" option for
    opening the file with an external application; only the "Save" and
    "Cancel" options will be available.
    
    This is very useful to enable when the browser is sandboxed (e.g. via
    AppArmor) in such a way that it is forbidden to run external
    applications, since users then are not presented with this choice
    which will not work and only cause confusion.
---
 browser/app/profile/firefox.js              |    1 +
 toolkit/mozapps/downloads/nsHelperAppDlg.js |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
index a827f52..6c30b7d 100644
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -324,6 +324,7 @@ pref("browser.download.useDownloadDir", true);
 pref("browser.download.folderList", 1);
 pref("browser.download.manager.addToRecentDocs", true);
 pref("browser.download.manager.resumeOnWakeDelay", 10000);
+pref("browser.download.forbid_open_with", false);
 
 // This allows disabling the animated notifications shown by
 // the Downloads Indicator when a download starts or completes.
diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js
index 43653f9..abb7ca2 100644
--- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
+++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
@@ -458,7 +458,8 @@ nsUnknownContentTypeDialog.prototype = {
     var shouldntRememberChoice = (mimeType == "application/octet-stream" ||
                                   mimeType == "application/x-msdownload" ||
                                   this.mLauncher.targetFileIsExecutable);
-    if (shouldntRememberChoice && !this.openWithDefaultOK()) {
+    if ((shouldntRememberChoice && !this.openWithDefaultOK()) ||
+        Services.prefs.getBoolPref("browser.download.forbid_open_with")) {
       // hide featured choice
       this.dialogElement("normalBox").collapsed = true;
       // show basic choice





More information about the tbb-commits mailing list