зеркало из https://github.com/mozilla/gecko-dev.git
Bug 773942 - Hide the 'Open with Firefox' option if the download is started from the download button in pdf.js. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D72779
This commit is contained in:
Родитель
58822bff64
Коммит
b804d9a64f
|
@ -1240,7 +1240,13 @@ nsUnknownContentTypeDialog.prototype = {
|
|||
shouldShowInternalHandlerOption() {
|
||||
// This is currently available only for PDF files and when
|
||||
// pdf.js is enabled.
|
||||
let browsingContext = this.mDialog.BrowsingContext.get(
|
||||
this.mLauncher.browsingContextId
|
||||
);
|
||||
return (
|
||||
!browsingContext?.currentWindowGlobal?.documentPrincipal?.URI?.schemeIs(
|
||||
"resource"
|
||||
) &&
|
||||
this.mLauncher.MIMEInfo.primaryExtension == "pdf" &&
|
||||
!Services.prefs.getBoolPref("pdfjs.disabled", true) &&
|
||||
Services.prefs.getBoolPref(
|
||||
|
|
|
@ -1275,6 +1275,12 @@ NS_IMETHODIMP nsExternalAppHandler::GetContentLength(int64_t* aContentLength) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsExternalAppHandler::GetBrowsingContextId(
|
||||
uint64_t* aBrowsingContextId) {
|
||||
*aBrowsingContextId = mBrowsingContext->Id();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsExternalAppHandler::RetargetLoadNotifications(nsIRequest* request) {
|
||||
// we are going to run the downloading of the helper app in our own little
|
||||
// docloader / load group context. so go ahead and force the creation of a
|
||||
|
|
|
@ -176,4 +176,9 @@ interface nsIHelperAppLauncher : nsICancelable
|
|||
* The download content length, or -1 if the length is not available.
|
||||
*/
|
||||
readonly attribute int64_t contentLength;
|
||||
|
||||
/**
|
||||
* The browsingContext ID of the launcher's source
|
||||
*/
|
||||
readonly attribute uint64_t browsingContextId;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче