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

Unified Diff: Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp

Issue 993893002: Add the data attribute to the Notification object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: [WIP] modified wrong comment. Created 5 years, 9 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: Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
diff --git a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
index eaf56e840d7437aab3a97453af1835a9dce4f7e9..532642362999293e8ede385263ec4c039aef7c35 100644
--- a/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
+++ b/Source/modules/notifications/ServiceWorkerRegistrationNotifications.cpp
@@ -7,6 +7,9 @@
#include "bindings/core/v8/CallbackPromiseAdapter.h"
#include "bindings/core/v8/ScriptPromiseResolver.h"
+#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/SerializedScriptValue.h"
+#include "bindings/core/v8/SerializedScriptValueFactory.h"
#include "bindings/core/v8/V8ThrowException.h"
#include "core/dom/DOMException.h"
#include "core/dom/ExceptionCode.h"
@@ -21,7 +24,7 @@
namespace blink {
-ScriptPromise ServiceWorkerRegistrationNotifications::showNotification(ScriptState* scriptState, ServiceWorkerRegistration& serviceWorkerRegistration, const String& title, const NotificationOptions& options)
+ScriptPromise ServiceWorkerRegistrationNotifications::showNotification(ScriptState* scriptState, ServiceWorkerRegistration& serviceWorkerRegistration, const String& title, const NotificationOptions& options, ExceptionState& exceptionState)
{
ExecutionContext* executionContext = scriptState->executionContext();
@@ -46,7 +49,14 @@ ScriptPromise ServiceWorkerRegistrationNotifications::showNotification(ScriptSta
}
WebNotificationData::Direction dir = options.dir() == "rtl" ? WebNotificationData::DirectionRightToLeft : WebNotificationData::DirectionLeftToRight;
- WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, options.silent());
+
Peter Beverloo 2015/03/10 23:34:27 Mmm this duplication is not great. It happens in m
Sanghyun Park 2015/03/11 10:59:52 I cannot understand your comment properly. Is you
+ RefPtr<SerializedScriptValue> data;
+ if (options.hasData()) {
+ data = SerializedScriptValueFactory::instance().create(options.data(), 0, exceptionState, options.data().isolate());
Peter Beverloo 2015/03/10 23:34:27 nit: dito as in Notification.cpp, if exceptionStat
Sanghyun Park 2015/03/11 10:59:52 I'll fix this.
+ data->registerMemoryAllocatedWithCurrentScriptContext();
Peter Beverloo 2015/03/10 23:34:27 nit: dito as in Notification.cpp, we shouldn't hav
Sanghyun Park 2015/03/11 10:59:52 Ditto
+ }
+
+ WebNotificationData notification(title, dir, options.lang(), options.body(), options.tag(), iconUrl, options.silent(), data.release());
Peter Beverloo 2015/03/10 23:34:27 note: data.release() is fine here, because we won'
WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, void>(resolver);
SecurityOrigin* origin = executionContext->securityOrigin();

Powered by Google App Engine
This is Rietveld 408576698