Changeset 140927 in webkit


Ignore:
Timestamp:
Jan 27, 2013 2:58:30 AM (11 years ago)
Author:
jochen@chromium.org
Message:

Check notification permissions in the show() method
https://bugs.webkit.org/show_bug.cgi?id=108009

Reviewed by Adam Barth.

Source/WebCore:

Tests: fast/notifications/notifications-constructor-with-permission.html

fast/notifications/notifications-constructor-without-permission.html

  • Modules/notifications/Notification.cpp:

(WebCore::Notification::show):
(WebCore::Notification::taskTimerFired):

LayoutTests:

  • fast/notifications/notifications-constructor-with-permission-expected.txt: Added.
  • fast/notifications/notifications-constructor-with-permission.html: Added.
  • fast/notifications/notifications-constructor-without-permission-expected.txt: Added.
  • fast/notifications/notifications-constructor-without-permission.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140923 r140927  
     12013-01-27  Jochen Eisinger  <jochen@chromium.org>
     2
     3        Check notification permissions in the show() method
     4        https://bugs.webkit.org/show_bug.cgi?id=108009
     5
     6        Reviewed by Adam Barth.
     7
     8        * fast/notifications/notifications-constructor-with-permission-expected.txt: Added.
     9        * fast/notifications/notifications-constructor-with-permission.html: Added.
     10        * fast/notifications/notifications-constructor-without-permission-expected.txt: Added.
     11        * fast/notifications/notifications-constructor-without-permission.html: Added.
     12
    1132013-01-26  Sheriff Bot  <webkit.review.bot@gmail.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r140925 r140927  
     12013-01-27  Jochen Eisinger  <jochen@chromium.org>
     2
     3        Check notification permissions in the show() method
     4        https://bugs.webkit.org/show_bug.cgi?id=108009
     5
     6        Reviewed by Adam Barth.
     7
     8        Tests: fast/notifications/notifications-constructor-with-permission.html
     9               fast/notifications/notifications-constructor-without-permission.html
     10
     11        * Modules/notifications/Notification.cpp:
     12        (WebCore::Notification::show):
     13        (WebCore::Notification::taskTimerFired):
     14
    1152013-01-26  Tony Chang  <tony@chromium.org>
    216
  • trunk/Source/WebCore/Modules/notifications/Notification.cpp

    r128113 r140927  
    170170{
    171171    // prevent double-showing
    172     if (m_state == Idle && m_notificationCenter->client() && m_notificationCenter->client()->show(this)) {
    173         m_state = Showing;
    174         setPendingActivity(this);
     172    if (m_state == Idle && m_notificationCenter->client()) {
     173#if ENABLE(NOTIFICATIONS)
     174        if (!static_cast<Document*>(scriptExecutionContext())->page())
     175            return;
     176        if (NotificationController::from(static_cast<Document*>(scriptExecutionContext())->page())->client()->checkPermission(scriptExecutionContext()) != NotificationClient::PermissionAllowed) {
     177            dispatchErrorEvent();
     178            return;
     179        }
     180#endif
     181        if (m_notificationCenter->client()->show(this)) {
     182            m_state = Showing;
     183            setPendingActivity(this);
     184        }
    175185    }
    176186}
     
    241251{
    242252    ASSERT(scriptExecutionContext()->isDocument());
    243     ASSERT(static_cast<Document*>(scriptExecutionContext())->page());
    244253    ASSERT_UNUSED(timer, timer == m_taskTimer.get());
    245     if (NotificationController::from(static_cast<Document*>(scriptExecutionContext())->page())->client()->checkPermission(scriptExecutionContext()) != NotificationClient::PermissionAllowed) {
    246         dispatchErrorEvent();
    247         return;
    248     }
    249254    show();
    250255}
Note: See TracChangeset for help on using the changeset viewer.