Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: Source/bindings/tests/results/V8TestCheckSecurityInterface.cpp

Issue 94833002: Remove usage of deprecated V8 APIs from bindings code generator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityVoidMethodMethod(inf o); 196 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityVoidMethodMethod(inf o);
197 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 197 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
198 } 198 }
199 199
200 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetter(const v8::Propert yCallbackInfo<v8::Value>& info) 200 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetter(const v8::Propert yCallbackInfo<v8::Value>& info)
201 { 201 {
202 // This is only for getting a unique pointer which we can pass to privateTem plate. 202 // This is only for getting a unique pointer which we can pass to privateTem plate.
203 static int privateTemplateUniqueKey; 203 static int privateTemplateUniqueKey;
204 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 204 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
205 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 205 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
206 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal:: doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(V8 PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSecurityInterfa ce::wrapperTypeInfo, currentWorldType)), 0); 206 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal:: doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New(in fo.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestC heckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0);
207 207
208 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); 208 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType));
209 if (holder.IsEmpty()) { 209 if (holder.IsEmpty()) {
210 // This is only reachable via |object.__proto__.func|, in which case it 210 // This is only reachable via |object.__proto__.func|, in which case it
211 // has already passed the same origin security check 211 // has already passed the same origin security check
212 v8SetReturnValue(info, privateTemplate->GetFunction()); 212 v8SetReturnValue(info, privateTemplate->GetFunction());
213 return; 213 return;
214 } 214 }
215 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol der); 215 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol der);
216 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 216 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
217 static int sharedTemplateUniqueKey; 217 static int sharedTemplateUniqueKey;
218 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal ::doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New( V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSecurityInter face::wrapperTypeInfo, currentWorldType)), 0); 218 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal ::doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New( info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8Tes tCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0);
219 v8SetReturnValue(info, sharedTemplate->GetFunction()); 219 v8SetReturnValue(info, sharedTemplate->GetFunction());
220 return; 220 return;
221 } 221 }
222 222
223 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewSymbol("doNotCheckSecurityVoidMethod")); 223 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityVoidMethod", v8::String::kInter nalizedString));
224 if (!hiddenValue.IsEmpty()) { 224 if (!hiddenValue.IsEmpty()) {
225 v8SetReturnValue(info, hiddenValue); 225 v8SetReturnValue(info, hiddenValue);
226 return; 226 return;
227 } 227 }
228 228
229 v8SetReturnValue(info, privateTemplate->GetFunction()); 229 v8SetReturnValue(info, privateTemplate->GetFunction());
230 } 230 }
231 231
232 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback(v8::Local <v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 232 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback(v8::Local <v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
233 { 233 {
(...skipping 14 matching lines...) Expand all
248 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid MethodMethod(info); 248 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid MethodMethod(info);
249 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 249 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
250 } 250 }
251 251
252 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetter(c onst v8::PropertyCallbackInfo<v8::Value>& info) 252 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetter(c onst v8::PropertyCallbackInfo<v8::Value>& info)
253 { 253 {
254 // This is only for getting a unique pointer which we can pass to privateTem plate. 254 // This is only for getting a unique pointer which we can pass to privateTem plate.
255 static int privateTemplateUniqueKey; 255 static int privateTemplateUniqueKey;
256 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 256 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
257 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 257 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
258 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal:: doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8::S ignature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestChec kSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); 258 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal:: doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8::S ignature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawT emplate(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0);
259 259
260 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); 260 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType));
261 if (holder.IsEmpty()) { 261 if (holder.IsEmpty()) {
262 // This is only reachable via |object.__proto__.func|, in which case it 262 // This is only reachable via |object.__proto__.func|, in which case it
263 // has already passed the same origin security check 263 // has already passed the same origin security check
264 v8SetReturnValue(info, privateTemplate->GetFunction()); 264 v8SetReturnValue(info, privateTemplate->GetFunction());
265 return; 265 return;
266 } 266 }
267 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol der); 267 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol der);
268 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 268 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
269 static int sharedTemplateUniqueKey; 269 static int sharedTemplateUniqueKey;
270 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8: :Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCh eckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); 270 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8: :Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->ra wTemplate(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0) ;
271 v8SetReturnValue(info, sharedTemplate->GetFunction()); 271 v8SetReturnValue(info, sharedTemplate->GetFunction());
272 return; 272 return;
273 } 273 }
274 274
275 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewSymbol("doNotCheckSecurityPerWorldBindingsVoidMethod")); 275 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod", v8 ::String::kInternalizedString));
276 if (!hiddenValue.IsEmpty()) { 276 if (!hiddenValue.IsEmpty()) {
277 v8SetReturnValue(info, hiddenValue); 277 v8SetReturnValue(info, hiddenValue);
278 return; 278 return;
279 } 279 }
280 280
281 v8SetReturnValue(info, privateTemplate->GetFunction()); 281 v8SetReturnValue(info, privateTemplate->GetFunction());
282 } 282 }
283 283
284 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 284 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
285 { 285 {
(...skipping 14 matching lines...) Expand all
300 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid MethodMethodForMainWorld(info); 300 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoid MethodMethodForMainWorld(info);
301 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 301 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
302 } 302 }
303 303
304 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterFo rMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info) 304 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterFo rMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info)
305 { 305 {
306 // This is only for getting a unique pointer which we can pass to privateTem plate. 306 // This is only for getting a unique pointer which we can pass to privateTem plate.
307 static int privateTemplateUniqueKey; 307 static int privateTemplateUniqueKey;
308 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 308 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
309 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 309 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
310 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal:: doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Undefi ned(), v8::Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate (&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); 310 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal:: doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Undefi ned(), v8::Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsol ate())->rawTemplate(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorld Type)), 0);
311 311
312 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); 312 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType));
313 if (holder.IsEmpty()) { 313 if (holder.IsEmpty()) {
314 // This is only reachable via |object.__proto__.func|, in which case it 314 // This is only reachable via |object.__proto__.func|, in which case it
315 // has already passed the same origin security check 315 // has already passed the same origin security check
316 v8SetReturnValue(info, privateTemplate->GetFunction()); 316 v8SetReturnValue(info, privateTemplate->GetFunction());
317 return; 317 return;
318 } 318 }
319 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol der); 319 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol der);
320 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 320 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
321 static int sharedTemplateUniqueKey; 321 static int sharedTemplateUniqueKey;
322 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Unde fined(), v8::Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTempla te(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0); 322 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Unde fined(), v8::Signature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIs olate())->rawTemplate(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWor ldType)), 0);
323 v8SetReturnValue(info, sharedTemplate->GetFunction()); 323 v8SetReturnValue(info, sharedTemplate->GetFunction());
324 return; 324 return;
325 } 325 }
326 326
327 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewSymbol("doNotCheckSecurityPerWorldBindingsVoidMethod")); 327 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod", v8 ::String::kInternalizedString));
328 if (!hiddenValue.IsEmpty()) { 328 if (!hiddenValue.IsEmpty()) {
329 v8SetReturnValue(info, hiddenValue); 329 v8SetReturnValue(info, hiddenValue);
330 return; 330 return;
331 } 331 }
332 332
333 v8SetReturnValue(info, privateTemplate->GetFunction()); 333 v8SetReturnValue(info, privateTemplate->GetFunction());
334 } 334 }
335 335
336 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val ue>& info) 336 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val ue>& info)
337 { 337 {
(...skipping 14 matching lines...) Expand all
352 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadOnlyVoidMethodMe thod(info); 352 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadOnlyVoidMethodMe thod(info);
353 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 353 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
354 } 354 }
355 355
356 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetter(const v8: :PropertyCallbackInfo<v8::Value>& info) 356 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetter(const v8: :PropertyCallbackInfo<v8::Value>& info)
357 { 357 {
358 // This is only for getting a unique pointer which we can pass to privateTem plate. 358 // This is only for getting a unique pointer which we can pass to privateTem plate.
359 static int privateTemplateUniqueKey; 359 static int privateTemplateUniqueKey;
360 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 360 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
361 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 361 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
362 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal:: doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signature ::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSecurit yInterface::wrapperTypeInfo, currentWorldType)), 0); 362 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal:: doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signature ::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplate( &V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0);
363 363
364 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); 364 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType));
365 if (holder.IsEmpty()) { 365 if (holder.IsEmpty()) {
366 // This is only reachable via |object.__proto__.func|, in which case it 366 // This is only reachable via |object.__proto__.func|, in which case it
367 // has already passed the same origin security check 367 // has already passed the same origin security check
368 v8SetReturnValue(info, privateTemplate->GetFunction()); 368 v8SetReturnValue(info, privateTemplate->GetFunction());
369 return; 369 return;
370 } 370 }
371 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol der); 371 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol der);
372 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 372 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
373 static int sharedTemplateUniqueKey; 373 static int sharedTemplateUniqueKey;
374 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal ::doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signatu re::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSecur ityInterface::wrapperTypeInfo, currentWorldType)), 0); 374 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal ::doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signatu re::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemplat e(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0);
375 v8SetReturnValue(info, sharedTemplate->GetFunction()); 375 v8SetReturnValue(info, sharedTemplate->GetFunction());
376 return; 376 return;
377 } 377 }
378 378
379 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewSymbol("doNotCheckSecurityReadOnlyVoidMethod")); 379 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityReadOnlyVoidMethod", v8::String ::kInternalizedString));
380 if (!hiddenValue.IsEmpty()) { 380 if (!hiddenValue.IsEmpty()) {
381 v8SetReturnValue(info, hiddenValue); 381 v8SetReturnValue(info, hiddenValue);
382 return; 382 return;
383 } 383 }
384 384
385 v8SetReturnValue(info, privateTemplate->GetFunction()); 385 v8SetReturnValue(info, privateTemplate->GetFunction());
386 } 386 }
387 387
388 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCallback(v 8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 388 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCallback(v 8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
389 { 389 {
(...skipping 14 matching lines...) Expand all
404 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityUnforgeableVoidMetho dMethod(info); 404 TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityUnforgeableVoidMetho dMethod(info);
405 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 405 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
406 } 406 }
407 407
408 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetter(const v8::PropertyCallbackInfo<v8::Value>& info) 408 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
409 { 409 {
410 // This is only for getting a unique pointer which we can pass to privateTem plate. 410 // This is only for getting a unique pointer which we can pass to privateTem plate.
411 static int privateTemplateUniqueKey; 411 static int privateTemplateUniqueKey;
412 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); 412 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
413 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); 413 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
414 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal:: doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Signat ure::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSecu rityInterface::wrapperTypeInfo, currentWorldType)), 0); 414 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal:: doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Signat ure::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTempla te(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0);
415 415
416 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType)); 416 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestCheckSecurityInterface::GetTemplate(info.GetIsolate(), currentWorldType));
417 if (holder.IsEmpty()) { 417 if (holder.IsEmpty()) {
418 // This is only reachable via |object.__proto__.func|, in which case it 418 // This is only reachable via |object.__proto__.func|, in which case it
419 // has already passed the same origin security check 419 // has already passed the same origin security check
420 v8SetReturnValue(info, privateTemplate->GetFunction()); 420 v8SetReturnValue(info, privateTemplate->GetFunction());
421 return; 421 return;
422 } 422 }
423 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol der); 423 TestCheckSecurityInterface* imp = V8TestCheckSecurityInterface::toNative(hol der);
424 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 424 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
425 static int sharedTemplateUniqueKey; 425 static int sharedTemplateUniqueKey;
426 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal ::doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Sign ature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestCheckSe curityInterface::wrapperTypeInfo, currentWorldType)), 0); 426 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestCheckSecurityInterfaceV8Internal ::doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Sign ature::New(info.GetIsolate(), V8PerIsolateData::from(info.GetIsolate())->rawTemp late(&V8TestCheckSecurityInterface::wrapperTypeInfo, currentWorldType)), 0);
427 v8SetReturnValue(info, sharedTemplate->GetFunction()); 427 v8SetReturnValue(info, sharedTemplate->GetFunction());
428 return; 428 return;
429 } 429 }
430 430
431 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewSymbol("doNotCheckSecurityUnforgeableVoidMethod")); 431 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewFromUtf8(info.GetIsolate(), "doNotCheckSecurityUnforgeableVoidMethod", v8::Str ing::kInternalizedString));
432 if (!hiddenValue.IsEmpty()) { 432 if (!hiddenValue.IsEmpty()) {
433 v8SetReturnValue(info, hiddenValue); 433 v8SetReturnValue(info, hiddenValue);
434 return; 434 return;
435 } 435 }
436 436
437 v8SetReturnValue(info, privateTemplate->GetFunction()); 437 v8SetReturnValue(info, privateTemplate->GetFunction());
438 } 438 }
439 439
440 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetterCallbac k(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 440 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetterCallbac k(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
441 { 441 {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 V8TestCheckSecurityInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestCheckSecu rityInterfaceAttributes), 488 V8TestCheckSecurityInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestCheckSecu rityInterfaceAttributes),
489 0, 0, 489 0, 0,
490 V8TestCheckSecurityInterfaceMethods, WTF_ARRAY_LENGTH(V8TestCheckSecurit yInterfaceMethods), 490 V8TestCheckSecurityInterfaceMethods, WTF_ARRAY_LENGTH(V8TestCheckSecurit yInterfaceMethods),
491 isolate, currentWorldType); 491 isolate, currentWorldType);
492 UNUSED_PARAM(defaultSignature); 492 UNUSED_PARAM(defaultSignature);
493 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate(); 493 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate();
494 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate(); 494 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate();
495 UNUSED_PARAM(instanceTemplate); 495 UNUSED_PARAM(instanceTemplate);
496 UNUSED_PARAM(prototypeTemplate); 496 UNUSED_PARAM(prototypeTemplate);
497 instanceTemplate->SetAccessCheckCallbacks(TestCheckSecurityInterfaceV8Intern al::namedSecurityCheck, TestCheckSecurityInterfaceV8Internal::indexedSecurityChe ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestCheckSecurity Interface::wrapperTypeInfo))); 497 instanceTemplate->SetAccessCheckCallbacks(TestCheckSecurityInterfaceV8Intern al::namedSecurityCheck, TestCheckSecurityInterfaceV8Internal::indexedSecurityChe ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&V8TestCheckSecurity Interface::wrapperTypeInfo)));
498 prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurityVoid Method"), TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityVoidMethodOrig inSafeMethodGetterCallback, TestCheckSecurityInterfaceV8Internal::TestCheckSecur ityInterfaceOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, sta tic_cast<v8::PropertyAttribute>(v8::DontDelete)); 498 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS ecurityVoidMethod", v8::String::kInternalizedString), TestCheckSecurityInterface V8Internal::doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback, TestChec kSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSetterCa llback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8:: DontDelete));
499 if (currentWorldType == MainWorld) { 499 if (currentWorldType == MainWorld) {
500 prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurity PerWorldBindingsVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSe curityPerWorldBindingsVoidMethodOriginSafeMethodGetterCallbackForMainWorld, Test CheckSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSett erCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>( v8::DontDelete)); 500 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestCh eckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig inSafeMethodGetterCallbackForMainWorld, TestCheckSecurityInterfaceV8Internal::Te stCheckSecurityInterfaceOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_C AN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete));
501 } else { 501 } else {
502 prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurity PerWorldBindingsVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSe curityPerWorldBindingsVoidMethodOriginSafeMethodGetterCallback, TestCheckSecurit yInterfaceV8Internal::TestCheckSecurityInterfaceOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDele te)); 502 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCh eckSecurityPerWorldBindingsVoidMethod", v8::String::kInternalizedString), TestCh eckSecurityInterfaceV8Internal::doNotCheckSecurityPerWorldBindingsVoidMethodOrig inSafeMethodGetterCallback, TestCheckSecurityInterfaceV8Internal::TestCheckSecur ityInterfaceOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, sta tic_cast<v8::PropertyAttribute>(v8::DontDelete));
503 } 503 }
504 prototypeTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurityRead OnlyVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityReadOn lyVoidMethodOriginSafeMethodGetterCallback, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly)); 504 prototypeTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckS ecurityReadOnlyVoidMethod", v8::String::kInternalizedString), TestCheckSecurityI nterfaceV8Internal::doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCa llback, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v 8::DontDelete | v8::ReadOnly));
505 instanceTemplate->SetAccessor(v8::String::NewSymbol("doNotCheckSecurityUnfor geableVoidMethod"), TestCheckSecurityInterfaceV8Internal::doNotCheckSecurityUnfo rgeableVoidMethodOriginSafeMethodGetterCallback, TestCheckSecurityInterfaceV8Int ernal::TestCheckSecurityInterfaceOriginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete)); 505 instanceTemplate->SetAccessor(v8::String::NewFromUtf8(isolate, "doNotCheckSe curityUnforgeableVoidMethod", v8::String::kInternalizedString), TestCheckSecurit yInterfaceV8Internal::doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGet terCallback, TestCheckSecurityInterfaceV8Internal::TestCheckSecurityInterfaceOri ginSafeMethodSetterCallback, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::Pr opertyAttribute>(v8::DontDelete));
506 506
507 // Custom toString template 507 // Custom toString template
508 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c urrent()->toStringTemplate()); 508 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
509 return functionTemplate; 509 return functionTemplate;
510 } 510 }
511 511
512 v8::Handle<v8::FunctionTemplate> V8TestCheckSecurityInterface::GetTemplate(v8::I solate* isolate, WrapperWorldType currentWorldType) 512 v8::Handle<v8::FunctionTemplate> V8TestCheckSecurityInterface::GetTemplate(v8::I solate* isolate, WrapperWorldType currentWorldType)
513 { 513 {
514 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 514 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
515 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 515 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
516 if (result != data->templateMap(currentWorldType).end()) 516 if (result != data->templateMap(currentWorldType).end())
517 return result->value.newLocal(isolate); 517 return result->value.newLocal(isolate);
518 518
519 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 519 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
520 v8::HandleScope handleScope(isolate); 520 v8::EscapableHandleScope handleScope(isolate);
521 v8::Handle<v8::FunctionTemplate> templ = 521 v8::Local<v8::FunctionTemplate> templ =
522 ConfigureV8TestCheckSecurityInterfaceTemplate(data->rawTemplate(&wrapper TypeInfo, currentWorldType), isolate, currentWorldType); 522 ConfigureV8TestCheckSecurityInterfaceTemplate(data->rawTemplate(&wrapper TypeInfo, currentWorldType), isolate, currentWorldType);
523 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 523 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
524 return handleScope.Close(templ); 524 return handleScope.Escape(templ);
525 } 525 }
526 526
527 bool V8TestCheckSecurityInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8 ::Isolate* isolate, WrapperWorldType currentWorldType) 527 bool V8TestCheckSecurityInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8 ::Isolate* isolate, WrapperWorldType currentWorldType)
528 { 528 {
529 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 529 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
530 } 530 }
531 531
532 bool V8TestCheckSecurityInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> j sValue, v8::Isolate* isolate) 532 bool V8TestCheckSecurityInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> j sValue, v8::Isolate* isolate)
533 { 533 {
534 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld) 534 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
(...skipping 26 matching lines...) Expand all
561 fromInternalPointer(object)->deref(); 561 fromInternalPointer(object)->deref();
562 } 562 }
563 563
564 template<> 564 template<>
565 v8::Handle<v8::Value> toV8NoInline(TestCheckSecurityInterface* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate) 565 v8::Handle<v8::Value> toV8NoInline(TestCheckSecurityInterface* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate)
566 { 566 {
567 return toV8(impl, creationContext, isolate); 567 return toV8(impl, creationContext, isolate);
568 } 568 }
569 569
570 } // namespace WebCore 570 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestCallback.cpp ('k') | Source/bindings/tests/results/V8TestConditionalInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698