| Index: Source/bindings/core/v8/Dictionary.cpp
|
| diff --git a/Source/bindings/core/v8/Dictionary.cpp b/Source/bindings/core/v8/Dictionary.cpp
|
| index bcdb11df661b17d28fe53000590b0d594dcab7a9..9abe95a5a69589866e0c2abf28de017a18c9c988 100644
|
| --- a/Source/bindings/core/v8/Dictionary.cpp
|
| +++ b/Source/bindings/core/v8/Dictionary.cpp
|
| @@ -138,281 +138,6 @@ bool Dictionary::get(const String& key, v8::Local<v8::Value>& value) const
|
| return getKey(key, value);
|
| }
|
|
|
| -bool Dictionary::get(const String& key, bool& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - v8::Local<v8::Boolean> v8Bool = v8Value->ToBoolean();
|
| - if (v8Bool.IsEmpty())
|
| - return false;
|
| - value = v8Bool->Value();
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::convert(ConversionContext& context, const String& key, bool& value) const
|
| -{
|
| - ConversionContextScope scope(context);
|
| - get(key, value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, int32_t& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32();
|
| - if (v8Int32.IsEmpty())
|
| - return false;
|
| - value = v8Int32->Value();
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, double& value, bool& hasValue) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value)) {
|
| - hasValue = false;
|
| - return false;
|
| - }
|
| -
|
| - hasValue = true;
|
| - TONATIVE_DEFAULT(v8::Local<v8::Number>, v8Number, v8Value->ToNumber(), false);
|
| - if (v8Number.IsEmpty())
|
| - return false;
|
| - value = v8Number->Value();
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, double& value) const
|
| -{
|
| - bool unused;
|
| - return get(key, value, unused);
|
| -}
|
| -
|
| -bool Dictionary::convert(ConversionContext& context, const String& key, double& value) const
|
| -{
|
| - ConversionContextScope scope(context);
|
| -
|
| - bool hasValue = false;
|
| - if (!get(key, value, hasValue) && hasValue) {
|
| - context.throwTypeError(ExceptionMessages::incorrectPropertyType(key, "is not of type 'double'."));
|
| - return false;
|
| - }
|
| - return true;
|
| -}
|
| -
|
| -template<typename StringType>
|
| -inline bool Dictionary::getStringType(const String& key, StringType& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - TOSTRING_DEFAULT(V8StringResource<>, stringValue, v8Value, false);
|
| - value = stringValue;
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, String& value) const
|
| -{
|
| - return getStringType(key, value);
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, AtomicString& value) const
|
| -{
|
| - return getStringType(key, value);
|
| -}
|
| -
|
| -bool Dictionary::convert(ConversionContext& context, const String& key, String& value) const
|
| -{
|
| - ConversionContextScope scope(context);
|
| -
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return true;
|
| -
|
| - TOSTRING_DEFAULT(V8StringResource<>, stringValue, v8Value, false);
|
| - value = stringValue;
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, ScriptValue& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = ScriptValue(ScriptState::current(m_isolate), v8Value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::convert(ConversionContext& context, const String& key, ScriptValue& value) const
|
| -{
|
| - ConversionContextScope scope(context);
|
| -
|
| - get(key, value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, unsigned short& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32();
|
| - if (v8Int32.IsEmpty())
|
| - return false;
|
| - value = static_cast<unsigned short>(v8Int32->Value());
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, short& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32();
|
| - if (v8Int32.IsEmpty())
|
| - return false;
|
| - value = static_cast<short>(v8Int32->Value());
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, unsigned& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32();
|
| - if (v8Int32.IsEmpty())
|
| - return false;
|
| - value = static_cast<unsigned>(v8Int32->Value());
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, unsigned long& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - v8::Local<v8::Integer> v8Integer = v8Value->ToInteger();
|
| - if (v8Integer.IsEmpty())
|
| - return false;
|
| - value = static_cast<unsigned long>(v8Integer->Value());
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, unsigned long long& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - TONATIVE_DEFAULT(v8::Local<v8::Number>, v8Number, v8Value->ToNumber(), false);
|
| - if (v8Number.IsEmpty())
|
| - return false;
|
| - double d = v8Number->Value();
|
| - doubleToInteger(d, value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, RefPtrWillBeMember<LocalDOMWindow>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - // We need to handle a DOMWindow specially, because a DOMWindow wrapper
|
| - // exists on a prototype chain of v8Value.
|
| - value = toDOMWindow(v8Value, m_isolate);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, RefPtrWillBeMember<Storage>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = V8Storage::toNativeWithTypeCheck(m_isolate, v8Value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, MessagePortArray& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - ASSERT(m_isolate);
|
| - ASSERT(m_isolate == v8::Isolate::GetCurrent());
|
| - if (WebCore::isUndefinedOrNull(v8Value))
|
| - return true;
|
| - bool success = false;
|
| - value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, m_isolate, &success);
|
| - return success;
|
| -}
|
| -
|
| -bool Dictionary::convert(ConversionContext& context, const String& key, MessagePortArray& value) const
|
| -{
|
| - ConversionContextScope scope(context);
|
| -
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return true;
|
| -
|
| - return get(key, value);
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, HashSet<AtomicString>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - // FIXME: Support array-like objects
|
| - if (!v8Value->IsArray())
|
| - return false;
|
| -
|
| - ASSERT(m_isolate);
|
| - ASSERT(m_isolate == v8::Isolate::GetCurrent());
|
| - v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value);
|
| - for (size_t i = 0; i < v8Array->Length(); ++i) {
|
| - v8::Local<v8::Value> indexedValue = v8Array->Get(v8::Integer::New(m_isolate, i));
|
| - TOSTRING_DEFAULT(V8StringResource<>, stringValue, indexedValue, false);
|
| - value.add(stringValue);
|
| - }
|
| -
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::convert(ConversionContext& context, const String& key, HashSet<AtomicString>& value) const
|
| -{
|
| - ConversionContextScope scope(context);
|
| -
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return true;
|
| -
|
| - if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value))
|
| - return true;
|
| -
|
| - if (!v8Value->IsArray()) {
|
| - context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key));
|
| - return false;
|
| - }
|
| -
|
| - return get(key, value);
|
| -}
|
| -
|
| bool Dictionary::getWithUndefinedOrNullCheck(const String& key, String& value) const
|
| {
|
| v8::Local<v8::Value> v8Value;
|
| @@ -444,131 +169,6 @@ bool Dictionary::getWithUndefinedOrNullCheck(const String& key, RefPtr<Path2D>&
|
| return true;
|
| }
|
|
|
| -bool Dictionary::get(const String& key, RefPtr<Uint8Array>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = V8Uint8Array::toNativeWithTypeCheck(m_isolate, v8Value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, RefPtr<ArrayBufferView>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = V8ArrayBufferView::toNativeWithTypeCheck(m_isolate, v8Value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, Member<MIDIPort>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = V8MIDIPort::toNativeWithTypeCheck(m_isolate, v8Value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, RefPtrWillBeMember<MediaKeyError>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = V8MediaKeyError::toNativeWithTypeCheck(m_isolate, v8Value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, RefPtrWillBeMember<TrackBase>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - TrackBase* source = 0;
|
| - if (v8Value->IsObject()) {
|
| - v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value);
|
| -
|
| - // FIXME: this will need to be changed so it can also return an AudioTrack or a VideoTrack once
|
| - // we add them.
|
| - v8::Handle<v8::Object> track = V8TextTrack::findInstanceInPrototypeChain(wrapper, m_isolate);
|
| - if (!track.IsEmpty())
|
| - source = V8TextTrack::toNative(track);
|
| - }
|
| - value = source;
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, Member<SpeechRecognitionResult>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = V8SpeechRecognitionResult::toNativeWithTypeCheck(m_isolate, v8Value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, Member<SpeechRecognitionResultList>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = V8SpeechRecognitionResultList::toNativeWithTypeCheck(m_isolate, v8Value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, Member<Gamepad>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = V8Gamepad::toNativeWithTypeCheck(m_isolate, v8Value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, Member<MediaStream>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = V8MediaStream::toNativeWithTypeCheck(m_isolate, v8Value);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, RefPtrWillBeMember<EventTarget>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = nullptr;
|
| - // We need to handle a LocalDOMWindow specially, because a LocalDOMWindow wrapper
|
| - // exists on a prototype chain of v8Value.
|
| - if (v8Value->IsObject()) {
|
| - v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value);
|
| - v8::Handle<v8::Object> window = V8Window::findInstanceInPrototypeChain(wrapper, m_isolate);
|
| - if (!window.IsEmpty()) {
|
| - value = toWrapperTypeInfo(window)->toEventTarget(window);
|
| - return true;
|
| - }
|
| - }
|
| -
|
| - if (V8DOMWrapper::isDOMWrapper(v8Value)) {
|
| - v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value);
|
| - value = toWrapperTypeInfo(wrapper)->toEventTarget(wrapper);
|
| - }
|
| - return true;
|
| -}
|
| -
|
| bool Dictionary::get(const String& key, Dictionary& value) const
|
| {
|
| v8::Local<v8::Value> v8Value;
|
| @@ -584,16 +184,6 @@ bool Dictionary::get(const String& key, Dictionary& value) const
|
| return true;
|
| }
|
|
|
| -bool Dictionary::get(const String& key, RefPtr<Headers>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = V8Headers::toNativeWithTypeCheck(m_isolate, v8Value);
|
| - return true;
|
| -}
|
| -
|
| bool Dictionary::set(const String& key, const v8::Handle<v8::Value>& value)
|
| {
|
| if (isUndefinedOrNull())
|
| @@ -637,88 +227,6 @@ bool Dictionary::convert(ConversionContext& context, const String& key, Dictiona
|
| return false;
|
| }
|
|
|
| -bool Dictionary::get(const String& key, Vector<String>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - if (!v8Value->IsArray())
|
| - return false;
|
| -
|
| - v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value);
|
| - for (size_t i = 0; i < v8Array->Length(); ++i) {
|
| - v8::Local<v8::Value> indexedValue = v8Array->Get(v8::Uint32::New(m_isolate, i));
|
| - TOSTRING_DEFAULT(V8StringResource<>, stringValue, indexedValue, false);
|
| - value.append(stringValue);
|
| - }
|
| -
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::convert(ConversionContext& context, const String& key, Vector<String>& value) const
|
| -{
|
| - ConversionContextScope scope(context);
|
| -
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return true;
|
| -
|
| - if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value))
|
| - return true;
|
| -
|
| - if (!v8Value->IsArray()) {
|
| - context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key));
|
| - return false;
|
| - }
|
| -
|
| - return get(key, value);
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, ArrayValue& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - if (!v8Value->IsArray())
|
| - return false;
|
| -
|
| - ASSERT(m_isolate);
|
| - ASSERT(m_isolate == v8::Isolate::GetCurrent());
|
| - value = ArrayValue(v8::Local<v8::Array>::Cast(v8Value), m_isolate);
|
| - return true;
|
| -}
|
| -
|
| -bool Dictionary::convert(ConversionContext& context, const String& key, ArrayValue& value) const
|
| -{
|
| - ConversionContextScope scope(context);
|
| -
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return true;
|
| -
|
| - if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value))
|
| - return true;
|
| -
|
| - if (!v8Value->IsArray()) {
|
| - context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key));
|
| - return false;
|
| - }
|
| -
|
| - return get(key, value);
|
| -}
|
| -
|
| -bool Dictionary::get(const String& key, RefPtrWillBeMember<DOMError>& value) const
|
| -{
|
| - v8::Local<v8::Value> v8Value;
|
| - if (!getKey(key, v8Value))
|
| - return false;
|
| -
|
| - value = V8DOMError::toNativeWithTypeCheck(m_isolate, v8Value);
|
| - return true;
|
| -}
|
| -
|
| bool Dictionary::getOwnPropertiesAsStringHashMap(HashMap<String, String>& hashMap) const
|
| {
|
| if (!isObject())
|
|
|