Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: Source/bindings/core/v8/Iterable.h

Issue 1100223003: bindings: Add empty checks for toV8() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef Iterable_h 5 #ifndef Iterable_h
6 #define Iterable_h 6 #define Iterable_h
7 7
8 #include "bindings/core/v8/V8IteratorResultValue.h" 8 #include "bindings/core/v8/V8IteratorResultValue.h"
9 #include "bindings/core/v8/V8ScriptRunner.h" 9 #include "bindings/core/v8/V8ScriptRunner.h"
10 #include "core/dom/Iterator.h" 10 #include "core/dom/Iterator.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 KeyType key; 57 KeyType key;
58 ValueType value; 58 ValueType value;
59 59
60 if (!source->next(scriptState, key, value, exceptionState)) 60 if (!source->next(scriptState, key, value, exceptionState))
61 return; 61 return;
62 62
63 ASSERT(!exceptionState.hadException()); 63 ASSERT(!exceptionState.hadException());
64 64
65 args[0] = toV8(value, creationContext, isolate); 65 args[0] = toV8(value, creationContext, isolate);
66 args[1] = toV8(key, creationContext, isolate); 66 args[1] = toV8(key, creationContext, isolate);
67 if (args[0].IsEmpty() || args[1].IsEmpty()) {
68 if (tryCatch.HasCaught())
69 exceptionState.rethrowV8Exception(tryCatch.Exception());
70 return;
71 }
67 72
68 v8::Local<v8::Value> result; 73 v8::Local<v8::Value> result;
69 if (!V8ScriptRunner::callFunction(v8Callback, scriptState->execution Context(), v8ThisArg, 3, args, isolate).ToLocal(&result)) { 74 if (!V8ScriptRunner::callFunction(v8Callback, scriptState->execution Context(), v8ThisArg, 3, args, isolate).ToLocal(&result)) {
70 exceptionState.rethrowV8Exception(tryCatch.Exception()); 75 exceptionState.rethrowV8Exception(tryCatch.Exception());
71 return; 76 return;
72 } 77 }
73 } 78 }
74 } 79 }
75 80
76 class IterationSource : public GarbageCollectedFinalized<IterationSource> { 81 class IterationSource : public GarbageCollectedFinalized<IterationSource> {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 public: 196 public:
192 Iterator* iterator(ScriptState* scriptState, ExceptionState& exceptionState) 197 Iterator* iterator(ScriptState* scriptState, ExceptionState& exceptionState)
193 { 198 {
194 return this->entriesForBinding(scriptState, exceptionState); 199 return this->entriesForBinding(scriptState, exceptionState);
195 } 200 }
196 }; 201 };
197 202
198 } // namespace blink 203 } // namespace blink
199 204
200 #endif // Iterable_h 205 #endif // Iterable_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698