Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2357)

Unified Diff: Source/modules/notifications/Notification.cpp

Issue 22909013: Notification should not leak document. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update testexp Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/notifications/Notification.h ('k') | Source/web/WebNotification.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/notifications/Notification.cpp
diff --git a/Source/modules/notifications/Notification.cpp b/Source/modules/notifications/Notification.cpp
index 742e6b7517f5fa90285c79f957aa4a0cadbea9ca..a2d0c8d5e7abac55cd8287c4f774c1e499d0cc3d 100644
--- a/Source/modules/notifications/Notification.cpp
+++ b/Source/modules/notifications/Notification.cpp
@@ -199,11 +199,15 @@ void Notification::finalize()
void Notification::dispatchShowEvent()
{
+#if ENABLE(LEGACY_NOTIFICATIONS)
+ dispatchEvent(Event::create(eventNames().displayEvent, false, false));
+#endif
dispatchEvent(Event::create(eventNames().showEvent, false, false));
}
void Notification::dispatchClickEvent()
{
+ UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
WindowFocusAllowedIndicator windowFocusAllowed;
dispatchEvent(Event::create(eventNames().clickEvent, false, false));
}
@@ -228,6 +232,14 @@ void Notification::taskTimerFired(Timer<Notification>* timer)
}
#endif
+bool Notification::dispatchEvent(PassRefPtr<Event> event)
+{
+ // Do not dispatch if the context is gone.
+ if (!scriptExecutionContext())
+ return false;
+
+ return EventTarget::dispatchEvent(event);
+}
#if ENABLE(NOTIFICATIONS)
const String& Notification::permission(ScriptExecutionContext* context)
« no previous file with comments | « Source/modules/notifications/Notification.h ('k') | Source/web/WebNotification.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698