Commit 98610a85 authored by Jonathan Watt's avatar Jonathan Watt
Browse files

Bug 1749014 - Remove some unused printUtils.js code and a test. r=mstriemer

We don't "pass" print settings to the content process by saving them to prefs,
so the test is no longer useful (this removes the code it's testing anyway).

Differential Revision: https://phabricator.services.mozilla.com/D135349
parent 3f013a04
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -97,7 +97,6 @@ support-files =
[test_dialog_with_positioning.html]
tags = openwindow
[test_fixed_bg_scrolling_repaints.html]
[test_last_used_printer_name.html]
[test_prerendered_transforms.html]
[test_printer_default_settings.html]
[test_printpreview.xhtml]
+0 −32
Original line number Diff line number Diff line
<!DOCTYPE HTML>
<html>
<head>
  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body onload="run()">
<script type="application/javascript">

SimpleTest.waitForExplicitFinish();

function getLastUsedPrinterName() {
  try {
      let PSSVC = Cc["@mozilla.org/gfx/printsettings-service;1"].getService(
        Ci.nsIPrintSettingsService
      );

      return PSSVC.lastUsedPrinterName;
    } catch (e) {
      Cu.reportError(e);
    }

    return null;
}

function run() {
  isnot(getLastUsedPrinterName(), null);
  SimpleTest.finish();
}

</script>
</body>
</html>
+0 −40
Original line number Diff line number Diff line
@@ -462,46 +462,6 @@ var PrintUtils = {
    }
    return printSettings;
  },

  get shouldSimplify() {
    return this._shouldSimplify;
  },

  setSimplifiedMode(shouldSimplify) {
    this._shouldSimplify = shouldSimplify;
  },

  getLastUsedPrinterName() {
    let PSSVC = Cc["@mozilla.org/gfx/printsettings-service;1"].getService(
      Ci.nsIPrintSettingsService
    );
    let lastUsedPrinterName = PSSVC.lastUsedPrinterName;
    if (!lastUsedPrinterName) {
      // We "pass" print settings over to the content process by saving them to
      // prefs (yuck!). It is important to try to avoid saving to prefs without
      // prefixing them with a printer name though, so this hack tries to make
      // sure that (in the common case) we have set the "last used" printer,
      // which makes us save to prefs prefixed with its name, and makes sure
      // the content process will pick settings up from those prefixed prefs
      // too.
      let settings = this.getPrintSettings();
      if (settings.printerName) {
        PSSVC.savePrintSettingsToPrefs(
          settings,
          false,
          Ci.nsIPrintSettings.kInitSavePrinterName
        );
        PSSVC.savePrintSettingsToPrefs(
          settings,
          true,
          Ci.nsIPrintSettings.kInitSaveAll
        );
        lastUsedPrinterName = settings.printerName;
      }
    }

    return lastUsedPrinterName;
  },
};

class PrintPreview extends MozElements.BaseControl {