Changeset 135007 in webkit


Ignore:
Timestamp:
Nov 16, 2012, 3:02:52 PM (13 years ago)
Author:
Lucas Forschler
Message:

Merged r131280. <rdar://problem/12516340>

Location:
branches/safari-536.28-branch
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-536.28-branch/Source/WebCore/ChangeLog

    r135005 r135007  
     12012-11-16  Lucas Forschler  <lforschler@apple.com>
     2
     3        Merge r131280
     4
     5    2012-10-14  Jon Lee  <jonlee@apple.com>
     6
     7            Allow notification origin permission request when no js callback is provided
     8            https://bugs.webkit.org/show_bug.cgi?id=63615
     9            <rdar://problem/11059590>
     10
     11            Reviewed by Sam Weinig.
     12
     13            Instead of throwing a type error when no callback is provided, we pass a null callback.
     14
     15            Test: http/tests/notifications/legacy/request-no-callback.html
     16
     17            * bindings/js/JSDesktopNotificationsCustom.cpp:
     18            (WebCore::JSNotificationCenter::requestPermission):
     19
    1202012-11-16  Lucas Forschler  <lforschler@apple.com>
    221
  • branches/safari-536.28-branch/Source/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp

    r115943 r135007  
    5959        return throwSyntaxError(exec);
    6060
    61     if (!exec->argument(0).isObject())
    62         return throwTypeError(exec);
    63 
    64     PassRefPtr<JSCustomVoidCallback> callback = JSCustomVoidCallback::create(exec->argument(0).getObject(), toJSDOMGlobalObject(static_cast<Document*>(context), exec));
    65 
    66     impl()->requestPermission(callback);
     61    // If a callback function is provided as first argument, convert to a VoidCallback.
     62    RefPtr<JSVoidCallback> callback;
     63    if (exec->argument(0).isObject()) {
     64        callback = JSVoidCallback::create(exec->argument(0).getObject(), toJSDOMGlobalObject(static_cast<Document*>(context), exec));
     65        if (exec->hadException())
     66            return jsUndefined();
     67    }
     68    impl()->requestPermission(callback.release());
    6769    return jsUndefined();
    6870}
  • branches/safari-536.28-branch/Source/WebKit/mac/ChangeLog

    r135005 r135007  
     12012-11-16  Lucas Forschler  <lforschler@apple.com>
     2
     3        Merge r131280
     4
     5    2012-10-14  Jon Lee  <jonlee@apple.com>
     6
     7            Allow notification origin permission request when no js callback is provided
     8            https://bugs.webkit.org/show_bug.cgi?id=63615
     9            <rdar://problem/11059590>
     10
     11            Reviewed by Sam Weinig.
     12
     13            Introduce a boolean to determine whether the request was using the legacy or standard API. This way,
     14            we do not fall through to calling the standard API's callback if the legacy API's callback is null.
     15
     16            * WebCoreSupport/WebNotificationClient.mm:
     17            (WebCore):
     18            (-[WebNotificationPolicyListener initWithVoidCallback:]):
     19            (-[WebNotificationPolicyListener allow]):
     20            (-[WebNotificationPolicyListener deny]):
     21
    1222012-11-16  Lucas Forschler  <lforschler@apple.com>
    223
  • branches/safari-536.28-branch/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm

    r115943 r135007  
    5555#if ENABLE(LEGACY_NOTIFICATIONS)
    5656    RefPtr<VoidCallback> _voidCallback;
     57    bool _isLegacyRequest;
    5758#endif
    5859}
     
    251252        return nil;
    252253
    253     ASSERT(callback);
     254    _isLegacyRequest = true;
    254255    _voidCallback = callback;
    255256    return self;
     
    260261{
    261262#if ENABLE(LEGACY_NOTIFICATIONS)
    262     if (_voidCallback) {
    263         _voidCallback->handleEvent();
     263    if (_isLegacyRequest) {
     264        if (_voidCallback)
     265            _voidCallback->handleEvent();
    264266        return;
    265267    }
     
    273275{
    274276#if ENABLE(LEGACY_NOTIFICATIONS)
    275     if (_voidCallback) {
    276         _voidCallback->handleEvent();
     277    if (_isLegacyRequest) {
     278        if (_voidCallback)
     279            _voidCallback->handleEvent();
    277280        return;
    278281    }
  • branches/safari-536.28-branch/Source/WebKit2/ChangeLog

    r135005 r135007  
     12012-11-16  Lucas Forschler  <lforschler@apple.com>
     2
     3        Merge r131280
     4
     5    2012-10-14  Jon Lee  <jonlee@apple.com>
     6
     7            Allow notification origin permission request when no js callback is provided
     8            https://bugs.webkit.org/show_bug.cgi?id=63615
     9            <rdar://problem/11059590>
     10
     11            Reviewed by Sam Weinig.
     12
     13            Null checks already exist for both standard and legacy API callbacks, so no changes are needed here
     14            like there are in WebKit 1. The checks existed because the callbacks are held in a hash map used to keep
     15            track of pending requests.
     16
     17            Also, add a check for a null callback when short circuiting.
     18
     19            * WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
     20            (WebKit::NotificationPermissionRequestManager::startRequest):
     21
    1222012-11-16  Lucas Forschler  <lforschler@apple.com>
    223
  • branches/safari-536.28-branch/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp

    r134263 r135007  
    8282    NotificationClient::Permission permission = permissionLevel(origin);
    8383    if (permission != NotificationClient::PermissionNotAllowed) {
    84         callback->handleEvent();
     84        if (callback)
     85            callback->handleEvent();
    8586        return;
    8687    }
  • branches/safari-536.28-branch/Tools/ChangeLog

    r134991 r135007  
     12012-11-16  Lucas Forschler  <lforschler@apple.com>
     2
     3    Merge r131280
     4
     5    2012-10-14  Jon Lee  <jonlee@apple.com>
     6
     7            Allow notification origin permission request when no js callback is provided
     8            https://bugs.webkit.org/show_bug.cgi?id=63615
     9            <rdar://problem/11059590>
     10
     11            Reviewed by Sam Weinig.
     12
     13            Teach DRT to look at the existing entries in the permission hash map when permission is requested.
     14
     15            * DumpRenderTree/mac/MockWebNotificationProvider.h: Expose policyForOrigin.
     16            * DumpRenderTree/mac/MockWebNotificationProvider.mm:
     17            (-[MockWebNotificationProvider setWebNotificationOrigin:permission:]):
     18            * DumpRenderTree/mac/UIDelegate.mm:
     19            (-[UIDelegate webView:decidePolicyForNotificationRequestFromOrigin:listener:]): Look at whether a
     20            policy for the origin already exists. If so, accept or deny the request as appropriate. Otherwise,
     21            accept by default.
     22
    1232012-11-16  Lucas Forschler  <lforschler@apple.com>
    224
Note: See TracChangeset for help on using the changeset viewer.