| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 | 161 |
| 162 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8
::AccessType type, v8::Local<v8::Value>) | 162 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8
::AccessType type, v8::Local<v8::Value>) |
| 163 { | 163 { |
| 164 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(ho
st); | 164 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(ho
st); |
| 165 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
curityError); | 165 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe
curityError); |
| 166 } | 166 } |
| 167 | 167 |
| 168 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 168 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 169 { | 169 { |
| 170 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethod"
, "TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate()); |
| 170 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); | 171 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(inf
o.Holder()); |
| 171 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
| 172 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { | 172 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { |
| 173 exceptionState.throwIfNeeded(); | 173 exceptionState.throwIfNeeded(); |
| 174 return; | 174 return; |
| 175 } | 175 } |
| 176 imp->voidMethod(); | 176 imp->voidMethod(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | 179 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 180 { | 180 { |
| 181 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 181 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dOriginSafeMethodGetter(info); | 442 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dOriginSafeMethodGetter(info); |
| 443 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 443 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 444 } | 444 } |
| 445 | 445 |
| 446 static void TestInterfaceCheckSecurityOriginSafeMethodSetter(v8::Local<v8::Strin
g> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
o) | 446 static void TestInterfaceCheckSecurityOriginSafeMethodSetter(v8::Local<v8::Strin
g> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
o) |
| 447 { | 447 { |
| 448 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestInterfaceCheckSecurity::GetTemplate(info.GetIsolate(), worldType(info.GetIso
late()))); | 448 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestInterfaceCheckSecurity::GetTemplate(info.GetIsolate(), worldType(info.GetIso
late()))); |
| 449 if (holder.IsEmpty()) | 449 if (holder.IsEmpty()) |
| 450 return; | 450 return; |
| 451 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol
der); | 451 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol
der); |
| 452 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 452 v8::String::Utf8Value attributeName(name); |
| 453 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName,
"TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate()); |
| 453 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { | 454 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { |
| 454 exceptionState.throwIfNeeded(); | 455 exceptionState.throwIfNeeded(); |
| 455 return; | 456 return; |
| 456 } | 457 } |
| 457 | 458 |
| 458 info.This()->SetHiddenValue(name, jsValue); | 459 info.This()->SetHiddenValue(name, jsValue); |
| 459 } | 460 } |
| 460 | 461 |
| 461 static void TestInterfaceCheckSecurityOriginSafeMethodSetterCallback(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) |
| 462 { | 463 { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 fromInternalPointer(object)->deref(); | 561 fromInternalPointer(object)->deref(); |
| 561 } | 562 } |
| 562 | 563 |
| 563 template<> | 564 template<> |
| 564 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* 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) |
| 565 { | 566 { |
| 566 return toV8(impl, creationContext, isolate); | 567 return toV8(impl, creationContext, isolate); |
| 567 } | 568 } |
| 568 | 569 |
| 569 } // namespace WebCore | 570 } // namespace WebCore |
| OLD | NEW |