OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 134 matching lines...) Loading... |
145 | 145 |
146 namespace { | 146 namespace { |
147 | 147 |
148 class InternalsIterator FINAL : public Iterator { | 148 class InternalsIterator FINAL : public Iterator { |
149 public: | 149 public: |
150 InternalsIterator() : m_current(0) { } | 150 InternalsIterator() : m_current(0) { } |
151 | 151 |
152 virtual ScriptValue next(ScriptState* scriptState, ExceptionState& exception
State) OVERRIDE | 152 virtual ScriptValue next(ScriptState* scriptState, ExceptionState& exception
State) OVERRIDE |
153 { | 153 { |
154 v8::Isolate* isolate = scriptState->isolate(); | 154 v8::Isolate* isolate = scriptState->isolate(); |
155 v8::Local<v8::Value> value = v8::Integer::New(isolate, m_current * m_cur
rent); | 155 int value = m_current * m_current; |
156 bool done = (m_current >= 5); | 156 if (m_current >= 5) |
| 157 return ScriptValue(scriptState, v8DoneIteratorResult(isolate)); |
157 ++m_current; | 158 ++m_current; |
158 | 159 return ScriptValue(scriptState, v8IteratorResult(scriptState, value)); |
159 v8::Local<v8::Object> result = v8::Object::New(isolate); | |
160 result->Set(v8String(isolate, "value"), value); | |
161 result->Set(v8String(isolate, "done"), v8Boolean(done, isolate)); | |
162 return ScriptValue(scriptState, result); | |
163 } | 160 } |
164 | 161 |
165 virtual ScriptValue next(ScriptState* scriptState, ScriptValue value, Except
ionState& exceptionState) OVERRIDE | 162 virtual ScriptValue next(ScriptState* scriptState, ScriptValue value, Except
ionState& exceptionState) OVERRIDE |
166 { | 163 { |
167 exceptionState.throwTypeError("Not implemented"); | 164 exceptionState.throwTypeError("Not implemented"); |
168 return ScriptValue(); | 165 return ScriptValue(); |
169 } | 166 } |
170 | 167 |
171 private: | 168 private: |
172 int m_current; | 169 int m_current; |
(...skipping 2089 matching lines...) Loading... |
2262 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState
); | 2259 element->ensureUserAgentShadowRoot().setInnerHTML(htmlSource, exceptionState
); |
2263 toHTMLPlugInElement(element)->setUsePlaceholderContent(true); | 2260 toHTMLPlugInElement(element)->setUsePlaceholderContent(true); |
2264 } | 2261 } |
2265 | 2262 |
2266 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio
nState) | 2263 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio
nState) |
2267 { | 2264 { |
2268 return new InternalsIterator; | 2265 return new InternalsIterator; |
2269 } | 2266 } |
2270 | 2267 |
2271 } // namespace blink | 2268 } // namespace blink |
OLD | NEW |