Loading widget/gtk/nsDeviceContextSpecG.cpp +28 −26 Original line number Diff line number Diff line Loading @@ -338,11 +338,6 @@ nsDeviceContextSpecGTK::BeginDocument(const nsAString& aTitle, } RefPtr<PrintEndDocumentPromise> nsDeviceContextSpecGTK::EndDocument() { return nsIDeviceContextSpec::EndDocumentPromiseFromResult(DoEndDocument(), __func__); } nsresult nsDeviceContextSpecGTK::DoEndDocument() { switch (mPrintSettings->GetOutputDestination()) { case nsIPrintSettings::kOutputDestinationPrinter: { // At this point, we might have a GtkPrinter set up in nsPrintSettingsGTK, Loading Loading @@ -374,28 +369,35 @@ nsresult nsDeviceContextSpecGTK::DoEndDocument() { nsresult rv = NS_NewLocalFile(targetPath, false, getter_AddRefs(destFile)); NS_ENSURE_SUCCESS(rv, rv); if (NS_FAILED(rv)) { return PrintEndDocumentPromise::CreateAndReject(rv, __func__); } return nsIDeviceContextSpec::EndDocumentAsync( __func__, [destFile = std::move(destFile), spoolFile = std::move(mSpoolFile)]() -> nsresult { nsAutoString destLeafName; rv = destFile->GetLeafName(destLeafName); auto rv = destFile->GetLeafName(destLeafName); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIFile> destDir; rv = destFile->GetParent(getter_AddRefs(destDir)); NS_ENSURE_SUCCESS(rv, rv); rv = mSpoolFile->MoveTo(destDir, destLeafName); rv = spoolFile->MoveTo(destDir, destLeafName); NS_ENSURE_SUCCESS(rv, rv); mSpoolFile = nullptr; // This is the standard way to get the UNIX umask. Ugh. mode_t mask = umask(0); umask(mask); // If you're not familiar with umasks, they contain the bits of what NOT // to set in the permissions (thats because files and directories have // different numbers of bits for their permissions) // If you're not familiar with umasks, they contain the bits of what // NOT to set in the permissions (thats because files and // directories have different numbers of bits for their permissions) destFile->SetPermissions(0666 & ~(mask)); return NS_OK; }); break; } case nsIPrintSettings::kOutputDestinationStream: Loading @@ -403,5 +405,5 @@ nsresult nsDeviceContextSpecGTK::DoEndDocument() { MOZ_ASSERT(!mSpoolFile); break; } return NS_OK; return PrintEndDocumentPromise::CreateAndResolve(true, __func__); } widget/gtk/nsDeviceContextSpecG.h +0 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,6 @@ class nsDeviceContextSpecGTK : public nsIDeviceContextSpec { nsCString mTitle; private: nsresult DoEndDocument(); void EnumeratePrinters(); void StartPrintJob(); static gboolean PrinterEnumerator(GtkPrinter* aPrinter, gpointer aData); Loading Loading
widget/gtk/nsDeviceContextSpecG.cpp +28 −26 Original line number Diff line number Diff line Loading @@ -338,11 +338,6 @@ nsDeviceContextSpecGTK::BeginDocument(const nsAString& aTitle, } RefPtr<PrintEndDocumentPromise> nsDeviceContextSpecGTK::EndDocument() { return nsIDeviceContextSpec::EndDocumentPromiseFromResult(DoEndDocument(), __func__); } nsresult nsDeviceContextSpecGTK::DoEndDocument() { switch (mPrintSettings->GetOutputDestination()) { case nsIPrintSettings::kOutputDestinationPrinter: { // At this point, we might have a GtkPrinter set up in nsPrintSettingsGTK, Loading Loading @@ -374,28 +369,35 @@ nsresult nsDeviceContextSpecGTK::DoEndDocument() { nsresult rv = NS_NewLocalFile(targetPath, false, getter_AddRefs(destFile)); NS_ENSURE_SUCCESS(rv, rv); if (NS_FAILED(rv)) { return PrintEndDocumentPromise::CreateAndReject(rv, __func__); } return nsIDeviceContextSpec::EndDocumentAsync( __func__, [destFile = std::move(destFile), spoolFile = std::move(mSpoolFile)]() -> nsresult { nsAutoString destLeafName; rv = destFile->GetLeafName(destLeafName); auto rv = destFile->GetLeafName(destLeafName); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIFile> destDir; rv = destFile->GetParent(getter_AddRefs(destDir)); NS_ENSURE_SUCCESS(rv, rv); rv = mSpoolFile->MoveTo(destDir, destLeafName); rv = spoolFile->MoveTo(destDir, destLeafName); NS_ENSURE_SUCCESS(rv, rv); mSpoolFile = nullptr; // This is the standard way to get the UNIX umask. Ugh. mode_t mask = umask(0); umask(mask); // If you're not familiar with umasks, they contain the bits of what NOT // to set in the permissions (thats because files and directories have // different numbers of bits for their permissions) // If you're not familiar with umasks, they contain the bits of what // NOT to set in the permissions (thats because files and // directories have different numbers of bits for their permissions) destFile->SetPermissions(0666 & ~(mask)); return NS_OK; }); break; } case nsIPrintSettings::kOutputDestinationStream: Loading @@ -403,5 +405,5 @@ nsresult nsDeviceContextSpecGTK::DoEndDocument() { MOZ_ASSERT(!mSpoolFile); break; } return NS_OK; return PrintEndDocumentPromise::CreateAndResolve(true, __func__); }
widget/gtk/nsDeviceContextSpecG.h +0 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,6 @@ class nsDeviceContextSpecGTK : public nsIDeviceContextSpec { nsCString mTitle; private: nsresult DoEndDocument(); void EnumeratePrinters(); void StartPrintJob(); static gboolean PrinterEnumerator(GtkPrinter* aPrinter, gpointer aData); Loading