Title: [135007] branches/safari-536.28-branch

Diff

Modified: branches/safari-536.28-branch/Source/WebCore/ChangeLog (135006 => 135007)


--- branches/safari-536.28-branch/Source/WebCore/ChangeLog	2012-11-16 22:51:12 UTC (rev 135006)
+++ branches/safari-536.28-branch/Source/WebCore/ChangeLog	2012-11-16 23:02:52 UTC (rev 135007)
@@ -1,5 +1,24 @@
 2012-11-16  Lucas Forschler  <lforsch...@apple.com>
 
+        Merge r131280
+
+    2012-10-14  Jon Lee  <jon...@apple.com>
+
+            Allow notification origin permission request when no js callback is provided
+            https://bugs.webkit.org/show_bug.cgi?id=63615
+            <rdar://problem/11059590>
+
+            Reviewed by Sam Weinig.
+
+            Instead of throwing a type error when no callback is provided, we pass a null callback.
+
+            Test: http/tests/notifications/legacy/request-no-callback.html
+
+            * bindings/js/JSDesktopNotificationsCustom.cpp:
+            (WebCore::JSNotificationCenter::requestPermission):
+
+2012-11-16  Lucas Forschler  <lforsch...@apple.com>
+
         Merge r130565
 
     2012-10-05  Tim Horton  <timothy_hor...@apple.com>

Modified: branches/safari-536.28-branch/Source/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp (135006 => 135007)


--- branches/safari-536.28-branch/Source/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp	2012-11-16 22:51:12 UTC (rev 135006)
+++ branches/safari-536.28-branch/Source/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp	2012-11-16 23:02:52 UTC (rev 135007)
@@ -58,12 +58,14 @@
     if (context->isWorkerContext())
         return throwSyntaxError(exec);
 
-    if (!exec->argument(0).isObject())
-        return throwTypeError(exec);
-
-    PassRefPtr<JSCustomVoidCallback> callback = JSCustomVoidCallback::create(exec->argument(0).getObject(), toJSDOMGlobalObject(static_cast<Document*>(context), exec));
-
-    impl()->requestPermission(callback);
+    // If a callback function is provided as first argument, convert to a VoidCallback.
+    RefPtr<JSVoidCallback> callback;
+    if (exec->argument(0).isObject()) {
+        callback = JSVoidCallback::create(exec->argument(0).getObject(), toJSDOMGlobalObject(static_cast<Document*>(context), exec));
+        if (exec->hadException())
+            return jsUndefined();
+    }
+    impl()->requestPermission(callback.release());
     return jsUndefined();
 }
 

Modified: branches/safari-536.28-branch/Source/WebKit/mac/ChangeLog (135006 => 135007)


--- branches/safari-536.28-branch/Source/WebKit/mac/ChangeLog	2012-11-16 22:51:12 UTC (rev 135006)
+++ branches/safari-536.28-branch/Source/WebKit/mac/ChangeLog	2012-11-16 23:02:52 UTC (rev 135007)
@@ -1,5 +1,26 @@
 2012-11-16  Lucas Forschler  <lforsch...@apple.com>
 
+        Merge r131280
+
+    2012-10-14  Jon Lee  <jon...@apple.com>
+
+            Allow notification origin permission request when no js callback is provided
+            https://bugs.webkit.org/show_bug.cgi?id=63615
+            <rdar://problem/11059590>
+
+            Reviewed by Sam Weinig.
+
+            Introduce a boolean to determine whether the request was using the legacy or standard API. This way,
+            we do not fall through to calling the standard API's callback if the legacy API's callback is null.
+
+            * WebCoreSupport/WebNotificationClient.mm:
+            (WebCore):
+            (-[WebNotificationPolicyListener initWithVoidCallback:]):
+            (-[WebNotificationPolicyListener allow]):
+            (-[WebNotificationPolicyListener deny]):
+
+2012-11-16  Lucas Forschler  <lforsch...@apple.com>
+
         Merge r130565
 
     2012-10-05  Tim Horton  <timothy_hor...@apple.com>

Modified: branches/safari-536.28-branch/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm (135006 => 135007)


--- branches/safari-536.28-branch/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm	2012-11-16 22:51:12 UTC (rev 135006)
+++ branches/safari-536.28-branch/Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm	2012-11-16 23:02:52 UTC (rev 135007)
@@ -54,6 +54,7 @@
 #endif
 #if ENABLE(LEGACY_NOTIFICATIONS)
     RefPtr<VoidCallback> _voidCallback;
