зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1657796 - Ensure downloads requested to open with system viewer always do. r=Gijs
* Check both the useSystemViewer flag and the preferredAction for that mime-type when deciding to not open PDFs into pdf.js * Don't set alwaysAskBeforeHandling to true when toggling off the "Always open in system viewer" context menu item. Differential Revision: https://phabricator.services.mozilla.com/D86992
This commit is contained in:
Родитель
3d47eef6c3
Коммит
7e28671750
|
@ -856,7 +856,6 @@ DownloadsViewUI.DownloadElementShell.prototype = {
|
|||
);
|
||||
// User has selected to not open this mime-type with the system viewer
|
||||
mimeInfo.preferredAction = mimeInfo.handleInternally;
|
||||
mimeInfo.alwaysAskBeforeHandling = true;
|
||||
}
|
||||
handlerSvc.store(mimeInfo);
|
||||
DownloadsCommon.openDownload(this.download).catch(Cu.reportError);
|
||||
|
|
|
@ -795,23 +795,29 @@ var DownloadIntegration = {
|
|||
}
|
||||
|
||||
const PDF_CONTENT_TYPE = "application/pdf";
|
||||
if (
|
||||
aDownload.handleInternally ||
|
||||
(!useSystemDefault && // No explicit instruction was passed to launch this download using the default system viewer.
|
||||
mimeInfo &&
|
||||
(mimeInfo.type == PDF_CONTENT_TYPE ||
|
||||
fileExtension?.toLowerCase() == "pdf") &&
|
||||
!mimeInfo.alwaysAskBeforeHandling &&
|
||||
mimeInfo.preferredAction === Ci.nsIHandlerInfo.handleInternally &&
|
||||
!aDownload.launchWhenSucceeded)
|
||||
) {
|
||||
DownloadUIHelper.loadFileIn(file, {
|
||||
browsingContextId: aDownload.source.browsingContextId,
|
||||
isPrivate: aDownload.source.isPrivate,
|
||||
openWhere,
|
||||
userContextId: aDownload.source.userContextId,
|
||||
});
|
||||
return;
|
||||
|
||||
if (!useSystemDefault && mimeInfo) {
|
||||
useSystemDefault = mimeInfo.preferredAction == mimeInfo.useSystemDefault;
|
||||
}
|
||||
if (!useSystemDefault) {
|
||||
// No explicit instruction was passed to launch this download using the default system viewer.
|
||||
if (
|
||||
aDownload.handleInternally ||
|
||||
(mimeInfo &&
|
||||
(mimeInfo.type == PDF_CONTENT_TYPE ||
|
||||
fileExtension?.toLowerCase() == "pdf") &&
|
||||
!mimeInfo.alwaysAskBeforeHandling &&
|
||||
mimeInfo.preferredAction === Ci.nsIHandlerInfo.handleInternally &&
|
||||
!aDownload.launchWhenSucceeded)
|
||||
) {
|
||||
DownloadUIHelper.loadFileIn(file, {
|
||||
browsingContextId: aDownload.source.browsingContextId,
|
||||
isPrivate: aDownload.source.isPrivate,
|
||||
openWhere,
|
||||
userContextId: aDownload.source.userContextId,
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// An attempt will now be made to launch the download, clear the
|
||||
|
|
Загрузка…
Ссылка в новой задаче