gecko-dev/browser/components/preferences
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
..
dialogs Bug 1557754 - Don't allow locked preferences to be enabled. r=Gijs 2020-04-24 16:50:37 +00:00
tests 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
containers.inc.xhtml Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
containers.js Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
extensionControlled.js Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
findInPage.js Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
fxaPairDevice.js Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
fxaPairDevice.xhtml Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
home.inc.xhtml Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
home.js Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
jar.mn Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
main.inc.xhtml Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
main.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
moz.build Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
preferences.js Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
preferences.xhtml Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
privacy.inc.xhtml Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
privacy.js Bug 1632854 - Pass the ChromeWindow reference to the OSKeyStore instead of the content global so the dialog will be app modal. r=MattN 2020-04-29 20:28:11 +00:00
search.inc.xhtml Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
search.js Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
searchResults.inc.xhtml Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
subdialogs.js Bug 1631289 - Stop including preferences.css twice in preferences dialogs. r=jaws 2020-04-23 19:29:48 +00:00
sync.inc.xhtml Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00
sync.js Bug 1201243 - Make browser/components/preferences/in-content top-level and move dialogs to a subdirectory. r=jaws 2020-04-22 23:35:08 +00:00