| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 v8::Local<v8::Value> value = options->Get(key); | 234 v8::Local<v8::Value> value = options->Get(key); |
| 235 TOSTRING_DEFAULT(V8StringResource<>, stringKey, key, false); | 235 TOSTRING_DEFAULT(V8StringResource<>, stringKey, key, false); |
| 236 TOSTRING_DEFAULT(V8StringResource<>, stringValue, value, false); | 236 TOSTRING_DEFAULT(V8StringResource<>, stringValue, value, false); |
| 237 if (!static_cast<const String&>(stringKey).isEmpty()) | 237 if (!static_cast<const String&>(stringKey).isEmpty()) |
| 238 hashMap.set(stringKey, stringValue); | 238 hashMap.set(stringKey, stringValue); |
| 239 } | 239 } |
| 240 | 240 |
| 241 return true; | 241 return true; |
| 242 } | 242 } |
| 243 | 243 |
| 244 bool Dictionary::getOwnPropertyNames(Vector<String>& names) const | |
| 245 { | |
| 246 if (!isObject()) | |
| 247 return false; | |
| 248 | |
| 249 v8::Handle<v8::Object> options = m_options->ToObject(); | |
| 250 if (options.IsEmpty()) | |
| 251 return false; | |
| 252 | |
| 253 v8::Local<v8::Array> properties = options->GetOwnPropertyNames(); | |
| 254 if (properties.IsEmpty()) | |
| 255 return true; | |
| 256 for (uint32_t i = 0; i < properties->Length(); ++i) { | |
| 257 v8::Local<v8::String> key = properties->Get(i)->ToString(); | |
| 258 if (!options->Has(key)) | |
| 259 continue; | |
| 260 TOSTRING_DEFAULT(V8StringResource<>, stringKey, key, false); | |
| 261 names.append(stringKey); | |
| 262 } | |
| 263 | |
| 264 return true; | |
| 265 } | |
| 266 | |
| 267 bool Dictionary::getPropertyNames(Vector<String>& names) const | 244 bool Dictionary::getPropertyNames(Vector<String>& names) const |
| 268 { | 245 { |
| 269 if (!isObject()) | 246 if (!isObject()) |
| 270 return false; | 247 return false; |
| 271 | 248 |
| 272 v8::Handle<v8::Object> options = m_options->ToObject(); | 249 v8::Handle<v8::Object> options = m_options->ToObject(); |
| 273 if (options.IsEmpty()) | 250 if (options.IsEmpty()) |
| 274 return false; | 251 return false; |
| 275 | 252 |
| 276 v8::Local<v8::Array> properties = options->GetPropertyNames(); | 253 v8::Local<v8::Array> properties = options->GetPropertyNames(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 305 | 282 |
| 306 return *this; | 283 return *this; |
| 307 } | 284 } |
| 308 | 285 |
| 309 void Dictionary::ConversionContext::throwTypeError(const String& detail) | 286 void Dictionary::ConversionContext::throwTypeError(const String& detail) |
| 310 { | 287 { |
| 311 exceptionState().throwTypeError(detail); | 288 exceptionState().throwTypeError(detail); |
| 312 } | 289 } |
| 313 | 290 |
| 314 } // namespace blink | 291 } // namespace blink |
| OLD | NEW |