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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if (!v8CallBoolean(m_dictionaryObject->Has(v8Context(), key))) | 115 if (!v8CallBoolean(m_dictionaryObject->Has(v8Context(), key))) |
116 return false; | 116 return false; |
117 | 117 |
118 // Swallow a possible exception in v8::Object::Get(). | 118 // Swallow a possible exception in v8::Object::Get(). |
119 // TODO(bashi,yukishiino): Should rethrow the exception. | 119 // TODO(bashi,yukishiino): Should rethrow the exception. |
120 // http://crbug.com/666661 | 120 // http://crbug.com/666661 |
121 v8::TryCatch tryCatch(isolate()); | 121 v8::TryCatch tryCatch(isolate()); |
122 return m_dictionaryObject->Get(v8Context(), key).ToLocal(&result); | 122 return m_dictionaryObject->Get(v8Context(), key).ToLocal(&result); |
123 } | 123 } |
124 | 124 |
125 WARN_UNUSED_RESULT static v8::MaybeLocal<v8::String> getStringValueInArray( | |
126 v8::Local<v8::Context> context, | |
127 v8::Local<v8::Array> array, | |
128 uint32_t index) { | |
129 v8::Local<v8::Value> value; | |
130 if (!array->Get(context, index).ToLocal(&value)) | |
131 return v8::MaybeLocal<v8::String>(); | |
132 return value->ToString(context); | |
133 } | |
134 | |
135 HashMap<String, String> Dictionary::getOwnPropertiesAsStringHashMap( | 125 HashMap<String, String> Dictionary::getOwnPropertiesAsStringHashMap( |
136 ExceptionState& exceptionState) const { | 126 ExceptionState& exceptionState) const { |
137 if (m_dictionaryObject.IsEmpty()) | 127 if (m_dictionaryObject.IsEmpty()) |
138 return HashMap<String, String>(); | 128 return HashMap<String, String>(); |
139 | 129 |
140 v8::TryCatch tryCatch(isolate()); | 130 v8::TryCatch tryCatch(isolate()); |
141 v8::Local<v8::Array> propertyNames; | 131 v8::Local<v8::Array> propertyNames; |
142 if (!m_dictionaryObject->GetOwnPropertyNames(v8Context()) | 132 if (!m_dictionaryObject->GetOwnPropertyNames(v8Context()) |
143 .ToLocal(&propertyNames)) { | 133 .ToLocal(&propertyNames)) { |
144 exceptionState.rethrowV8Exception(tryCatch.Exception()); | 134 exceptionState.rethrowV8Exception(tryCatch.Exception()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 if (!stringKey.prepare(isolate(), exceptionState)) | 186 if (!stringKey.prepare(isolate(), exceptionState)) |
197 return Vector<String>(); | 187 return Vector<String>(); |
198 | 188 |
199 names.push_back(stringKey); | 189 names.push_back(stringKey); |
200 } | 190 } |
201 | 191 |
202 return names; | 192 return names; |
203 } | 193 } |
204 | 194 |
205 } // namespace blink | 195 } // namespace blink |
OLD | NEW |