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

Side by Side Diff: Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp

Issue 1061243002: bindings: Adds check for attributes on prototype chains in CSSStyleDeclaration. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 if (cssPropertyInfo(v8Name.As<v8::String>(), info.GetIsolate())) { 192 if (cssPropertyInfo(v8Name.As<v8::String>(), info.GetIsolate())) {
193 v8SetReturnValueInt(info, 0); 193 v8SetReturnValueInt(info, 0);
194 return; 194 return;
195 } 195 }
196 } 196 }
197 197
198 void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) 198 void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
199 { 199 {
200 if (!name->IsString()) 200 if (!name->IsString())
201 return; 201 return;
202 auto nameString = name.As<v8::String>();
203 auto context = info.GetIsolate()->GetCurrentContext();
202 // First look for API defined attributes on the style declaration object. 204 // First look for API defined attributes on the style declaration object.
203 if (v8CallBoolean(info.Holder()->HasRealNamedCallbackProperty(info.GetIsolat e()->GetCurrentContext(), name.As<v8::String>()))) 205 if (v8CallBoolean(info.Holder()->HasRealNamedCallbackProperty(context, nameS tring)))
204 return; 206 return;
207 {
208 v8::Local<v8::Value> returnValue;
209 v8::TryCatch tryCatch;
210 if (v8Call(info.Holder()->GetRealNamedPropertyInPrototypeChain(context, nameString), returnValue, tryCatch)) {
bashi 2015/04/07 08:44:56 I read the following comment on GetRealNamedProper
Yuki 2015/04/07 09:29:00 I think that it is an intended behavior that GetRe
211 v8SetReturnValue(info, returnValue);
212 return;
213 }
214 if (tryCatch.HasCaught()) {
215 tryCatch.ReThrow();
216 return;
217 }
218 }
205 219
206 // Search the style declaration. 220 // Search the style declaration.
207 CSSPropertyInfo* propInfo = cssPropertyInfo(name.As<v8::String>(), info.GetI solate()); 221 CSSPropertyInfo* propInfo = cssPropertyInfo(name.As<v8::String>(), info.GetI solate());
208 222
209 // Do not handle non-property names. 223 // Do not handle non-property names.
210 if (!propInfo) 224 if (!propInfo)
211 return; 225 return;
212 226
213 CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder()); 227 CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder());
214 RefPtrWillBeRawPtr<CSSValue> cssValue = impl->getPropertyCSSValueInternal(st atic_cast<CSSPropertyID>(propInfo->propID)); 228 RefPtrWillBeRawPtr<CSSValue> cssValue = impl->getPropertyCSSValueInternal(st atic_cast<CSSPropertyID>(propInfo->propID));
(...skipping 19 matching lines...) Expand all
234 ExceptionState exceptionState(ExceptionState::SetterContext, getPropertyName (static_cast<CSSPropertyID>(propInfo->propID)), "CSSStyleDeclaration", info.Hold er(), info.GetIsolate()); 248 ExceptionState exceptionState(ExceptionState::SetterContext, getPropertyName (static_cast<CSSPropertyID>(propInfo->propID)), "CSSStyleDeclaration", info.Hold er(), info.GetIsolate());
235 impl->setPropertyInternal(static_cast<CSSPropertyID>(propInfo->propID), prop ertyValue, false, exceptionState); 249 impl->setPropertyInternal(static_cast<CSSPropertyID>(propInfo->propID), prop ertyValue, false, exceptionState);
236 250
237 if (exceptionState.throwIfNeeded()) 251 if (exceptionState.throwIfNeeded())
238 return; 252 return;
239 253
240 v8SetReturnValue(info, value); 254 v8SetReturnValue(info, value);
241 } 255 }
242 256
243 } // namespace blink 257 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698