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

Unified Diff: Source/WebKit/chromium/src/WebNotification.cpp

Issue 7148005: Merge 88738 - [Chromium] WebNotification should check if ScriptExecutionContext is gone (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 6 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/WebKit/chromium/public/WebNotification.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/src/WebNotification.cpp
===================================================================
--- Source/WebKit/chromium/src/WebNotification.cpp (revision 88742)
+++ Source/WebKit/chromium/src/WebNotification.cpp (working copy)
@@ -116,29 +116,35 @@
void WebNotification::dispatchDisplayEvent()
{
- RefPtr<Event> event = Event::create("display", false, true);
- m_private->dispatchEvent(event.release());
+ dispatchEvent("display");
}
void WebNotification::dispatchErrorEvent(const WebKit::WebString& /* errorMessage */)
{
// FIXME: errorMessage not supported by WebCore yet
- RefPtr<Event> event = Event::create(eventNames().errorEvent, false, true);
- m_private->dispatchEvent(event.release());
+ dispatchEvent(eventNames().errorEvent);
}
void WebNotification::dispatchCloseEvent(bool /* byUser */)
{
// FIXME: byUser flag not supported by WebCore yet
- RefPtr<Event> event = Event::create(eventNames().closeEvent, false, true);
- m_private->dispatchEvent(event.release());
+ dispatchEvent(eventNames().closeEvent);
}
void WebNotification::dispatchClickEvent()
{
// Make sure clicks on notifications are treated as user gestures.
UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
- RefPtr<Event> event = Event::create(eventNames().clickEvent, false, true);
+ dispatchEvent(eventNames().clickEvent);
+}
+
+void WebNotification::dispatchEvent(const WTF::AtomicString& type)
+{
+ // Do not dispatch if the context is gone.
+ if (!m_private->scriptExecutionContext())
+ return;
+
+ RefPtr<Event> event = Event::create(type, false, true);
m_private->dispatchEvent(event.release());
}
« no previous file with comments | « Source/WebKit/chromium/public/WebNotification.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698