Bug 1537955 - Do not spoof DevicePixelRatio for pdfs r=Ehsan

pdfs should not have a way to exfiltrate the true device pixel ratio,
so it is safe to provide the correct value, enabling them to be rendered
correctly.

Differential Revision: https://phabricator.services.mozilla.com/D39994

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Ritter 2019-08-02 04:10:09 +00:00
Родитель e7f4ed385b
Коммит 41227282b4
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -3736,7 +3736,18 @@ double nsGlobalWindowOuter::GetDevicePixelRatioOuter(CallerType aCallerType) {
}
if (nsContentUtils::ResistFingerprinting(aCallerType)) {
return 1.0;
// Spoofing the DevicePixelRatio causes blurriness in some situations
// on HiDPI displays. pdf.js is a non-system caller; but it can't
// expose the fingerprintable information, so we can safely disable
// spoofing in this situation. It doesn't address the issue for
// web-rendered content (including pdf.js instances on the web.)
// In the future we hope to have a better solution to fix all HiDPI
// blurriness...
nsAutoCString origin;
nsresult rv = this->GetPrincipal()->GetOrigin(origin);
if (NS_FAILED(rv) || origin != NS_LITERAL_CSTRING("resource://pdf.js")) {
return 1.0;
}
}
float overrideDPPX = presContext->GetOverrideDPPX();