+    bool _isLegacyRequest;
 #endif
 }
 #if ENABLE(NOTIFICATIONS)
@@ -250,7 +251,7 @@
     if (!(self = [super init]))
         return nil;
 
-    ASSERT(callback);
+    _isLegacyRequest = true;
     _voidCallback = callback;
     return self;
 }
@@ -259,8 +260,9 @@
 - (void)allow
 {
 #if ENABLE(LEGACY_NOTIFICATIONS)
-    if (_voidCallback) {
-        _voidCallback->handleEvent();
+    if (_isLegacyRequest) {
+        if (_voidCallback)
+            _voidCallback->handleEvent();
         return;
     }
 #endif
@@ -272,8 +274,9 @@
 - (void)deny
 {
 #if ENABLE(LEGACY_NOTIFICATIONS)
-    if (_voidCallback) {
-        _voidCallback->handleEvent();
+    if (_isLegacyRequest) {
+        if (_voidCallback)
+            _voidCallback->handleEvent();
         return;
     }
 #endif

Modified: branches/safari-536.28-branch/Source/WebKit2/ChangeLog (135006 => 135007)


--- branches/safari-536.28-branch/Source/WebKit2/ChangeLog	2012-11-16 22:51:12 UTC (rev 135006)
+++ branches/safari-536.28-branch/Source/WebKit2/ChangeLog	2012-11-16 23:02:52 UTC (rev 135007)
@@ -1,5 +1,26 @@
 2012-11-16  Lucas Forschler  <lforsch...@apple.com>
 
+        Merge r131280
+
+    2012-10-14  Jon Lee  <jon...@apple.com>
+
+            Allow notification origin permission request when no js callback is provided
+            https://bugs.webkit.org/show_bug.cgi?id=63615
+            <rdar://problem/11059590>
+
+            Reviewed by Sam Weinig.
+
+            Null checks already exist for both standard and legacy API callbacks, so no changes are needed here
+            like there are in WebKit 1. The checks existed because the callbacks are held in a hash map used to keep
+            track of pending requests.
+
+            Also, add a check for a null callback when short circuiting.
+
+            * WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
+            (WebKit::NotificationPermissionRequestManager::startRequest):
+
+2012-11-16  Lucas Forschler  <lforsch...@apple.com>
+
         Merge r130565
 
     2012-10-05  Tim Horton  <timothy_hor...@apple.com>

Modified: branches/safari-536.28-branch/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp (135006 => 135007)


--- branches/safari-536.28-branch/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp	2012-11-16 22:51:12 UTC (rev 135006)
+++ branches/safari-536.28-branch/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp	2012-11-16 23:02:52 UTC (rev 135007)
@@ -81,7 +81,8 @@
 {
     NotificationClient::Permission permission = permissionLevel(origin);
     if (permission != NotificationClient::PermissionNotAllowed) {
-        callback->handleEvent();
+        if (callback)
+            callback->handleEvent();
         return;
     }
     

Modified: branches/safari-536.28-branch/Tools/ChangeLog (135006 => 135007)


--- branches/safari-536.28-branch/Tools/ChangeLog	2012-11-16 22:51:12 UTC (rev 135006)
+++ branches/safari-536.28-branch/Tools/ChangeLog	2012-11-16 23:02:52 UTC (rev 135007)
@@ -1,5 +1,27 @@
 2012-11-16  Lucas Forschler  <lforsch...@apple.com>
 
+    Merge r131280
+
+    2012-10-14  Jon Lee  <jon...@apple.com>
+
+            Allow notification origin permission request when no js callback is provided
+            https://bugs.webkit.org/show_bug.cgi?id=63615
+            <rdar://problem/11059590>
+
+            Reviewed by Sam Weinig.
+
+            Teach DRT to look at the existing entries in the permission hash map when permission is requested.
+
+            * DumpRenderTree/mac/MockWebNotificationProvider.h: Expose policyForOrigin.
+            * DumpRenderTree/mac/MockWebNotificationProvider.mm:
+            (-[MockWebNotificationProvider setWebNotificationOrigin:permission:]):
+            * DumpRenderTree/mac/UIDelegate.mm:
+            (-[UIDelegate webView:decidePolicyForNotificationRequestFromOrigin:listener:]): Look at whether a
+            policy for the origin already exists. If so, accept or deny the request as appropriate. Otherwise,
+            accept by default.
+
+2012-11-16  Lucas Forschler  <lforsch...@apple.com>
+
         Merge r128088
 
     2012-09-10  Brady Eidson  <beid...@apple.com>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to