Changeset 128113 in webkit


Ignore:
Timestamp:
Sep 10, 2012 3:12:52 PM (12 years ago)
Author:
jonlee@apple.com
Message:

Source/WebCore: Update notifications to latest spec
https://bugs.webkit.org/show_bug.cgi?id=91726
<rdar://problem/11910451>

Reviewed by Alexey Proskuryakov.

Among the changes:

Addition of lang attribute
http://lists.w3.org/Archives/Public/public-web-notification/2012Jul/0025.html

Specification of icon URL is icon instead of iconURL
http://lists.w3.org/Archives/Public/public-web-notification/2012Jul/0012.html

Tests are not possible since at best they only verify exposure of the attributes, which isn't
terribly useful, and use of the attributes depend on the platform.

  • Modules/notifications/Notification.cpp:

(WebCore::Notification::create): Add support for reading lang, dir, and icon from option dictionary.

  • Modules/notifications/Notification.h:

(Notification): Make url() and setURL(), which are used for HTML notifications, only available with
ENABLE(LEGACY_NOTIFICATIONS).
(WebCore::Notification::setIconURL): Added so that it can be set from the option dictionary.
(WebCore::Notification::lang):
(WebCore::Notification::setLang):

  • Modules/notifications/Notification.idl: According to specification, dir is not exposed.

Source/WebKit/mac: Update notifications to latest spec
https://bugs.webkit.org/show_bug.cgi?id=91726
<rdar://problem/11910451>

Reviewed by Alexey Proskuryakov.

Expose lang and dir.

  • WebView/WebNotification.h:
  • WebView/WebNotification.mm:

(-[WebNotification lang]):
(-[WebNotification dir]):

Source/WebKit2: Update notifications to latest spec
https://bugs.webkit.org/show_bug.cgi?id=91726
<rdar://problem/11910451>

Reviewed by Alexey Proskuryakov.

Expose lang and dir.

  • UIProcess/API/C/WKNotification.cpp:

(WKNotificationCopyLang):
(WKNotificationCopyDir):

  • UIProcess/API/C/WKNotification.h:
  • UIProcess/Notifications/WebNotification.cpp:

(WebKit::WebNotification::WebNotification):

  • UIProcess/Notifications/WebNotification.h:

(WebKit::WebNotification::create):
(WebKit::WebNotification::lang):
(WebKit::WebNotification::dir):
(WebNotification):

  • UIProcess/Notifications/WebNotificationManagerProxy.cpp:

(WebKit::WebNotificationManagerProxy::show):

  • UIProcess/Notifications/WebNotificationManagerProxy.h:

(WebNotificationManagerProxy):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::showNotification):

  • UIProcess/WebPageProxy.h:

(WebPageProxy):

  • UIProcess/WebPageProxy.messages.in:
  • WebProcess/Notifications/WebNotificationManager.cpp:

(WebKit::WebNotificationManager::show):

