| OLD | NEW |
| 1 {% include 'copyright_block.txt' %} | 1 {% include 'copyright_block.txt' %} |
| 2 #include "{{v8_class_or_partial}}.h" | 2 #include "{{v8_class_or_partial}}.h" |
| 3 | 3 |
| 4 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} | 4 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} |
| 5 #include "{{filename}}" | 5 #include "{{filename}}" |
| 6 {% endfor %} | 6 {% endfor %} |
| 7 | 7 |
| 8 namespace blink { | 8 namespace blink { |
| 9 {% set to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class | 9 {% set to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class |
| 10 if active_scriptwrappable else '0' %} | 10 if active_scriptwrappable else '0' %} |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 {% endif %} | 87 {% endif %} |
| 88 {{attribute_setter_callback(attribute, world_suffix)}} | 88 {{attribute_setter_callback(attribute, world_suffix)}} |
| 89 {% endif %} | 89 {% endif %} |
| 90 {% endfor %} | 90 {% endfor %} |
| 91 {% endfor %} | 91 {% endfor %} |
| 92 {##############################################################################} | 92 {##############################################################################} |
| 93 {% block security_check_functions %} | 93 {% block security_check_functions %} |
| 94 {% if has_access_check_callbacks and not is_partial %} | 94 {% if has_access_check_callbacks and not is_partial %} |
| 95 bool securityCheck(v8::Local<v8::Context> accessingContext, v8::Local<v8::Object
> accessedObject, v8::Local<v8::Value> data) | 95 bool securityCheck(v8::Local<v8::Context> accessingContext, v8::Local<v8::Object
> accessedObject, v8::Local<v8::Value> data) |
| 96 { | 96 { |
| 97 {% if interface_name == 'Window' %} |
| 98 // TODO(jochen): Take accessingContext into account. |
| 99 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 100 v8::Local<v8::Object> window = V8Window::findInstanceInPrototypeChain(access
edObject, isolate); |
| 101 if (window.IsEmpty()) |
| 102 return false; // the frame is gone. |
| 103 |
| 104 DOMWindow* targetWindow = V8Window::toImpl(window); |
| 105 ASSERT(targetWindow); |
| 106 if (!targetWindow->isLocalDOMWindow()) |
| 107 return false; |
| 108 |
| 109 LocalFrame* targetFrame = toLocalDOMWindow(targetWindow)->frame(); |
| 110 if (!targetFrame) |
| 111 return false; |
| 112 |
| 113 // Notify the loader's client if the initial document has been accessed. |
| 114 if (targetFrame->loader().stateMachine()->isDisplayingInitialEmptyDocument()
) |
| 115 targetFrame->loader().didAccessInitialDocument(); |
| 116 |
| 117 return BindingSecurity::shouldAllowAccessTo(isolate, callingDOMWindow(isolat
e), targetWindow, DoNotReportSecurityError); |
| 118 {% else %}{# if interface_name == 'Window' #} |
| 119 {# Not 'Window' means it\'s Location. #} |
| 97 // TODO(jochen): Take accessingContext into account. | 120 // TODO(jochen): Take accessingContext into account. |
| 98 {{cpp_class}}* impl = {{v8_class}}::toImpl(accessedObject); | 121 {{cpp_class}}* impl = {{v8_class}}::toImpl(accessedObject); |
| 99 return BindingSecurity::shouldAllowAccessTo(v8::Isolate::GetCurrent(), calli
ngDOMWindow(v8::Isolate::GetCurrent()), impl, DoNotReportSecurityError); | 122 return BindingSecurity::shouldAllowAccessTo(v8::Isolate::GetCurrent(), calli
ngDOMWindow(v8::Isolate::GetCurrent()), impl, DoNotReportSecurityError); |
| 123 {% endif %}{# if interface_name == 'Window' #} |
| 100 } | 124 } |
| 101 | 125 |
| 102 {% endif %} | 126 {% endif %} |
| 103 {% endblock %} | 127 {% endblock %} |
| 104 {##############################################################################} | 128 {##############################################################################} |
| 105 {# Methods #} | 129 {# Methods #} |
| 106 {% from 'methods.cpp' import generate_method, overload_resolution_method, | 130 {% from 'methods.cpp' import generate_method, overload_resolution_method, |
| 107 method_callback, origin_safe_method_getter, generate_constructor, | 131 method_callback, origin_safe_method_getter, generate_constructor, |
| 108 method_implemented_in_private_script, generate_post_message_impl, | 132 method_implemented_in_private_script, generate_post_message_impl, |
| 109 runtime_determined_length_method, runtime_determined_maxarg_method | 133 runtime_determined_length_method, runtime_determined_maxarg_method |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 interfaceTemplate->SetLength({{interface_length}}); | 284 interfaceTemplate->SetLength({{interface_length}}); |
| 261 {% endif %} | 285 {% endif %} |
| 262 {% endif %}{# is_partial #} | 286 {% endif %}{# is_partial #} |
| 263 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTe
mplate); | 287 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTe
mplate); |
| 264 ALLOW_UNUSED_LOCAL(signature); | 288 ALLOW_UNUSED_LOCAL(signature); |
| 265 v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->Instance
Template(); | 289 v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->Instance
Template(); |
| 266 ALLOW_UNUSED_LOCAL(instanceTemplate); | 290 ALLOW_UNUSED_LOCAL(instanceTemplate); |
| 267 v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->Prototy
peTemplate(); | 291 v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->Prototy
peTemplate(); |
| 268 ALLOW_UNUSED_LOCAL(prototypeTemplate); | 292 ALLOW_UNUSED_LOCAL(prototypeTemplate); |
| 269 | 293 |
| 270 {%- if not is_partial %} | 294 {%- if interface_name == 'Window' and not is_partial %}{{newline}} |
| 271 {% if interface_name == 'Window' %}{{newline}} | |
| 272 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); | 295 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); |
| 273 {% endif %} | 296 {% endif %} |
| 274 {% if is_global %}{{newline}} | |
| 275 interfaceTemplate->SetHiddenPrototype(true); | |
| 276 {% endif %} | |
| 277 {% endif %} | |
| 278 | 297 |
| 279 // Register DOM constants, attributes and operations. | 298 // Register DOM constants, attributes and operations. |
| 280 {% if runtime_enabled_function %} | 299 {% if runtime_enabled_function %} |
| 281 if ({{runtime_enabled_function}}()) { | 300 if ({{runtime_enabled_function}}()) { |
| 282 {% endif %} | 301 {% endif %} |
| 283 {% filter indent(4 if runtime_enabled_function else 0, true) %} | 302 {% filter indent(4 if runtime_enabled_function else 0, true) %} |
| 284 {% if constants %} | 303 {% if constants %} |
| 285 {{install_constants() | indent}} | 304 {{install_constants() | indent}} |
| 286 {% endif %} | 305 {% endif %} |
| 287 {% if has_attribute_configuration %} | 306 {% if has_attribute_configuration %} |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 {{method_implemented_in_private_script(method)}} | 420 {{method_implemented_in_private_script(method)}} |
| 402 {% endfor %} | 421 {% endfor %} |
| 403 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 422 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
| 404 {{attribute_getter_implemented_in_private_script(attribute)}} | 423 {{attribute_getter_implemented_in_private_script(attribute)}} |
| 405 {% if attribute.has_setter %} | 424 {% if attribute.has_setter %} |
| 406 {{attribute_setter_implemented_in_private_script(attribute)}} | 425 {{attribute_setter_implemented_in_private_script(attribute)}} |
| 407 {% endif %} | 426 {% endif %} |
| 408 {% endfor %} | 427 {% endfor %} |
| 409 {% block partial_interface %}{% endblock %} | 428 {% block partial_interface %}{% endblock %} |
| 410 } // namespace blink | 429 } // namespace blink |
| OLD | NEW |