Changeset 128080 in webkit


Ignore:
Timestamp:
Sep 10, 2012 11:08:25 AM (12 years ago)
Author:
jonlee@apple.com
Message:

The options dictionary in Notification constructor should not accept event listeners
https://bugs.webkit.org/show_bug.cgi?id=95538
<rdar://problem/12213901>

Reviewed by Alexey Proskuryakov.

Source/WebCore:

The latest spec only allows setting the event listeners after the notification has been created.

Test: http/tests/notifications/events-in-dictionary.html

  • Modules/notifications/Notification.cpp:

(WebCore::Notification::create): Do not look for the event handlers in the options dictionary.

LayoutTests:

Make sure the onshow handler added in the options dictionary does not get called.

  • http/tests/notifications/events-in-dictionary-expected.txt: Added.
  • http/tests/notifications/events-in-dictionary.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r128079 r128080  
     12012-08-31  Jon Lee  <jonlee@apple.com>
     2
     3        The options dictionary in Notification constructor should not accept event listeners
     4        https://bugs.webkit.org/show_bug.cgi?id=95538
     5        <rdar://problem/12213901>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Make sure the onshow handler added in the options dictionary does not get called.
     10
     11        * http/tests/notifications/events-in-dictionary-expected.txt: Added.
     12        * http/tests/notifications/events-in-dictionary.html: Added.
     13
    1142012-08-31  Jon Lee  <jonlee@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r128078 r128080  
     12012-08-31  Jon Lee  <jonlee@apple.com>
     2
     3        The options dictionary in Notification constructor should not accept event listeners
     4        https://bugs.webkit.org/show_bug.cgi?id=95538
     5        <rdar://problem/12213901>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        The latest spec only allows setting the event listeners after the notification has been created.
     10
     11        Test: http/tests/notifications/events-in-dictionary.html
     12
     13        * Modules/notifications/Notification.cpp:
     14        (WebCore::Notification::create): Do not look for the event handlers in the options dictionary.
     15
    1162012-09-04  Robert Hogan  <robert@webkit.org>
    217
  • trunk/Source/WebCore/Modules/notifications/Notification.cpp

    r127062 r128080  
    139139
    140140#if ENABLE(NOTIFICATIONS)
    141 static void getAndAddEventListener(const AtomicString& eventName, const char* property, const Dictionary& options, Notification* notification)
    142 {
    143     RefPtr<EventListener> listener = options.getEventListener(property, notification);
    144     if (listener)
    145         notification->addEventListener(eventName, listener.release(), false);
    146 }
    147 
    148141PassRefPtr<Notification> Notification::create(ScriptExecutionContext* context, const String& title, const Dictionary& options)
    149142{
     
    154147    if (options.get("tag", argument))
    155148        notification->setTag(argument);
    156     getAndAddEventListener(eventNames().showEvent, "onshow", options, notification.get());
    157     getAndAddEventListener(eventNames().closeEvent, "onclose", options, notification.get());
    158     getAndAddEventListener(eventNames().errorEvent, "onerror", options, notification.get());
    159     getAndAddEventListener(eventNames().clickEvent, "onclick", options, notification.get());
    160149
    161150    notification->suspendIfNeeded();
Note: See TracChangeset for help on using the changeset viewer.