OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! |
32 | 32 |
33 #include "config.h" | 33 #include "config.h" |
34 #include "V8TestCheckSecurityInterface.h" | 34 #include "V8TestInterfaceCheckSecurity.h" |
35 | 35 |
36 #include "RuntimeEnabledFeatures.h" | 36 #include "RuntimeEnabledFeatures.h" |
37 #include "bindings/v8/BindingSecurity.h" | 37 #include "bindings/v8/BindingSecurity.h" |
38 #include "bindings/v8/ExceptionMessages.h" | 38 #include "bindings/v8/ExceptionMessages.h" |
39 #include "bindings/v8/ExceptionState.h" | 39 #include "bindings/v8/ExceptionState.h" |
40 #include "bindings/v8/ScriptController.h" | 40 #include "bindings/v8/ScriptController.h" |
41 #include "bindings/v8/V8Binding.h" | 41 #include "bindings/v8/V8Binding.h" |
42 #include "bindings/v8/V8DOMConfiguration.h" | 42 #include "bindings/v8/V8DOMConfiguration.h" |
43 #include "bindings/v8/V8DOMWrapper.h" | 43 #include "bindings/v8/V8DOMWrapper.h" |
44 #include "core/dom/ContextFeatures.h" | 44 #include "core/dom/ContextFeatures.h" |
45 #include "core/dom/Document.h" | 45 #include "core/dom/Document.h" |
46 #include "platform/TraceEvent.h" | 46 #include "platform/TraceEvent.h" |
47 #include "wtf/UnusedParam.h" | 47 #include "wtf/UnusedParam.h" |
48 | 48 |
49 namespace WebCore { | 49 namespace WebCore { |
50 | 50 |
51 static void initializeScriptWrappableForInterface(TestCheckSecurityInterface* ob
ject) | 51 static void initializeScriptWrappableForInterface(TestInterfaceCheckSecurity* ob
ject) |
52 { | 52 { |
53 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 53 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
54 ScriptWrappable::setTypeInfoInObject(object, &V8TestCheckSecurityInterfa
ce::wrapperTypeInfo); | 54 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceCheckSecuri
ty::wrapperTypeInfo); |
55 else | 55 else |
56 ASSERT_NOT_REACHED(); | 56 ASSERT_NOT_REACHED(); |
57 } | 57 } |
58 | 58 |
59 } // namespace WebCore | 59 } // namespace WebCore |
60 | 60 |
61 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 61 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
62 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | 62 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
63 // in the global namespace. | 63 // in the global namespace. |
64 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 64 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
65 void webCoreInitializeScriptWrappableForInterface(WebCore::TestCheckSecurityInte
rface* object) | 65 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceCheckSec
urity* object) |
66 { | 66 { |
67 WebCore::initializeScriptWrappableForInterface(object); | 67 WebCore::initializeScriptWrappableForInterface(object); |
68 } | 68 } |
69 | 69 |
70 namespace WebCore { | 70 namespace WebCore { |
71 const WrapperTypeInfo V8TestCheckSecurityInterface::wrapperTypeInfo = { gin::kEm
bedderBlink, V8TestCheckSecurityInterface::GetTemplate, V8TestCheckSecurityInter
face::derefObject, 0, 0, 0, V8TestCheckSecurityInterface::installPerContextEnabl
edMethods, 0, WrapperTypeObjectPrototype }; | 71 const WrapperTypeInfo V8TestInterfaceCheckSecurity::wrapperTypeInfo = { gin::kEm
bedderBlink, V8TestInterfaceCheckSecurity::GetTemplate, V8TestInterfaceCheckSecu
rity::derefObject, 0, 0, 0, V8TestInterfaceCheckSecurity::installPerContextEnabl
edMethods, 0, WrapperTypeObjectPrototype }; |
72 | 72 |
73 namespace TestCheckSecurityInterfaceV8Internal { | 73 namespace TestInterfaceCheckSecurityV8Internal { |
74 | 74 |
75 template <typename T> void V8_USE(T) { } | 75 template <typename T> void V8_USE(T) { } |
76 | 76 |
77 static void longAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Valu
e>& info) | 77 static void longAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Valu
e>& info) |
78 { | 78 { |
79 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 79 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
80 v8SetReturnValueInt(info, imp->longAttribute()); | 80 v8SetReturnValueInt(info, imp->longAttribute()); |
81 } | 81 } |
82 | 82 |
83 static void longAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8
::PropertyCallbackInfo<v8::Value>& info) | 83 static void longAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8
::PropertyCallbackInfo<v8::Value>& info) |
84 { | 84 { |
85 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 85 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
86 TestCheckSecurityInterfaceV8Internal::longAttributeAttributeGetter(info); | 86 TestInterfaceCheckSecurityV8Internal::longAttributeAttributeGetter(info); |
87 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 87 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
88 } | 88 } |
89 | 89 |
90 static void doNotCheckSecurityLongAttributeAttributeGetter(const v8::PropertyCal
lbackInfo<v8::Value>& info) | 90 static void doNotCheckSecurityLongAttributeAttributeGetter(const v8::PropertyCal
lbackInfo<v8::Value>& info) |
91 { | 91 { |
92 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 92 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
93 v8SetReturnValueInt(info, imp->doNotCheckSecurityLongAttribute()); | 93 v8SetReturnValueInt(info, imp->doNotCheckSecurityLongAttribute()); |
94 } | 94 } |
95 | 95 |
96 static void doNotCheckSecurityLongAttributeAttributeGetterCallback(v8::Local<v8:
:String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 96 static void doNotCheckSecurityLongAttributeAttributeGetterCallback(v8::Local<v8:
:String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
97 { | 97 { |
98 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 98 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
99 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityLongAttributeAttribu
teGetter(info); | 99 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityLongAttributeAttribu
teGetter(info); |
100 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 100 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
101 } | 101 } |
102 | 102 |
103 static void doNotCheckSecurityLongAttributeAttributeSetter(v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<void>& info) | 103 static void doNotCheckSecurityLongAttributeAttributeSetter(v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<void>& info) |
104 { | 104 { |
105 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 105 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
106 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); | 106 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); |
107 imp->setDoNotCheckSecurityLongAttribute(cppValue); | 107 imp->setDoNotCheckSecurityLongAttribute(cppValue); |
108 } | 108 } |
109 | 109 |
110 static void doNotCheckSecurityLongAttributeAttributeSetterCallback(v8::Local<v8:
:String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& in
fo) | 110 static void doNotCheckSecurityLongAttributeAttributeSetterCallback(v8::Local<v8:
:String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& in
fo) |
111 { | 111 { |
112 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 112 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
113 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityLongAttributeAttribu
teSetter(jsValue, info); | 113 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityLongAttributeAttribu
teSetter(jsValue, info); |
114 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 114 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
115 } | 115 } |
116 | 116 |
117 static void doNotCheckSecurityReadonlyLongAttributeAttributeGetter(const v8::Pro
pertyCallbackInfo<v8::Value>& info) | 117 static void doNotCheckSecurityReadonlyLongAttributeAttributeGetter(const v8::Pro
pertyCallbackInfo<v8::Value>& info) |
118 { | 118 { |
119 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 119 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
120 v8SetReturnValueInt(info, imp->doNotCheckSecurityReadonlyLongAttribute()); | 120 v8SetReturnValueInt(info, imp->doNotCheckSecurityReadonlyLongAttribute()); |
121 } | 121 } |
122 | 122 |
123 static void doNotCheckSecurityReadonlyLongAttributeAttributeGetterCallback(v8::L
ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 123 static void doNotCheckSecurityReadonlyLongAttributeAttributeGetterCallback(v8::L
ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
124 { | 124 { |
125 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 125 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
126 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadonlyLongAttribut
eAttributeGetter(info); | 126 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReadonlyLongAttribut
eAttributeGetter(info); |
127 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 127 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
128 } | 128 } |
129 | 129 |
130 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetter(const v8::Pro
pertyCallbackInfo<v8::Value>& info) | 130 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetter(const v8::Pro
pertyCallbackInfo<v8::Value>& info) |
131 { | 131 { |
132 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 132 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
133 v8SetReturnValueInt(info, imp->doNotCheckSecurityOnSetterLongAttribute()); | 133 v8SetReturnValueInt(info, imp->doNotCheckSecurityOnSetterLongAttribute()); |
134 } | 134 } |
135 | 135 |
136 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetterCallback(v8::L
ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 136 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetterCallback(v8::L
ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
137 { | 137 { |
138 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 138 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
139 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityOnSetterLongAttribut
eAttributeGetter(info); | 139 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityOnSetterLongAttribut
eAttributeGetter(info); |
140 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 140 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
141 } | 141 } |
142 | 142 |
143 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetter(v8::Local<v8:
:Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 143 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetter(v8::Local<v8:
:Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
144 { | 144 { |
145 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 145 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
146 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); | 146 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); |
147 imp->setDoNotCheckSecurityOnSetterLongAttribute(cppValue); | 147 imp->setDoNotCheckSecurityOnSetterLongAttribute(cppValue); |
148 } | 148 } |
149 | 149 |
150 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetterCallback(v8::L
ocal<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v
oid>& info) | 150 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetterCallback(v8::L
ocal<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v
oid>& info) |
151 { | 151 { |
152 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 152 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
153 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityOnSetterLongAttribut
eAttributeSetter(jsValue, info); | 153 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityOnSetterLongAttribut
eAttributeSetter(jsValue, info); |
154 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 154 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
155 } | 155 } |
156 | 156 |
157 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access
Type type, v8::Local<v8::Value>) | 157 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access
Type type, v8::Local<v8::Value>) |
158 { | 158 { |
159 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(ho
st); | 159 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(ho
st); |
160 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
curityError); | 160 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
curityError); |
161 } | 161 } |
162 | 162 |
163 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8
::AccessType type, v8::Local<v8::Value>) | 163 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8
::AccessType type, v8::Local<v8::Value>) |
164 { | 164 { |
165 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(ho
st); | 165 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(ho
st); |
166 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
curityError); | 166 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
curityError); |
167 } | 167 } |
168 | 168 |
169 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 169 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
170 { | 170 { |
171 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 171 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
172 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 172 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
173 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { | 173 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { |
174 exceptionState.throwIfNeeded(); | 174 exceptionState.throwIfNeeded(); |
175 return; | 175 return; |
176 } | 176 } |
177 imp->voidMethod(); | 177 imp->voidMethod(); |
178 } | 178 } |
179 | 179 |
180 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | 180 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) |
181 { | 181 { |
182 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 182 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
183 TestCheckSecurityInterfaceV8Internal::voidMethodMethod(info); | 183 TestInterfaceCheckSecurityV8Internal::voidMethodMethod(info); |
184 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 184 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
185 } | 185 } |
186 | 186 |
187 static void doNotCheckSecurityVoidMethodMethod(const v8::FunctionCallbackInfo<v8
::Value>& info) | 187 static void doNotCheckSecurityVoidMethodMethod(const v8::FunctionCallbackInfo<v8
::Value>& info) |
188 { | 188 { |
189 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 189 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
190 imp->doNotCheckSecurityVoidMethod(); | 190 imp->doNotCheckSecurityVoidMethod(); |
191 } | 191 } |
192 | 192 |
193 static void doNotCheckSecurityVoidMethodMethodCallback(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 193 static void doNotCheckSecurityVoidMethodMethodCallback(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
194 { | 194 { |
195 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 195 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
196 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityVoidMethodMethod(inf
o); | 196 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodMethod(inf
o); |
197 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 197 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
198 } | 198 } |
199 | 199 |
200 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetter(const v8::Propert
yCallbackInfo<v8::Value>& info) | 200 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetter(const v8::Propert
yCallbackInfo<v8::Value>& info) |
201 { | 201 { |
202 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 202 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
203 static int privateTemplateUniqueKey; | 203 static int privateTemplateUniqueKey; |
204 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 204 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
205 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 205 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
206 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(in
fo.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestC
heckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); | 206 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal::
doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(in
fo.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestI
nterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); |
207 | 207 |
208 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 208 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestInterfaceCheckSecurity::GetTemplate(info.GetIsolate(), currentWorldType)); |
209 if (holder.IsEmpty()) { | 209 if (holder.IsEmpty()) { |
210 // This is only reachable via |object.__proto__.func|, in which case it | 210 // This is only reachable via |object.__proto__.func|, in which case it |
211 // has already passed the same origin security check | 211 // has already passed the same origin security check |
212 v8SetReturnValue(info, privateTemplate->GetFunction()); | 212 v8SetReturnValue(info, privateTemplate->GetFunction()); |
213 return; | 213 return; |
214 } | 214 } |
215 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); | 215 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol
der); |
216 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { | 216 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
217 static int sharedTemplateUniqueKey; | 217 static int sharedTemplateUniqueKey; |
218 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
::doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(
info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8Tes
tCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); | 218 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal
::doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(
info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8Tes
tInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); |
219 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 219 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
220 return; | 220 return; |
221 } | 221 } |
222 | 222 |
223 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityVoidMethod", v8::String::kInter
nalizedString)); | 223 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityVoidMethod", v8::String::kInter
nalizedString)); |
224 if (!hiddenValue.IsEmpty()) { | 224 if (!hiddenValue.IsEmpty()) { |
225 v8SetReturnValue(info, hiddenValue); | 225 v8SetReturnValue(info, hiddenValue); |
226 return; | 226 return; |
227 } | 227 } |
228 | 228 |
229 v8SetReturnValue(info, privateTemplate->GetFunction()); | 229 v8SetReturnValue(info, privateTemplate->GetFunction()); |
230 } | 230 } |
231 | 231 |
232 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback(v8::Local
<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 232 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback(v8::Local
<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
233 { | 233 { |
234 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 234 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
235 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityVoidMethodOriginSafe
MethodGetter(info); | 235 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodOriginSafe
MethodGetter(info); |
236 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 236 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
237 } | 237 } |
238 | 238 |
239 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethod(const v8::Functio
nCallbackInfo<v8::Value>& info) | 239 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethod(const v8::Functio
nCallbackInfo<v8::Value>& info) |
240 { | 240 { |
241 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 241 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
242 imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); | 242 imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); |
243 } | 243 } |
244 | 244 |
245 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback(const v8:
:FunctionCallbackInfo<v8::Value>& info) | 245 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback(const v8:
:FunctionCallbackInfo<v8::Value>& info) |
246 { | 246 { |
247 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 247 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
248 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethod(info); | 248 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethod(info); |
249 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 249 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
250 } | 250 } |
251 | 251 |
252 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetter(c
onst v8::PropertyCallbackInfo<v8::Value>& info) | 252 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetter(c
onst v8::PropertyCallbackInfo<v8::Value>& info) |
253 { | 253 { |
254 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 254 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
255 static int privateTemplateUniqueKey; | 255 static int privateTemplateUniqueKey; |
256 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 256 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
257 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 257 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
258 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8::S
ignature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawT
emplate(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); | 258 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal::
doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8::S
ignature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawT
emplate(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); |
259 | 259 |
260 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 260 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestInterfaceCheckSecurity::GetTemplate(info.GetIsolate(), currentWorldType)); |
261 if (holder.IsEmpty()) { | 261 if (holder.IsEmpty()) { |
262 // This is only reachable via |object.__proto__.func|, in which case it | 262 // This is only reachable via |object.__proto__.func|, in which case it |
263 // has already passed the same origin security check | 263 // has already passed the same origin security check |
264 v8SetReturnValue(info, privateTemplate->GetFunction()); | 264 v8SetReturnValue(info, privateTemplate->GetFunction()); |
265 return; | 265 return; |
266 } | 266 } |
267 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); | 267 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol
der); |
268 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { | 268 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
269 static int sharedTemplateUniqueKey; | 269 static int sharedTemplateUniqueKey; |
270 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8:
:Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->ra
wTemplate(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0)
; | 270 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal
::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8:
:Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->ra
wTemplate(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0)
; |
271 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 271 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
272 return; | 272 return; |
273 } | 273 } |
274 | 274 |
275 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod", v8
::String::kInternalizedString)); | 275 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod", v8
::String::kInternalizedString)); |
276 if (!hiddenValue.IsEmpty()) { | 276 if (!hiddenValue.IsEmpty()) { |
277 v8SetReturnValue(info, hiddenValue); | 277 v8SetReturnValue(info, hiddenValue); |
278 return; | 278 return; |
279 } | 279 } |
280 | 280 |
281 v8SetReturnValue(info, privateTemplate->GetFunction()); | 281 v8SetReturnValue(info, privateTemplate->GetFunction()); |
282 } | 282 } |
283 | 283 |
284 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 284 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
285 { | 285 { |
286 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 286 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
287 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetter(info); | 287 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetter(info); |
288 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 288 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
289 } | 289 } |
290 | 290 |
291 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodForMainWorld(const
v8::FunctionCallbackInfo<v8::Value>& info) | 291 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodForMainWorld(const
v8::FunctionCallbackInfo<v8::Value>& info) |
292 { | 292 { |
293 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 293 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
294 imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); | 294 imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); |
295 } | 295 } |
296 | 296 |
297 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWor
ld(const v8::FunctionCallbackInfo<v8::Value>& info) | 297 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWor
ld(const v8::FunctionCallbackInfo<v8::Value>& info) |
298 { | 298 { |
299 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 299 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
300 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethodForMainWorld(info); | 300 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethodForMainWorld(info); |
301 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 301 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
302 } | 302 } |
303 | 303 |
304 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterFo
rMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info) | 304 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterFo
rMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info) |
305 { | 305 { |
306 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 306 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
307 static int privateTemplateUniqueKey; | 307 static int privateTemplateUniqueKey; |
308 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 308 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
309 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 309 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
310 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Undefi
ned(), v8::Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsol
ate())->rawTemplate(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorld
Type)), 0); | 310 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal::
doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Undefi
ned(), v8::Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsol
ate())->rawTemplate(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorld
Type)), 0); |
311 | 311 |
312 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 312 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestInterfaceCheckSecurity::GetTemplate(info.GetIsolate(), currentWorldType)); |
313 if (holder.IsEmpty()) { | 313 if (holder.IsEmpty()) { |
314 // This is only reachable via |object.__proto__.func|, in which case it | 314 // This is only reachable via |object.__proto__.func|, in which case it |
315 // has already passed the same origin security check | 315 // has already passed the same origin security check |
316 v8SetReturnValue(info, privateTemplate->GetFunction()); | 316 v8SetReturnValue(info, privateTemplate->GetFunction()); |
317 return; | 317 return; |
318 } | 318 } |
319 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); | 319 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol
der); |
320 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { | 320 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
321 static int sharedTemplateUniqueKey; | 321 static int sharedTemplateUniqueKey; |
322 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Unde
fined(), v8::Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIs
olate())->rawTemplate(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWor
ldType)), 0); | 322 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal
::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Unde
fined(), v8::Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIs
olate())->rawTemplate(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWor
ldType)), 0); |
323 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 323 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
324 return; | 324 return; |
325 } | 325 } |
326 | 326 |
327 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod", v8
::String::kInternalizedString)); | 327 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod", v8
::String::kInternalizedString)); |
328 if (!hiddenValue.IsEmpty()) { | 328 if (!hiddenValue.IsEmpty()) { |
329 v8SetReturnValue(info, hiddenValue); | 329 v8SetReturnValue(info, hiddenValue); |
330 return; | 330 return; |
331 } | 331 } |
332 | 332 |
333 v8SetReturnValue(info, privateTemplate->GetFunction()); | 333 v8SetReturnValue(info, privateTemplate->GetFunction()); |
334 } | 334 } |
335 | 335 |
336 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val
ue>& info) | 336 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val
ue>& info) |
337 { | 337 { |
338 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 338 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
339 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetterForMainWorld(info); | 339 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetterForMainWorld(info); |
340 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 340 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
341 } | 341 } |
342 | 342 |
343 static void doNotCheckSecurityReadOnlyVoidMethodMethod(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 343 static void doNotCheckSecurityReadOnlyVoidMethodMethod(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
344 { | 344 { |
345 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 345 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
346 imp->doNotCheckSecurityReadOnlyVoidMethod(); | 346 imp->doNotCheckSecurityReadOnlyVoidMethod(); |
347 } | 347 } |
348 | 348 |
349 static void doNotCheckSecurityReadOnlyVoidMethodMethodCallback(const v8::Functio
nCallbackInfo<v8::Value>& info) | 349 static void doNotCheckSecurityReadOnlyVoidMethodMethodCallback(const v8::Functio
nCallbackInfo<v8::Value>& info) |
350 { | 350 { |
351 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 351 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
352 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadOnlyVoidMethodMe
thod(info); | 352 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodMe
thod(info); |
353 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 353 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
354 } | 354 } |
355 | 355 |
356 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetter(const v8:
:PropertyCallbackInfo<v8::Value>& info) | 356 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetter(const v8:
:PropertyCallbackInfo<v8::Value>& info) |
357 { | 357 { |
358 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 358 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
359 static int privateTemplateUniqueKey; | 359 static int privateTemplateUniqueKey; |
360 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 360 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
361 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 361 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
362 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signature
::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplate(
&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); | 362 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal::
doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signature
::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplate(
&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); |
363 | 363 |
364 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 364 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestInterfaceCheckSecurity::GetTemplate(info.GetIsolate(), currentWorldType)); |
365 if (holder.IsEmpty()) { | 365 if (holder.IsEmpty()) { |
366 // This is only reachable via |object.__proto__.func|, in which case it | 366 // This is only reachable via |object.__proto__.func|, in which case it |
367 // has already passed the same origin security check | 367 // has already passed the same origin security check |
368 v8SetReturnValue(info, privateTemplate->GetFunction()); | 368 v8SetReturnValue(info, privateTemplate->GetFunction()); |
369 return; | 369 return; |
370 } | 370 } |
371 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); | 371 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol
der); |
372 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { | 372 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
373 static int sharedTemplateUniqueKey; | 373 static int sharedTemplateUniqueKey; |
374 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
::doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signatu
re::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplat
e(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); | 374 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal
::doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signatu
re::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplat
e(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); |
375 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 375 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
376 return; | 376 return; |
377 } | 377 } |
378 | 378 |
379 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityReadOnlyVoidMethod", v8::String
::kInternalizedString)); | 379 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityReadOnlyVoidMethod", v8::String
::kInternalizedString)); |
380 if (!hiddenValue.IsEmpty()) { | 380 if (!hiddenValue.IsEmpty()) { |
381 v8SetReturnValue(info, hiddenValue); | 381 v8SetReturnValue(info, hiddenValue); |
382 return; | 382 return; |
383 } | 383 } |
384 | 384 |
385 v8SetReturnValue(info, privateTemplate->GetFunction()); | 385 v8SetReturnValue(info, privateTemplate->GetFunction()); |
386 } | 386 } |
387 | 387 |
388 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCallback(v
8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 388 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCallback(v
8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
389 { | 389 { |
390 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 390 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
391 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadOnlyVoidMethodOr
iginSafeMethodGetter(info); | 391 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodOr
iginSafeMethodGetter(info); |
392 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 392 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
393 } | 393 } |
394 | 394 |
395 static void doNotCheckSecurityUnforgeableVoidMethodMethod(const v8::FunctionCall
backInfo<v8::Value>& info) | 395 static void doNotCheckSecurityUnforgeableVoidMethodMethod(const v8::FunctionCall
backInfo<v8::Value>& info) |
396 { | 396 { |
397 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 397 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
398 imp->doNotCheckSecurityUnforgeableVoidMethod(); | 398 imp->doNotCheckSecurityUnforgeableVoidMethod(); |
399 } | 399 } |
400 | 400 |
401 static void doNotCheckSecurityUnforgeableVoidMethodMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) | 401 static void doNotCheckSecurityUnforgeableVoidMethodMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) |
402 { | 402 { |
403 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 403 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
404 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dMethod(info); | 404 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dMethod(info); |
405 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 405 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
406 } | 406 } |
407 | 407 |
408 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetter(const
v8::PropertyCallbackInfo<v8::Value>& info) | 408 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetter(const
v8::PropertyCallbackInfo<v8::Value>& info) |
409 { | 409 { |
410 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 410 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
411 static int privateTemplateUniqueKey; | 411 static int privateTemplateUniqueKey; |
412 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 412 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
413 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 413 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
414 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Signat
ure::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTempla
te(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); | 414 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal::
doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Signat
ure::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTempla
te(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); |
415 | 415 |
416 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 416 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestInterfaceCheckSecurity::GetTemplate(info.GetIsolate(), currentWorldType)); |
417 if (holder.IsEmpty()) { | 417 if (holder.IsEmpty()) { |
418 // This is only reachable via |object.__proto__.func|, in which case it | 418 // This is only reachable via |object.__proto__.func|, in which case it |
419 // has already passed the same origin security check | 419 // has already passed the same origin security check |
420 v8SetReturnValue(info, privateTemplate->GetFunction()); | 420 v8SetReturnValue(info, privateTemplate->GetFunction()); |
421 return; | 421 return; |
422 } | 422 } |
423 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); | 423 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol
der); |
424 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { | 424 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
425 static int sharedTemplateUniqueKey; | 425 static int sharedTemplateUniqueKey; |
426 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal
::doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Sign
ature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemp
late(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); | 426 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal
::doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Sign
ature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemp
late(&V8TestInterfaceCheckSecurity::wrapperTypeInfo, currentWorldType)), 0); |
427 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 427 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
428 return; | 428 return; |
429 } | 429 } |
430 | 430 |
431 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityUnforgeableVoidMethod", v8::Str
ing::kInternalizedString)); | 431 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityUnforgeableVoidMethod", v8::Str
ing::kInternalizedString)); |
432 if (!hiddenValue.IsEmpty()) { | 432 if (!hiddenValue.IsEmpty()) { |
433 v8SetReturnValue(info, hiddenValue); | 433 v8SetReturnValue(info, hiddenValue); |
434 return; | 434 return; |
435 } | 435 } |
436 | 436 |
437 v8SetReturnValue(info, privateTemplate->GetFunction()); | 437 v8SetReturnValue(info, privateTemplate->GetFunction()); |
438 } | 438 } |
439 | 439 |
440 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetterCallbac
k(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 440 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetterCallbac
k(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
441 { | 441 { |
442 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 442 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
443 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dOriginSafeMethodGetter(info); | 443 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dOriginSafeMethodGetter(info); |
444 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 444 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
445 } | 445 } |
446 | 446 |
447 static void TestCheckSecurityInterfaceOriginSafeMethodSetter(v8::Local<v8::Strin
g> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
o) | 447 static void TestInterfaceCheckSecurityOriginSafeMethodSetter(v8::Local<v8::Strin
g> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
o) |
448 { | 448 { |
449 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), worldType(info.GetIso
late()))); | 449 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestInterfaceCheckSecurity::GetTemplate(info.GetIsolate(), worldType(info.GetIso
late()))); |
450 if (holder.IsEmpty()) | 450 if (holder.IsEmpty()) |
451 return; | 451 return; |
452 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); | 452 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol
der); |
453 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 453 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
454 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { | 454 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { |
455 exceptionState.throwIfNeeded(); | 455 exceptionState.throwIfNeeded(); |
456 return; | 456 return; |
457 } | 457 } |
458 | 458 |
459 info.This()->SetHiddenValue(name, jsValue); | 459 info.This()->SetHiddenValue(name, jsValue); |
460 } | 460 } |
461 | 461 |
462 static void TestCheckSecurityInterfaceOriginSafeMethodSetterCallback(v8::Local<v
8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<vo
id>& info) | 462 static void TestInterfaceCheckSecurityOriginSafeMethodSetterCallback(v8::Local<v
8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<vo
id>& info) |
463 { | 463 { |
464 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 464 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
465 TestCheckSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMe
thodSetter(name, jsValue, info); | 465 TestInterfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOriginSafeMe
thodSetter(name, jsValue, info); |
466 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 466 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
467 } | 467 } |
468 | 468 |
469 } // namespace TestCheckSecurityInterfaceV8Internal | 469 } // namespace TestInterfaceCheckSecurityV8Internal |
470 | 470 |
471 static const V8DOMConfiguration::AttributeConfiguration V8TestCheckSecurityInter
faceAttributes[] = { | 471 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceCheckSecu
rityAttributes[] = { |
472 {"longAttribute", TestCheckSecurityInterfaceV8Internal::longAttributeAttribu
teGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stati
c_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 472 {"longAttribute", TestInterfaceCheckSecurityV8Internal::longAttributeAttribu
teGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stati
c_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
473 {"doNotCheckSecurityLongAttribute", TestCheckSecurityInterfaceV8Internal::do
NotCheckSecurityLongAttributeAttributeGetterCallback, TestCheckSecurityInterface
V8Internal::doNotCheckSecurityLongAttributeAttributeSetterCallback, 0, 0, 0, sta
tic_cast<v8::AccessControl>(v8::ALL_CAN_READ | v8::ALL_CAN_WRITE), static_cast<v
8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 473 {"doNotCheckSecurityLongAttribute", TestInterfaceCheckSecurityV8Internal::do
NotCheckSecurityLongAttributeAttributeGetterCallback, TestInterfaceCheckSecurity
V8Internal::doNotCheckSecurityLongAttributeAttributeSetterCallback, 0, 0, 0, sta
tic_cast<v8::AccessControl>(v8::ALL_CAN_READ | v8::ALL_CAN_WRITE), static_cast<v
8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
474 {"doNotCheckSecurityReadonlyLongAttribute", TestCheckSecurityInterfaceV8Inte
rnal::doNotCheckSecurityReadonlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0
, static_cast<v8::AccessControl>(v8::ALL_CAN_READ), static_cast<v8::PropertyAttr
ibute>(v8::None), 0 /* on instance */}, | 474 {"doNotCheckSecurityReadonlyLongAttribute", TestInterfaceCheckSecurityV8Inte
rnal::doNotCheckSecurityReadonlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0
, static_cast<v8::AccessControl>(v8::ALL_CAN_READ), static_cast<v8::PropertyAttr
ibute>(v8::None), 0 /* on instance */}, |
475 {"doNotCheckSecurityOnSetterLongAttribute", TestCheckSecurityInterfaceV8Inte
rnal::doNotCheckSecurityOnSetterLongAttributeAttributeGetterCallback, TestCheckS
ecurityInterfaceV8Internal::doNotCheckSecurityOnSetterLongAttributeAttributeSett
erCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::ALL_CAN_WRITE), static_c
ast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 475 {"doNotCheckSecurityOnSetterLongAttribute", TestInterfaceCheckSecurityV8Inte
rnal::doNotCheckSecurityOnSetterLongAttributeAttributeGetterCallback, TestInterf
aceCheckSecurityV8Internal::doNotCheckSecurityOnSetterLongAttributeAttributeSett
erCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::ALL_CAN_WRITE), static_c
ast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
476 }; | 476 }; |
477 | 477 |
478 static const V8DOMConfiguration::MethodConfiguration V8TestCheckSecurityInterfac
eMethods[] = { | 478 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceCheckSecurit
yMethods[] = { |
479 {"voidMethod", TestCheckSecurityInterfaceV8Internal::voidMethodMethodCallbac
k, 0, 0}, | 479 {"voidMethod", TestInterfaceCheckSecurityV8Internal::voidMethodMethodCallbac
k, 0, 0}, |
480 }; | 480 }; |
481 | 481 |
482 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestCheckSecurityInterfaceTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) | 482 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceCheckSecurityTem
plate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, W
rapperWorldType currentWorldType) |
483 { | 483 { |
484 functionTemplate->ReadOnlyPrototype(); | 484 functionTemplate->ReadOnlyPrototype(); |
485 | 485 |
486 v8::Local<v8::Signature> defaultSignature; | 486 v8::Local<v8::Signature> defaultSignature; |
487 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestCheckSecurityInterface", v8::Local<v8::FunctionTemplate>(), V8TestChec
kSecurityInterface::internalFieldCount, | 487 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceCheckSecurity", v8::Local<v8::FunctionTemplate>(), V8TestInte
rfaceCheckSecurity::internalFieldCount, |
488 V8TestCheckSecurityInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestCheckSecu
rityInterfaceAttributes), | 488 V8TestInterfaceCheckSecurityAttributes, WTF_ARRAY_LENGTH(V8TestInterface
CheckSecurityAttributes), |
489 0, 0, | 489 0, 0, |
490 V8TestCheckSecurityInterfaceMethods, WTF_ARRAY_LENGTH(V8TestCheckSecurit
yInterfaceMethods), | 490 V8TestInterfaceCheckSecurityMethods, WTF_ARRAY_LENGTH(V8TestInterfaceChe
ckSecurityMethods), |
491 isolate, currentWorldType); | 491 isolate, currentWorldType); |
492 UNUSED_PARAM(defaultSignature); | 492 UNUSED_PARAM(defaultSignature); |
493 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 493 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
494 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 494 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
495 UNUSED_PARAM(instanceTemplate); | 495 UNUSED_PARAM(instanceTemplate); |
496 UNUSED_PARAM(prototypeTemplate); | 496 UNUSED_PARAM(prototypeTemplate); |
497 instanceTemplate->SetAccessCheckCallbacks(TestCheckSecurityInterfaceV8Intern
al::namedSecurityCheck, TestCheckSecurityInterfaceV8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestCheckSecurity
Interface::wrapperTypeInfo))); | 497 instanceTemplate->SetAccessCheckCallbacks(TestInterfaceCheckSecurityV8Intern
al::namedSecurityCheck, TestInterfaceCheckSecurityV8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestInterfaceChec
kSecurity::wrapperTypeInfo))); |
498 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS
ecurityVoidMethod", v8::String::kInternalizedString), TestCheckSecurityInterface
V8Internal::doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback, TestChec
kSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSetterCa
llback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::
DontDelete)); | 498 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS
ecurityVoidMethod", v8::String::kInternalizedString), TestInterfaceCheckSecurity
V8Internal::doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback, TestInte
rfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOriginSafeMethodSetterCa
llback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::
DontDelete)); |
499 if (currentWorldType == MainWorld) { | 499 if (currentWorldType == MainWorld) { |
500 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh
eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestCh
eckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig
inSafeMethodGetterCallbackForMainWorld, TestCheckSecurityInterfaceV8Internal::Te
stCheckSecurityInterfaceOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_C
AN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)); | 500 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh
eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestIn
terfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig
inSafeMethodGetterCallbackForMainWorld, TestInterfaceCheckSecurityV8Internal::Te
stInterfaceCheckSecurityOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_C
AN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)); |
501 } else { | 501 } else { |
502 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh
eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestCh
eckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig
inSafeMethodGetterCallback, TestCheckSecurityInterfaceV8Internal::TestCheckSecur
ityInterfaceOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, sta
tic_cast<v8::PropertyAttribute>(v8::DontDelete)); | 502 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh
eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestIn
terfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig
inSafeMethodGetterCallback, TestInterfaceCheckSecurityV8Internal::TestInterfaceC
heckSecurityOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, sta
tic_cast<v8::PropertyAttribute>(v8::DontDelete)); |
503 } | 503 } |
504 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS
ecurityReadOnlyVoidMethod", v8::String::kInternalizedString), TestCheckSecurityI
nterfaceV8Internal::doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCa
llback, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v
8::DontDelete | v8::ReadOnly)); | 504 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS
ecurityReadOnlyVoidMethod", v8::String::kInternalizedString), TestInterfaceCheck
SecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCa
llback, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v
8::DontDelete | v8::ReadOnly)); |
505 instanceTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckSe
curityUnforgeableVoidMethod", v8::String::kInternalizedString), TestCheckSecurit
yInterfaceV8Internal::doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGet
terCallback, TestCheckSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOri
ginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::Pr
opertyAttribute>(v8::DontDelete)); | 505 instanceTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckSe
curityUnforgeableVoidMethod", v8::String::kInternalizedString), TestInterfaceChe
ckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGet
terCallback, TestInterfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOri
ginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::Pr
opertyAttribute>(v8::DontDelete)); |
506 | 506 |
507 // Custom toString template | 507 // Custom toString template |
508 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 508 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
509 return functionTemplate; | 509 return functionTemplate; |
510 } | 510 } |
511 | 511 |
512 v8::Handle<v8::FunctionTemplate> V8TestCheckSecurityInterface::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) | 512 v8::Handle<v8::FunctionTemplate> V8TestInterfaceCheckSecurity::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) |
513 { | 513 { |
514 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 514 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
515 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 515 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
516 if (result != data->templateMap(currentWorldType).end()) | 516 if (result != data->templateMap(currentWorldType).end()) |
517 return result->value.newLocal(isolate); | 517 return result->value.newLocal(isolate); |
518 | 518 |
519 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 519 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
520 v8::EscapableHandleScope handleScope(isolate); | 520 v8::EscapableHandleScope handleScope(isolate); |
521 v8::Local<v8::FunctionTemplate> templ = | 521 v8::Local<v8::FunctionTemplate> templ = |
522 ConfigureV8TestCheckSecurityInterfaceTemplate(data->rawTemplate(&wrapper
TypeInfo, currentWorldType), isolate, currentWorldType); | 522 ConfigureV8TestInterfaceCheckSecurityTemplate(data->rawTemplate(&wrapper
TypeInfo, currentWorldType), isolate, currentWorldType); |
523 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 523 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
524 return handleScope.Escape(templ); | 524 return handleScope.Escape(templ); |
525 } | 525 } |
526 | 526 |
527 bool V8TestCheckSecurityInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate, WrapperWorldType currentWorldType) | 527 bool V8TestInterfaceCheckSecurity::hasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate, WrapperWorldType currentWorldType) |
528 { | 528 { |
529 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 529 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
530 } | 530 } |
531 | 531 |
532 bool V8TestCheckSecurityInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate) | 532 bool V8TestInterfaceCheckSecurity::hasInstanceInAnyWorld(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate) |
533 { | 533 { |
534 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 534 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
535 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | 535 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
536 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | 536 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
537 } | 537 } |
538 | 538 |
539 v8::Handle<v8::Object> V8TestCheckSecurityInterface::createWrapper(PassRefPtr<Te
stCheckSecurityInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isol
ate* isolate) | 539 v8::Handle<v8::Object> V8TestInterfaceCheckSecurity::createWrapper(PassRefPtr<Te
stInterfaceCheckSecurity> impl, v8::Handle<v8::Object> creationContext, v8::Isol
ate* isolate) |
540 { | 540 { |
541 ASSERT(impl); | 541 ASSERT(impl); |
542 ASSERT(!DOMDataStore::containsWrapper<V8TestCheckSecurityInterface>(impl.get
(), isolate)); | 542 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceCheckSecurity>(impl.get
(), isolate)); |
543 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 543 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
544 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 544 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
545 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 545 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
546 // the same object de-ref functions, though, so use that as the basis of
the check. | 546 // the same object de-ref functions, though, so use that as the basis of
the check. |
547 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 547 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
548 } | 548 } |
549 | 549 |
550 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 550 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
551 if (UNLIKELY(wrapper.IsEmpty())) | 551 if (UNLIKELY(wrapper.IsEmpty())) |
552 return wrapper; | 552 return wrapper; |
553 | 553 |
554 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 554 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
555 V8DOMWrapper::associateObjectWithWrapper<V8TestCheckSecurityInterface>(impl,
&wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 555 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceCheckSecurity>(impl,
&wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
556 return wrapper; | 556 return wrapper; |
557 } | 557 } |
558 | 558 |
559 void V8TestCheckSecurityInterface::derefObject(void* object) | 559 void V8TestInterfaceCheckSecurity::derefObject(void* object) |
560 { | 560 { |
561 fromInternalPointer(object)->deref(); | 561 fromInternalPointer(object)->deref(); |
562 } | 562 } |
563 | 563 |
564 template<> | 564 template<> |
565 v8::Handle<v8::Value> toV8NoInline(TestCheckSecurityInterface* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) | 565 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) |
566 { | 566 { |
567 return toV8(impl, creationContext, isolate); | 567 return toV8(impl, creationContext, isolate); |
568 } | 568 } |
569 | 569 |
570 } // namespace WebCore | 570 } // namespace WebCore |
OLD | NEW |