Bug 1441598 Part 2: When cancelling a print make sure the DialogOpened message has been sent. r=jwatt

This commit is contained in:
Bob Owen 2018-03-04 18:43:33 +00:00
Родитель 5f274865e8
Коммит e74e1ff661
2 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -102,12 +102,21 @@ PrintProgressDialogParent::Observe(nsISupports *aSubject, const char *aTopic,
if (aTopic) { if (aTopic) {
if (!strcmp(aTopic, "cancelled")) { if (!strcmp(aTopic, "cancelled")) {
Unused << SendCancelledCurrentJob(); Unused << SendCancelledCurrentJob();
if (!mDialogOpenedSent) {
// We haven't already called SendDialogOpened, so call it now or it
// might never get sent and block the child from new printing requests.
// Also set mActive to false because we don't want to send it twice
// and our PrintProgressDialogChild will get deleted anyway.
Unused << SendDialogOpened();
mActive = false;
}
} else if (!strcmp(aTopic, "completed")) { } else if (!strcmp(aTopic, "completed")) {
// Once printing is complete don't send any messages to the child. // Once printing is complete don't send any messages to the child.
mActive = false; mActive = false;
} }
} else { } else {
Unused << SendDialogOpened(); Unused << SendDialogOpened();
mDialogOpenedSent = true;
} }
} else { } else {
NS_WARNING("The print progress dialog finished opening, but communications " NS_WARNING("The print progress dialog finished opening, but communications "

Просмотреть файл

@ -56,6 +56,7 @@ private:
nsCOMPtr<nsIWebProgressListener> mWebProgressListener; nsCOMPtr<nsIWebProgressListener> mWebProgressListener;
nsCOMPtr<nsIPrintProgressParams> mPrintProgressParams; nsCOMPtr<nsIPrintProgressParams> mPrintProgressParams;
bool mActive; bool mActive;
bool mDialogOpenedSent = false;
}; };
} // namespace embedding } // namespace embedding