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

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

Issue 171533006: V8 Binding: Introduce toNativeWithTypeCheck (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 598 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
599 return handleScope.Escape(templ); 599 return handleScope.Escape(templ);
600 } 600 }
601 601
602 bool V8TestInterfaceCheckSecurity::hasInstance(v8::Handle<v8::Value> jsValue, v8 ::Isolate* isolate) 602 bool V8TestInterfaceCheckSecurity::hasInstance(v8::Handle<v8::Value> jsValue, v8 ::Isolate* isolate)
603 { 603 {
604 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 604 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
605 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 605 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
606 } 606 }
607 607
608 TestInterfaceCheckSecurity* V8TestInterfaceCheckSecurity::toNativeWithTypeCheck( v8::Isolate* isolate, v8::Handle<v8::Value> value)
609 {
610 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
611 }
612
608 v8::Handle<v8::Object> V8TestInterfaceCheckSecurity::createWrapper(PassRefPtr<Te stInterfaceCheckSecurity> impl, v8::Handle<v8::Object> creationContext, v8::Isol ate* isolate) 613 v8::Handle<v8::Object> V8TestInterfaceCheckSecurity::createWrapper(PassRefPtr<Te stInterfaceCheckSecurity> impl, v8::Handle<v8::Object> creationContext, v8::Isol ate* isolate)
609 { 614 {
610 ASSERT(impl); 615 ASSERT(impl);
611 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceCheckSecurity>(impl.get (), isolate)); 616 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceCheckSecurity>(impl.get (), isolate));
612 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 617 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
613 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 618 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
614 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 619 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
615 // the same object de-ref functions, though, so use that as the basis of the check. 620 // the same object de-ref functions, though, so use that as the basis of the check.
616 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 621 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
617 } 622 }
(...skipping 12 matching lines...) Expand all
630 fromInternalPointer(object)->deref(); 635 fromInternalPointer(object)->deref();
631 } 636 }
632 637
633 template<> 638 template<>
634 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate) 639 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCheckSecurity* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate)
635 { 640 {
636 return toV8(impl, creationContext, isolate); 641 return toV8(impl, creationContext, isolate);
637 } 642 }
638 643
639 } // namespace WebCore 644 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698