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

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

Issue 2857303003: History API throws when serializing a SharedArrayBuffer (Closed)
Patch Set: use enum class instead of bool 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
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 89 SerializedScriptValue::SerializeOptions options;
90 options.for_storage = true; 90 options.for_storage = SerializedScriptValue::SerializeForStorage::kYes;
91 RefPtr<SerializedScriptValue> serialized_script_value = 91 RefPtr<SerializedScriptValue> serialized_script_value =
92 SerializedScriptValue::Serialize(isolate, data.V8Value(), options, 92 SerializedScriptValue::Serialize(isolate, data.V8Value(), options,
93 exception_state); 93 exception_state);
94 if (exception_state.HadException()) 94 if (exception_state.HadException())
95 return WebNotificationData(); 95 return WebNotificationData();
96 96
97 Vector<char> serialized_data; 97 Vector<char> serialized_data;
98 serialized_script_value->ToWireBytes(serialized_data); 98 serialized_script_value->ToWireBytes(serialized_data);
99 99
100 web_data.data = serialized_data; 100 web_data.data = serialized_data;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 actions.push_back(web_action); 133 actions.push_back(web_action);
134 } 134 }
135 135
136 web_data.actions = actions; 136 web_data.actions = actions;
137 137
138 return web_data; 138 return web_data;
139 } 139 }
140 140
141 } // namespace blink 141 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698