2011-02-05 Nate Chapin <japhet@chromium.org>
[WebKit.git] / Source / WebCore / notifications / NotificationCenter.cpp
index a2289ec5d05746c8f9069b6abd5ff6af5562416c..3d08055304ed197f83c2e0e4204b07dc5fc0956e 100644 (file)
@@ -42,21 +42,20 @@ namespace WebCore {
 
 NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationPresenter* presenter)
     : ActiveDOMObject(context, this)
 
 NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationPresenter* presenter)
     : ActiveDOMObject(context, this)
-    , m_scriptExecutionContext(context)
     , m_notificationPresenter(presenter) {}
 
 int NotificationCenter::checkPermission()
 {
     , m_notificationPresenter(presenter) {}
 
 int NotificationCenter::checkPermission()
 {
-    if (!presenter())
+    if (!presenter() || !scriptExecutionContext())
         return NotificationPresenter::PermissionDenied;
         return NotificationPresenter::PermissionDenied;
-    return m_notificationPresenter->checkPermission(m_scriptExecutionContext);
+    return m_notificationPresenter->checkPermission(scriptExecutionContext());
 }
 
 void NotificationCenter::requestPermission(PassRefPtr<VoidCallback> callback)
 {
 }
 
 void NotificationCenter::requestPermission(PassRefPtr<VoidCallback> callback)
 {
-    if (!presenter())
+    if (!presenter() || !scriptExecutionContext())
         return;
         return;
-    m_notificationPresenter->requestPermission(m_scriptExecutionContext, callback);
+    m_notificationPresenter->requestPermission(scriptExecutionContext(), callback);
 }
 
 void NotificationCenter::disconnectFrame()
 }
 
 void NotificationCenter::disconnectFrame()
@@ -66,9 +65,8 @@ void NotificationCenter::disconnectFrame()
     ASSERT(m_notificationPresenter);
     if (!m_notificationPresenter)
         return;
     ASSERT(m_notificationPresenter);
     if (!m_notificationPresenter)
         return;
-    m_notificationPresenter->cancelRequestsForPermission(m_scriptExecutionContext);
+    m_notificationPresenter->cancelRequestsForPermission(scriptExecutionContext());
     m_notificationPresenter = 0;
     m_notificationPresenter = 0;
-    m_scriptExecutionContext = 0;
 }
 
 } // namespace WebCore
 }
 
 } // namespace WebCore