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

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperations.cpp

Issue 1967453002: Always check that a Name is a String before converting it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "V8TestSpecialOperations.h" 7 #include "V8TestSpecialOperations.h"
8 8
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/UnionTypesCore.h" 10 #include "bindings/core/v8/UnionTypesCore.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 v8SetReturnValue(info, result); 58 v8SetReturnValue(info, result);
59 } 59 }
60 60
61 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 61 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
62 { 62 {
63 TestSpecialOperationsV8Internal::namedItemMethod(info); 63 TestSpecialOperationsV8Internal::namedItemMethod(info);
64 } 64 }
65 65
66 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall backInfo<v8::Value>& info) 66 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall backInfo<v8::Value>& info)
67 { 67 {
68 if (!name->IsString())
69 return;
68 auto nameString = name.As<v8::String>(); 70 auto nameString = name.As<v8::String>();
69 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()) ; 71 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()) ;
70 AtomicString propertyName = toCoreAtomicString(nameString); 72 AtomicString propertyName = toCoreAtomicString(nameString);
71 NodeOrNodeList result; 73 NodeOrNodeList result;
72 impl->getItem(propertyName, result); 74 impl->getItem(propertyName, result);
73 if (result.isNull()) 75 if (result.isNull())
74 return; 76 return;
75 v8SetReturnValue(info, result); 77 v8SetReturnValue(info, result);
76 } 78 }
77 79
78 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop ertyCallbackInfo<v8::Value>& info) 80 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop ertyCallbackInfo<v8::Value>& info)
79 { 81 {
80 TestSpecialOperationsV8Internal::namedPropertyGetter(name, info); 82 TestSpecialOperationsV8Internal::namedPropertyGetter(name, info);
81 } 83 }
82 84
83 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info) 85 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
84 { 86 {
87 if (!name->IsString())
88 return;
85 auto nameString = name.As<v8::String>(); 89 auto nameString = name.As<v8::String>();
86 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()) ; 90 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()) ;
87 V8StringResource<> propertyName(nameString); 91 V8StringResource<> propertyName(nameString);
88 if (!propertyName.prepare()) 92 if (!propertyName.prepare())
89 return; 93 return;
90 Node* propertyValue = V8Node::toImplWithTypeCheck(info.GetIsolate(), v8Value ); 94 Node* propertyValue = V8Node::toImplWithTypeCheck(info.GetIsolate(), v8Value );
91 if (!propertyValue && !isUndefinedOrNull(v8Value)) { 95 if (!propertyValue && !isUndefinedOrNull(v8Value)) {
92 exceptionState.throwTypeError("The provided value is not of type 'Node'. "); 96 exceptionState.throwTypeError("The provided value is not of type 'Node'. ");
93 exceptionState.throwIfNeeded(); 97 exceptionState.throwIfNeeded();
94 return; 98 return;
95 } 99 }
96 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); 100 bool result = impl->anonymousNamedSetter(propertyName, propertyValue);
97 if (!result) 101 if (!result)
98 return; 102 return;
99 v8SetReturnValue(info, v8Value); 103 v8SetReturnValue(info, v8Value);
100 } 104 }
101 105
102 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8:: Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) 106 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8:: Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
103 { 107 {
104 TestSpecialOperationsV8Internal::namedPropertySetter(name, v8Value, info); 108 TestSpecialOperationsV8Internal::namedPropertySetter(name, v8Value, info);
105 } 109 }
106 110
107 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb ackInfo<v8::Integer>& info) 111 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb ackInfo<v8::Integer>& info)
108 { 112 {
113 if (!name->IsString())
114 return;
109 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()) ; 115 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()) ;
110 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); 116 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
111 v8::String::Utf8Value namedProperty(name); 117 v8::String::Utf8Value namedProperty(name);
112 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestSpecialOperations", info.Holder(), info.GetIsolate()); 118 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestSpecialOperations", info.Holder(), info.GetIsolate());
113 bool result = impl->namedPropertyQuery(propertyName, exceptionState); 119 bool result = impl->namedPropertyQuery(propertyName, exceptionState);
114 if (exceptionState.throwIfNeeded()) 120 if (exceptionState.throwIfNeeded())
115 return; 121 return;
116 if (!result) 122 if (!result)
117 return; 123 return;
118 v8SetReturnValueInt(info, v8::None); 124 v8SetReturnValueInt(info, v8::None);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 { 187 {
182 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value); 188 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
183 } 189 }
184 190
185 TestSpecialOperations* V8TestSpecialOperations::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value) 191 TestSpecialOperations* V8TestSpecialOperations::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
186 { 192 {
187 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu e)) : 0; 193 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu e)) : 0;
188 } 194 }
189 195
190 } // namespace blink 196 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698