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

Side by Side Diff: Source/bindings/templates/dictionary_v8.cpp

Issue 568703002: IDL: Values for dictionaries should be a object, null or undefined (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove assertion and added a guard Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "{{v8_class}}.h" 8 #include "{{v8_class}}.h"
9 9
10 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} 10 {% for filename in cpp_includes if filename != '%s.h' % v8_class %}
11 #include "{{filename}}" 11 #include "{{filename}}"
12 {% endfor %} 12 {% endfor %}
13 13
14 namespace blink { 14 namespace blink {
15 15
16 {{cpp_class}}* {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, ExceptionState& exceptionState) 16 {{cpp_class}}* {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, ExceptionState& exceptionState)
17 { 17 {
18 if (!isUndefinedOrNull(v8Value) && !v8Value->IsObject()) {
19 // Just returns 0. A TypeError will be thrown later.
20 return 0;
21 }
22
18 {{cpp_class}}* impl = {{cpp_class}}::create(); 23 {{cpp_class}}* impl = {{cpp_class}}::create();
19 // FIXME: Do not use Dictionary and DictionaryHelper 24 // FIXME: Do not use Dictionary and DictionaryHelper
20 // https://crbug.com/321462 25 // https://crbug.com/321462
21 Dictionary dictionary(v8Value, isolate); 26 Dictionary dictionary(v8Value, isolate);
22 // FIXME: Remove this v8::TryCatch once the code is switched from 27 // FIXME: Remove this v8::TryCatch once the code is switched from
23 // Dictionary/DictionaryHelper to something that uses ExceptionState. 28 // Dictionary/DictionaryHelper to something that uses ExceptionState.
24 v8::TryCatch block; 29 v8::TryCatch block;
25 {% for member in members %} 30 {% for member in members %}
26 {{member.cpp_type}} {{member.name}}; 31 {{member.cpp_type}} {{member.name}};
27 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "{{member.name }}", {{member.name}})) { 32 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "{{member.name }}", {{member.name}})) {
(...skipping 21 matching lines...) Expand all
49 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value_t o_v8_value}}); 54 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value_t o_v8_value}});
50 {% if member.v8_default_value %} 55 {% if member.v8_default_value %}
51 else 56 else
52 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.v8_default_ value}}); 57 v8Object->Set(v8String(isolate, "{{member.name}}"), {{member.v8_default_ value}});
53 {% endif %} 58 {% endif %}
54 {% endfor %} 59 {% endfor %}
55 return v8Object; 60 return v8Object;
56 } 61 }
57 62
58 } // namespace blink 63 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698