| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 imp->postMessage(message); | 135 imp->postMessage(message); |
| 136 } | 136 } |
| 137 | 137 |
| 138 static void postMessageMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | 138 static void postMessageMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 139 { | 139 { |
| 140 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 140 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 141 TestCheckSecurityInterfaceV8Internal::postMessageMethod(info); | 141 TestCheckSecurityInterfaceV8Internal::postMessageMethod(info); |
| 142 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 142 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 143 } | 143 } |
| 144 | 144 |
| 145 static void postMessageAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>
& info) | 145 static void postMessageOriginSafeMethodGetter(const v8::PropertyCallbackInfo<v8:
:Value>& info) |
| 146 { | 146 { |
| 147 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 147 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 148 static int privateTemplateUniqueKey; | 148 static int privateTemplateUniqueKey; |
| 149 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 149 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
| 150 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 150 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 151 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
postMessageMethodCallback, v8Undefined(), v8::Signature::New(V8PerIsolateData::f
rom(info.GetIsolate())->rawTemplate(&V8TestCheckSecurityInterface::wrapperTypeIn
fo, currentWorldType)), 1); | 151 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
postMessageMethodCallback, v8Undefined(), v8::Signature::New(V8PerIsolateData::f
rom(info.GetIsolate())->rawTemplate(&V8TestCheckSecurityInterface::wrapperTypeIn
fo, currentWorldType)), 1); |
| 152 | 152 |
| 153 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 153 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); |
| 154 if (holder.IsEmpty()) { | 154 if (holder.IsEmpty()) { |
| 155 // can only reach here by 'object.__proto__.func', and it should passed | 155 // can only reach here by 'object.__proto__.func', and it should passed |
| (...skipping 11 matching lines...) Expand all Loading... |
| 167 | 167 |
| 168 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("postMessage")); | 168 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("postMessage")); |
| 169 if (!hiddenValue.IsEmpty()) { | 169 if (!hiddenValue.IsEmpty()) { |
| 170 v8SetReturnValue(info, hiddenValue); | 170 v8SetReturnValue(info, hiddenValue); |
| 171 return; | 171 return; |
| 172 } | 172 } |
| 173 | 173 |
| 174 v8SetReturnValue(info, privateTemplate->GetFunction()); | 174 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 175 } | 175 } |
| 176 | 176 |
| 177 static void postMessageAttributeGetterCallback(v8::Local<v8::String>, const v8::
PropertyCallbackInfo<v8::Value>& info) | 177 static void postMessageOriginSafeMethodGetterCallback(v8::Local<v8::String>, con
st v8::PropertyCallbackInfo<v8::Value>& info) |
| 178 { | 178 { |
| 179 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 179 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 180 TestCheckSecurityInterfaceV8Internal::postMessageAttributeGetter(info); | 180 TestCheckSecurityInterfaceV8Internal::postMessageOriginSafeMethodGetter(info
); |
| 181 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 181 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 182 } | 182 } |
| 183 | 183 |
| 184 static void perWorldBindingsMethodWithDoNotCheckSecurityMethod(const v8::Functio
nCallbackInfo<v8::Value>& info) | 184 static void perWorldBindingsMethodWithDoNotCheckSecurityMethod(const v8::Functio
nCallbackInfo<v8::Value>& info) |
| 185 { | 185 { |
| 186 if (UNLIKELY(info.Length() < 1)) { | 186 if (UNLIKELY(info.Length() < 1)) { |
| 187 throwTypeError(ExceptionMessages::failedToExecute("perWorldBindingsMetho
dWithDoNotCheckSecurity", "TestCheckSecurityInterface", ExceptionMessages::notEn
oughArguments(1, info.Length())), info.GetIsolate()); | 187 throwTypeError(ExceptionMessages::failedToExecute("perWorldBindingsMetho
dWithDoNotCheckSecurity", "TestCheckSecurityInterface", ExceptionMessages::notEn
oughArguments(1, info.Length())), info.GetIsolate()); |
| 188 return; | 188 return; |
| 189 } | 189 } |
| 190 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 190 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); |
| 191 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, url, info[0]); | 191 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, url, info[0]); |
| 192 imp->perWorldBindingsMethodWithDoNotCheckSecurity(url); | 192 imp->perWorldBindingsMethodWithDoNotCheckSecurity(url); |
| 193 } | 193 } |
| 194 | 194 |
| 195 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodCallback(const v8:
:FunctionCallbackInfo<v8::Value>& info) | 195 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodCallback(const v8:
:FunctionCallbackInfo<v8::Value>& info) |
| 196 { | 196 { |
| 197 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 197 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 198 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge
tCurrentContext()); | 198 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge
tCurrentContext()); |
| 199 if (contextData && contextData->activityLogger()) { | 199 if (contextData && contextData->activityLogger()) { |
| 200 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle
<v8::Value> >(info, 0); | 200 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle
<v8::Value> >(info, 0); |
| 201 contextData->activityLogger()->log("TestCheckSecurityInterface.perWorldB
indingsMethodWithDoNotCheckSecurity", info.Length(), loggerArgs.data(), "Method"
); | 201 contextData->activityLogger()->log("TestCheckSecurityInterface.perWorldB
indingsMethodWithDoNotCheckSecurity", info.Length(), loggerArgs.data(), "Method"
); |
| 202 } | 202 } |
| 203 TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
curityMethod(info); | 203 TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
curityMethod(info); |
| 204 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 204 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 205 } | 205 } |
| 206 | 206 |
| 207 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetter(const v8
::PropertyCallbackInfo<v8::Value>& info) | 207 static void perWorldBindingsMethodWithDoNotCheckSecurityOriginSafeMethodGetter(c
onst v8::PropertyCallbackInfo<v8::Value>& info) |
| 208 { | 208 { |
| 209 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 209 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 210 static int privateTemplateUniqueKey; | 210 static int privateTemplateUniqueKey; |
| 211 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 211 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
| 212 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 212 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 213 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
perWorldBindingsMethodWithDoNotCheckSecurityMethodCallback, v8Undefined(), v8::S
ignature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestChec
kSecurityInterface::wrapperTypeInfo, currentWorldType)), 1); | 213 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
perWorldBindingsMethodWithDoNotCheckSecurityMethodCallback, v8Undefined(), v8::S
ignature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestChec
kSecurityInterface::wrapperTypeInfo, currentWorldType)), 1); |
| 214 | 214 |
| 215 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 215 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); |
| 216 if (holder.IsEmpty()) { | 216 if (holder.IsEmpty()) { |
| 217 // can only reach here by 'object.__proto__.func', and it should passed | 217 // can only reach here by 'object.__proto__.func', and it should passed |
| (...skipping 11 matching lines...) Expand all Loading... |
| 229 | 229 |
| 230 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("perWorldBindingsMethodWithDoNotCheckSecurity")); | 230 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("perWorldBindingsMethodWithDoNotCheckSecurity")); |
| 231 if (!hiddenValue.IsEmpty()) { | 231 if (!hiddenValue.IsEmpty()) { |
| 232 v8SetReturnValue(info, hiddenValue); | 232 v8SetReturnValue(info, hiddenValue); |
| 233 return; | 233 return; |
| 234 } | 234 } |
| 235 | 235 |
| 236 v8SetReturnValue(info, privateTemplate->GetFunction()); | 236 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 237 } | 237 } |
| 238 | 238 |
| 239 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetterCallback(
v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | 239 static void perWorldBindingsMethodWithDoNotCheckSecurityOriginSafeMethodGetterCa
llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 240 { | 240 { |
| 241 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 241 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 242 TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
curityAttributeGetter(info); | 242 TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
curityOriginSafeMethodGetter(info); |
| 243 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 243 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 244 } | 244 } |
| 245 | 245 |
| 246 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodForMainWorld(const
v8::FunctionCallbackInfo<v8::Value>& info) | 246 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodForMainWorld(const
v8::FunctionCallbackInfo<v8::Value>& info) |
| 247 { | 247 { |
| 248 if (UNLIKELY(info.Length() < 1)) { | 248 if (UNLIKELY(info.Length() < 1)) { |
| 249 throwTypeError(ExceptionMessages::failedToExecute("perWorldBindingsMetho
dWithDoNotCheckSecurity", "TestCheckSecurityInterface", ExceptionMessages::notEn
oughArguments(1, info.Length())), info.GetIsolate()); | 249 throwTypeError(ExceptionMessages::failedToExecute("perWorldBindingsMetho
dWithDoNotCheckSecurity", "TestCheckSecurityInterface", ExceptionMessages::notEn
oughArguments(1, info.Length())), info.GetIsolate()); |
| 250 return; | 250 return; |
| 251 } | 251 } |
| 252 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); | 252 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(inf
o.Holder()); |
| 253 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, url, info[0]); | 253 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, url, info[0]); |
| 254 imp->perWorldBindingsMethodWithDoNotCheckSecurity(url); | 254 imp->perWorldBindingsMethodWithDoNotCheckSecurity(url); |
| 255 } | 255 } |
| 256 | 256 |
| 257 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodCallbackForMainWor
ld(const v8::FunctionCallbackInfo<v8::Value>& info) | 257 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodCallbackForMainWor
ld(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 258 { | 258 { |
| 259 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 259 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 260 TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
curityMethodForMainWorld(info); | 260 TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
curityMethodForMainWorld(info); |
| 261 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 261 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 262 } | 262 } |
| 263 | 263 |
| 264 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetterForMainWo
rld(const v8::PropertyCallbackInfo<v8::Value>& info) | 264 static void perWorldBindingsMethodWithDoNotCheckSecurityOriginSafeMethodGetterFo
rMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info) |
| 265 { | 265 { |
| 266 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 266 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 267 static int privateTemplateUniqueKey; | 267 static int privateTemplateUniqueKey; |
| 268 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 268 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
| 269 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 269 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 270 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
perWorldBindingsMethodWithDoNotCheckSecurityMethodCallbackForMainWorld, v8Undefi
ned(), v8::Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate
(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 1); | 270 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal::
perWorldBindingsMethodWithDoNotCheckSecurityMethodCallbackForMainWorld, v8Undefi
ned(), v8::Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate
(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 1); |
| 271 | 271 |
| 272 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); | 272 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); |
| 273 if (holder.IsEmpty()) { | 273 if (holder.IsEmpty()) { |
| 274 // can only reach here by 'object.__proto__.func', and it should passed | 274 // can only reach here by 'object.__proto__.func', and it should passed |
| (...skipping 11 matching lines...) Expand all Loading... |
| 286 | 286 |
| 287 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("perWorldBindingsMethodWithDoNotCheckSecurity")); | 287 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N
ewSymbol("perWorldBindingsMethodWithDoNotCheckSecurity")); |
| 288 if (!hiddenValue.IsEmpty()) { | 288 if (!hiddenValue.IsEmpty()) { |
| 289 v8SetReturnValue(info, hiddenValue); | 289 v8SetReturnValue(info, hiddenValue); |
| 290 return; | 290 return; |
| 291 } | 291 } |
| 292 | 292 |
| 293 v8SetReturnValue(info, privateTemplate->GetFunction()); | 293 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 294 } | 294 } |
| 295 | 295 |
| 296 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetterCallbackF
orMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& in
fo) | 296 static void perWorldBindingsMethodWithDoNotCheckSecurityOriginSafeMethodGetterCa
llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val
ue>& info) |
| 297 { | 297 { |
| 298 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 298 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 299 TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
curityAttributeGetterForMainWorld(info); | 299 TestCheckSecurityInterfaceV8Internal::perWorldBindingsMethodWithDoNotCheckSe
curityOriginSafeMethodGetterForMainWorld(info); |
| 300 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 300 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 301 } | 301 } |
| 302 | 302 |
| 303 static void TestCheckSecurityInterfaceDomainSafeFunctionSetter(v8::Local<v8::Str
ing> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& i
nfo) | 303 static void TestCheckSecurityInterfaceOriginSafeMethodSetter(v8::Local<v8::Strin
g> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
o) |
| 304 { | 304 { |
| 305 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), worldType(info.GetIso
late()))); | 305 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), worldType(info.GetIso
late()))); |
| 306 if (holder.IsEmpty()) | 306 if (holder.IsEmpty()) |
| 307 return; | 307 return; |
| 308 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); | 308 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol
der); |
| 309 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 309 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
| 310 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { | 310 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)
) { |
| 311 exceptionState.throwIfNeeded(); | 311 exceptionState.throwIfNeeded(); |
| 312 return; | 312 return; |
| 313 } | 313 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 338 UNUSED_PARAM(prototypeTemplate); | 338 UNUSED_PARAM(prototypeTemplate); |
| 339 instanceTemplate->SetAccessCheckCallbacks(TestCheckSecurityInterfaceV8Intern
al::namedSecurityCheck, TestCheckSecurityInterfaceV8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestCheckSecurity
Interface::wrapperTypeInfo))); | 339 instanceTemplate->SetAccessCheckCallbacks(TestCheckSecurityInterfaceV8Intern
al::namedSecurityCheck, TestCheckSecurityInterfaceV8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestCheckSecurity
Interface::wrapperTypeInfo))); |
| 340 | 340 |
| 341 // Custom Signature 'excitingFunction' | 341 // Custom Signature 'excitingFunction' |
| 342 const int excitingFunctionArgc = 1; | 342 const int excitingFunctionArgc = 1; |
| 343 v8::Handle<v8::FunctionTemplate> excitingFunctionArgv[excitingFunctionArgc]
= { V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::wrapperTypeInfo, curre
ntWorldType) }; | 343 v8::Handle<v8::FunctionTemplate> excitingFunctionArgv[excitingFunctionArgc]
= { V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::wrapperTypeInfo, curre
ntWorldType) }; |
| 344 v8::Handle<v8::Signature> excitingFunctionSignature = v8::Signature::New(fun
ctionTemplate, excitingFunctionArgc, excitingFunctionArgv); | 344 v8::Handle<v8::Signature> excitingFunctionSignature = v8::Signature::New(fun
ctionTemplate, excitingFunctionArgc, excitingFunctionArgv); |
| 345 prototypeTemplate->Set(v8::String::NewSymbol("excitingFunction"), v8::Functi
onTemplate::New(TestCheckSecurityInterfaceV8Internal::excitingFunctionMethodCall
back, v8Undefined(), excitingFunctionSignature, 1)); | 345 prototypeTemplate->Set(v8::String::NewSymbol("excitingFunction"), v8::Functi
onTemplate::New(TestCheckSecurityInterfaceV8Internal::excitingFunctionMethodCall
back, v8Undefined(), excitingFunctionSignature, 1)); |
| 346 | 346 |
| 347 // Function 'postMessage' (Extended Attributes: 'DoNotCheckSecurity') | 347 // Function 'postMessage' (Extended Attributes: 'DoNotCheckSecurity') |
| 348 prototypeTemplate->SetAccessor(v8::String::NewSymbol("postMessage"), TestChe
ckSecurityInterfaceV8Internal::postMessageAttributeGetterCallback, TestCheckSecu
rityInterfaceV8Internal::TestCheckSecurityInterfaceDomainSafeFunctionSetter, v8U
ndefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)
); | 348 prototypeTemplate->SetAccessor(v8::String::NewSymbol("postMessage"), TestChe
ckSecurityInterfaceV8Internal::postMessageOriginSafeMethodGetterCallback, TestCh
eckSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSetter
, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDe
lete)); |
| 349 | 349 |
| 350 // Function 'perWorldBindingsMethodWithDoNotCheckSecurity' (Extended Attribu
tes: 'DoNotCheckSecurity PerWorldBindings ActivityLogging') | 350 // Function 'perWorldBindingsMethodWithDoNotCheckSecurity' (Extended Attribu
tes: 'DoNotCheckSecurity PerWorldBindings ActivityLogging') |
| 351 if (currentWorldType == MainWorld) { | 351 if (currentWorldType == MainWorld) { |
| 352 prototypeTemplate->SetAccessor(v8::String::NewSymbol("perWorldBindingsMe
thodWithDoNotCheckSecurity"), TestCheckSecurityInterfaceV8Internal::perWorldBind
ingsMethodWithDoNotCheckSecurityAttributeGetterCallbackForMainWorld, TestCheckSe
curityInterfaceV8Internal::TestCheckSecurityInterfaceDomainSafeFunctionSetter, v
8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelet
e)); | 352 prototypeTemplate->SetAccessor(v8::String::NewSymbol("perWorldBindingsMe
thodWithDoNotCheckSecurity"), TestCheckSecurityInterfaceV8Internal::perWorldBind
ingsMethodWithDoNotCheckSecurityOriginSafeMethodGetterCallbackForMainWorld, Test
CheckSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSett
er, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::Dont
Delete)); |
| 353 } else { | 353 } else { |
| 354 prototypeTemplate->SetAccessor(v8::String::NewSymbol("perWorldBindingsMe
thodWithDoNotCheckSecurity"), TestCheckSecurityInterfaceV8Internal::perWorldBind
ingsMethodWithDoNotCheckSecurityAttributeGetterCallback, TestCheckSecurityInterf
aceV8Internal::TestCheckSecurityInterfaceDomainSafeFunctionSetter, v8Undefined()
, v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)); | 354 prototypeTemplate->SetAccessor(v8::String::NewSymbol("perWorldBindingsMe
thodWithDoNotCheckSecurity"), TestCheckSecurityInterfaceV8Internal::perWorldBind
ingsMethodWithDoNotCheckSecurityOriginSafeMethodGetterCallback, TestCheckSecurit
yInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSetter, v8Undefi
ned(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)); |
| 355 } | 355 } |
| 356 | 356 |
| 357 // Custom toString template | 357 // Custom toString template |
| 358 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 358 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); |
| 359 return functionTemplate; | 359 return functionTemplate; |
| 360 } | 360 } |
| 361 | 361 |
| 362 v8::Handle<v8::FunctionTemplate> V8TestCheckSecurityInterface::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) | 362 v8::Handle<v8::FunctionTemplate> V8TestCheckSecurityInterface::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) |
| 363 { | 363 { |
| 364 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 364 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 V8DOMWrapper::associateObjectWithWrapper<V8TestCheckSecurityInterface>(impl,
&wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 405 V8DOMWrapper::associateObjectWithWrapper<V8TestCheckSecurityInterface>(impl,
&wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 406 return wrapper; | 406 return wrapper; |
| 407 } | 407 } |
| 408 | 408 |
| 409 void V8TestCheckSecurityInterface::derefObject(void* object) | 409 void V8TestCheckSecurityInterface::derefObject(void* object) |
| 410 { | 410 { |
| 411 fromInternalPointer(object)->deref(); | 411 fromInternalPointer(object)->deref(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace WebCore | 414 } // namespace WebCore |
| OLD | NEW |