Closed Bug 1650886 Opened 4 years ago Closed 4 years ago

Add available paper size information to nsIPrinter interface

Categories

(Core :: Printing: Setup, enhancement, P1)

80 Branch
enhancement

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox80 --- wontfix
firefox81 --- fixed

People

(Reporter: nordzilla, Assigned: nordzilla)

References

(Blocks 1 open bug)

Details

(Whiteboard: [print2020_v81])

Attachments

(3 files, 1 obsolete file)

The new print preview UI will require page-size information. This patch will add functionality to get the available page size names and dimensions from an nsIPrinter.

Implementation Plan

  • Part 1 -- Add nsIPaper Interface and base implementation
  • Part 2 -- Implement retrieval for macOS
  • Part 3 -- Implement retrieval for GTK
  • Part 4 -- Implement retrieval for Windows
  • Add nsIPaper interface.
  • Add nsIPaper implementaiton.
Blocks: 1651112
No longer blocks: 1631440
Depends on: 1647480
Whiteboard: print2020_v80 → [print2020_v80]
Summary: Add Page Size Information to nsIPrinter interface → Add available paper size information to nsIPrinter interface
  • Add macOS-specific function to retrieve the paper list for a given printer.
  • Add JS test to ensure papers are initialized with valid values.
Attachment #9161986 - Attachment description: Bug 1650886 - Part 2 Expose Paper Sizes for macOS -- WIP → Bug 1650886 - Part 2 Expose Paper Sizes for macOS r=jwatt,alaskanemily
Depends on: 1651532
Attachment #9162644 - Attachment description: Bug 1650886 - Part 3 Expose Paper Sizes for Linux (GTK) -- WIP → Bug 1650886 - Part 3 Expose Paper Sizes for Linux (GTK) r=jwatt,alaskanemily
Keywords: leave-open
Pushed by rmaries@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ed8db2a54c61 Part 1 nsIPaper Base Implementation r=jwatt https://hg.mozilla.org/integration/autoland/rev/e2485d1bb142 Part 2 Expose Paper Sizes for macOS r=jwatt

At least some of this is down to a previous change that hasn't been hit until this test:
https://searchfox.org/mozilla-central/rev/af5cff556a9482d7aa2267a82f2ccfaf18e797e9/widget/windows/nsDeviceContextSpecWin.cpp#598

When the argument was changed this wasn't removed and never gets deleted.

I still seem to be getting another nsTArray_base leaked however ... still looking.

Found the last one, it is from here [1], which is called as part of [2].

I think we need to add a custom destructor to nsPrinterListWin and add the following into it:
GlobalPrinters::GetInstance()->FreeGlobalPrinters();

[1] https://searchfox.org/mozilla-central/rev/89814940895946b48b4c04c702efd2c676ec8e7e/widget/windows/nsDeviceContextSpecWin.cpp#624
[2] https://searchfox.org/mozilla-central/rev/89814940895946b48b4c04c702efd2c676ec8e7e/widget/windows/nsDeviceContextSpecWin.cpp#589

Thanks for hunting those down. I found the GlobalPrinters::GetInstance()->FreeGlobalPrinters(); one over the weekend but I saw that it didn't fix the entire issue:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=8448f368dcb90a23584e5639a029f32af4112668&selectedTaskRun=Vp8Vopv_Szam689iOOyHnw.0

I will patch this ASAP.

Flags: needinfo?(enordin)

I've launched a try with the updated changes.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=f65bc1f6b73a4d24b7a6df17f6a811ea26f1943c

Will land as soon as I see it's green. This is my fault for not running a try on Windows initially. I only tested the behavior on macOS because that is the implementation that is landing in part 2 where the test is introduced. I didn't consider that there may be a previously untested memory leak in the Windows code.

Edit:

Try came up green: re-queuing to land.

Pushed by abutkovits@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f65d2491cbb4 Part 1 nsIPaper Base Implementation r=jwatt https://hg.mozilla.org/integration/autoland/rev/de485a27b337 Part 2 Expose Paper Sizes for macOS r=jwatt

Oh gosh, that's embarrassing. I re-queued for landing after the try came up green, but I forgot to push the latest update to phabricator.

My apologies.

Flags: needinfo?(enordin)
Pushed by abutkovits@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a7614ba2d1d3 Part 1 nsIPaper Base Implementation r=jwatt https://hg.mozilla.org/integration/autoland/rev/82d3cbd0c3a8 Part 2 Expose Paper Sizes for macOS r=jwatt
Pushed by bobowencode@gmail.com: https://hg.mozilla.org/integration/autoland/rev/20d873dac781 Part 4: Expose Paper Sizes for Windows. r=jwatt
Whiteboard: [print2020_v80] → [print2020_v81]
Attachment #9162644 - Attachment is obsolete: true

Marking as resolved, because all relevant patches have landed.

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
No longer blocks: 1653607
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: