Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Unified Diff: third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp

Issue 1636483002: Update the PushEvent to have a nullable PushMessageData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp b/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp
index f0842173fc71cdb32bcd0fcdc83ecbbb73922143..bb81a46588ee931a9cf652c06d367bbe43ba47f6 100644
--- a/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp
+++ b/third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp
@@ -18,6 +18,12 @@ namespace blink {
PushMessageData* PushMessageData::create(const String& messageString)
{
+ // The standard supports both an empty but valid message and a null message.
+ // In case the message is explicitly null, return a null pointer which will
+ // be set in the PushEvent.
+ if (messageString.isNull()) {
Peter Beverloo 2016/01/25 17:39:07 micro nit: no curly brackets here either
harkness 2016/01/26 12:07:20 Done.
+ return nullptr;
+ }
return PushMessageData::create(ArrayBufferOrArrayBufferViewOrUSVString::fromUSVString(messageString));
}

Powered by Google App Engine
This is Rietveld 408576698