summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-document-actions-throw.html34
-rw-r--r--third_party/WebKit/Source/modules/notifications/NotificationData.cpp12
-rw-r--r--third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp37
3 files changed, 1 insertions, 82 deletions
diff --git a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-document-actions-throw.html b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-document-actions-throw.html
index 813d649..5110ca7 100644
--- a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-document-actions-throw.html
+++ b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-document-actions-throw.html
@@ -48,40 +48,6 @@
}).catch(unreached_rejection(test));
}, 'showNotification() must reject if a NotificationAction has no title.');
-
- async_test(function(test) {
- var scope = 'resources/scope/' + location.pathname + "/emptyaction";
-
- getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(workerInfo) {
- assert_inherits(workerInfo.registration, 'showNotification', 'showNotification() must be exposed.');
-
- workerInfo.registration.showNotification('Title', {
- actions: [{ action: "", title: "Foo" }]
- }).then(unreached_fulfillment(test)).catch(function(error) {
- assert_equals(error.name, 'TypeError');
- assert_equals(error.message, "Failed to execute 'showNotification' on 'ServiceWorkerRegistration': NotificationAction `action` must not be empty.");
- test.done();
- });
- }).catch(unreached_rejection(test));
-
- }, 'showNotification() must reject if a NotificationAction has an empty action.');
-
- async_test(function(test) {
- var scope = 'resources/scope/' + location.pathname + "/emptytitle";
-
- getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(workerInfo) {
- assert_inherits(workerInfo.registration, 'showNotification', 'showNotification() must be exposed.');
-
- workerInfo.registration.showNotification('Title', {
- actions: [{ action: "foo", title: "" }]
- }).then(unreached_fulfillment(test)).catch(function(error) {
- assert_equals(error.name, 'TypeError');
- assert_equals(error.message, "Failed to execute 'showNotification' on 'ServiceWorkerRegistration': NotificationAction `title` must not be empty.");
- test.done();
- });
- }).catch(unreached_rejection(test));
-
- }, 'showNotification() must reject if a NotificationAction has an empty title.');
</script>
</body>
</html>
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationData.cpp b/third_party/WebKit/Source/modules/notifications/NotificationData.cpp
index 4052706..d7ce4f0 100644
--- a/third_party/WebKit/Source/modules/notifications/NotificationData.cpp
+++ b/third_party/WebKit/Source/modules/notifications/NotificationData.cpp
@@ -75,18 +75,8 @@ WebNotificationData createWebNotificationData(ExecutionContext* executionContext
const size_t maxActions = Notification::maxActions();
for (const NotificationAction& action : options.actions()) {
- if (action.action().isEmpty()) {
- exceptionState.throwTypeError("NotificationAction `action` must not be empty.");
- return WebNotificationData();
- }
-
- if (action.title().isEmpty()) {
- exceptionState.throwTypeError("NotificationAction `title` must not be empty.");
- return WebNotificationData();
- }
-
if (actions.size() >= maxActions)
- continue;
+ break;
WebNotificationAction webAction;
webAction.action = action.action();
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
index d446cee..e385bba 100644
--- a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
+++ b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
@@ -179,43 +179,6 @@ TEST_F(NotificationDataTest, DirectionValues)
}
}
-TEST_F(NotificationDataTest, RequiredActionProperties)
-{
- NotificationOptions options;
-
- // The NotificationAction.action property is required.
- {
- NotificationAction action;
- action.setTitle(kNotificationActionTitle);
-
- HeapVector<NotificationAction> actions;
- actions.append(action);
-
- options.setActions(actions);
-
- TrackExceptionState exceptionState;
- WebNotificationData notificationData = createWebNotificationData(executionContext(), kNotificationTitle, options, exceptionState);
- ASSERT_TRUE(exceptionState.hadException());
- EXPECT_EQ("NotificationAction `action` must not be empty.", exceptionState.message());
- }
-
- // The NotificationAction.title property is required.
- {
- NotificationAction action;
- action.setAction(kNotificationActionAction);
-
- HeapVector<NotificationAction> actions;
- actions.append(action);
-
- options.setActions(actions);
-
- TrackExceptionState exceptionState;
- WebNotificationData notificationData = createWebNotificationData(executionContext(), kNotificationTitle, options, exceptionState);
- ASSERT_TRUE(exceptionState.hadException());
- EXPECT_EQ("NotificationAction `title` must not be empty.", exceptionState.message());
- }
-}
-
TEST_F(NotificationDataTest, MaximumActionCount)
{
HeapVector<NotificationAction> actions;