Closed Bug 1660909 Opened 1 year ago Closed 1 year ago

Crash in nsIPrinterList::GetNamedOrDefaultPrinter with non-first printer name

Categories

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

Firefox 81
Unspecified
macOS
defect

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox80 --- unaffected
firefox81 --- fixed
firefox82 --- fixed

People

(Reporter: alaskanemily, Assigned: alaskanemily)

Details

(Whiteboard: [print2020_v81])

Attachments

(1 file)

nsIPrinterList::GetNamedOrDefaultPrinter will crash on CUPS platforms (OS X, Linux, BSD, etc) when given a printer name which is present in the printer list, but is not the first one in the list.

The crash is present in the 81 branch.

Severity: -- → S2
Priority: -- → P1
Attachment #9171825 - Attachment description: Bug 1660909 - Fix a crash in GetNamedPrinter and GetDefaultOrNamedPrinter on CUPS → Bug 1660909 - Fix a crash in NamedPrinter on CUPS
Pushed by emcdonough@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4e746a73dfec
Fix a crash in NamedPrinter on CUPS r=emilio
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch

Reminder to request beta approval. We probably won't use this, but having it on beta keeps our options open.

Flags: needinfo?(emcdonough)

Comment on attachment 9171825 [details]
Bug 1660909 - Fix a crash in NamedPrinter on CUPS

Beta/Release Uplift Approval Request

  • User impact if declined: Further code for the new print UI that is uplifted may cause crashes on non-Windows platforms.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): The change is extremely self-contained, and development of further changes for the new print UI that occur on nightly is being done with it already in place.
  • String changes made/needed:
Flags: needinfo?(emcdonough)
Attachment #9171825 - Flags: approval-mozilla-beta?

The problem can be observed on OS X or Linux by running the following in the browser console:

Cc["@mozilla.org/gfx/printerlist;1"].getService(
    Ci.nsIPrinterList
).printers.then(
  function(ps){
    if(ps.length < 2){
      console.log("You need two printers to test.");
    }
    else{
      Cc["@mozilla.org/gfx/printerlist;1"].getService(
        Ci.nsIPrinterList
      ).getNamedOrDefaultPrinter(ps[1].QueryInterface(Ci.nsIPrinter).name).then(
      function(){ console.log("OK"); });
  }
});

Comment on attachment 9171825 [details]
Bug 1660909 - Fix a crash in NamedPrinter on CUPS

Approved for 81.0b4.

Attachment #9171825 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.