| Index: third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
|
| index d0bb9de194cf24ec8ad2487adc5c89c2ed997404..64c806effb0e00657aa309f18873126eba93e42f 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
|
| @@ -905,6 +905,28 @@ v8::Local<v8::Function> getBoundFunction(v8::Local<v8::Function> function)
|
| return boundFunction->IsFunction() ? v8::Local<v8::Function>::Cast(boundFunction) : function;
|
| }
|
|
|
| +v8::MaybeLocal<v8::Object> getEsIterator(v8::Isolate* isolate, v8::Local<v8::Object> object, ExceptionState& exceptionState)
|
| +{
|
| + v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
| + v8::Local<v8::Value> iteratorGetter;
|
| + if (!object->Get(context, v8::Symbol::GetIterator(isolate)).ToLocal(&iteratorGetter))
|
| + return v8::MaybeLocal<v8::Object>();
|
| + if (!iteratorGetter->IsFunction()) {
|
| + exceptionState.throwTypeError("Iterator getter is not callable.");
|
| + return v8::MaybeLocal<v8::Object>();
|
| + }
|
| +
|
| + v8::Local<v8::Function> getterFunction = iteratorGetter.As<v8::Function>();
|
| + v8::Local<v8::Value> iterator;
|
| + if (!V8ScriptRunner::callFunction(getterFunction, toExecutionContext(context), object, 0, nullptr, isolate).ToLocal(&iterator))
|
| + return v8::MaybeLocal<v8::Object>();
|
| + if (!iterator->IsObject()) {
|
| + exceptionState.throwTypeError("Iterator is not an object.");
|
| + return v8::MaybeLocal<v8::Object>();
|
| + }
|
| + return v8::MaybeLocal<v8::Object>(iterator.As<v8::Object>());
|
| +}
|
| +
|
| bool addHiddenValueToArray(v8::Isolate* isolate, v8::Local<v8::Object> object, v8::Local<v8::Value> value, int arrayIndex)
|
| {
|
| ASSERT(!value.IsEmpty());
|
|
|