| OLD | NEW |
| (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::voidMethod(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 if (!scriptState->executionContext() || !scriptState->domWindow()) |
| 26 return false; |
| 27 |
| 28 ScriptState::Scope scope(scriptState); |
| 29 v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptS
tate->context()->Global(), 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, "TestPrivateScriptInterface", "voi
dMethod", windowWrapper, 0, argv); |
| 35 if (block.HasCaught()) |
| 36 return false; |
| 37 return true; |
| 38 } |
| 39 |
| 40 bool V8TestPrivateScriptInterface::shortMethod(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 if (!scriptState->executionContext() || !scriptState->domWindow()) |
| 47 return false; |
| 48 |
| 49 ScriptState::Scope scope(scriptState); |
| 50 v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptS
tate->context()->Global(), 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, "T
estPrivateScriptInterface", "shortMethod", windowWrapper, 0, argv); |
| 56 if (block.HasCaught()) |
| 57 return false; |
| 58 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod
", "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState->
isolate()); |
| 59 int cppValue = toInt16(v8Value, exceptionState); |
| 60 if (block.HasCaught()) |
| 61 return false; |
| 62 *output = cppValue; |
| 63 return true; |
| 64 } |
| 65 |
| 66 bool V8TestPrivateScriptInterface::shortMethodWithShortArgument(LocalFrame* fram
e, 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 if (!scriptState->executionContext() || !scriptState->domWindow()) |
| 73 return false; |
| 74 |
| 75 ScriptState::Scope scope(scriptState); |
| 76 v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptS
tate->context()->Global(), 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, "T
estPrivateScriptInterface", "shortMethodWithShortArgument", windowWrapper, 1, ar
gv); |
| 83 if (block.HasCaught()) |
| 84 return false; |
| 85 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod
WithShortArgument", "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::stringMethodWithStringArgument(LocalFrame* fr
ame, String value, String* 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 if (!scriptState->executionContext() || !scriptState->domWindow()) |
| 100 return false; |
| 101 |
| 102 ScriptState::Scope scope(scriptState); |
| 103 v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptS
tate->context()->Global(), 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, "T
estPrivateScriptInterface", "stringMethodWithStringArgument", windowWrapper, 1,
argv); |
| 110 if (block.HasCaught()) |
| 111 return false; |
| 112 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringMetho
dWithStringArgument", "TestPrivateScriptInterface", scriptState->context()->Glob
al(), scriptState->isolate()); |
| 113 V8StringResource<> cppValue = v8Value; |
| 114 if (block.HasCaught()) |
| 115 return false; |
| 116 *output = cppValue; |
| 117 return true; |
| 118 } |
| 119 |
| 120 bool V8TestPrivateScriptInterface::nodeMethodWithNodeArgument(LocalFrame* frame,
PassRefPtrWillBeRawPtr<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 if (!scriptState->executionContext() || !scriptState->domWindow()) |
| 127 return false; |
| 128 |
| 129 ScriptState::Scope scope(scriptState); |
| 130 v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptS
tate->context()->Global(), 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, "T
estPrivateScriptInterface", "nodeMethodWithNodeArgument", windowWrapper, 1, argv
); |
| 137 if (block.HasCaught()) |
| 138 return false; |
| 139 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeMethodW
ithNodeArgument", "TestPrivateScriptInterface", scriptState->context()->Global()
, scriptState->isolate()); |
| 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::nodeMethodWithVariousArguments(LocalFrame* fr
ame, PassRefPtrWillBeRawPtr<Document> document, PassRefPtrWillBeRawPtr<Node> nod
e, int value1, double value2, String string, RefPtrWillBeRawPtr<Node>* 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 if (!scriptState->executionContext() || !scriptState->domWindow()) |
| 154 return false; |
| 155 |
| 156 ScriptState::Scope scope(scriptState); |
| 157 v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptS
tate->context()->Global(), scriptState->isolate()); |
| 158 |
| 159 v8::Handle<v8::Value> documentHandle = toV8(document, scriptState->context()
->Global(), scriptState->isolate()); |
| 160 v8::Handle<v8::Value> nodeHandle = toV8(node, scriptState->context()->Global
(), scriptState->isolate()); |
| 161 v8::Handle<v8::Value> value1Handle = v8::Integer::New(scriptState->isolate()
, value1); |
| 162 v8::Handle<v8::Value> value2Handle = v8::Number::New(scriptState->isolate(),
value2); |
| 163 v8::Handle<v8::Value> stringHandle = v8String(scriptState->isolate(), string
); |
| 164 v8::Handle<v8::Value> argv[] = { documentHandle, nodeHandle, value1Handle, v
alue2Handle, stringHandle }; |
| 165 // FIXME: Support exceptions thrown from Blink-in-JS. |
| 166 v8::TryCatch block; |
| 167 v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState, "T
estPrivateScriptInterface", "nodeMethodWithVariousArguments", windowWrapper, 5,
argv); |
| 168 if (block.HasCaught()) |
| 169 return false; |
| 170 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeMethodW
ithVariousArguments", "TestPrivateScriptInterface", scriptState->context()->Glob
al(), scriptState->isolate()); |
| 171 Node* cppValue = V8Node::toNativeWithTypeCheck(scriptState->isolate(), v8Val
ue); |
| 172 if (block.HasCaught()) |
| 173 return false; |
| 174 *output = cppValue; |
| 175 return true; |
| 176 } |
| 177 |
| 178 } // namespace WebCore |
| OLD | NEW |