| OLD | NEW |
| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 return set(['']) # At minimum, include isolated worlds. | 155 return set(['']) # At minimum, include isolated worlds. |
| 156 | 156 |
| 157 | 157 |
| 158 # [CallWith] | 158 # [CallWith] |
| 159 CALL_WITH_ARGUMENTS = { | 159 CALL_WITH_ARGUMENTS = { |
| 160 'ScriptState': 'scriptState', | 160 'ScriptState': 'scriptState', |
| 161 'ExecutionContext': 'scriptContext', | 161 'ExecutionContext': 'scriptContext', |
| 162 'ScriptArguments': 'scriptArguments.release()', | 162 'ScriptArguments': 'scriptArguments.release()', |
| 163 'ActiveWindow': 'callingDOMWindow(info.GetIsolate())', | 163 'ActiveWindow': 'callingDOMWindow(info.GetIsolate())', |
| 164 'FirstWindow': 'enteredDOMWindow(info.GetIsolate())', | 164 'FirstWindow': 'enteredDOMWindow(info.GetIsolate())', |
| 165 'Document': 'document', |
| 165 } | 166 } |
| 166 # List because key order matters, as we want arguments in deterministic order | 167 # List because key order matters, as we want arguments in deterministic order |
| 167 CALL_WITH_VALUES = [ | 168 CALL_WITH_VALUES = [ |
| 168 'ScriptState', | 169 'ScriptState', |
| 169 'ExecutionContext', | 170 'ExecutionContext', |
| 170 'ScriptArguments', | 171 'ScriptArguments', |
| 171 'ActiveWindow', | 172 'ActiveWindow', |
| 172 'FirstWindow', | 173 'FirstWindow', |
| 174 'Document', |
| 173 ] | 175 ] |
| 174 | 176 |
| 175 | 177 |
| 176 def call_with_arguments(member, call_with_values=None): | 178 def call_with_arguments(call_with_values): |
| 177 # Optional parameter so setter can override with [SetterCallWith] | |
| 178 call_with_values = call_with_values or member.extended_attributes.get('CallW
ith') | |
| 179 if not call_with_values: | 179 if not call_with_values: |
| 180 return [] | 180 return [] |
| 181 return [CALL_WITH_ARGUMENTS[value] | 181 return [CALL_WITH_ARGUMENTS[value] |
| 182 for value in CALL_WITH_VALUES | 182 for value in CALL_WITH_VALUES |
| 183 if extended_attribute_value_contains(call_with_values, value)] | 183 if extended_attribute_value_contains(call_with_values, value)] |
| 184 | 184 |
| 185 | 185 |
| 186 # [Conditional] | 186 # [Conditional] |
| 187 def conditional_string(definition_or_member): | 187 def conditional_string(definition_or_member): |
| 188 extended_attributes = definition_or_member.extended_attributes | 188 extended_attributes = definition_or_member.extended_attributes |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 248 |
| 249 The returned function checks if a method/attribute is enabled. | 249 The returned function checks if a method/attribute is enabled. |
| 250 Given extended attribute RuntimeEnabled=FeatureName, return: | 250 Given extended attribute RuntimeEnabled=FeatureName, return: |
| 251 RuntimeEnabledFeatures::{featureName}Enabled | 251 RuntimeEnabledFeatures::{featureName}Enabled |
| 252 """ | 252 """ |
| 253 extended_attributes = definition_or_member.extended_attributes | 253 extended_attributes = definition_or_member.extended_attributes |
| 254 if 'RuntimeEnabled' not in extended_attributes: | 254 if 'RuntimeEnabled' not in extended_attributes: |
| 255 return None | 255 return None |
| 256 feature_name = extended_attributes['RuntimeEnabled'] | 256 feature_name = extended_attributes['RuntimeEnabled'] |
| 257 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) | 257 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) |
| OLD | NEW |