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

Side by Side Diff: Source/bindings/tests/results/V8TestPrivateScriptInterface.cpp

Issue 345893002: Implement an infrastructure of Blink-in-JS Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6
7 #include "config.h"
8 #include "V8TestPrivateScriptInterface.h"
9
10 #include "bindings/core/v8/V8Window.h"
11 #include "bindings/tests/v8/V8Document.h"
12 #include "bindings/tests/v8/V8Node.h"
13 #include "bindings/v8/PrivateScriptController.h"
14 #include "core/dom/ScriptForbiddenScope.h"
15 #include "core/frame/LocalFrame.h"
16
17 namespace WebCore {
18
19 bool V8TestPrivateScriptInterface::doNothing(LocalFrame* frame)
20 {
21 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptWorld());
22 if (context.IsEmpty())
23 return false;
24 ScriptState* scriptState = ScriptState::from(context);
25 ScriptState::Scope scope(scriptState);
26 LocalDOMWindow* window = scriptState->domWindow();
27 if (!window)
28 return false;
29 v8::Handle<v8::Value> windowWrapper = toV8(window, scriptState->context()->G lobal(), scriptState->isolate());
30
31 v8::Handle<v8::Value> *argv = 0;
32 // FIXME: Support exceptions thrown from Blink-in-JS.
33 v8::TryCatch block;
34 PrivateScriptController::run(scriptState->isolate(), "TestPrivateScriptInter face", "doNothing", windowWrapper, 0, argv);
35 if (block.HasCaught())
36 return false;
37 return true;
38 }
39
40 bool V8TestPrivateScriptInterface::return123(LocalFrame* frame, int* output)
41 {
42 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptWorld());
43 if (context.IsEmpty())
44 return false;
45 ScriptState* scriptState = ScriptState::from(context);
46 ScriptState::Scope scope(scriptState);
47 LocalDOMWindow* window = scriptState->domWindow();
48 if (!window)
49 return false;
50 v8::Handle<v8::Value> windowWrapper = toV8(window, scriptState->context()->G lobal(), scriptState->isolate());
51
52 v8::Handle<v8::Value> *argv = 0;
53 // FIXME: Support exceptions thrown from Blink-in-JS.
54 v8::TryCatch block;
55 v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState->is olate(), "TestPrivateScriptInterface", "return123", windowWrapper, 0, argv);
56 if (block.HasCaught())
57 return false;
58 ExceptionState exceptionState(ExceptionState::ExecutionContext, "return123", "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState->is olate());
59 int cppValue = toInt16(v8Value, exceptionState);
60 if (block.HasCaught())
61 return false;
62 *output = cppValue;
63 return true;
64 }
65
66 bool V8TestPrivateScriptInterface::echoInteger(LocalFrame* frame, int value, int * output)
67 {
68 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptWorld());
69 if (context.IsEmpty())
70 return false;
71 ScriptState* scriptState = ScriptState::from(context);
72 ScriptState::Scope scope(scriptState);
73 LocalDOMWindow* window = scriptState->domWindow();
74 if (!window)
75 return false;
76 v8::Handle<v8::Value> windowWrapper = toV8(window, scriptState->context()->G lobal(), scriptState->isolate());
77
78 v8::Handle<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(), value);
79 v8::Handle<v8::Value> argv[] = { valueHandle };
80 // FIXME: Support exceptions thrown from Blink-in-JS.
81 v8::TryCatch block;
82 v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState->is olate(), "TestPrivateScriptInterface", "echoInteger", windowWrapper, 1, argv);
83 if (block.HasCaught())
84 return false;
85 ExceptionState exceptionState(ExceptionState::ExecutionContext, "echoInteger ", "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState-> isolate());
86 int cppValue = toInt16(v8Value, exceptionState);
87 if (block.HasCaught())
88 return false;
89 *output = cppValue;
90 return true;
91 }
92
93 bool V8TestPrivateScriptInterface::echoString(LocalFrame* frame, String value, S tring* output)
94 {
95 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptWorld());
96 if (context.IsEmpty())
97 return false;
98 ScriptState* scriptState = ScriptState::from(context);
99 ScriptState::Scope scope(scriptState);
100 LocalDOMWindow* window = scriptState->domWindow();
101 if (!window)
102 return false;
103 v8::Handle<v8::Value> windowWrapper = toV8(window, scriptState->context()->G lobal(), scriptState->isolate());
104
105 v8::Handle<v8::Value> valueHandle = v8String(scriptState->isolate(), value);
106 v8::Handle<v8::Value> argv[] = { valueHandle };
107 // FIXME: Support exceptions thrown from Blink-in-JS.
108 v8::TryCatch block;
109 v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState->is olate(), "TestPrivateScriptInterface", "echoString", windowWrapper, 1, argv);
110 if (block.HasCaught())
111 return false;
112 ExceptionState exceptionState(ExceptionState::ExecutionContext, "echoString" , "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState->i solate());
113 V8StringResource<> cppValue = v8Value;
114 if (block.HasCaught())
115 return false;
116 *output = cppValue;
117 return true;
118 }
119
120 bool V8TestPrivateScriptInterface::echoNode(LocalFrame* frame, PassRefPtrWillBeR awPtr<Node> value, RefPtrWillBeRawPtr<Node>* output)
121 {
122 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptWorld());
123 if (context.IsEmpty())
124 return false;
125 ScriptState* scriptState = ScriptState::from(context);
126 ScriptState::Scope scope(scriptState);
127 LocalDOMWindow* window = scriptState->domWindow();
128 if (!window)
129 return false;
130 v8::Handle<v8::Value> windowWrapper = toV8(window, scriptState->context()->G lobal(), scriptState->isolate());
131
132 v8::Handle<v8::Value> valueHandle = toV8(value, scriptState->context()->Glob al(), scriptState->isolate());
133 v8::Handle<v8::Value> argv[] = { valueHandle };
134 // FIXME: Support exceptions thrown from Blink-in-JS.
135 v8::TryCatch block;
136 v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState->is olate(), "TestPrivateScriptInterface", "echoNode", windowWrapper, 1, argv);
137 if (block.HasCaught())
138 return false;
139 ExceptionState exceptionState(ExceptionState::ExecutionContext, "echoNode", "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState->iso late());
140 Node* cppValue = V8Node::toNativeWithTypeCheck(scriptState->isolate(), v8Val ue);
141 if (block.HasCaught())
142 return false;
143 *output = cppValue;
144 return true;
145 }
146
147 bool V8TestPrivateScriptInterface::addInteger(LocalFrame* frame, int value1, int value2, int* output)
148 {
149 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptWorld());
150 if (context.IsEmpty())
151 return false;
152 ScriptState* scriptState = ScriptState::from(context);
153 ScriptState::Scope scope(scriptState);
154 LocalDOMWindow* window = scriptState->domWindow();
155 if (!window)
156 return false;
157 v8::Handle<v8::Value> windowWrapper = toV8(window, scriptState->context()->G lobal(), scriptState->isolate());
158
159 v8::Handle<v8::Value> value1Handle = v8::Integer::New(scriptState->isolate() , value1);
160 v8::Handle<v8::Value> value2Handle = v8::Integer::New(scriptState->isolate() , value2);
161 v8::Handle<v8::Value> argv[] = { value1Handle, value2Handle };
162 // FIXME: Support exceptions thrown from Blink-in-JS.
163 v8::TryCatch block;
164 v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState->is olate(), "TestPrivateScriptInterface", "addInteger", windowWrapper, 2, argv);
165 if (block.HasCaught())
166 return false;
167 ExceptionState exceptionState(ExceptionState::ExecutionContext, "addInteger" , "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState->i solate());
168 int cppValue = toInt16(v8Value, exceptionState);
169 if (block.HasCaught())
170 return false;
171 *output = cppValue;
172 return true;
173 }
174
175 bool V8TestPrivateScriptInterface::addString(LocalFrame* frame, String value1, S tring value2, String* output)
176 {
177 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptWorld());
178 if (context.IsEmpty())
179 return false;
180 ScriptState* scriptState = ScriptState::from(context);
181 ScriptState::Scope scope(scriptState);
182 LocalDOMWindow* window = scriptState->domWindow();
183 if (!window)
184 return false;
185 v8::Handle<v8::Value> windowWrapper = toV8(window, scriptState->context()->G lobal(), scriptState->isolate());
186
187 v8::Handle<v8::Value> value1Handle = v8String(scriptState->isolate(), value1 );
188 v8::Handle<v8::Value> value2Handle = v8String(scriptState->isolate(), value2 );
189 v8::Handle<v8::Value> argv[] = { value1Handle, value2Handle };
190 // FIXME: Support exceptions thrown from Blink-in-JS.
191 v8::TryCatch block;
192 v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState->is olate(), "TestPrivateScriptInterface", "addString", windowWrapper, 2, argv);
193 if (block.HasCaught())
194 return false;
195 ExceptionState exceptionState(ExceptionState::ExecutionContext, "addString", "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState->is olate());
196 V8StringResource<> cppValue = v8Value;
197 if (block.HasCaught())
198 return false;
199 *output = cppValue;
200 return true;
201 }
202
203 bool V8TestPrivateScriptInterface::setIntegerToDocument(LocalFrame* frame, PassR efPtrWillBeRawPtr<Document> document, int value)
204 {
205 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptWorld());
206 if (context.IsEmpty())
207 return false;
208 ScriptState* scriptState = ScriptState::from(context);
209 ScriptState::Scope scope(scriptState);
210 LocalDOMWindow* window = scriptState->domWindow();
211 if (!window)
212 return false;
213 v8::Handle<v8::Value> windowWrapper = toV8(window, scriptState->context()->G lobal(), scriptState->isolate());
214
215 v8::Handle<v8::Value> documentHandle = toV8(document, scriptState->context() ->Global(), scriptState->isolate());
216 v8::Handle<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(), value);
217 v8::Handle<v8::Value> argv[] = { documentHandle, valueHandle };
218 // FIXME: Support exceptions thrown from Blink-in-JS.
219 v8::TryCatch block;
220 PrivateScriptController::run(scriptState->isolate(), "TestPrivateScriptInter face", "setIntegerToDocument", windowWrapper, 2, argv);
221 if (block.HasCaught())
222 return false;
223 return true;
224 }
225
226 bool V8TestPrivateScriptInterface::getIntegerFromDocument(LocalFrame* frame, Pas sRefPtrWillBeRawPtr<Document> document, int* output)
227 {
228 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptWorld());
229 if (context.IsEmpty())
230 return false;
231 ScriptState* scriptState = ScriptState::from(context);
232 ScriptState::Scope scope(scriptState);
233 LocalDOMWindow* window = scriptState->domWindow();
234 if (!window)
235 return false;
236 v8::Handle<v8::Value> windowWrapper = toV8(window, scriptState->context()->G lobal(), scriptState->isolate());
237
238 v8::Handle<v8::Value> documentHandle = toV8(document, scriptState->context() ->Global(), scriptState->isolate());
239 v8::Handle<v8::Value> argv[] = { documentHandle };
240 // FIXME: Support exceptions thrown from Blink-in-JS.
241 v8::TryCatch block;
242 v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState->is olate(), "TestPrivateScriptInterface", "getIntegerFromDocument", windowWrapper, 1, argv);
243 if (block.HasCaught())
244 return false;
245 ExceptionState exceptionState(ExceptionState::ExecutionContext, "getIntegerF romDocument", "TestPrivateScriptInterface", scriptState->context()->Global(), sc riptState->isolate());
246 int cppValue = toInt16(v8Value, exceptionState);
247 if (block.HasCaught())
248 return false;
249 *output = cppValue;
250 return true;
251 }
252
253 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698