Bug 1352305 - Part 1: Making the XULWindow will not be enforecd to be rounded dimensions if it is a window without a primary content when fingerprinting resistance is enabled. r?ehsan
This patch making the nsXULWindow::ForceRoundedDimensions() will only be called
when this window is a window which has a primary content when fingerprinting
resistance is enabled.
This will fix the problem that dialog windows are incorrectly resized after
fingerprinting resistance is enabled.
MozReview-Commit-ID: 6WD6c38CTPv
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -1094,18 +1094,23 @@ void nsXULWindow::OnChromeLoaded()
if (NS_SUCCEEDED(rv)) {
mChromeLoaded = true;
ApplyChromeFlags();
SyncAttributesToWidget();
int32_t specWidth = -1, specHeight = -1;
bool gotSize = false;
+ bool isContent = false;
- if (nsContentUtils::ShouldResistFingerprinting()) {
+ GetHasPrimaryContent(&isContent);
+
+ // If this window has a primary content and fingerprinting resistance is
+ // enabled, we enforce this window to rounded dimensions.
+ if (isContent && nsContentUtils::ShouldResistFingerprinting()) {
ForceRoundedDimensions();
} else if (!mIgnoreXULSize) {
gotSize = LoadSizeFromXUL(specWidth, specHeight);
}
bool positionSet = !mIgnoreXULPosition;
nsCOMPtr<nsIXULWindow> parentWindow(do_QueryReferent(mParentWindow));
#if defined(XP_UNIX) && !defined(XP_MACOSX)