| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| 6 | 6 |
| 7 #include "config.h" | 7 #include "config.h" |
| 8 #include "V8TestInterfaceCheckSecurity.h" | 8 #include "V8TestInterfaceCheckSecurity.h" |
| 9 | 9 |
| 10 #include "bindings/core/v8/BindingSecurity.h" | 10 #include "bindings/core/v8/BindingSecurity.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // bindings/core/v8/ScriptWrappable.h. | 42 // bindings/core/v8/ScriptWrappable.h. |
| 43 const WrapperTypeInfo& TestInterfaceCheckSecurity::s_wrapperTypeInfo = V8TestInt
erfaceCheckSecurity::wrapperTypeInfo; | 43 const WrapperTypeInfo& TestInterfaceCheckSecurity::s_wrapperTypeInfo = V8TestInt
erfaceCheckSecurity::wrapperTypeInfo; |
| 44 | 44 |
| 45 namespace TestInterfaceCheckSecurityV8Internal { | 45 namespace TestInterfaceCheckSecurityV8Internal { |
| 46 | 46 |
| 47 template <typename T> void V8_USE(T) { } | 47 template <typename T> void V8_USE(T) { } |
| 48 | 48 |
| 49 static void longAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Valu
e>& info) | 49 static void longAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Valu
e>& info) |
| 50 { | 50 { |
| 51 v8::Handle<v8::Object> holder = info.Holder(); | 51 v8::Handle<v8::Object> holder = info.Holder(); |
| 52 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 52 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 53 v8SetReturnValueInt(info, impl->longAttribute()); | 53 v8SetReturnValueInt(info, impl->longAttribute()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 static void longAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8
::PropertyCallbackInfo<v8::Value>& info) | 56 static void longAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8
::PropertyCallbackInfo<v8::Value>& info) |
| 57 { | 57 { |
| 58 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 58 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 59 TestInterfaceCheckSecurityV8Internal::longAttributeAttributeGetter(info); | 59 TestInterfaceCheckSecurityV8Internal::longAttributeAttributeGetter(info); |
| 60 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 60 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 61 } | 61 } |
| 62 | 62 |
| 63 static void doNotCheckSecurityLongAttributeAttributeGetter(const v8::PropertyCal
lbackInfo<v8::Value>& info) | 63 static void doNotCheckSecurityLongAttributeAttributeGetter(const v8::PropertyCal
lbackInfo<v8::Value>& info) |
| 64 { | 64 { |
| 65 v8::Handle<v8::Object> holder = info.Holder(); | 65 v8::Handle<v8::Object> holder = info.Holder(); |
| 66 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 66 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 67 v8SetReturnValueInt(info, impl->doNotCheckSecurityLongAttribute()); | 67 v8SetReturnValueInt(info, impl->doNotCheckSecurityLongAttribute()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 static void doNotCheckSecurityLongAttributeAttributeGetterCallback(v8::Local<v8:
:String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 70 static void doNotCheckSecurityLongAttributeAttributeGetterCallback(v8::Local<v8:
:String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 71 { | 71 { |
| 72 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 72 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 73 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityLongAttributeAttribu
teGetter(info); | 73 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityLongAttributeAttribu
teGetter(info); |
| 74 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 74 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 75 } | 75 } |
| 76 | 76 |
| 77 static void doNotCheckSecurityLongAttributeAttributeSetter(v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<void>& info) | 77 static void doNotCheckSecurityLongAttributeAttributeSetter(v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<void>& info) |
| 78 { | 78 { |
| 79 v8::Handle<v8::Object> holder = info.Holder(); | 79 v8::Handle<v8::Object> holder = info.Holder(); |
| 80 ExceptionState exceptionState(ExceptionState::SetterContext, "doNotCheckSecu
rityLongAttribute", "TestInterfaceCheckSecurity", holder, info.GetIsolate()); | 80 ExceptionState exceptionState(ExceptionState::SetterContext, "doNotCheckSecu
rityLongAttribute", "TestInterfaceCheckSecurity", holder, info.GetIsolate()); |
| 81 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 81 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 82 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState)
, exceptionState); | 82 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState)
, exceptionState); |
| 83 impl->setDoNotCheckSecurityLongAttribute(cppValue); | 83 impl->setDoNotCheckSecurityLongAttribute(cppValue); |
| 84 } | 84 } |
| 85 | 85 |
| 86 static void doNotCheckSecurityLongAttributeAttributeSetterCallback(v8::Local<v8:
:String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& in
fo) | 86 static void doNotCheckSecurityLongAttributeAttributeSetterCallback(v8::Local<v8:
:String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& in
fo) |
| 87 { | 87 { |
| 88 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | 88 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| 89 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityLongAttributeAttribu
teSetter(v8Value, info); | 89 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityLongAttributeAttribu
teSetter(v8Value, info); |
| 90 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 90 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 91 } | 91 } |
| 92 | 92 |
| 93 static void doNotCheckSecurityReadonlyLongAttributeAttributeGetter(const v8::Pro
pertyCallbackInfo<v8::Value>& info) | 93 static void doNotCheckSecurityReadonlyLongAttributeAttributeGetter(const v8::Pro
pertyCallbackInfo<v8::Value>& info) |
| 94 { | 94 { |
| 95 v8::Handle<v8::Object> holder = info.Holder(); | 95 v8::Handle<v8::Object> holder = info.Holder(); |
| 96 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 96 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 97 v8SetReturnValueInt(info, impl->doNotCheckSecurityReadonlyLongAttribute()); | 97 v8SetReturnValueInt(info, impl->doNotCheckSecurityReadonlyLongAttribute()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 static void doNotCheckSecurityReadonlyLongAttributeAttributeGetterCallback(v8::L
ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 100 static void doNotCheckSecurityReadonlyLongAttributeAttributeGetterCallback(v8::L
ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 101 { | 101 { |
| 102 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 102 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 103 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReadonlyLongAttribut
eAttributeGetter(info); | 103 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReadonlyLongAttribut
eAttributeGetter(info); |
| 104 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 104 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 105 } | 105 } |
| 106 | 106 |
| 107 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetter(const v8::Pro
pertyCallbackInfo<v8::Value>& info) | 107 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetter(const v8::Pro
pertyCallbackInfo<v8::Value>& info) |
| 108 { | 108 { |
| 109 v8::Handle<v8::Object> holder = info.Holder(); | 109 v8::Handle<v8::Object> holder = info.Holder(); |
| 110 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 110 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 111 v8SetReturnValueInt(info, impl->doNotCheckSecurityOnSetterLongAttribute()); | 111 v8SetReturnValueInt(info, impl->doNotCheckSecurityOnSetterLongAttribute()); |
| 112 } | 112 } |
| 113 | 113 |
| 114 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetterCallback(v8::L
ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 114 static void doNotCheckSecurityOnSetterLongAttributeAttributeGetterCallback(v8::L
ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 115 { | 115 { |
| 116 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 116 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 117 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityOnSetterLongAttribut
eAttributeGetter(info); | 117 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityOnSetterLongAttribut
eAttributeGetter(info); |
| 118 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 118 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 119 } | 119 } |
| 120 | 120 |
| 121 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetter(v8::Local<v8:
:Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | 121 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetter(v8::Local<v8:
:Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| 122 { | 122 { |
| 123 v8::Handle<v8::Object> holder = info.Holder(); | 123 v8::Handle<v8::Object> holder = info.Holder(); |
| 124 ExceptionState exceptionState(ExceptionState::SetterContext, "doNotCheckSecu
rityOnSetterLongAttribute", "TestInterfaceCheckSecurity", holder, info.GetIsolat
e()); | 124 ExceptionState exceptionState(ExceptionState::SetterContext, "doNotCheckSecu
rityOnSetterLongAttribute", "TestInterfaceCheckSecurity", holder, info.GetIsolat
e()); |
| 125 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 125 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 126 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState)
, exceptionState); | 126 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState)
, exceptionState); |
| 127 impl->setDoNotCheckSecurityOnSetterLongAttribute(cppValue); | 127 impl->setDoNotCheckSecurityOnSetterLongAttribute(cppValue); |
| 128 } | 128 } |
| 129 | 129 |
| 130 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetterCallback(v8::L
ocal<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v
oid>& info) | 130 static void doNotCheckSecurityOnSetterLongAttributeAttributeSetterCallback(v8::L
ocal<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v
oid>& info) |
| 131 { | 131 { |
| 132 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | 132 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
| 133 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityOnSetterLongAttribut
eAttributeSetter(v8Value, info); | 133 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityOnSetterLongAttribut
eAttributeSetter(v8Value, info); |
| 134 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 134 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 135 } | 135 } |
| 136 | 136 |
| 137 static void doNotCheckSecurityReplaceableReadonlyLongAttributeAttributeGetter(co
nst v8::PropertyCallbackInfo<v8::Value>& info) | 137 static void doNotCheckSecurityReplaceableReadonlyLongAttributeAttributeGetter(co
nst v8::PropertyCallbackInfo<v8::Value>& info) |
| 138 { | 138 { |
| 139 v8::Handle<v8::Object> holder = info.Holder(); | 139 v8::Handle<v8::Object> holder = info.Holder(); |
| 140 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 140 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 141 v8SetReturnValueInt(info, impl->doNotCheckSecurityReplaceableReadonlyLongAtt
ribute()); | 141 v8SetReturnValueInt(info, impl->doNotCheckSecurityReplaceableReadonlyLongAtt
ribute()); |
| 142 } | 142 } |
| 143 | 143 |
| 144 static void doNotCheckSecurityReplaceableReadonlyLongAttributeAttributeGetterCal
lback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 144 static void doNotCheckSecurityReplaceableReadonlyLongAttributeAttributeGetterCal
lback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 145 { | 145 { |
| 146 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 146 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 147 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReplaceableReadonlyL
ongAttributeAttributeGetter(info); | 147 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityReplaceableReadonlyL
ongAttributeAttributeGetter(info); |
| 148 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 148 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 149 } | 149 } |
| 150 | 150 |
| 151 static void TestInterfaceCheckSecurityForceSetAttributeOnThis(v8::Local<v8::Stri
ng> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& in
fo) | 151 static void TestInterfaceCheckSecurityForceSetAttributeOnThis(v8::Local<v8::Stri
ng> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& in
fo) |
| 152 { | 152 { |
| 153 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(in
fo.Holder()); | 153 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(info
.Holder()); |
| 154 v8::String::Utf8Value attributeName(name); | 154 v8::String::Utf8Value attributeName(name); |
| 155 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName,
"TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate()); | 155 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName,
"TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate()); |
| 156 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { | 156 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { |
| 157 exceptionState.throwIfNeeded(); | 157 exceptionState.throwIfNeeded(); |
| 158 return; | 158 return; |
| 159 } | 159 } |
| 160 if (info.This()->IsObject()) | 160 if (info.This()->IsObject()) |
| 161 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); | 161 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); |
| 162 } | 162 } |
| 163 | 163 |
| 164 static void TestInterfaceCheckSecurityForceSetAttributeOnThisCallback(v8::Local<
v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v
oid>& info) | 164 static void TestInterfaceCheckSecurityForceSetAttributeOnThisCallback(v8::Local<
v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v
oid>& info) |
| 165 { | 165 { |
| 166 TestInterfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityForceSetAttr
ibuteOnThis(name, v8Value, info); | 166 TestInterfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityForceSetAttr
ibuteOnThis(name, v8Value, info); |
| 167 } | 167 } |
| 168 | 168 |
| 169 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access
Type type, v8::Local<v8::Value>) | 169 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access
Type type, v8::Local<v8::Value>) |
| 170 { | 170 { |
| 171 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
st); | 171 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(host
); |
| 172 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(),
impl->frame(), DoNotReportSecurityError); | 172 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(),
impl->frame(), DoNotReportSecurityError); |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8
::AccessType type, v8::Local<v8::Value>) | 175 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8
::AccessType type, v8::Local<v8::Value>) |
| 176 { | 176 { |
| 177 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
st); | 177 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(host
); |
| 178 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(),
impl->frame(), DoNotReportSecurityError); | 178 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(),
impl->frame(), DoNotReportSecurityError); |
| 179 } | 179 } |
| 180 | 180 |
| 181 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 181 static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 182 { | 182 { |
| 183 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethod"
, "TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate()); | 183 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethod"
, "TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate()); |
| 184 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(in
fo.Holder()); | 184 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(info
.Holder()); |
| 185 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { | 185 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { |
| 186 exceptionState.throwIfNeeded(); | 186 exceptionState.throwIfNeeded(); |
| 187 return; | 187 return; |
| 188 } | 188 } |
| 189 impl->voidMethod(); | 189 impl->voidMethod(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | 192 static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 193 { | 193 { |
| 194 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 194 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 195 TestInterfaceCheckSecurityV8Internal::voidMethodMethod(info); | 195 TestInterfaceCheckSecurityV8Internal::voidMethodMethod(info); |
| 196 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 196 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 197 } | 197 } |
| 198 | 198 |
| 199 static void doNotCheckSecurityVoidMethodMethod(const v8::FunctionCallbackInfo<v8
::Value>& info) | 199 static void doNotCheckSecurityVoidMethodMethod(const v8::FunctionCallbackInfo<v8
::Value>& info) |
| 200 { | 200 { |
| 201 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(in
fo.Holder()); | 201 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(info
.Holder()); |
| 202 impl->doNotCheckSecurityVoidMethod(); | 202 impl->doNotCheckSecurityVoidMethod(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 static void doNotCheckSecurityVoidMethodMethodCallback(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 205 static void doNotCheckSecurityVoidMethodMethodCallback(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
| 206 { | 206 { |
| 207 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 207 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 208 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodMethod(inf
o); | 208 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodMethod(inf
o); |
| 209 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 209 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 210 } | 210 } |
| 211 | 211 |
| 212 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetter(const v8::Propert
yCallbackInfo<v8::Value>& info) | 212 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetter(const v8::Propert
yCallbackInfo<v8::Value>& info) |
| 213 { | 213 { |
| 214 static int domTemplateKey; // This address is used for a key to look up the
dom template. | 214 static int domTemplateKey; // This address is used for a key to look up the
dom template. |
| 215 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 215 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 216 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem
plateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodMeth
odCallback, v8Undefined(), v8::Signature::New(info.GetIsolate(), V8TestInterface
CheckSecurity::domTemplate(info.GetIsolate())), 0); | 216 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem
plateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodMeth
odCallback, v8Undefined(), v8::Signature::New(info.GetIsolate(), V8TestInterface
CheckSecurity::domTemplate(info.GetIsolate())), 0); |
| 217 | 217 |
| 218 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); | 218 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); |
| 219 if (holder.IsEmpty()) { | 219 if (holder.IsEmpty()) { |
| 220 // This is only reachable via |object.__proto__.func|, in which case it | 220 // This is only reachable via |object.__proto__.func|, in which case it |
| 221 // has already passed the same origin security check | 221 // has already passed the same origin security check |
| 222 v8SetReturnValue(info, privateTemplate->GetFunction()); | 222 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 223 return; | 223 return; |
| 224 } | 224 } |
| 225 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 225 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 226 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), DoNotReportSecurityError)) { | 226 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), DoNotReportSecurityError)) { |
| 227 static int sharedTemplateKey; // This address is used for a key to look
up the dom template. | 227 static int sharedTemplateKey; // This address is used for a key to look
up the dom template. |
| 228 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha
redTemplateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMeth
odMethodCallback, v8Undefined(), v8::Signature::New(info.GetIsolate(), V8TestInt
erfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); | 228 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha
redTemplateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMeth
odMethodCallback, v8Undefined(), v8::Signature::New(info.GetIsolate(), V8TestInt
erfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); |
| 229 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 229 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 230 return; | 230 return; |
| 231 } | 231 } |
| 232 | 232 |
| 233 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This())
->GetHiddenValue(v8AtomicString(info.GetIsolate(), "doNotCheckSecurityVoidMethod
")); | 233 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This())
->GetHiddenValue(v8AtomicString(info.GetIsolate(), "doNotCheckSecurityVoidMethod
")); |
| 234 if (!hiddenValue.IsEmpty()) { | 234 if (!hiddenValue.IsEmpty()) { |
| 235 v8SetReturnValue(info, hiddenValue); | 235 v8SetReturnValue(info, hiddenValue); |
| 236 return; | 236 return; |
| 237 } | 237 } |
| 238 | 238 |
| 239 v8SetReturnValue(info, privateTemplate->GetFunction()); | 239 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 240 } | 240 } |
| 241 | 241 |
| 242 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback(v8::Local
<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 242 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback(v8::Local
<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 243 { | 243 { |
| 244 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 244 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 245 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodOriginSafe
MethodGetter(info); | 245 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityVoidMethodOriginSafe
MethodGetter(info); |
| 246 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 246 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 247 } | 247 } |
| 248 | 248 |
| 249 static void doNotCheckSecurityDoNotCheckSignatureVoidMethodMethod(const v8::Func
tionCallbackInfo<v8::Value>& info) | 249 static void doNotCheckSecurityDoNotCheckSignatureVoidMethodMethod(const v8::Func
tionCallbackInfo<v8::Value>& info) |
| 250 { | 250 { |
| 251 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(in
fo.Holder()); | 251 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(info
.Holder()); |
| 252 impl->doNotCheckSecurityDoNotCheckSignatureVoidMethod(); | 252 impl->doNotCheckSecurityDoNotCheckSignatureVoidMethod(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 static void doNotCheckSecurityDoNotCheckSignatureVoidMethodMethodCallback(const
v8::FunctionCallbackInfo<v8::Value>& info) | 255 static void doNotCheckSecurityDoNotCheckSignatureVoidMethodMethodCallback(const
v8::FunctionCallbackInfo<v8::Value>& info) |
| 256 { | 256 { |
| 257 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 257 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 258 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityDoNotCheckSignatureV
oidMethodMethod(info); | 258 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityDoNotCheckSignatureV
oidMethodMethod(info); |
| 259 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 259 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 260 } | 260 } |
| 261 | 261 |
| 262 static void doNotCheckSecurityDoNotCheckSignatureVoidMethodOriginSafeMethodGette
r(const v8::PropertyCallbackInfo<v8::Value>& info) | 262 static void doNotCheckSecurityDoNotCheckSignatureVoidMethodOriginSafeMethodGette
r(const v8::PropertyCallbackInfo<v8::Value>& info) |
| 263 { | 263 { |
| 264 static int domTemplateKey; // This address is used for a key to look up the
dom template. | 264 static int domTemplateKey; // This address is used for a key to look up the
dom template. |
| 265 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 265 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 266 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem
plateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityDoNotCheckSign
atureVoidMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0); | 266 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem
plateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityDoNotCheckSign
atureVoidMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0); |
| 267 | 267 |
| 268 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); | 268 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); |
| 269 if (holder.IsEmpty()) { | 269 if (holder.IsEmpty()) { |
| 270 // This is only reachable via |object.__proto__.func|, in which case it | 270 // This is only reachable via |object.__proto__.func|, in which case it |
| 271 // has already passed the same origin security check | 271 // has already passed the same origin security check |
| 272 v8SetReturnValue(info, privateTemplate->GetFunction()); | 272 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 273 return; | 273 return; |
| 274 } | 274 } |
| 275 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 275 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 276 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), DoNotReportSecurityError)) { | 276 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), DoNotReportSecurityError)) { |
| 277 static int sharedTemplateKey; // This address is used for a key to look
up the dom template. | 277 static int sharedTemplateKey; // This address is used for a key to look
up the dom template. |
| 278 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha
redTemplateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityDoNotChe
ckSignatureVoidMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(),
0); | 278 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha
redTemplateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityDoNotChe
ckSignatureVoidMethodMethodCallback, v8Undefined(), v8::Local<v8::Signature>(),
0); |
| 279 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 279 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 280 return; | 280 return; |
| 281 } | 281 } |
| 282 | 282 |
| 283 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This())
->GetHiddenValue(v8AtomicString(info.GetIsolate(), "doNotCheckSecurityDoNotCheck
SignatureVoidMethod")); | 283 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This())
->GetHiddenValue(v8AtomicString(info.GetIsolate(), "doNotCheckSecurityDoNotCheck
SignatureVoidMethod")); |
| 284 if (!hiddenValue.IsEmpty()) { | 284 if (!hiddenValue.IsEmpty()) { |
| 285 v8SetReturnValue(info, hiddenValue); | 285 v8SetReturnValue(info, hiddenValue); |
| 286 return; | 286 return; |
| 287 } | 287 } |
| 288 | 288 |
| 289 v8SetReturnValue(info, privateTemplate->GetFunction()); | 289 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 290 } | 290 } |
| 291 | 291 |
| 292 static void doNotCheckSecurityDoNotCheckSignatureVoidMethodOriginSafeMethodGette
rCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info
) | 292 static void doNotCheckSecurityDoNotCheckSignatureVoidMethodOriginSafeMethodGette
rCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info
) |
| 293 { | 293 { |
| 294 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 294 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 295 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityDoNotCheckSignatureV
oidMethodOriginSafeMethodGetter(info); | 295 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityDoNotCheckSignatureV
oidMethodOriginSafeMethodGetter(info); |
| 296 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 296 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 297 } | 297 } |
| 298 | 298 |
| 299 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethod(const v8::Functio
nCallbackInfo<v8::Value>& info) | 299 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethod(const v8::Functio
nCallbackInfo<v8::Value>& info) |
| 300 { | 300 { |
| 301 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(in
fo.Holder()); | 301 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(info
.Holder()); |
| 302 impl->doNotCheckSecurityPerWorldBindingsVoidMethod(); | 302 impl->doNotCheckSecurityPerWorldBindingsVoidMethod(); |
| 303 } | 303 } |
| 304 | 304 |
| 305 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback(const v8:
:FunctionCallbackInfo<v8::Value>& info) | 305 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback(const v8:
:FunctionCallbackInfo<v8::Value>& info) |
| 306 { | 306 { |
| 307 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 307 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 308 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethod(info); | 308 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethod(info); |
| 309 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 309 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 310 } | 310 } |
| 311 | 311 |
| 312 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetter(c
onst v8::PropertyCallbackInfo<v8::Value>& info) | 312 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetter(c
onst v8::PropertyCallbackInfo<v8::Value>& info) |
| 313 { | 313 { |
| 314 static int domTemplateKey; // This address is used for a key to look up the
dom template. | 314 static int domTemplateKey; // This address is used for a key to look up the
dom template. |
| 315 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 315 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 316 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem
plateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindin
gsVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(info.GetIsolate(),
V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); | 316 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem
plateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindin
gsVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(info.GetIsolate(),
V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); |
| 317 | 317 |
| 318 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); | 318 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); |
| 319 if (holder.IsEmpty()) { | 319 if (holder.IsEmpty()) { |
| 320 // This is only reachable via |object.__proto__.func|, in which case it | 320 // This is only reachable via |object.__proto__.func|, in which case it |
| 321 // has already passed the same origin security check | 321 // has already passed the same origin security check |
| 322 v8SetReturnValue(info, privateTemplate->GetFunction()); | 322 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 323 return; | 323 return; |
| 324 } | 324 } |
| 325 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 325 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 326 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), DoNotReportSecurityError)) { | 326 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), DoNotReportSecurityError)) { |
| 327 static int sharedTemplateKey; // This address is used for a key to look
up the dom template. | 327 static int sharedTemplateKey; // This address is used for a key to look
up the dom template. |
| 328 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha
redTemplateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorld
BindingsVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(info.GetIsol
ate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); | 328 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha
redTemplateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorld
BindingsVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(info.GetIsol
ate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); |
| 329 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 329 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 330 return; | 330 return; |
| 331 } | 331 } |
| 332 | 332 |
| 333 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This())
->GetHiddenValue(v8AtomicString(info.GetIsolate(), "doNotCheckSecurityPerWorldBi
ndingsVoidMethod")); | 333 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This())
->GetHiddenValue(v8AtomicString(info.GetIsolate(), "doNotCheckSecurityPerWorldBi
ndingsVoidMethod")); |
| 334 if (!hiddenValue.IsEmpty()) { | 334 if (!hiddenValue.IsEmpty()) { |
| 335 v8SetReturnValue(info, hiddenValue); | 335 v8SetReturnValue(info, hiddenValue); |
| 336 return; | 336 return; |
| 337 } | 337 } |
| 338 | 338 |
| 339 v8SetReturnValue(info, privateTemplate->GetFunction()); | 339 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 340 } | 340 } |
| 341 | 341 |
| 342 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 342 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 343 { | 343 { |
| 344 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 344 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 345 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetter(info); | 345 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetter(info); |
| 346 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 346 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 347 } | 347 } |
| 348 | 348 |
| 349 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodForMainWorld(const
v8::FunctionCallbackInfo<v8::Value>& info) | 349 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodForMainWorld(const
v8::FunctionCallbackInfo<v8::Value>& info) |
| 350 { | 350 { |
| 351 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(in
fo.Holder()); | 351 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(info
.Holder()); |
| 352 impl->doNotCheckSecurityPerWorldBindingsVoidMethod(); | 352 impl->doNotCheckSecurityPerWorldBindingsVoidMethod(); |
| 353 } | 353 } |
| 354 | 354 |
| 355 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWor
ld(const v8::FunctionCallbackInfo<v8::Value>& info) | 355 static void doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWor
ld(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 356 { | 356 { |
| 357 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 357 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 358 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethodForMainWorld(info); | 358 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodMethodForMainWorld(info); |
| 359 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 359 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 360 } | 360 } |
| 361 | 361 |
| 362 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterFo
rMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info) | 362 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterFo
rMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info) |
| 363 { | 363 { |
| 364 static int domTemplateKey; // This address is used for a key to look up the
dom template. | 364 static int domTemplateKey; // This address is used for a key to look up the
dom template. |
| 365 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 365 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 366 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem
plateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindin
gsVoidMethodMethodCallbackForMainWorld, v8Undefined(), v8::Signature::New(info.G
etIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); | 366 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem
plateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindin
gsVoidMethodMethodCallbackForMainWorld, v8Undefined(), v8::Signature::New(info.G
etIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); |
| 367 | 367 |
| 368 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); | 368 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); |
| 369 if (holder.IsEmpty()) { | 369 if (holder.IsEmpty()) { |
| 370 // This is only reachable via |object.__proto__.func|, in which case it | 370 // This is only reachable via |object.__proto__.func|, in which case it |
| 371 // has already passed the same origin security check | 371 // has already passed the same origin security check |
| 372 v8SetReturnValue(info, privateTemplate->GetFunction()); | 372 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 373 return; | 373 return; |
| 374 } | 374 } |
| 375 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 375 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 376 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), DoNotReportSecurityError)) { | 376 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), DoNotReportSecurityError)) { |
| 377 static int sharedTemplateKey; // This address is used for a key to look
up the dom template. | 377 static int sharedTemplateKey; // This address is used for a key to look
up the dom template. |
| 378 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha
redTemplateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorld
BindingsVoidMethodMethodCallbackForMainWorld, v8Undefined(), v8::Signature::New(
info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate()))
, 0); | 378 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha
redTemplateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorld
BindingsVoidMethodMethodCallbackForMainWorld, v8Undefined(), v8::Signature::New(
info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate()))
, 0); |
| 379 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 379 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 380 return; | 380 return; |
| 381 } | 381 } |
| 382 | 382 |
| 383 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This())
->GetHiddenValue(v8AtomicString(info.GetIsolate(), "doNotCheckSecurityPerWorldBi
ndingsVoidMethod")); | 383 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This())
->GetHiddenValue(v8AtomicString(info.GetIsolate(), "doNotCheckSecurityPerWorldBi
ndingsVoidMethod")); |
| 384 if (!hiddenValue.IsEmpty()) { | 384 if (!hiddenValue.IsEmpty()) { |
| 385 v8SetReturnValue(info, hiddenValue); | 385 v8SetReturnValue(info, hiddenValue); |
| 386 return; | 386 return; |
| 387 } | 387 } |
| 388 | 388 |
| 389 v8SetReturnValue(info, privateTemplate->GetFunction()); | 389 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 390 } | 390 } |
| 391 | 391 |
| 392 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val
ue>& info) | 392 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa
llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val
ue>& info) |
| 393 { | 393 { |
| 394 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 394 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 395 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetterForMainWorld(info); | 395 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityPerWorldBindingsVoid
MethodOriginSafeMethodGetterForMainWorld(info); |
| 396 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 396 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 397 } | 397 } |
| 398 | 398 |
| 399 static void doNotCheckSecurityUnforgeableVoidMethodMethod(const v8::FunctionCall
backInfo<v8::Value>& info) | 399 static void doNotCheckSecurityUnforgeableVoidMethodMethod(const v8::FunctionCall
backInfo<v8::Value>& info) |
| 400 { | 400 { |
| 401 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(in
fo.Holder()); | 401 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(info
.Holder()); |
| 402 impl->doNotCheckSecurityUnforgeableVoidMethod(); | 402 impl->doNotCheckSecurityUnforgeableVoidMethod(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 static void doNotCheckSecurityUnforgeableVoidMethodMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) | 405 static void doNotCheckSecurityUnforgeableVoidMethodMethodCallback(const v8::Func
tionCallbackInfo<v8::Value>& info) |
| 406 { | 406 { |
| 407 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 407 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 408 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dMethod(info); | 408 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dMethod(info); |
| 409 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 409 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 410 } | 410 } |
| 411 | 411 |
| 412 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetter(const
v8::PropertyCallbackInfo<v8::Value>& info) | 412 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetter(const
v8::PropertyCallbackInfo<v8::Value>& info) |
| 413 { | 413 { |
| 414 static int domTemplateKey; // This address is used for a key to look up the
dom template. | 414 static int domTemplateKey; // This address is used for a key to look up the
dom template. |
| 415 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 415 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 416 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem
plateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoi
dMethodMethodCallback, v8Undefined(), v8::Signature::New(info.GetIsolate(), V8Te
stInterfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); | 416 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem
plateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoi
dMethodMethodCallback, v8Undefined(), v8::Signature::New(info.GetIsolate(), V8Te
stInterfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); |
| 417 | 417 |
| 418 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); | 418 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); |
| 419 if (holder.IsEmpty()) { | 419 if (holder.IsEmpty()) { |
| 420 // This is only reachable via |object.__proto__.func|, in which case it | 420 // This is only reachable via |object.__proto__.func|, in which case it |
| 421 // has already passed the same origin security check | 421 // has already passed the same origin security check |
| 422 v8SetReturnValue(info, privateTemplate->GetFunction()); | 422 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 423 return; | 423 return; |
| 424 } | 424 } |
| 425 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 425 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 426 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), DoNotReportSecurityError)) { | 426 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), DoNotReportSecurityError)) { |
| 427 static int sharedTemplateKey; // This address is used for a key to look
up the dom template. | 427 static int sharedTemplateKey; // This address is used for a key to look
up the dom template. |
| 428 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha
redTemplateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgea
bleVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(info.GetIsolate()
, V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); | 428 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha
redTemplateKey, TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgea
bleVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(info.GetIsolate()
, V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate())), 0); |
| 429 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 429 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 430 return; | 430 return; |
| 431 } | 431 } |
| 432 | 432 |
| 433 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This())
->GetHiddenValue(v8AtomicString(info.GetIsolate(), "doNotCheckSecurityUnforgeabl
eVoidMethod")); | 433 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This())
->GetHiddenValue(v8AtomicString(info.GetIsolate(), "doNotCheckSecurityUnforgeabl
eVoidMethod")); |
| 434 if (!hiddenValue.IsEmpty()) { | 434 if (!hiddenValue.IsEmpty()) { |
| 435 v8SetReturnValue(info, hiddenValue); | 435 v8SetReturnValue(info, hiddenValue); |
| 436 return; | 436 return; |
| 437 } | 437 } |
| 438 | 438 |
| 439 v8SetReturnValue(info, privateTemplate->GetFunction()); | 439 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 440 } | 440 } |
| 441 | 441 |
| 442 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetterCallbac
k(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 442 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetterCallbac
k(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 443 { | 443 { |
| 444 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 444 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 445 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dOriginSafeMethodGetter(info); | 445 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho
dOriginSafeMethodGetter(info); |
| 446 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 446 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 447 } | 447 } |
| 448 | 448 |
| 449 static void TestInterfaceCheckSecurityOriginSafeMethodSetter(v8::Local<v8::Strin
g> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& inf
o) | 449 static void TestInterfaceCheckSecurityOriginSafeMethodSetter(v8::Local<v8::Strin
g> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& inf
o) |
| 450 { | 450 { |
| 451 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); | 451 v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceIn
PrototypeChain(info.This(), info.GetIsolate()); |
| 452 if (holder.IsEmpty()) | 452 if (holder.IsEmpty()) |
| 453 return; | 453 return; |
| 454 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(ho
lder); | 454 TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toImpl(hold
er); |
| 455 v8::String::Utf8Value attributeName(name); | 455 v8::String::Utf8Value attributeName(name); |
| 456 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName,
"TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate()); | 456 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName,
"TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate()); |
| 457 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { | 457 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { |
| 458 exceptionState.throwIfNeeded(); | 458 exceptionState.throwIfNeeded(); |
| 459 return; | 459 return; |
| 460 } | 460 } |
| 461 | 461 |
| 462 V8HiddenValue::setHiddenValue(info.GetIsolate(), v8::Handle<v8::Object>::Cas
t(info.This()), name, v8Value); | 462 V8HiddenValue::setHiddenValue(info.GetIsolate(), v8::Handle<v8::Object>::Cas
t(info.This()), name, v8Value); |
| 463 } | 463 } |
| 464 | 464 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 bool V8TestInterfaceCheckSecurity::hasInstance(v8::Handle<v8::Value> v8Value, v8
::Isolate* isolate) | 525 bool V8TestInterfaceCheckSecurity::hasInstance(v8::Handle<v8::Value> v8Value, v8
::Isolate* isolate) |
| 526 { | 526 { |
| 527 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | 527 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); |
| 528 } | 528 } |
| 529 | 529 |
| 530 v8::Handle<v8::Object> V8TestInterfaceCheckSecurity::findInstanceInPrototypeChai
n(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | 530 v8::Handle<v8::Object> V8TestInterfaceCheckSecurity::findInstanceInPrototypeChai
n(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) |
| 531 { | 531 { |
| 532 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | 532 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); |
| 533 } | 533 } |
| 534 | 534 |
| 535 TestInterfaceCheckSecurity* V8TestInterfaceCheckSecurity::toNativeWithTypeCheck(
v8::Isolate* isolate, v8::Handle<v8::Value> value) | 535 TestInterfaceCheckSecurity* V8TestInterfaceCheckSecurity::toImplWithTypeCheck(v8
::Isolate* isolate, v8::Handle<v8::Value> value) |
| 536 { | 536 { |
| 537 return hasInstance(value, isolate) ? fromInternalPointer(blink::toInternalPo
inter(v8::Handle<v8::Object>::Cast(value))) : 0; | 537 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<TestInterfaceCheckSecurity>() : 0; |
| 538 } | 538 } |
| 539 | 539 |
| 540 | 540 |
| 541 void V8TestInterfaceCheckSecurity::refObject(ScriptWrappableBase* internalPointe
r) | 541 void V8TestInterfaceCheckSecurity::refObject(ScriptWrappableBase* internalPointe
r) |
| 542 { | 542 { |
| 543 fromInternalPointer(internalPointer)->ref(); | 543 internalPointer->toImpl<TestInterfaceCheckSecurity>()->ref(); |
| 544 } | 544 } |
| 545 | 545 |
| 546 void V8TestInterfaceCheckSecurity::derefObject(ScriptWrappableBase* internalPoin
ter) | 546 void V8TestInterfaceCheckSecurity::derefObject(ScriptWrappableBase* internalPoin
ter) |
| 547 { | 547 { |
| 548 fromInternalPointer(internalPointer)->deref(); | 548 internalPointer->toImpl<TestInterfaceCheckSecurity>()->deref(); |
| 549 } | 549 } |
| 550 | 550 |
| 551 WrapperPersistentNode* V8TestInterfaceCheckSecurity::createPersistentHandle(Scri
ptWrappableBase* internalPointer) | 551 WrapperPersistentNode* V8TestInterfaceCheckSecurity::createPersistentHandle(Scri
ptWrappableBase* internalPointer) |
| 552 { | 552 { |
| 553 ASSERT_NOT_REACHED(); | 553 ASSERT_NOT_REACHED(); |
| 554 return 0; | 554 return 0; |
| 555 } | 555 } |
| 556 | 556 |
| 557 template<> | 557 template<> |
| 558 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) | 558 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) |
| 559 { | 559 { |
| 560 return toV8(impl, creationContext, isolate); | 560 return toV8(impl, creationContext, isolate); |
| 561 } | 561 } |
| 562 | 562 |
| 563 } // namespace blink | 563 } // namespace blink |
| OLD | NEW |