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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.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 /* 1 /*
2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2011 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // NOTE: cssPropertyInfo lookups incur several mallocs. 180 // NOTE: cssPropertyInfo lookups incur several mallocs.
181 // Successful lookups have the same cost the first time, but are cached. 181 // Successful lookups have the same cost the first time, but are cached.
182 if (cssPropertyInfo(v8Name.As<v8::String>())) { 182 if (cssPropertyInfo(v8Name.As<v8::String>())) {
183 v8SetReturnValueInt(info, 0); 183 v8SetReturnValueInt(info, 0);
184 return; 184 return;
185 } 185 }
186 } 186 }
187 187
188 void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) 188 void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
189 { 189 {
190 if (!name->IsString())
191 return;
192
190 // Search the style declaration. 193 // Search the style declaration.
191 CSSPropertyID unresolvedProperty = cssPropertyInfo(name.As<v8::String>()); 194 CSSPropertyID unresolvedProperty = cssPropertyInfo(name.As<v8::String>());
192 195
193 // Do not handle non-property names. 196 // Do not handle non-property names.
194 if (!unresolvedProperty) 197 if (!unresolvedProperty)
195 return; 198 return;
196 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty); 199 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty);
197 200
198 CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder()); 201 CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder());
199 // TODO(leviw): This API doesn't support custom properties. 202 // TODO(leviw): This API doesn't support custom properties.
(...skipping 21 matching lines...) Expand all
221 // TODO(leviw): This API doesn't support custom properties. 224 // TODO(leviw): This API doesn't support custom properties.
222 impl->setPropertyInternal(unresolvedProperty, String(), propertyValue, false , exceptionState); 225 impl->setPropertyInternal(unresolvedProperty, String(), propertyValue, false , exceptionState);
223 226
224 if (exceptionState.throwIfNeeded()) 227 if (exceptionState.throwIfNeeded())
225 return; 228 return;
226 229
227 v8SetReturnValue(info, value); 230 v8SetReturnValue(info, value);
228 } 231 }
229 232
230 } // namespace blink 233 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698