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

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

Issue 125043004: Remove world type from hasInstance() (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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 return result->value.newLocal(isolate); 512 return result->value.newLocal(isolate);
513 513
514 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 514 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
515 v8::EscapableHandleScope handleScope(isolate); 515 v8::EscapableHandleScope handleScope(isolate);
516 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode); 516 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
517 configureV8TestInterfaceCheckSecurityTemplate(templ, isolate, currentWorldTy pe); 517 configureV8TestInterfaceCheckSecurityTemplate(templ, isolate, currentWorldTy pe);
518 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 518 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
519 return handleScope.Escape(templ); 519 return handleScope.Escape(templ);
520 } 520 }
521 521
522 bool V8TestInterfaceCheckSecurity::hasInstance(v8::Handle<v8::Value> jsValue, v8 ::Isolate* isolate, WrapperWorldType currentWorldType) 522 bool V8TestInterfaceCheckSecurity::hasInstance(v8::Handle<v8::Value> jsValue, v8 ::Isolate* isolate)
523 { 523 {
524 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 524 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
525 } 525 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
526
527 bool V8TestInterfaceCheckSecurity::hasInstanceInAnyWorld(v8::Handle<v8::Value> j sValue, v8::Isolate* isolate)
528 {
529 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
530 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
531 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
532 } 526 }
533 527
534 v8::Handle<v8::Object> V8TestInterfaceCheckSecurity::createWrapper(PassRefPtr<Te stInterfaceCheckSecurity> impl, v8::Handle<v8::Object> creationContext, v8::Isol ate* isolate) 528 v8::Handle<v8::Object> V8TestInterfaceCheckSecurity::createWrapper(PassRefPtr<Te stInterfaceCheckSecurity> impl, v8::Handle<v8::Object> creationContext, v8::Isol ate* isolate)
535 { 529 {
536 ASSERT(impl); 530 ASSERT(impl);
537 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceCheckSecurity>(impl.get (), isolate)); 531 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceCheckSecurity>(impl.get (), isolate));
538 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 532 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
539 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 533 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
540 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 534 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
541 // the same object de-ref functions, though, so use that as the basis of the check. 535 // the same object de-ref functions, though, so use that as the basis of the check.
(...skipping 14 matching lines...) Expand all
556 fromInternalPointer(object)->deref(); 550 fromInternalPointer(object)->deref();
557 } 551 }
558 552
559 template<> 553 template<>
560 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)
561 { 555 {
562 return toV8(impl, creationContext, isolate); 556 return toV8(impl, creationContext, isolate);
563 } 557 }
564 558
565 } // namespace WebCore 559 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698