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

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

Issue 1938943002: Use v8::Object::CreateDataProperty() for object construction (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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 std::sort(propertyNames.begin(), propertyNames.end(), codePointCompareLe ssThan); 160 std::sort(propertyNames.begin(), propertyNames.end(), codePointCompareLe ssThan);
161 propertyNamesLength = propertyNames.size(); 161 propertyNamesLength = propertyNames.size();
162 } 162 }
163 163
164 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext(); 164 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
165 v8::Local<v8::Array> properties = v8::Array::New(info.GetIsolate(), property NamesLength); 165 v8::Local<v8::Array> properties = v8::Array::New(info.GetIsolate(), property NamesLength);
166 for (unsigned i = 0; i < propertyNamesLength; ++i) { 166 for (unsigned i = 0; i < propertyNamesLength; ++i) {
167 String key = propertyNames.at(i); 167 String key = propertyNames.at(i);
168 ASSERT(!key.isNull()); 168 ASSERT(!key.isNull());
169 v8::Local<v8::Integer> index = v8::Integer::New(info.GetIsolate(), i); 169 if (!v8CallBoolean(properties->CreateDataProperty(context, i, v8String(i nfo.GetIsolate(), key))))
170 if (!v8CallBoolean(properties->Set(context, index, v8String(info.GetIsol ate(), key))))
171 return; 170 return;
172 } 171 }
173 172
174 v8SetReturnValue(info, properties); 173 v8SetReturnValue(info, properties);
175 } 174 }
176 175
177 void V8CSSStyleDeclaration::namedPropertyQueryCustom(v8::Local<v8::Name> v8Name, const v8::PropertyCallbackInfo<v8::Integer>& info) 176 void V8CSSStyleDeclaration::namedPropertyQueryCustom(v8::Local<v8::Name> v8Name, const v8::PropertyCallbackInfo<v8::Integer>& info)
178 { 177 {
179 if (!v8Name->IsString()) 178 if (!v8Name->IsString())
180 return; 179 return;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // TODO(leviw): This API doesn't support custom properties. 221 // TODO(leviw): This API doesn't support custom properties.
223 impl->setPropertyInternal(unresolvedProperty, String(), propertyValue, false , exceptionState); 222 impl->setPropertyInternal(unresolvedProperty, String(), propertyValue, false , exceptionState);
224 223
225 if (exceptionState.throwIfNeeded()) 224 if (exceptionState.throwIfNeeded())
226 return; 225 return;
227 226
228 v8SetReturnValue(info, value); 227 v8SetReturnValue(info, value);
229 } 228 }
230 229
231 } // namespace blink 230 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698