| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 bool get(const String&, unsigned long long&) const; | 81 bool get(const String&, unsigned long long&) const; |
| 82 bool get(const String&, RefPtr<DOMWindow>&) const; | 82 bool get(const String&, RefPtr<DOMWindow>&) const; |
| 83 bool get(const String&, RefPtr<Storage>&) const; | 83 bool get(const String&, RefPtr<Storage>&) const; |
| 84 bool get(const String&, MessagePortArray&) const; | 84 bool get(const String&, MessagePortArray&) const; |
| 85 bool get(const String&, RefPtr<Uint8Array>&) const; | 85 bool get(const String&, RefPtr<Uint8Array>&) const; |
| 86 bool get(const String&, RefPtr<ArrayBufferView>&) const; | 86 bool get(const String&, RefPtr<ArrayBufferView>&) const; |
| 87 bool get(const String&, RefPtr<MIDIPort>&) const; | 87 bool get(const String&, RefPtr<MIDIPort>&) const; |
| 88 bool get(const String&, RefPtr<MediaKeyError>&) const; | 88 bool get(const String&, RefPtr<MediaKeyError>&) const; |
| 89 bool get(const String&, RefPtr<TrackBase>&) const; | 89 bool get(const String&, RefPtr<TrackBase>&) const; |
| 90 bool get(const String&, RefPtr<SpeechRecognitionError>&) const; | 90 bool get(const String&, RefPtr<SpeechRecognitionError>&) const; |
| 91 bool get(const String&, RefPtrWillBeRawPtr<SpeechRecognitionResult>&) const; | 91 bool get(const String&, RefPtr<SpeechRecognitionResult>&) const; |
| 92 bool get(const String&, RefPtrWillBeRawPtr<SpeechRecognitionResultList>&) co
nst; | 92 bool get(const String&, RefPtr<SpeechRecognitionResultList>&) const; |
| 93 bool get(const String&, RefPtr<MediaStream>&) const; | 93 bool get(const String&, RefPtr<MediaStream>&) const; |
| 94 bool get(const String&, RefPtr<EventTarget>&) const; | 94 bool get(const String&, RefPtr<EventTarget>&) const; |
| 95 bool get(const String&, HashSet<AtomicString>&) const; | 95 bool get(const String&, HashSet<AtomicString>&) const; |
| 96 bool get(const String&, Dictionary&) const; | 96 bool get(const String&, Dictionary&) const; |
| 97 bool get(const String&, Vector<String>&) const; | 97 bool get(const String&, Vector<String>&) const; |
| 98 bool get(const String&, ArrayValue&) const; | 98 bool get(const String&, ArrayValue&) const; |
| 99 bool get(const String&, RefPtr<DOMError>&) const; | 99 bool get(const String&, RefPtr<DOMError>&) const; |
| 100 bool get(const String&, OwnPtr<VoidCallback>&) const; | 100 bool get(const String&, OwnPtr<VoidCallback>&) const; |
| 101 bool get(const String&, v8::Local<v8::Value>&) const; | 101 bool get(const String&, v8::Local<v8::Value>&) const; |
| 102 | 102 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 private: | 146 private: |
| 147 ConversionContext& m_context; | 147 ConversionContext& m_context; |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 bool convert(ConversionContext&, const String&, bool&) const; | 150 bool convert(ConversionContext&, const String&, bool&) const; |
| 151 bool convert(ConversionContext&, const String&, double&) const; | 151 bool convert(ConversionContext&, const String&, double&) const; |
| 152 bool convert(ConversionContext&, const String&, String&) const; | 152 bool convert(ConversionContext&, const String&, String&) const; |
| 153 bool convert(ConversionContext&, const String&, ScriptValue&) const; | 153 bool convert(ConversionContext&, const String&, ScriptValue&) const; |
| 154 | 154 |
| 155 template<typename IntegralType> | 155 template<typename IntegralType> |
| 156 bool convert(ConversionContext&, const String&, IntegralType&) const; | 156 bool convert(ConversionContext &, const String&, IntegralType&) const; |
| 157 bool convert(ConversionContext&, const String&, MessagePortArray&) const; | 157 bool convert(ConversionContext &, const String&, MessagePortArray&) const; |
| 158 bool convert(ConversionContext&, const String&, HashSet<AtomicString>&) cons
t; | 158 bool convert(ConversionContext &, const String&, HashSet<AtomicString>&) con
st; |
| 159 bool convert(ConversionContext&, const String&, Dictionary&) const; | 159 bool convert(ConversionContext &, const String&, Dictionary&) const; |
| 160 bool convert(ConversionContext&, const String&, Vector<String>&) const; | 160 bool convert(ConversionContext &, const String&, Vector<String>&) const; |
| 161 bool convert(ConversionContext&, const String&, ArrayValue&) const; | 161 bool convert(ConversionContext &, const String&, ArrayValue&) const; |
| 162 template<typename T> | 162 template<typename T> |
| 163 bool convert(ConversionContext&, const String&, RefPtr<T>&) const; | 163 bool convert(ConversionContext &, const String&, RefPtr<T>&) const; |
| 164 template<typename T> | |
| 165 bool convert(ConversionContext&, const String&, RawPtr<T>&) const; | |
| 166 | 164 |
| 167 template<typename StringType> | 165 template<typename StringType> |
| 168 bool getStringType(const String&, StringType&) const; | 166 bool getStringType(const String&, StringType&) const; |
| 169 | 167 |
| 170 bool getOwnPropertiesAsStringHashMap(HashMap<String, String>&) const; | 168 bool getOwnPropertiesAsStringHashMap(HashMap<String, String>&) const; |
| 171 bool getOwnPropertyNames(Vector<String>&) const; | 169 bool getOwnPropertyNames(Vector<String>&) const; |
| 172 | 170 |
| 173 bool getWithUndefinedOrNullCheck(const String&, String&) const; | 171 bool getWithUndefinedOrNullCheck(const String&, String&) const; |
| 174 | 172 |
| 175 bool hasProperty(const String&) const; | 173 bool hasProperty(const String&) const; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 314 |
| 317 v8::Local<v8::Value> v8Value; | 315 v8::Local<v8::Value> v8Value; |
| 318 getKey(key, v8Value); | 316 getKey(key, v8Value); |
| 319 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) | 317 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) |
| 320 return true; | 318 return true; |
| 321 | 319 |
| 322 context.throwTypeError(ExceptionMessages::incorrectPropertyType(key, "does n
ot have a " + context.typeName() + " type.")); | 320 context.throwTypeError(ExceptionMessages::incorrectPropertyType(key, "does n
ot have a " + context.typeName() + " type.")); |
| 323 return false; | 321 return false; |
| 324 } | 322 } |
| 325 | 323 |
| 326 template<typename T> bool Dictionary::convert(ConversionContext& context, const
String& key, RawPtr<T>& value) const | |
| 327 { | |
| 328 ConversionContextScope scope(context); | |
| 329 | |
| 330 if (!get(key, value)) | |
| 331 return true; | |
| 332 | |
| 333 if (value) | |
| 334 return true; | |
| 335 | |
| 336 v8::Local<v8::Value> v8Value; | |
| 337 getKey(key, v8Value); | |
| 338 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) | |
| 339 return true; | |
| 340 | |
| 341 context.throwTypeError(ExceptionMessages::incorrectPropertyType(key, "does n
ot have a " + context.typeName() + " type.")); | |
| 342 return false; | |
| 343 } | |
| 344 | |
| 345 } | 324 } |
| 346 | 325 |
| 347 #endif // Dictionary_h | 326 #endif // Dictionary_h |
| OLD | NEW |