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

Side by Side Diff: Source/bindings/scripts/v8_types.py

Issue 1047993002: bindings: Add validation for enum Sequence or Array (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value}) ', 492 'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value}) ',
493 'SerializedScriptValue': 'SerializedScriptValueFactory::instance().create({v 8_value}, 0, 0, exceptionState, {isolate})', 493 'SerializedScriptValue': 'SerializedScriptValueFactory::instance().create({v 8_value}, 0, 0, exceptionState, {isolate})',
494 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', 494 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})',
495 'Window': 'toDOMWindow({isolate}, {v8_value})', 495 'Window': 'toDOMWindow({isolate}, {v8_value})',
496 'XPathNSResolver': 'toXPathNSResolver({isolate}, {v8_value})', 496 'XPathNSResolver': 'toXPathNSResolver({isolate}, {v8_value})',
497 } 497 }
498 498
499 499
500 def v8_conversion_needs_exception_state(idl_type): 500 def v8_conversion_needs_exception_state(idl_type):
501 return (idl_type.is_numeric_type or 501 return (idl_type.is_numeric_type or
502 idl_type.is_enum or
502 idl_type.is_dictionary or 503 idl_type.is_dictionary or
503 idl_type.name in ('ByteString', 'Dictionary', 'USVString', 'Serializ edScriptValue')) 504 idl_type.name in ('ByteString', 'Dictionary', 'USVString', 'Serializ edScriptValue'))
504 505
505 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep tion_state) 506 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep tion_state)
506 IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True 507 IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True
507 IdlUnionType.v8_conversion_needs_exception_state = True 508 IdlUnionType.v8_conversion_needs_exception_state = True
508 509
509 510
510 TRIVIAL_CONVERSIONS = frozenset([ 511 TRIVIAL_CONVERSIONS = frozenset([
511 'any', 512 'any',
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 number_of_nullable_member_types_union) 970 number_of_nullable_member_types_union)
970 971
971 972
972 def includes_nullable_type_union(idl_type): 973 def includes_nullable_type_union(idl_type):
973 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type 974 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type
974 return idl_type.number_of_nullable_member_types == 1 975 return idl_type.number_of_nullable_member_types == 1
975 976
976 IdlTypeBase.includes_nullable_type = False 977 IdlTypeBase.includes_nullable_type = False
977 IdlNullableType.includes_nullable_type = True 978 IdlNullableType.includes_nullable_type = True
978 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) 979 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698