зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1655746 - Avoid crashing when getting error notifications from printing. r=jwatt
We could legitimately get multiple error notifications and we'd try to reject the promise twice and crash. Differential Revision: https://phabricator.services.mozilla.com/D85441
This commit is contained in:
Родитель
36dc91fc09
Коммит
28aa61be0a
|
@ -3128,6 +3128,9 @@ class WebProgressListenerToPromise final : public nsIWebProgressListener {
|
|||
uint32_t aStateFlags, nsresult aStatus) override {
|
||||
if (aStateFlags & nsIWebProgressListener::STATE_STOP &&
|
||||
aStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT) {
|
||||
MOZ_RELEASE_ASSERT(mPromise,
|
||||
"Got duplicate load notification, "
|
||||
"or load after an error");
|
||||
mPromise->MaybeResolveWithUndefined();
|
||||
mPromise = nullptr;
|
||||
}
|
||||
|
@ -3136,7 +3139,7 @@ class WebProgressListenerToPromise final : public nsIWebProgressListener {
|
|||
NS_IMETHOD OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const char16_t* aMessage) override {
|
||||
if (aStatus != NS_OK) {
|
||||
if (aStatus != NS_OK && mPromise) {
|
||||
mPromise->MaybeReject(ErrorResult(aStatus));
|
||||
mPromise = nullptr;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче