Closed Bug 1604071 Opened 6 years ago Closed 6 years ago

Dead assignment in nsPrintDialogServiceGTK::Show

Categories

(Core :: Printing: Setup, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: alexhenrie24, Assigned: alexhenrie24)

Details

Attachments

(1 file)

nsPrintDialogServiceGTK::Show currently looks like this:

nsresult rv = fpPrintPortal->PreparePrintRequest(gtkParent);
NS_ENSURE_SUCCESS(rv, rv);

// This blocks until nsFlatpakPrintPortal::FinishPrintDialog is called
GtkPrintOperationResult printDialogResult = fpPrintPortal->GetResult();

rv = NS_OK;
switch (printDialogResult) {
  case GTK_PRINT_OPERATION_RESULT_APPLY: {
    nsCOMPtr<nsIObserverService> os =
        mozilla::services::GetObserverService();
    NS_ENSURE_STATE(os);
    // Observer waits until notified that the file with the content
    // to print has been written.
    rv = os->AddObserver(fpPrintPortal, "print-to-file-finished", false);
    NS_ENSURE_SUCCESS(rv, rv);
    break;
  }
  case GTK_PRINT_OPERATION_RESULT_CANCEL:
    rv = NS_ERROR_ABORT;
    break;
  default:
    NS_WARNING("Unexpected response");
    rv = NS_ERROR_ABORT;
}
return rv;

Setting rv to the constant NS_OK is pointless because rv was already set just before that and will be set again in the switch statement that immediately follows.

Assignee: nobody → alexhenrie24
Status: NEW → ASSIGNED
Pushed by rgurzau@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6946b0325267 Remove dead assignment from nsPrintDialogServiceGTK::Show. r=stransky
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
Type: defect → enhancement
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: