mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Backed out changeset 543a78ca4fa9 (bug 1747343) for causing mochitest failures at browser_bug676619.js. CLOSED TREE
This commit is contained in:
parent
79bf36e460
commit
f90c8918d4
@ -3376,7 +3376,7 @@ BrowserGlue.prototype = {
|
||||
_migrateUI: function BG__migrateUI() {
|
||||
// Use an increasing number to keep track of the current migration state.
|
||||
// Completely unrelated to the current Firefox release number.
|
||||
const UI_VERSION = 126;
|
||||
const UI_VERSION = 125;
|
||||
const BROWSER_DOCURL = AppConstants.BROWSER_CHROME_URL;
|
||||
|
||||
const PROFILE_DIR = Services.dirsvc.get("ProfD", Ci.nsIFile).path;
|
||||
@ -4152,25 +4152,6 @@ BrowserGlue.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
if (currentUIVersion < 126) {
|
||||
// Bug 1747343 - Add a pref to set the default download action to "Always
|
||||
// ask" so the UCT dialog will be opened for mime types that are not
|
||||
// stored already. Users who wanted this behavior would have disabled the
|
||||
// experimental pref browser.download.improvements_to_download_panel so we
|
||||
// can migrate its inverted value to this new pref.
|
||||
if (
|
||||
!Services.prefs.getBoolPref(
|
||||
"browser.download.improvements_to_download_panel",
|
||||
true
|
||||
)
|
||||
) {
|
||||
Services.prefs.setBoolPref(
|
||||
"browser.download.always_ask_before_handling_new_types",
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the migration version.
|
||||
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
|
||||
},
|
||||
|
@ -449,17 +449,6 @@
|
||||
</listheader>
|
||||
<richlistbox id="handlersView"
|
||||
preference="pref.downloads.disable_button.edit_actions"/>
|
||||
<description id="handleNewFileTypesDesc"
|
||||
data-l10n-id="applications-handle-new-file-types-description"/>
|
||||
<radiogroup id="handleNewFileTypes"
|
||||
preference="browser.download.always_ask_before_handling_new_types">
|
||||
<radio id="saveForNewTypes"
|
||||
value="false"
|
||||
data-l10n-id="applications-save-for-new-types"/>
|
||||
<radio id="askBeforeHandling"
|
||||
value="true"
|
||||
data-l10n-id="applications-ask-before-handling"/>
|
||||
</radiogroup>
|
||||
</groupbox>
|
||||
|
||||
|
||||
|
@ -51,7 +51,6 @@ Preferences.addAll([
|
||||
|
||||
// Downloads
|
||||
{ id: "browser.download.useDownloadDir", type: "bool" },
|
||||
{ id: "browser.download.always_ask_before_handling_new_types", type: "bool" },
|
||||
{ id: "browser.download.folderList", type: "int" },
|
||||
{ id: "browser.download.dir", type: "file" },
|
||||
|
||||
@ -2907,12 +2906,6 @@ var gMainPane = {
|
||||
* browser.download.folderList preference.
|
||||
* False - Always ask the user where to save a file and default to
|
||||
* browser.download.lastDir when displaying a folder picker dialog.
|
||||
* browser.download.always_ask_before_handling_new_types - bool
|
||||
* Defines the default behavior for new file handlers.
|
||||
* True - When downloading a file that doesn't match any existing
|
||||
* handlers, ask the user whether to save or open the file.
|
||||
* False - Save the file. The user can change the default action in
|
||||
* the Applications section in the preferences UI.
|
||||
* browser.download.dir - local file handle
|
||||
* A local folder the user may have selected for downloaded files to be
|
||||
* saved. Migration of other browser settings may also set this path.
|
||||
|
@ -454,16 +454,6 @@ applications-use-os-default-label =
|
||||
|
||||
##
|
||||
|
||||
applications-handle-new-file-types-description = What should { -brand-short-name } do with other files?
|
||||
|
||||
applications-save-for-new-types =
|
||||
.label = Save files
|
||||
.accesskey = S
|
||||
|
||||
applications-ask-before-handling =
|
||||
.label = Ask whether to open or save files
|
||||
.accesskey = A
|
||||
|
||||
drm-content-header = Digital Rights Management (DRM) Content
|
||||
|
||||
play-drm-content =
|
||||
|
@ -1153,12 +1153,6 @@
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# See bug 1747343
|
||||
- name: browser.download.always_ask_before_handling_new_types
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# See bug 1731668
|
||||
- name: browser.download.enable_spam_prevention
|
||||
type: bool
|
||||
|
@ -81,16 +81,14 @@ nsMIMEInfoBase::nsMIMEInfoBase(const char* aMIMEType)
|
||||
mClass(eMIMEInfo),
|
||||
mPreferredAction(nsIMIMEInfo::saveToDisk),
|
||||
mAlwaysAskBeforeHandling(
|
||||
StaticPrefs::
|
||||
browser_download_always_ask_before_handling_new_types()) {}
|
||||
!StaticPrefs::browser_download_improvements_to_download_panel()) {}
|
||||
|
||||
nsMIMEInfoBase::nsMIMEInfoBase(const nsACString& aMIMEType)
|
||||
: mSchemeOrType(aMIMEType),
|
||||
mClass(eMIMEInfo),
|
||||
mPreferredAction(nsIMIMEInfo::saveToDisk),
|
||||
mAlwaysAskBeforeHandling(
|
||||
StaticPrefs::
|
||||
browser_download_always_ask_before_handling_new_types()) {}
|
||||
!StaticPrefs::browser_download_improvements_to_download_panel()) {}
|
||||
|
||||
// Constructor for a handler that lets the caller specify whether this is a
|
||||
// MIME handler or a protocol handler. In the long run, these will be distinct
|
||||
@ -102,8 +100,7 @@ nsMIMEInfoBase::nsMIMEInfoBase(const nsACString& aType, HandlerClass aClass)
|
||||
mClass(aClass),
|
||||
mPreferredAction(nsIMIMEInfo::saveToDisk),
|
||||
mAlwaysAskBeforeHandling(
|
||||
StaticPrefs::
|
||||
browser_download_always_ask_before_handling_new_types() ||
|
||||
!StaticPrefs::browser_download_improvements_to_download_panel() ||
|
||||
aClass != eMIMEInfo) {}
|
||||
|
||||
nsMIMEInfoBase::~nsMIMEInfoBase() {}
|
||||
|
@ -155,10 +155,11 @@ var HandlerServiceTestUtils = {
|
||||
};
|
||||
} else {
|
||||
// On Desktop, the default preferredAction for MIME types is saveToDisk,
|
||||
// while for protocols it is alwaysAsk. Since Bug 1735843, for new MIME
|
||||
// types we default to not asking before handling unless a pref is set.
|
||||
alwaysAskBeforeHandling = Services.prefs.getBoolPref(
|
||||
"browser.download.always_ask_before_handling_new_types",
|
||||
// while for protocols it is alwaysAsk.
|
||||
// With the new download improvements, for MIME types we default to not
|
||||
// asking before handling
|
||||
alwaysAskBeforeHandling = !Services.prefs.getBoolPref(
|
||||
"browser.download.improvements_to_download_panel",
|
||||
false
|
||||
);
|
||||
|
||||
|
@ -58,68 +58,3 @@ add_task(async function skipDialogAndDownloadFile() {
|
||||
info("The file " + download.target.path + " is not removed, " + ex);
|
||||
}
|
||||
});
|
||||
|
||||
// Test that pref browser.download.always_ask_before_handling_new_types causes
|
||||
// the UCT dialog to be opened for unrecognized mime types
|
||||
add_task(async function skipDialogAndDownloadFile() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.download.improvements_to_download_panel", true],
|
||||
["browser.download.always_ask_before_handling_new_types", true],
|
||||
["browser.download.useDownloadDir", true],
|
||||
],
|
||||
});
|
||||
|
||||
let UCTObserver = {
|
||||
opened: PromiseUtils.defer(),
|
||||
closed: PromiseUtils.defer(),
|
||||
observe(aSubject, aTopic, aData) {
|
||||
let win = aSubject;
|
||||
switch (aTopic) {
|
||||
case "domwindowopened":
|
||||
win.addEventListener(
|
||||
"load",
|
||||
function onLoad(event) {
|
||||
// Let the dialog initialize
|
||||
SimpleTest.executeSoon(function() {
|
||||
UCTObserver.opened.resolve(win);
|
||||
});
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
break;
|
||||
case "domwindowclosed":
|
||||
if (
|
||||
win.location ==
|
||||
"chrome://mozapps/content/downloads/unknownContentType.xhtml"
|
||||
) {
|
||||
this.closed.resolve();
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
Services.ww.registerNotification(UCTObserver);
|
||||
|
||||
info("Opening new tab with file of unknown content type");
|
||||
await BrowserTestUtils.withNewTab(
|
||||
{
|
||||
gBrowser,
|
||||
url:
|
||||
"http://mochi.test:8888/browser/toolkit/mozapps/downloads/tests/browser/unknownContentType_dialog_layout_data.pif",
|
||||
waitForLoad: false,
|
||||
waitForStateStop: true,
|
||||
},
|
||||
async function() {
|
||||
let uctWindow = await UCTObserver.opened.promise;
|
||||
info("Unknown content type dialog opened");
|
||||
let focusOnDialog = SimpleTest.promiseFocus(uctWindow);
|
||||
uctWindow.focus();
|
||||
await focusOnDialog;
|
||||
uctWindow.document.getElementById("unknownContentType").cancelDialog();
|
||||
info("Unknown content type dialog canceled");
|
||||
uctWindow = null;
|
||||
Services.ww.unregisterNotification(UCTObserver);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
@ -105,8 +105,8 @@ function run_test() {
|
||||
Assert.equal(handlerInfo.possibleApplicationHandlers.length, 0);
|
||||
Assert.equal(
|
||||
handlerInfo.alwaysAskBeforeHandling,
|
||||
prefSvc.getBoolPref(
|
||||
"browser.download.always_ask_before_handling_new_types",
|
||||
!prefSvc.getBoolPref(
|
||||
"browser.download.improvements_to_download_panel",
|
||||
false
|
||||
)
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user