Chromium Code Reviews| Index: Source/modules/webdatabase/SQLResultSetRowList.cpp |
| diff --git a/Source/modules/webdatabase/SQLResultSetRowList.cpp b/Source/modules/webdatabase/SQLResultSetRowList.cpp |
| index 1d16c5e4e84cfb40825699f0a7e9d65809161d43..1cc41ecc521de3081da5c7a2053e8fc4bbfd246b 100644 |
| --- a/Source/modules/webdatabase/SQLResultSetRowList.cpp |
| +++ b/Source/modules/webdatabase/SQLResultSetRowList.cpp |
| @@ -29,6 +29,12 @@ |
| #include "config.h" |
| #include "modules/webdatabase/SQLResultSetRowList.h" |
| +#include "bindings/core/v8/ExceptionMessages.h" |
| +#include "bindings/core/v8/ToV8.h" |
| +#include "bindings/core/v8/V8Binding.h" |
|
vivekg
2015/03/04 13:40:44
The V8Binding.h inclusion is not required.
I wan
|
| +#include "bindings/modules/v8/ToV8.h" |
| +#include "core/dom/ExceptionCode.h" |
| + |
| namespace blink { |
| unsigned SQLResultSetRowList::length() const |
| @@ -41,4 +47,24 @@ unsigned SQLResultSetRowList::length() const |
| return m_result.size() / m_columns.size(); |
| } |
| +ScriptValue SQLResultSetRowList::item(unsigned index, ExceptionState& exceptionState) |
|
Yuki
2015/03/04 14:11:04
This function should return Vector<pair<String, SQ
Jens Widell
2015/03/04 14:18:26
I disagree. The code generator determines what the
Jens Widell
2015/03/04 14:23:41
That said, we should still perhaps not use toV8()
Yuki
2015/03/04 14:30:45
Agreed. Otherwise, we face to another issue how t
|
| +{ |
| + if (index >= length()) { |
| + exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::indexExceedsMaximumBound<unsigned>("index", index, length())); |
| + return ScriptValue(); |
| + } |
| + unsigned numColumns = m_columns.size(); |
| + unsigned valuesIndex = index * numColumns; |
| + |
| + Vector<std::pair<String, v8::Handle<v8::Value>>> dataArray; |
| + v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| + |
| + for (unsigned i = 0; i < numColumns; ++i) |
| + dataArray.append(std::make_pair(m_columns[i], toV8(m_result[valuesIndex + i], isolate))); |
| + |
| + ScriptState* scriptState = ScriptState::current(isolate); |
| + ASSERT(scriptState); |
| + return ScriptValue(scriptState, toV8(dataArray, scriptState->context()->Global(), isolate)); |
| +} |
| + |
| } |