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

Side by Side Diff: mojo/public/tools/bindings/generators/js_templates/validation_macros.tmpl

Issue 2796253002: Associated Message Validation (Closed)
Patch Set: Validate payloadInterfaceIds before getting it. Use [0] for dimensions for validateArrayPointer. Ca… Created 3 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
OLDNEW
1 {% macro _check_err() -%} 1 {% macro _check_err() -%}
2 if (err !== validator.validationError.NONE) 2 if (err !== validator.validationError.NONE)
3 return err; 3 return err;
4 {%- endmacro %} 4 {%- endmacro %}
5 5
6 {%- macro _validate_field(field, offset, name) %} 6 {%- macro _validate_field(field, offset, name) %}
7 {%- if field|is_string_pointer_field %} 7 {%- if field|is_string_pointer_field %}
8 // validate {{name}} 8 // validate {{name}}
9 err = messageValidator.validateStringPointer({{offset}}, {{field|validate_nullab le_params}}) 9 err = messageValidator.validateStringPointer({{offset}}, {{field|validate_nullab le_params}})
10 {{_check_err()}} 10 {{_check_err()}}
(...skipping 10 matching lines...) Expand all
21 err = messageValidator.validateMapPointer({{offset}}, {{field|validate_map_param s}}); 21 err = messageValidator.validateMapPointer({{offset}}, {{field|validate_map_param s}});
22 {{_check_err()}} 22 {{_check_err()}}
23 {%- elif field|is_interface_field %} 23 {%- elif field|is_interface_field %}
24 // validate {{name}} 24 // validate {{name}}
25 err = messageValidator.validateInterface({{offset}}, {{field|validate_nullable_p arams}}); 25 err = messageValidator.validateInterface({{offset}}, {{field|validate_nullable_p arams}});
26 {{_check_err()}} 26 {{_check_err()}}
27 {%- elif field|is_interface_request_field %} 27 {%- elif field|is_interface_request_field %}
28 // validate {{name}} 28 // validate {{name}}
29 err = messageValidator.validateInterfaceRequest({{offset}}, {{field|validate_nul lable_params}}) 29 err = messageValidator.validateInterfaceRequest({{offset}}, {{field|validate_nul lable_params}})
30 {{_check_err()}} 30 {{_check_err()}}
31 {%- elif field|is_associated_interface_field %}
32 // validate {{name}}
33 err = messageValidator.validateAssociatedInterface({{offset}}, {{field|validate_ nullable_params}});
34 {{_check_err()}}
35 {%- elif field|is_associated_interface_request_field %}
36 // validate {{name}}
37 err = messageValidator.validateAssociatedInterfaceRequest({{offset}}, {{field|va lidate_nullable_params}})
38 {{_check_err()}}
31 {%- elif field|is_handle_field %} 39 {%- elif field|is_handle_field %}
32 // validate {{name}} 40 // validate {{name}}
33 err = messageValidator.validateHandle({{offset}}, {{field|validate_nullable_para ms}}) 41 err = messageValidator.validateHandle({{offset}}, {{field|validate_nullable_para ms}})
34 {{_check_err()}} 42 {{_check_err()}}
35 {%- elif field|is_enum_field %} 43 {%- elif field|is_enum_field %}
36 // validate {{name}} 44 // validate {{name}}
37 err = messageValidator.validateEnum({{offset}}, {{field|validate_enum_params}}); 45 err = messageValidator.validateEnum({{offset}}, {{field|validate_enum_params}});
38 {{_check_err()}} 46 {{_check_err()}}
39 {%- endif %} 47 {%- endif %}
40 {%- endmacro %} 48 {%- endmacro %}
(...skipping 10 matching lines...) Expand all
51 59
52 {%- macro validate_union_field(field, offset, name) %} 60 {%- macro validate_union_field(field, offset, name) %}
53 {%- if field|is_union_field %} 61 {%- if field|is_union_field %}
54 // validate {{name}} 62 // validate {{name}}
55 err = messageValidator.validateNestedUnion({{offset}}, {{field|validate_union_pa rams}}); 63 err = messageValidator.validateNestedUnion({{offset}}, {{field|validate_union_pa rams}});
56 {{_check_err()}} 64 {{_check_err()}}
57 {%- else %} 65 {%- else %}
58 {{_validate_field(field, offset, name)}} 66 {{_validate_field(field, offset, name)}}
59 {%- endif %} 67 {%- endif %}
60 {%- endmacro %} 68 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698