gecko-dev/uriloader/exthandler
Gijs Kruitbosch 6c3c9b5bf3 Bug 1633790 - allow PDF.js use when we've misled the user into misconfiguring PDF handlers, r=jaws,mattwoodrow
Prior to this patch, PDF.js tracks both its own 'disabled' pref (which is used
by enterprise policy) and whether it is the default handler per the handler
service - but it tracks both in one bool, which determines whether its
streamconverter registers.

Really, what we want is to never use PDF.js if it's preffed off.

However, if there is some other default, it should be acceptable to use PDF.js
in some circumstances, like for <embed> or <object>s where otherwise we
would show no content at all.

Even for toplevel PDFs, if the user has configured Firefox to open PDFs in
an external helper app which is Firefox (which is currently an easy mistake
to make in the unknownContentType dialog), or has it set to the OS default,
but has changed their OS default to Firefox, we really still want to open
those PDFs with PDF.js.

This patch fixes all of this by splitting out the pref tracking from the
handler state tracking. Only the pref will completely disable PDF.js.

Then, in the streamconverter code, we check whether PDF.js should be used for
PDFs, and if there's a misconfiguration that we can correct. This code is
invoked from the parent process when we load PDFs in frames or toplevel
documents, and will prevent us from invoking PDF.js in the child if the user
would prefer that not to happen.

As a driveby, this cleans up how we track the pref inside PDF.js, and how we
get notified of changes to the handler - we were missing changes made in the
unknown content type dialog, so it seemed worth making it generic.

Differential Revision: https://phabricator.services.mozilla.com/D73510
2020-05-06 20:28:36 +00:00
..
android Bug 1633790 - add an API on nsIMIMEInfo that exposes whether we're the OS default handler, r=jaws 2020-05-06 20:25:29 +00:00
docs
mac Bug 1628961 - Replace MOZ_MUST_USE with [[nodiscard]] in docshell and uriloader. r=smaug 2020-04-14 06:41:42 +00:00
tests Bug 1633790 - remove unused method arguments in the external helper app service, r=jaws 2020-05-06 20:32:09 +00:00
uikit
unix Bug 1626451 - Remove nsAutoPtr usage from uriloader/. r=valentin 2020-04-03 21:05:39 +00:00
win Bug 1633790 - add an API on nsIMIMEInfo that exposes whether we're the OS default handler, r=jaws 2020-05-06 20:25:29 +00:00
ContentHandlerService.cpp
ContentHandlerService.h Bug 1628961 - Replace MOZ_MUST_USE with [[nodiscard]] in docshell and uriloader. r=smaug 2020-04-14 06:41:42 +00:00
DBusHelpers.h
ExternalHelperAppChild.cpp
ExternalHelperAppChild.h Bug 1628961 - Replace MOZ_MUST_USE with [[nodiscard]] in docshell and uriloader. r=smaug 2020-04-14 06:41:42 +00:00
ExternalHelperAppParent.cpp Bug 1622619 - Replace URIParams with nsIURI in PContent.ipdl r=valentin 2020-03-31 18:47:30 +00:00
ExternalHelperAppParent.h Bug 1622619 - Replace URIParams with nsIURI in PContent.ipdl r=valentin 2020-03-31 18:47:30 +00:00
HandlerService.js Bug 1633790 - allow PDF.js use when we've misled the user into misconfiguring PDF handlers, r=jaws,mattwoodrow 2020-05-06 20:28:36 +00:00
HandlerService.manifest
HandlerServiceChild.h
HandlerServiceParent.cpp Bug 1633790 - add an API on nsIMIMEInfo that exposes whether we're the OS default handler, r=jaws 2020-05-06 20:25:29 +00:00
HandlerServiceParent.h
PExternalHelperApp.ipdl
PHandlerService.ipdl
WebHandlerApp.jsm Bug 1536556 - Replace raw thrown Cr.ERRORs with Components.Exception. r=mossop,remote-protocol-reviewers,marionette-reviewers,whimboo,necko-reviewers,geckoview-reviewers,valentin,agi 2020-05-05 17:41:36 +00:00
components.conf
moz.build
nsCExternalHandlerService.idl
nsContentHandlerApp.h
nsDBusHandlerApp.cpp
nsDBusHandlerApp.h
nsExternalHelperAppService.cpp Bug 1633790 - remove unused method arguments in the external helper app service, r=jaws 2020-05-06 20:32:09 +00:00
nsExternalHelperAppService.h Bug 1628961 - Replace MOZ_MUST_USE with [[nodiscard]] in docshell and uriloader. r=smaug 2020-04-14 06:41:42 +00:00
nsExternalProtocolHandler.cpp Bug 1627707 - Rename LoadInfo::LoadingPrincipal to GetLoadingPrincipal as it can return null. r=ckerschb 2020-04-06 18:57:36 +00:00
nsExternalProtocolHandler.h
nsIContentDispatchChooser.idl
nsIExternalHelperAppService.idl Bug 1633790 - remove unused method arguments in the external helper app service, r=jaws 2020-05-06 20:32:09 +00:00
nsIExternalProtocolService.idl
nsIExternalURLHandlerService.idl
nsIHandlerService.idl
nsIHelperAppLauncherDialog.idl
nsISharingHandlerApp.idl
nsLocalHandlerApp.cpp
nsLocalHandlerApp.h
nsMIMEInfoChild.h Bug 1633790 - add an API on nsIMIMEInfo that exposes whether we're the OS default handler, r=jaws 2020-05-06 20:25:29 +00:00
nsMIMEInfoImpl.cpp Bug 1633790 - add an API on nsIMIMEInfo that exposes whether we're the OS default handler, r=jaws 2020-05-06 20:25:29 +00:00
nsMIMEInfoImpl.h Bug 1633790 - add an API on nsIMIMEInfo that exposes whether we're the OS default handler, r=jaws 2020-05-06 20:25:29 +00:00
nsOSHelperAppServiceChild.cpp
nsOSHelperAppServiceChild.h