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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::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 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethod"
, "TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate()); |
171 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); | 172 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
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 TestInterfaceCheckSecurityV8Internal::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 ExceptionState exceptionState(ExceptionState::ExecutionContext, "doNotCheckS
ecurityVoidMethod", "TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate
()); |
189 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); | 190 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
190 imp->doNotCheckSecurityVoidMethod(); | 191 imp->doNotCheckSecurityVoidMethod(); |
191 } | 192 } |
192 | 193 |
193 static void doNotCheckSecurityVoidMethodMethodCallback(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 194 static void doNotCheckSecurityVoidMethodMethodCallback(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
194 { | 195 { |
195 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 196 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
196 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodMethod(inf
o); | 197 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodMethod(inf
o); |
197 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 198 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
198 } | 199 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 232 |
232 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback(v8::Local
<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 233 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback(v8::Local
<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
233 { | 234 { |
234 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 235 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
235 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodOriginSafe
MethodGetter(info); | 236 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodOriginSafe
MethodGetter(info); |
236 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 237 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
237 } | 238 } |
238 | 239 |
239 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethod(const v8::Functio
nCallbackInfo<v8::Value>& info) | 240 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethod(const v8::Functio
nCallbackInfo<v8::Value>& info) |
240 { | 241 { |
| 242 ExceptionState exceptionState(ExceptionState::ExecutionContext, "doNotCheckS
ecurityPerWorldBindingsVoidMethod", "TestInterfaceCheckSecurity", info.Holder(),
info.GetIsolate()); |
241 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); | 243 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
242 imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); | 244 imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); |
243 } | 245 } |
244 | 246 |
245 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback(const v8:
:FunctionCallbackInfo<v8::Value>& info) | 247 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback(const v8:
:FunctionCallbackInfo<v8::Value>& info) |
246 { | 248 { |
247 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 249 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
248 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethod(info); | 250 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethod(info); |
249 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 251 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
250 } | 252 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 285 |
284 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 286 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
285 { | 287 { |
286 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 288 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
287 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetter(info); | 289 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetter(info); |
288 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 290 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
289 } | 291 } |
290 | 292 |
291 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodForMainWorld(const
v8::FunctionCallbackInfo<v8::Value>& info) | 293 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodForMainWorld(const
v8::FunctionCallbackInfo<v8::Value>& info) |
292 { | 294 { |
| 295 ExceptionState exceptionState(ExceptionState::ExecutionContext, "doNotCheckS
ecurityPerWorldBindingsVoidMethod", "TestInterfaceCheckSecurity", info.Holder(),
info.GetIsolate()); |
293 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); | 296 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
294 imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); | 297 imp->doNotCheckSecurityPerWorldBindingsVoidMethod(); |
295 } | 298 } |
296 | 299 |
297 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWor
ld(const v8::FunctionCallbackInfo<v8::Value>& info) | 300 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWor
ld(const v8::FunctionCallbackInfo<v8::Value>& info) |
298 { | 301 { |
299 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 302 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
300 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethodForMainWorld(info); | 303 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethodForMainWorld(info); |
301 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 304 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
302 } | 305 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 338 |
336 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val
ue>& info) | 339 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val
ue>& info) |
337 { | 340 { |
338 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 341 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
339 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetterForMainWorld(info); | 342 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetterForMainWorld(info); |
340 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 343 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
341 } | 344 } |
342 | 345 |
343 static void doNotCheckSecurityReadOnlyVoidMethodMethod(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 346 static void doNotCheckSecurityReadOnlyVoidMethodMethod(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
344 { | 347 { |
| 348 ExceptionState exceptionState(ExceptionState::ExecutionContext, "doNotCheckS
ecurityReadOnlyVoidMethod", "TestInterfaceCheckSecurity", info.Holder(), info.Ge
tIsolate()); |
345 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); | 349 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
346 imp->doNotCheckSecurityReadOnlyVoidMethod(); | 350 imp->doNotCheckSecurityReadOnlyVoidMethod(); |
347 } | 351 } |
348 | 352 |
349 static void doNotCheckSecurityReadOnlyVoidMethodMethodCallback(const v8::Functio
nCallbackInfo<v8::Value>& info) | 353 static void doNotCheckSecurityReadOnlyVoidMethodMethodCallback(const v8::Functio
nCallbackInfo<v8::Value>& info) |
350 { | 354 { |
351 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 355 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
352 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodMe
thod(info); | 356 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodMe
thod(info); |
353 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 357 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
354 } | 358 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 391 |
388 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCallback(v
8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 392 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCallback(v
8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
389 { | 393 { |
390 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 394 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
391 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodOr
iginSafeMethodGetter(info); | 395 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReadOnlyVoidMethodOr
iginSafeMethodGetter(info); |
392 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 396 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
393 } | 397 } |
394 | 398 |
395 static void doNotCheckSecurityUnforgeableVoidMethodMethod(const v8::FunctionCall
backInfo<v8::Value>& info) | 399 static void doNotCheckSecurityUnforgeableVoidMethodMethod(const v8::FunctionCall
backInfo<v8::Value>& info) |
396 { | 400 { |
| 401 ExceptionState exceptionState(ExceptionState::ExecutionContext, "doNotCheckS
ecurityUnforgeableVoidMethod", "TestInterfaceCheckSecurity", info.Holder(), info
.GetIsolate()); |
397 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); | 402 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
398 imp->doNotCheckSecurityUnforgeableVoidMethod(); | 403 imp->doNotCheckSecurityUnforgeableVoidMethod(); |
399 } | 404 } |
400 | 405 |
401 static void doNotCheckSecurityUnforgeableVoidMethodMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) | 406 static void doNotCheckSecurityUnforgeableVoidMethodMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) |
402 { | 407 { |
403 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 408 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
404 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dMethod(info); | 409 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dMethod(info); |
405 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 410 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
406 } | 411 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dOriginSafeMethodGetter(info); | 448 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dOriginSafeMethodGetter(info); |
444 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 449 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
445 } | 450 } |
446 | 451 |
447 static void TestInterfaceCheckSecurityOriginSafeMethodSetter(v8::Local<v8::Strin
g> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
o) | 452 static void TestInterfaceCheckSecurityOriginSafeMethodSetter(v8::Local<v8::Strin
g> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
o) |
448 { | 453 { |
449 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestInterfaceCheckSecurity::GetTemplate(info.GetIsolate(), worldType(info.GetIso
late()))); | 454 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestInterfaceCheckSecurity::GetTemplate(info.GetIsolate(), worldType(info.GetIso
late()))); |
450 if (holder.IsEmpty()) | 455 if (holder.IsEmpty()) |
451 return; | 456 return; |
452 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol
der); | 457 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol
der); |
453 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 458 v8::String::Utf8Value attributeName(name); |
| 459 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName,
"TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate()); |
454 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { | 460 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { |
455 exceptionState.throwIfNeeded(); | 461 exceptionState.throwIfNeeded(); |
456 return; | 462 return; |
457 } | 463 } |
458 | 464 |
459 info.This()->SetHiddenValue(name, jsValue); | 465 info.This()->SetHiddenValue(name, jsValue); |
460 } | 466 } |
461 | 467 |
462 static void TestInterfaceCheckSecurityOriginSafeMethodSetterCallback(v8::Local<v
8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<vo
id>& info) | 468 static void TestInterfaceCheckSecurityOriginSafeMethodSetterCallback(v8::Local<v
8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<vo
id>& info) |
463 { | 469 { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 fromInternalPointer(object)->deref(); | 567 fromInternalPointer(object)->deref(); |
562 } | 568 } |
563 | 569 |
564 template<> | 570 template<> |
565 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) | 571 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) |
566 { | 572 { |
567 return toV8(impl, creationContext, isolate); | 573 return toV8(impl, creationContext, isolate); |
568 } | 574 } |
569 | 575 |
570 } // namespace WebCore | 576 } // namespace WebCore |
OLD | NEW |