| Index: Source/modules/notifications/Notification.cpp
|
| diff --git a/Source/modules/notifications/Notification.cpp b/Source/modules/notifications/Notification.cpp
|
| index 1ae79f16e69b4af63edbbd9a5138601a727f6436..89fe61c4ffa0bb89b62a3e2a24cea916ee94f0f0 100644
|
| --- a/Source/modules/notifications/Notification.cpp
|
| +++ b/Source/modules/notifications/Notification.cpp
|
| @@ -31,7 +31,11 @@
|
| #include "config.h"
|
| #include "modules/notifications/Notification.h"
|
|
|
| +#include "bindings/core/v8/ExceptionState.h"
|
| +#include "bindings/core/v8/ScriptState.h"
|
| +#include "bindings/core/v8/ScriptValue.h"
|
| #include "bindings/core/v8/ScriptWrappable.h"
|
| +#include "bindings/core/v8/SerializedScriptValueFactory.h"
|
| #include "core/dom/Document.h"
|
| #include "core/dom/ExecutionContext.h"
|
| #include "core/dom/ExecutionContextTask.h"
|
| @@ -72,6 +76,13 @@ Notification* Notification::create(ExecutionContext* context, const String& titl
|
| return nullptr;
|
| }
|
|
|
| + RefPtr<SerializedScriptValue> data;
|
| + if (options.hasData()) {
|
| + data = SerializedScriptValueFactory::instance().create(options.data(), nullptr, exceptionState, options.data().isolate());
|
| + if (exceptionState.hadException())
|
| + return nullptr;
|
| + }
|
| +
|
| Notification* notification = new Notification(title, context);
|
|
|
| notification->setBody(options.body());
|
| @@ -79,6 +90,7 @@ Notification* Notification::create(ExecutionContext* context, const String& titl
|
| notification->setLang(options.lang());
|
| notification->setDir(options.dir());
|
| notification->setSilent(options.silent());
|
| + notification->setSerializedData(data.release());
|
| if (options.hasIcon()) {
|
| KURL iconUrl = options.icon().isEmpty() ? KURL() : context->completeURL(options.icon());
|
| if (!iconUrl.isEmpty() && iconUrl.isValid())
|
| @@ -272,6 +284,14 @@ bool Notification::hasPendingActivity() const
|
| return m_state == NotificationStateShowing || m_asyncRunner.isActive();
|
| }
|
|
|
| +ScriptValue Notification::data(ScriptState* scriptState) const
|
| +{
|
| + if (!m_serializedData)
|
| + return ScriptValue::createNull(scriptState);
|
| +
|
| + return ScriptValue(scriptState, m_serializedData->deserialize(scriptState->isolate()));
|
| +}
|
| +
|
| DEFINE_TRACE(Notification)
|
| {
|
| RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(visitor);
|
|
|