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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/interface_base.cpp

Issue 2209303002: binding: Moves the check for the first access to the initial document into BindingSecurity. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed android_webview tests. Created 4 years, 4 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 {% 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 {% block security_check_functions %} 81 {% block security_check_functions %}
82 {% if has_access_check_callbacks and not is_partial %} 82 {% if has_access_check_callbacks and not is_partial %}
83 bool securityCheck(v8::Local<v8::Context> accessingContext, v8::Local<v8::Object > accessedObject, v8::Local<v8::Value> data) 83 bool securityCheck(v8::Local<v8::Context> accessingContext, v8::Local<v8::Object > accessedObject, v8::Local<v8::Value> data)
84 { 84 {
85 {% if interface_name == 'Window' %} 85 {% if interface_name == 'Window' %}
86 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 86 v8::Isolate* isolate = v8::Isolate::GetCurrent();
87 v8::Local<v8::Object> window = V8Window::findInstanceInPrototypeChain(access edObject, isolate); 87 v8::Local<v8::Object> window = V8Window::findInstanceInPrototypeChain(access edObject, isolate);
88 if (window.IsEmpty()) 88 if (window.IsEmpty())
89 return false; // the frame is gone. 89 return false; // the frame is gone.
90 90
91 DOMWindow* targetWindow = V8Window::toImpl(window); 91 const DOMWindow* targetWindow = V8Window::toImpl(window);
92 ASSERT(targetWindow);
93 if (!targetWindow->isLocalDOMWindow())
94 return false;
95
96 LocalFrame* targetFrame = toLocalDOMWindow(targetWindow)->frame();
97 if (!targetFrame)
98 return false;
99
100 // Notify the loader's client if the initial document has been accessed.
101 if (targetFrame->loader().stateMachine()->isDisplayingInitialEmptyDocument() )
102 targetFrame->loader().didAccessInitialDocument();
haraken 2016/08/13 02:29:36 You're saying that this CL will call didAccessInit
Yuki 2016/08/15 03:42:58 You're right. Not necessarily, but it's intention
103
104 return BindingSecurity::shouldAllowAccessTo(isolate, toLocalDOMWindow(toDOMW indow(accessingContext)), targetWindow, DoNotReportSecurityError); 92 return BindingSecurity::shouldAllowAccessTo(isolate, toLocalDOMWindow(toDOMW indow(accessingContext)), targetWindow, DoNotReportSecurityError);
105 {% else %}{# if interface_name == 'Window' #} 93 {% else %}{# if interface_name == 'Window' #}
106 {# Not 'Window' means it\'s Location. #} 94 {# Not 'Window' means it\'s Location. #}
107 {{cpp_class}}* impl = {{v8_class}}::toImpl(accessedObject); 95 {{cpp_class}}* impl = {{v8_class}}::toImpl(accessedObject);
108 return BindingSecurity::shouldAllowAccessTo(v8::Isolate::GetCurrent(), toLoc alDOMWindow(toDOMWindow(accessingContext)), impl, DoNotReportSecurityError); 96 return BindingSecurity::shouldAllowAccessTo(v8::Isolate::GetCurrent(), toLoc alDOMWindow(toDOMWindow(accessingContext)), impl, DoNotReportSecurityError);
109 {% endif %}{# if interface_name == 'Window' #} 97 {% endif %}{# if interface_name == 'Window' #}
110 } 98 }
111 99
112 {% endif %} 100 {% endif %}
113 {% endblock %} 101 {% endblock %}
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 {{method_implemented_in_private_script(method)}} 418 {{method_implemented_in_private_script(method)}}
431 {% endfor %} 419 {% endfor %}
432 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 420 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
433 {{attribute_getter_implemented_in_private_script(attribute)}} 421 {{attribute_getter_implemented_in_private_script(attribute)}}
434 {% if attribute.has_setter %} 422 {% if attribute.has_setter %}
435 {{attribute_setter_implemented_in_private_script(attribute)}} 423 {{attribute_setter_implemented_in_private_script(attribute)}}
436 {% endif %} 424 {% endif %}
437 {% endfor %} 425 {% endfor %}
438 {% block partial_interface %}{% endblock %} 426 {% block partial_interface %}{% endblock %}
439 } // namespace blink 427 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698