Bug 1281959 - Add a pref hiding the "Open with" option. r=dolske

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.

See https://trac.torproject.org/17502
This commit is contained in:
anonym 2016-06-28 14:23:00 +02:00
Родитель 1a20c85c2d
Коммит 91d0ac1119
2 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -112,6 +112,9 @@ pref("offline-apps.quota.warn", 51200);
// cache compression turned off for now - see bug #715198
pref("browser.cache.compression_level", 0);
// Don't show "Open with" option on download dialog if true.
pref("browser.download.forbid_open_with", false);
// Whether or not testing features are enabled.
pref("dom.quotaManager.testing", false);

Просмотреть файл

@ -472,7 +472,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