Bug 1114554 - Patch 9 - Fixed crash in b2g-desktop tests. r=nsm

--HG--
extra : rebase_source : 1b59acf04bcc9a8311bc7c6fe163b99c84eabe35
This commit is contained in:
Robert Bindar 2015-07-13 13:45:17 -07:00
parent 16a5e3f9b8
commit 25dfda5b20

View File

@ -1148,6 +1148,15 @@ NotificationObserver::Observe(nsISupports* aSubject, const char* aTopic,
}
}
} else if (!strcmp("alertfinished", aTopic)) {
// In b2g-desktop, if the app is closed, closing a notification still
// triggers the observer which might be alive even though the owner window
// was closed. Keeping this until we remove the close event (Bug 1139363)
// from implementation.
nsCOMPtr<nsPIDOMWindow> window = notification->GetOwner();
if (NS_WARN_IF(!window || !window->IsCurrentInnerWindow())) {
return NS_ERROR_FAILURE;
}
notification->UnpersistNotification();
notification->mIsClosed = true;
notification->DispatchTrustedEvent(NS_LITERAL_STRING("close"));