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

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

Issue 135843008: Remove V8HiddenPropertyName (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return; 211 return;
212 } 212 }
213 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der); 213 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der);
214 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 214 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
215 static int sharedTemplateUniqueKey; 215 static int sharedTemplateUniqueKey;
216 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New( info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType)), 0); 216 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityVoidMethodMethodCallback, v8Undefined(), v8::Signature::New( info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), currentWorldType)), 0);
217 v8SetReturnValue(info, sharedTemplate->GetFunction()); 217 v8SetReturnValue(info, sharedTemplate->GetFunction());
218 return; 218 return;
219 } 219 }
220 220
221 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8AtomicStrin g(info.GetIsolate(), "doNotCheckSecurityVoidMethod")); 221 v8::Local<v8::Value> hiddenValue = getHiddenValue(info.This(), v8AtomicStrin g(info.GetIsolate(), "doNotCheckSecurityVoidMethod"));
222 if (!hiddenValue.IsEmpty()) { 222 if (!hiddenValue.IsEmpty()) {
223 v8SetReturnValue(info, hiddenValue); 223 v8SetReturnValue(info, hiddenValue);
224 return; 224 return;
225 } 225 }
226 226
227 v8SetReturnValue(info, privateTemplate->GetFunction()); 227 v8SetReturnValue(info, privateTemplate->GetFunction());
228 } 228 }
229 229
230 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback(v8::Local <v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 230 static void doNotCheckSecurityVoidMethodOriginSafeMethodGetterCallback(v8::Local <v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
231 { 231 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return; 263 return;
264 } 264 }
265 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der); 265 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der);
266 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 266 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
267 static int sharedTemplateUniqueKey; 267 static int sharedTemplateUniqueKey;
268 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8: :Signature::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(inf o.GetIsolate(), currentWorldType)), 0); 268 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallback, v8Undefined(), v8: :Signature::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(inf o.GetIsolate(), currentWorldType)), 0);
269 v8SetReturnValue(info, sharedTemplate->GetFunction()); 269 v8SetReturnValue(info, sharedTemplate->GetFunction());
270 return; 270 return;
271 } 271 }
272 272
273 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8AtomicStrin g(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod")); 273 v8::Local<v8::Value> hiddenValue = getHiddenValue(info.This(), v8AtomicStrin g(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod"));
274 if (!hiddenValue.IsEmpty()) { 274 if (!hiddenValue.IsEmpty()) {
275 v8SetReturnValue(info, hiddenValue); 275 v8SetReturnValue(info, hiddenValue);
276 return; 276 return;
277 } 277 }
278 278
279 v8SetReturnValue(info, privateTemplate->GetFunction()); 279 v8SetReturnValue(info, privateTemplate->GetFunction());
280 } 280 }
281 281
282 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 282 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa llback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
283 { 283 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 return; 315 return;
316 } 316 }
317 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der); 317 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der);
318 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 318 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
319 static int sharedTemplateUniqueKey; 319 static int sharedTemplateUniqueKey;
320 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Unde fined(), v8::Signature::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::dom Template(info.GetIsolate(), currentWorldType)), 0); 320 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityPerWorldBindingsVoidMethodMethodCallbackForMainWorld, v8Unde fined(), v8::Signature::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::dom Template(info.GetIsolate(), currentWorldType)), 0);
321 v8SetReturnValue(info, sharedTemplate->GetFunction()); 321 v8SetReturnValue(info, sharedTemplate->GetFunction());
322 return; 322 return;
323 } 323 }
324 324
325 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8AtomicStrin g(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod")); 325 v8::Local<v8::Value> hiddenValue = getHiddenValue(info.This(), v8AtomicStrin g(info.GetIsolate(), "doNotCheckSecurityPerWorldBindingsVoidMethod"));
326 if (!hiddenValue.IsEmpty()) { 326 if (!hiddenValue.IsEmpty()) {
327 v8SetReturnValue(info, hiddenValue); 327 v8SetReturnValue(info, hiddenValue);
328 return; 328 return;
329 } 329 }
330 330
331 v8SetReturnValue(info, privateTemplate->GetFunction()); 331 v8SetReturnValue(info, privateTemplate->GetFunction());
332 } 332 }
333 333
334 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val ue>& info) 334 static void doNotCheckSecurityPerWorldBindingsVoidMethodOriginSafeMethodGetterCa llbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Val ue>& info)
335 { 335 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 return; 367 return;
368 } 368 }
369 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der); 369 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der);
370 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 370 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
371 static int sharedTemplateUniqueKey; 371 static int sharedTemplateUniqueKey;
372 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signatu re::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIso late(), currentWorldType)), 0); 372 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityReadOnlyVoidMethodMethodCallback, v8Undefined(), v8::Signatu re::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.GetIso late(), currentWorldType)), 0);
373 v8SetReturnValue(info, sharedTemplate->GetFunction()); 373 v8SetReturnValue(info, sharedTemplate->GetFunction());
374 return; 374 return;
375 } 375 }
376 376
377 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8AtomicStrin g(info.GetIsolate(), "doNotCheckSecurityReadOnlyVoidMethod")); 377 v8::Local<v8::Value> hiddenValue = getHiddenValue(info.This(), v8AtomicStrin g(info.GetIsolate(), "doNotCheckSecurityReadOnlyVoidMethod"));
378 if (!hiddenValue.IsEmpty()) { 378 if (!hiddenValue.IsEmpty()) {
379 v8SetReturnValue(info, hiddenValue); 379 v8SetReturnValue(info, hiddenValue);
380 return; 380 return;
381 } 381 }
382 382
383 v8SetReturnValue(info, privateTemplate->GetFunction()); 383 v8SetReturnValue(info, privateTemplate->GetFunction());
384 } 384 }
385 385
386 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCallback(v 8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 386 static void doNotCheckSecurityReadOnlyVoidMethodOriginSafeMethodGetterCallback(v 8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
387 { 387 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 return; 419 return;
420 } 420 }
421 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der); 421 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der);
422 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) { 422 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
423 static int sharedTemplateUniqueKey; 423 static int sharedTemplateUniqueKey;
424 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Sign ature::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.Get Isolate(), currentWorldType)), 0); 424 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, TestInterfaceCheckSecurityV8Internal ::doNotCheckSecurityUnforgeableVoidMethodMethodCallback, v8Undefined(), v8::Sign ature::New(info.GetIsolate(), V8TestInterfaceCheckSecurity::domTemplate(info.Get Isolate(), currentWorldType)), 0);
425 v8SetReturnValue(info, sharedTemplate->GetFunction()); 425 v8SetReturnValue(info, sharedTemplate->GetFunction());
426 return; 426 return;
427 } 427 }
428 428
429 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8AtomicStrin g(info.GetIsolate(), "doNotCheckSecurityUnforgeableVoidMethod")); 429 v8::Local<v8::Value> hiddenValue = getHiddenValue(info.This(), v8AtomicStrin g(info.GetIsolate(), "doNotCheckSecurityUnforgeableVoidMethod"));
430 if (!hiddenValue.IsEmpty()) { 430 if (!hiddenValue.IsEmpty()) {
431 v8SetReturnValue(info, hiddenValue); 431 v8SetReturnValue(info, hiddenValue);
432 return; 432 return;
433 } 433 }
434 434
435 v8SetReturnValue(info, privateTemplate->GetFunction()); 435 v8SetReturnValue(info, privateTemplate->GetFunction());
436 } 436 }
437 437
438 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetterCallbac k(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 438 static void doNotCheckSecurityUnforgeableVoidMethodOriginSafeMethodGetterCallbac k(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
439 { 439 {
440 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 440 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
441 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho dOriginSafeMethodGetter(info); 441 TestInterfaceCheckSecurityV8Internal::doNotCheckSecurityUnforgeableVoidMetho dOriginSafeMethodGetter(info);
442 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 442 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
443 } 443 }
444 444
445 static void TestInterfaceCheckSecurityOriginSafeMethodSetter(v8::Local<v8::Strin g> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf o) 445 static void TestInterfaceCheckSecurityOriginSafeMethodSetter(v8::Local<v8::Strin g> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf o)
446 { 446 {
447 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), worldType(info.GetIso late()))); 447 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8 TestInterfaceCheckSecurity::domTemplate(info.GetIsolate(), worldType(info.GetIso late())));
448 if (holder.IsEmpty()) 448 if (holder.IsEmpty())
449 return; 449 return;
450 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der); 450 TestInterfaceCheckSecurity* imp = V8TestInterfaceCheckSecurity::toNative(hol der);
451 v8::String::Utf8Value attributeName(name); 451 v8::String::Utf8Value attributeName(name);
452 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate()); 452 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "TestInterfaceCheckSecurity", info.Holder(), info.GetIsolate());
453 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState) ) { 453 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState) ) {
454 exceptionState.throwIfNeeded(); 454 exceptionState.throwIfNeeded();
455 return; 455 return;
456 } 456 }
457 457
458 info.This()->SetHiddenValue(name, jsValue); 458 setHiddenValue(info.This(), name, jsValue);
459 } 459 }
460 460
461 static void TestInterfaceCheckSecurityOriginSafeMethodSetterCallback(v8::Local<v 8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<vo id>& info) 461 static void TestInterfaceCheckSecurityOriginSafeMethodSetterCallback(v8::Local<v 8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<vo id>& info)
462 { 462 {
463 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 463 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
464 TestInterfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOriginSafeMe thodSetter(name, jsValue, info); 464 TestInterfaceCheckSecurityV8Internal::TestInterfaceCheckSecurityOriginSafeMe thodSetter(name, jsValue, info);
465 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 465 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
466 } 466 }
467 467
468 } // namespace TestInterfaceCheckSecurityV8Internal 468 } // namespace TestInterfaceCheckSecurityV8Internal
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 fromInternalPointer(object)->deref(); 550 fromInternalPointer(object)->deref();
551 } 551 }
552 552
553 template<> 553 template<>
554 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate) 554 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate)
555 { 555 {
556 return toV8(impl, creationContext, isolate); 556 return toV8(impl, creationContext, isolate);
557 } 557 }
558 558
559 } // namespace WebCore 559 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698