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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_interface.py

Issue 1509493002: Disallow [Measure] and [MeasureAs] on interfaces without a constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # coding=utf-8 2 # coding=utf-8
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 'number_of_required_arguments': 224 'number_of_required_arguments':
225 number_of_required_arguments(constructor), 225 number_of_required_arguments(constructor),
226 } for constructor in interface.custom_constructors] 226 } for constructor in interface.custom_constructors]
227 227
228 # [NamedConstructor] 228 # [NamedConstructor]
229 named_constructor = named_constructor_context(interface) 229 named_constructor = named_constructor_context(interface)
230 230
231 if constructors or custom_constructors or named_constructor: 231 if constructors or custom_constructors or named_constructor:
232 if interface.is_partial: 232 if interface.is_partial:
233 raise Exception('[Constructor] and [NamedConstructor] MUST NOT be' 233 raise Exception('[Constructor] and [NamedConstructor] MUST NOT be'
234 ' specified on partial interface definitions:' 234 ' specified on partial interface definitions: '
235 '%s' % interface.name) 235 '%s' % interface.name)
236 236
237 includes.add('bindings/core/v8/V8ObjectConstructor.h') 237 includes.add('bindings/core/v8/V8ObjectConstructor.h')
238 includes.add('core/frame/LocalDOMWindow.h') 238 includes.add('core/frame/LocalDOMWindow.h')
239 elif 'Measure' in extended_attributes or 'MeasureAs' in extended_attributes:
240 raise Exception('[Measure] or [MeasureAs] specified for interface withou t a constructor: '
241 '%s' % interface.name)
239 242
240 # [Unscopeable] attributes and methods 243 # [Unscopeable] attributes and methods
241 unscopeables = [] 244 unscopeables = []
242 for attribute in interface.attributes: 245 for attribute in interface.attributes:
243 if 'Unscopeable' in attribute.extended_attributes: 246 if 'Unscopeable' in attribute.extended_attributes:
244 unscopeables.append((attribute.name, v8_utilities.runtime_enabled_fu nction_name(attribute))) 247 unscopeables.append((attribute.name, v8_utilities.runtime_enabled_fu nction_name(attribute)))
245 for method in interface.operations: 248 for method in interface.operations:
246 if 'Unscopeable' in method.extended_attributes: 249 if 'Unscopeable' in method.extended_attributes:
247 unscopeables.append((method.name, v8_utilities.runtime_enabled_funct ion_name(method))) 250 unscopeables.append((method.name, v8_utilities.runtime_enabled_funct ion_name(method)))
248 251
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 1390
1388 extended_attributes = deleter.extended_attributes 1391 extended_attributes = deleter.extended_attributes
1389 idl_type = deleter.idl_type 1392 idl_type = deleter.idl_type
1390 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') 1393 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState')
1391 return { 1394 return {
1392 'is_call_with_script_state': is_call_with_script_state, 1395 'is_call_with_script_state': is_call_with_script_state,
1393 'is_custom': 'Custom' in extended_attributes, 1396 'is_custom': 'Custom' in extended_attributes,
1394 'is_raises_exception': 'RaisesException' in extended_attributes, 1397 'is_raises_exception': 'RaisesException' in extended_attributes,
1395 'name': cpp_name(deleter), 1398 'name': cpp_name(deleter),
1396 } 1399 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698