зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1659737 - Add pref to control showing radio button for viewable internally types. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D87456
This commit is contained in:
Родитель
9af7b6fe90
Коммит
908b40d98b
|
@ -402,8 +402,11 @@ pref("browser.download.autohideButton", true);
|
|||
|
||||
// This controls the visibility of the radio button in the
|
||||
// Unknown Content Type (Helper App) dialog that will open
|
||||
// the content in the browser.
|
||||
// the content in the browser for PDF and for other
|
||||
// Viewable Internally types
|
||||
// (see browser.download.viewableInternally.enabledTypes)
|
||||
pref("browser.helperApps.showOpenOptionForPdfJS", true);
|
||||
pref("browser.helperApps.showOpenOptionForViewableInternally", true);
|
||||
|
||||
// search engines URL
|
||||
pref("browser.search.searchEnginesURL", "https://addons.mozilla.org/%LOCALE%/firefox/search-engines/");
|
||||
|
|
|
@ -1308,8 +1308,14 @@ nsUnknownContentTypeDialog.prototype = {
|
|||
);
|
||||
}
|
||||
|
||||
return DownloadIntegration.shouldViewDownloadInternally(
|
||||
this.mLauncher.MIMEInfo.MIMEType
|
||||
return (
|
||||
Services.prefs.getBoolPref(
|
||||
"browser.helperApps.showOpenOptionForViewableInternally",
|
||||
false
|
||||
) &&
|
||||
DownloadIntegration.shouldViewDownloadInternally(
|
||||
this.mLauncher.MIMEInfo.MIMEType
|
||||
)
|
||||
);
|
||||
},
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ add_task(async function setup() {
|
|||
set: [
|
||||
["security.dialog_enable_delay", 0],
|
||||
["browser.helperApps.showOpenOptionForPdfJS", true],
|
||||
["browser.helperApps.showOpenOptionForViewableInternally", true],
|
||||
],
|
||||
});
|
||||
|
||||
|
@ -467,9 +468,9 @@ add_task(async function test_internal_handler_hidden_with_other_type() {
|
|||
|
||||
/**
|
||||
* Check that the "Open with internal handler" option is not presented
|
||||
* when the feature is disabled.
|
||||
* when the feature is disabled for PDFs.
|
||||
*/
|
||||
add_task(async function test_internal_handler_hidden_with_pref_disabled() {
|
||||
add_task(async function test_internal_handler_hidden_with_pdf_pref_disabled() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.helperApps.showOpenOptionForPdfJS", false]],
|
||||
});
|
||||
|
@ -503,3 +504,39 @@ add_task(async function test_internal_handler_hidden_with_pref_disabled() {
|
|||
BrowserTestUtils.removeTab(loadingTab);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Check that the "Open with internal handler" option is not presented
|
||||
* for other viewable internally types when disabled.
|
||||
*/
|
||||
add_task(
|
||||
async function test_internal_handler_hidden_with_viewable_internally_pref_disabled() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.helperApps.showOpenOptionForViewableInternally", false]],
|
||||
});
|
||||
let dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
|
||||
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
TEST_PATH + "file_xml_attachment_test.xml"
|
||||
);
|
||||
let dialogWindow = await dialogWindowPromise;
|
||||
is(
|
||||
dialogWindow.location.href,
|
||||
"chrome://mozapps/content/downloads/unknownContentType.xhtml",
|
||||
"Should have seen the unknown content dialogWindow."
|
||||
);
|
||||
let doc = dialogWindow.document;
|
||||
|
||||
await waitForAcceptButtonToGetEnabled(doc);
|
||||
|
||||
let internalHandlerRadio = doc.querySelector("#handleInternally");
|
||||
ok(
|
||||
internalHandlerRadio.hidden,
|
||||
"The option should be hidden for XML when the pref is false"
|
||||
);
|
||||
|
||||
let dialog = doc.querySelector("#unknownContentType");
|
||||
dialog.cancelDialog();
|
||||
BrowserTestUtils.removeTab(loadingTab);
|
||||
}
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче