| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (!dictionary.get(key, v8Value)) | 258 if (!dictionary.get(key, v8Value)) |
| 259 return false; | 259 return false; |
| 260 | 260 |
| 261 // We need to handle a DOMWindow specially, because a DOMWindow wrapper | 261 // We need to handle a DOMWindow specially, because a DOMWindow wrapper |
| 262 // exists on a prototype chain of v8Value. | 262 // exists on a prototype chain of v8Value. |
| 263 value = toDOMWindow(v8Value, dictionary.isolate()); | 263 value = toDOMWindow(v8Value, dictionary.isolate()); |
| 264 return true; | 264 return true; |
| 265 } | 265 } |
| 266 | 266 |
| 267 template <> | 267 template <> |
| 268 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Mess
agePortArray& value) | |
| 269 { | |
| 270 v8::Local<v8::Value> v8Value; | |
| 271 if (!dictionary.get(key, v8Value)) | |
| 272 return false; | |
| 273 | |
| 274 ASSERT(dictionary.isolate()); | |
| 275 ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent()); | |
| 276 if (blink::isUndefinedOrNull(v8Value)) | |
| 277 return true; | |
| 278 bool success = false; | |
| 279 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value,
key, dictionary.isolate(), &success); | |
| 280 return success; | |
| 281 } | |
| 282 | |
| 283 template <> | |
| 284 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Hash
Set<AtomicString>& value) | 268 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Hash
Set<AtomicString>& value) |
| 285 { | 269 { |
| 286 v8::Local<v8::Value> v8Value; | 270 v8::Local<v8::Value> v8Value; |
| 287 if (!dictionary.get(key, v8Value)) | 271 if (!dictionary.get(key, v8Value)) |
| 288 return false; | 272 return false; |
| 289 | 273 |
| 290 // FIXME: Support array-like objects | 274 // FIXME: Support array-like objects |
| 291 if (!v8Value->IsArray()) | 275 if (!v8Value->IsArray()) |
| 292 return false; | 276 return false; |
| 293 | 277 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 | 640 |
| 657 template <> | 641 template <> |
| 658 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers
ionContext& context, const String& key, MessagePortArray& value) | 642 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers
ionContext& context, const String& key, MessagePortArray& value) |
| 659 { | 643 { |
| 660 Dictionary::ConversionContextScope scope(context); | 644 Dictionary::ConversionContextScope scope(context); |
| 661 | 645 |
| 662 v8::Local<v8::Value> v8Value; | 646 v8::Local<v8::Value> v8Value; |
| 663 if (!dictionary.get(key, v8Value)) | 647 if (!dictionary.get(key, v8Value)) |
| 664 return true; | 648 return true; |
| 665 | 649 |
| 666 return DictionaryHelper::get(dictionary, key, value); | 650 ASSERT(dictionary.isolate()); |
| 651 ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent()); |
| 652 |
| 653 if (isUndefinedOrNull(v8Value)) |
| 654 return true; |
| 655 |
| 656 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value,
key, dictionary.isolate(), context.exceptionState()); |
| 657 |
| 658 if (context.exceptionState().throwIfNeeded()) |
| 659 return false; |
| 660 |
| 661 return true; |
| 667 } | 662 } |
| 668 | 663 |
| 669 } // namespace blink | 664 } // namespace blink |
| OLD | NEW |