Index: third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp b/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp |
index 739e3a075c546e8039e9ae376604ed72ff869d5f..64105f0fef59b2bd6f99d9475a9707dcfcd7c2de 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/V8IteratorResultValue.cpp |
@@ -18,4 +18,17 @@ v8::Local<v8::Object> v8IteratorResultValue(v8::Isolate* isolate, bool done, v8: |
return result; |
} |
+v8::MaybeLocal<v8::Value> v8IterationItemUnpack(ScriptState* scriptState, v8::Local<v8::Object> item, bool* done) |
haraken
2015/12/10 14:24:35
I don't see much benefit in returning a MaybeLocal
yhirano
2015/12/11 03:27:18
bashi@'s document says we should return a maybe ha
bashi
2015/12/11 04:03:20
+1 for MaybeLocal because this could throw an exce
|
+{ |
+ v8::MaybeLocal<v8::Value> maybeValue = item->Get(scriptState->context(), v8String(scriptState->isolate(), "value")); |
+ if (maybeValue.IsEmpty()) |
haraken
2015/12/10 14:24:35
Can you use:
if (!v8Call(item->Get(...)))
r
yhirano
2015/12/11 03:27:18
It is technically possible, but we don't have to u
|
+ return maybeValue; |
+ v8::Local<v8::Value> doneValue; |
+ if (!v8Call(item->Get(scriptState->context(), v8String(scriptState->isolate(), "done")), doneValue) |
+ || !v8Call(doneValue->BooleanValue(scriptState->context()), *done)) { |
+ return v8::MaybeLocal<v8::Value>(); |
+ } |
+ return maybeValue; |
+} |
+ |
} // namespace blink |