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 draft
authorTim Huang <tihuang@mozilla.com>
Tue, 02 May 2017 18:11:50 +0800
changeset 571277 6c7b645970453cb6732609cfb63ab48c626ce7c3
parent 571272 48c0fd9c9ec5d68061ea7b59358874ae8da72572
child 571278 301c8868a8da13a12af82629799f733a12986080
push id56738
push userbmo:tihuang@mozilla.com
push dateTue, 02 May 2017 10:12:10 +0000
reviewersehsan
bugs1352305
milestone55.0a1
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
xpfe/appshell/nsXULWindow.cpp
--- 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)