Bug 1672370: Revert paper size pref validation back to checking for either being less than 100 inches. r=jwatt, a=jcristau
authorBob Owen <bobowencode@gmail.com>
Thu, 22 Oct 2020 08:13:35 +0000
changeset 618981 c88c6f80d2d274d2563acc297b54685ab0f7023b
parent 618980 11baa02b4e2ad63a73ced2aa4d6d88617ad952aa
child 618982 368d17ec7a2df69a349a0ca1e6a48c1368c5555e
push id2439
push userjcristau@mozilla.com
push dateMon, 26 Oct 2020 13:38:53 +0000
treeherdermozilla-release@368d17ec7a2d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt, jcristau
bugs1672370
milestone82.0.1
Bug 1672370: Revert paper size pref validation back to checking for either being less than 100 inches. r=jwatt, a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D94341
widget/nsPrintSettingsService.cpp
--- a/widget/nsPrintSettingsService.cpp
+++ b/widget/nsPrintSettingsService.cpp
@@ -329,30 +329,22 @@ nsresult nsPrintSettingsService::ReadPre
 
     if (gotPaperSizeFromPrefs &&
         paperSizeUnit != nsIPrintSettings::kPaperSizeInches &&
         paperSizeUnit != nsIPrintSettings::kPaperSizeMillimeters) {
       gotPaperSizeFromPrefs = false;
     }
 
     if (gotPaperSizeFromPrefs) {
-      // Impose some limits to purge at least some corrupt pref values to try to
-      // avoid bugs like bug 315687.  Sizes based on telemetry max/mins.
-      constexpr double minInMM = 10.0;
-      constexpr double maxInMM = 4500.0;
-      constexpr double minInIn = minInMM / 25.4;
-      constexpr double maxInIn = 100.0;  // (~2.4m) used since bug 315687
-
-      if ((paperSizeUnit == nsIPrintSettings::kPaperSizeMillimeters &&
-           (paperWidth < minInMM || paperWidth > maxInMM ||
-            paperHeight < minInMM || paperHeight > maxInMM)) ||
-          (paperWidth < minInIn || paperWidth > maxInIn ||
-           paperHeight < minInIn || paperHeight > maxInIn)) {
-        gotPaperSizeFromPrefs = false;
-      }
+      // Bug 315687: Sanity check paper size to avoid paper size values in
+      // mm when the size unit flag is inches. The value 100 is arbitrary
+      // and can be changed.
+      gotPaperSizeFromPrefs =
+          (paperSizeUnit != nsIPrintSettings::kPaperSizeInches) ||
+          (paperWidth < 100.0) || (paperHeight < 100.0);
     }
 
     if (gotPaperSizeFromPrefs) {
       aPS->SetPaperSizeUnit(paperSizeUnit);
       aPS->SetPaperWidth(paperWidth);
       aPS->SetPaperHeight(paperHeight);
       aPS->SetPaperId(str);
     }