LayoutTests: 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.

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:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r128111 r128113  
     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-09-10  Geoffrey Garen  <ggaren@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r128110 r128113  
     12012-09-07  Jon Lee  <jonlee@apple.com>
     2
     3        Update notifications to latest spec
     4        https://bugs.webkit.org/show_bug.cgi?id=91726
     5        <rdar://problem/11910451>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Among the changes:
     10
     11        Addition of lang attribute
     12        http://lists.w3.org/Archives/Public/public-web-notification/2012Jul/0025.html
     13
     14        Specification of icon URL is icon instead of iconURL
     15        http://lists.w3.org/Archives/Public/public-web-notification/2012Jul/0012.html
     16
     17        Tests are not possible since at best they only verify exposure of the attributes, which isn't
     18        terribly useful, and use of the attributes depend on the platform.
     19
     20        * Modules/notifications/Notification.cpp:
     21        (WebCore::Notification::create): Add support for reading lang, dir, and icon from option dictionary.
     22        * Modules/notifications/Notification.h:
     23        (Notification): Make url() and setURL(), which are used for HTML notifications, only available with
     24        ENABLE(LEGACY_NOTIFICATIONS).
     25        (WebCore::Notification::setIconURL): Added so that it can be set from the option dictionary.
     26        (WebCore::Notification::lang):
     27        (WebCore::Notification::setLang):
     28        * Modules/notifications/Notification.idl: According to specification, dir is not exposed.
     29
     302012-08-31  Jon Lee  <jonlee@apple.com>
     31
     32        The options dictionary in Notification constructor should not accept event listeners
     33        https://bugs.webkit.org/show_bug.cgi?id=95538
     34        <rdar://problem/12213901>
     35
     36        Reviewed by Alexey Proskuryakov.
     37
     38        The latest spec only allows setting the event listeners after the notification has been created.
     39
     40        Test: http/tests/notifications/events-in-dictionary.html
     41
     42        * Modules/notifications/Notification.cpp:
     43        (WebCore::Notification::create): Do not look for the event handlers in the options dictionary.
     44
    1452012-09-10  Tony Chang  <tony@chromium.org>
    246
  • trunk/Source/WebCore/Modules/notifications/Notification.cpp

    r128080 r128113  
    147147    if (options.get("tag", argument))
    148148        notification->setTag(argument);
     149    if (options.get("lang", argument))
     150        notification->setLang(argument);
     151    if (options.get("dir", argument))
     152        notification->setDir(argument);
     153    if (options.get("icon", argument)) {
     154        KURL iconURI = argument.isEmpty() ? KURL() : context->completeURL(argument);
     155        if (!iconURI.isEmpty() && iconURI.isValid())
     156            notification->setIconURL(iconURI);
     157    }
    149158
    150159    notification->suspendIfNeeded();
  • trunk/Source/WebCore/Modules/notifications/Notification.h

    r127321 r128113  
    8787    void setHTML(bool isHTML) { m_isHTML = isHTML; }
    8888   
     89#if ENABLE(LEGACY_NOTIFICATIONS)
    8990    KURL url() const { return m_notificationURL; }
    9091    void setURL(KURL url) { m_notificationURL = url; }
    91    
     92#endif
     93
    9294    KURL iconURL() const { return m_icon; }
     95    void setIconURL(const KURL& url) { m_icon = url; }
    9396
    9497    String title() const { return m_title; }
    9598    String body() const { return m_body; }
     99
     100    String lang() const { return m_lang; }
     101    void setLang(const String& lang) { m_lang = lang; }
    96102
    97103    String dir() const { return m_direction; }
     
    175181    String m_title;
    176182    String m_body;
    177     // FIXME: Deprecate HTML Notifications.
     183#if ENABLE(LEGACY_NOTIFICATIONS)
    178184    KURL m_notificationURL;
     185#endif
    179186
    180187    String m_direction;
     188    String m_lang;
    181189    String m_tag;
    182190
  • trunk/Source/WebCore/Modules/notifications/Notification.idl

    r125280 r128113  
    6565        attribute EventListener onclick;
    6666
     67#if defined(ENABLE_LEGACY_NOTIFICATIONS) && ENABLE_LEGACY_NOTIFICATIONS
    6768        attribute DOMString dir;
    68 #if defined(ENABLE_LEGACY_NOTIFICATIONS) && ENABLE_LEGACY_NOTIFICATIONS
    6969        attribute DOMString replaceId;
    7070#endif
  • trunk/Source/WebKit/mac/ChangeLog

    r128112 r128113  
     12012-09-07  Jon Lee  <jonlee@apple.com>
     2
     3        Update notifications to latest spec
     4        https://bugs.webkit.org/show_bug.cgi?id=91726
     5        <rdar://problem/11910451>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Expose lang and dir.
     10
     11        * WebView/WebNotification.h:
     12        * WebView/WebNotification.mm:
     13        (-[WebNotification lang]):
     14        (-[WebNotification dir]):
     15
    1162012-09-10  Jer Noble  <jer.noble@apple.com>
    217
  • trunk/Source/WebKit/mac/WebView/WebNotification.h

    r127009 r128113  
    3939- (NSString *)tag;
    4040- (NSString *)iconURL;
     41- (NSString *)lang;
     42- (NSString *)dir;
    4143- (WebSecurityOrigin *)origin;
    4244- (uint64_t)notificationID;
  • trunk/Source/WebKit/mac/WebView/WebNotification.mm

    r127009 r128113  
    118118}
    119119
     120- (NSString *)lang
     121{
     122#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     123    return core(self)->lang();
     124#else
     125    return nil;
     126#endif
     127}
     128
     129- (NSString *)dir
     130{
     131#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
     132    return core(self)->dir();
     133#else
     134    return nil;
     135#endif
     136}
     137
    120138- (WebSecurityOrigin *)origin
    121139{
  • trunk/Source/WebKit2/ChangeLog

    r128103 r128113  
     12012-09-07  Jon Lee  <jonlee@apple.com>
     2
     3        Update notifications to latest spec
     4        https://bugs.webkit.org/show_bug.cgi?id=91726
     5        <rdar://problem/11910451>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Expose lang and dir.
     10
     11        * UIProcess/API/C/WKNotification.cpp:
     12        (WKNotificationCopyLang):
     13        (WKNotificationCopyDir):
     14        * UIProcess/API/C/WKNotification.h:
     15        * UIProcess/Notifications/WebNotification.cpp:
     16        (WebKit::WebNotification::WebNotification):
     17        * UIProcess/Notifications/WebNotification.h:
     18        (WebKit::WebNotification::create):
     19        (WebKit::WebNotification::lang):
     20        (WebKit::WebNotification::dir):
     21        (WebNotification):
     22        * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
     23        (WebKit::WebNotificationManagerProxy::show):
     24        * UIProcess/Notifications/WebNotificationManagerProxy.h:
     25        (WebNotificationManagerProxy):
     26        * UIProcess/WebPageProxy.cpp:
     27        (WebKit::WebPageProxy::showNotification):
     28        * UIProcess/WebPageProxy.h:
     29        (WebPageProxy):
     30        * UIProcess/WebPageProxy.messages.in:
     31        * WebProcess/Notifications/WebNotificationManager.cpp:
     32        (WebKit::WebNotificationManager::show):
     33
    1342012-09-10  Alexey Proskuryakov  <ap@apple.com>
    235
  • trunk/Source/WebKit2/UIProcess/API/C/WKNotification.cpp

    r112821 r128113  
    5858}
    5959
     60WKStringRef WKNotificationCopyLang(WKNotificationRef notification)
     61{
     62    return toCopiedAPI(toImpl(notification)->lang());
     63}
     64
     65WKStringRef WKNotificationCopyDir(WKNotificationRef notification)
     66{
     67    return toCopiedAPI(toImpl(notification)->dir());
     68}
     69
    6070WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification)
    6171{
  • trunk/Source/WebKit2/UIProcess/API/C/WKNotification.h

    r112821 r128113  
    3939WK_EXPORT WKStringRef WKNotificationCopyIconURL(WKNotificationRef notification);
    4040WK_EXPORT WKStringRef WKNotificationCopyTag(WKNotificationRef notification);
     41WK_EXPORT WKStringRef WKNotificationCopyLang(WKNotificationRef notification);
     42WK_EXPORT WKStringRef WKNotificationCopyDir(WKNotificationRef notification);
    4143WK_EXPORT WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification);
    4244WK_EXPORT uint64_t WKNotificationGetID(WKNotificationRef notification);
  • trunk/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp

    r112821 r128113  
    3434namespace WebKit {
    3535
    36 WebNotification::WebNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& originString, uint64_t notificationID)
     36WebNotification::WebNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, const String& dir, const String& originString, uint64_t notificationID)
    3737    : m_title(title)
    3838    , m_body(body)
    3939    , m_iconURL(iconURL)
    4040    , m_tag(tag)
     41    , m_lang(lang)
     42    , m_dir(dir)
    4143    , m_origin(WebSecurityOrigin::createFromString(originString))
    4244    , m_notificationID(notificationID)
  • trunk/Source/WebKit2/UIProcess/Notifications/WebNotification.h

    r112821 r128113  
    4646    static const Type APIType = TypeNotification;
    4747   
    48     static PassRefPtr<WebNotification> create(const String& title, const String& body, const String& iconURL, const String& tag, const String& originString, uint64_t notificationID)
     48    static PassRefPtr<WebNotification> create(const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, const String& dir, const String& originString, uint64_t notificationID)
    4949    {
    50         return adoptRef(new WebNotification(title, body, iconURL, tag, originString, notificationID));
     50        return adoptRef(new WebNotification(title, body, iconURL, tag, lang, dir, originString, notificationID));
    5151    }
    5252   
     
    5555    const String& iconURL() const { return m_iconURL; }
    5656    const String& tag() const { return m_tag; }
     57    const String& lang() const { return m_lang; }
     58    const String& dir() const { return m_dir; }
    5759    WebSecurityOrigin* origin() const { return m_origin.get(); }
    5860   
     
    6062
    6163private:
    62     WebNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& originString, uint64_t notificationID);
     64    WebNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, const String& dir, const String& originString, uint64_t notificationID);
    6365
    6466    virtual Type type() const { return APIType; }
     
    6870    String m_iconURL;
    6971    String m_tag;
     72    String m_lang;
     73    String m_dir;
    7074    RefPtr<WebSecurityOrigin> m_origin;
    7175    uint64_t m_notificationID;
  • trunk/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp

    r112821 r128113  
    7777}
    7878
    79 void WebNotificationManagerProxy::show(WebPageProxy* page, const String& title, const String& body, const String& iconURL, const String& tag, const String& originString, uint64_t notificationID)
     79void WebNotificationManagerProxy::show(WebPageProxy* page, const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, const String& dir, const String& originString, uint64_t notificationID)
    8080{
    8181    if (!isNotificationIDValid(notificationID))
    8282        return;
    8383   
    84     RefPtr<WebNotification> notification = WebNotification::create(title, body, iconURL, tag, originString, notificationID);
     84    RefPtr<WebNotification> notification = WebNotification::create(title, body, iconURL, tag, lang, dir, originString, notificationID);
    8585    m_notifications.set(notificationID, notification);
    8686    m_provider.show(page, notification.get());
  • trunk/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h

    r112821 r128113  
    6161    void populateCopyOfNotificationPermissions(HashMap<String, bool>&);
    6262
    63     void show(WebPageProxy*, const String& title, const String& body, const String& iconURL, const String& tag, const String& originString, uint64_t notificationID);
     63    void show(WebPageProxy*, const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, const String& dir, const String& originString, uint64_t notificationID);
    6464
    6565    void providerDidShowNotification(uint64_t notificationID);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r127988 r128113  
    37173717}
    37183718
    3719 void WebPageProxy::showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& originString, uint64_t notificationID)
    3720 {
    3721     m_process->context()->notificationManagerProxy()->show(this, title, body, iconURL, tag, originString, notificationID);
     3719void WebPageProxy::showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, const String& dir, const String& originString, uint64_t notificationID)
     3720{
     3721    m_process->context()->notificationManagerProxy()->show(this, title, body, iconURL, tag, lang, dir, originString, notificationID);
    37223722}
    37233723
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r127988 r128113  
    831831
    832832    void requestNotificationPermission(uint64_t notificationID, const String& originString);
    833     void showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& originString, uint64_t notificationID);
     833    void showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, const String& dir, const String& originString, uint64_t notificationID);
    834834   
    835835#if USE(TILED_BACKING_STORE)
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r127988 r128113  
    233233    # Notification messages
    234234    RequestNotificationPermission(uint64_t requestID, WTF::String originIdentifier)
    235     ShowNotification(WTF::String title, WTF::String body, WTF::String iconURL, WTF::String tag, WTF::String originIdentifier, uint64_t notificationID)
     235    ShowNotification(WTF::String title, WTF::String body, WTF::String iconURL, WTF::String tag, WTF::String lang, WTF::String dir, WTF::String originIdentifier, uint64_t notificationID)
    236236
    237237    # Spelling and grammar messages
  • trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp

    r127019 r128113  
    138138
    139139#if ENABLE(NOTIFICATIONS)
    140     m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->title(), notification->body(), notification->iconURL().string(), notification->tag(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
     140    m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->title(), notification->body(), notification->iconURL().string(), notification->tag(), notification->lang(), notification->dir(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
    141141#else
    142     m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->title(), notification->body(), notification->iconURL().string(), notification->replaceId(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
     142    m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->title(), notification->body(), notification->iconURL().string(), notification->replaceId(), notification->lang(), notification->dir(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
    143143#endif
    144144    return true;
Note: See TracChangeset for help on using the changeset viewer.