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

Side by Side Diff: third_party/WebKit/Source/modules/notifications/NotificationData.cpp

Issue 2860873002: Notification API throws when serializing SharedArrayBuffer (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/notifications/NotificationData.h" 5 #include "modules/notifications/NotificationData.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/SerializedScriptValue.h" 8 #include "bindings/core/v8/SerializedScriptValue.h"
9 #include "bindings/core/v8/SerializedScriptValueFactory.h" 9 #include "bindings/core/v8/SerializedScriptValueFactory.h"
10 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 ? static_cast<double>(options.timestamp()) 79 ? static_cast<double>(options.timestamp())
80 : WTF::CurrentTimeMS(); 80 : WTF::CurrentTimeMS();
81 web_data.renotify = options.renotify(); 81 web_data.renotify = options.renotify();
82 web_data.silent = options.silent(); 82 web_data.silent = options.silent();
83 web_data.require_interaction = options.requireInteraction(); 83 web_data.require_interaction = options.requireInteraction();
84 84
85 if (options.hasData()) { 85 if (options.hasData()) {
86 const ScriptValue& data = options.data(); 86 const ScriptValue& data = options.data();
87 v8::Isolate* isolate = data.GetIsolate(); 87 v8::Isolate* isolate = data.GetIsolate();
88 DCHECK(isolate->InContext()); 88 DCHECK(isolate->InContext());
89 SerializedScriptValue::SerializeOptions options;
90 options.for_storage = true;
89 RefPtr<SerializedScriptValue> serialized_script_value = 91 RefPtr<SerializedScriptValue> serialized_script_value =
90 SerializedScriptValue::Serialize( 92 SerializedScriptValue::Serialize(isolate, data.V8Value(), options,
91 isolate, data.V8Value(), SerializedScriptValue::SerializeOptions(), 93 exception_state);
92 exception_state);
93 if (exception_state.HadException()) 94 if (exception_state.HadException())
94 return WebNotificationData(); 95 return WebNotificationData();
95 96
96 Vector<char> serialized_data; 97 Vector<char> serialized_data;
97 serialized_script_value->ToWireBytes(serialized_data); 98 serialized_script_value->ToWireBytes(serialized_data);
98 99
99 web_data.data = serialized_data; 100 web_data.data = serialized_data;
100 } 101 }
101 102
102 Vector<WebNotificationAction> actions; 103 Vector<WebNotificationAction> actions;
(...skipping 28 matching lines...) Expand all
131 132
132 actions.push_back(web_action); 133 actions.push_back(web_action);
133 } 134 }
134 135
135 web_data.actions = actions; 136 web_data.actions = actions;
136 137
137 return web_data; 138 return web_data;
138 } 139 }
139 140
140 } // namespace blink 141 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698