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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/tests/results/V8TestPrivateScriptInterface.h ('k') | Source/bindings/v8/DOMWrapperWorld.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/V8TestPrivateScriptInterface.cpp
diff --git a/Source/bindings/tests/results/V8TestPrivateScriptInterface.cpp b/Source/bindings/tests/results/V8TestPrivateScriptInterface.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ab681fea330a488f5e1e990b073406520d9f5180
--- /dev/null
+++ b/Source/bindings/tests/results/V8TestPrivateScriptInterface.cpp
@@ -0,0 +1,178 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
+
+#include "config.h"
+#include "V8TestPrivateScriptInterface.h"
+
+#include "bindings/core/v8/V8Window.h"
+#include "bindings/tests/v8/V8Document.h"
+#include "bindings/tests/v8/V8Node.h"
+#include "bindings/v8/PrivateScriptController.h"
+#include "core/dom/ScriptForbiddenScope.h"
+#include "core/frame/LocalFrame.h"
+
+namespace WebCore {
+
+bool V8TestPrivateScriptInterface::voidMethod(LocalFrame* frame)
+{
+ v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privateScriptWorld());
+ if (context.IsEmpty())
+ return false;
+ ScriptState* scriptState = ScriptState::from(context);
+ if (!scriptState->executionContext() || !scriptState->domWindow())
+ return false;
+
+ ScriptState::Scope scope(scriptState);
+ v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptState->context()->Global(), scriptState->isolate());
+
+ v8::Handle<v8::Value> *argv = 0;
+ // FIXME: Support exceptions thrown from Blink-in-JS.
+ v8::TryCatch block;
+ PrivateScriptController::run(scriptState, "TestPrivateScriptInterface", "voidMethod", windowWrapper, 0, argv);
+ if (block.HasCaught())
+ return false;
+ return true;
+}
+
+bool V8TestPrivateScriptInterface::shortMethod(LocalFrame* frame, int* output)
+{
+ v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privateScriptWorld());
+ if (context.IsEmpty())
+ return false;
+ ScriptState* scriptState = ScriptState::from(context);
+ if (!scriptState->executionContext() || !scriptState->domWindow())
+ return false;
+
+ ScriptState::Scope scope(scriptState);
+ v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptState->context()->Global(), scriptState->isolate());
+
+ v8::Handle<v8::Value> *argv = 0;
+ // FIXME: Support exceptions thrown from Blink-in-JS.
+ v8::TryCatch block;
+ v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState, "TestPrivateScriptInterface", "shortMethod", windowWrapper, 0, argv);
+ if (block.HasCaught())
+ return false;
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod", "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState->isolate());
+ int cppValue = toInt16(v8Value, exceptionState);
+ if (block.HasCaught())
+ return false;
+ *output = cppValue;
+ return true;
+}
+
+bool V8TestPrivateScriptInterface::shortMethodWithShortArgument(LocalFrame* frame, int value, int* output)
+{
+ v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privateScriptWorld());
+ if (context.IsEmpty())
+ return false;
+ ScriptState* scriptState = ScriptState::from(context);
+ if (!scriptState->executionContext() || !scriptState->domWindow())
+ return false;
+
+ ScriptState::Scope scope(scriptState);
+ v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptState->context()->Global(), scriptState->isolate());
+
+ v8::Handle<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(), value);
+ v8::Handle<v8::Value> argv[] = { valueHandle };
+ // FIXME: Support exceptions thrown from Blink-in-JS.
+ v8::TryCatch block;
+ v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState, "TestPrivateScriptInterface", "shortMethodWithShortArgument", windowWrapper, 1, argv);
+ if (block.HasCaught())
+ return false;
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethodWithShortArgument", "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState->isolate());
+ int cppValue = toInt16(v8Value, exceptionState);
+ if (block.HasCaught())
+ return false;
+ *output = cppValue;
+ return true;
+}
+
+bool V8TestPrivateScriptInterface::stringMethodWithStringArgument(LocalFrame* frame, String value, String* output)
+{
+ v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privateScriptWorld());
+ if (context.IsEmpty())
+ return false;
+ ScriptState* scriptState = ScriptState::from(context);
+ if (!scriptState->executionContext() || !scriptState->domWindow())
+ return false;
+
+ ScriptState::Scope scope(scriptState);
+ v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptState->context()->Global(), scriptState->isolate());
+
+ v8::Handle<v8::Value> valueHandle = v8String(scriptState->isolate(), value);
+ v8::Handle<v8::Value> argv[] = { valueHandle };
+ // FIXME: Support exceptions thrown from Blink-in-JS.
+ v8::TryCatch block;
+ v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState, "TestPrivateScriptInterface", "stringMethodWithStringArgument", windowWrapper, 1, argv);
+ if (block.HasCaught())
+ return false;
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringMethodWithStringArgument", "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState->isolate());
+ V8StringResource<> cppValue = v8Value;
+ if (block.HasCaught())
+ return false;
+ *output = cppValue;
+ return true;
+}
+
+bool V8TestPrivateScriptInterface::nodeMethodWithNodeArgument(LocalFrame* frame, PassRefPtrWillBeRawPtr<Node> value, RefPtrWillBeRawPtr<Node>* output)
+{
+ v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privateScriptWorld());
+ if (context.IsEmpty())
+ return false;
+ ScriptState* scriptState = ScriptState::from(context);
+ if (!scriptState->executionContext() || !scriptState->domWindow())
+ return false;
+
+ ScriptState::Scope scope(scriptState);
+ v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptState->context()->Global(), scriptState->isolate());
+
+ v8::Handle<v8::Value> valueHandle = toV8(value, scriptState->context()->Global(), scriptState->isolate());
+ v8::Handle<v8::Value> argv[] = { valueHandle };
+ // FIXME: Support exceptions thrown from Blink-in-JS.
+ v8::TryCatch block;
+ v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState, "TestPrivateScriptInterface", "nodeMethodWithNodeArgument", windowWrapper, 1, argv);
+ if (block.HasCaught())
+ return false;
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeMethodWithNodeArgument", "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState->isolate());
+ Node* cppValue = V8Node::toNativeWithTypeCheck(scriptState->isolate(), v8Value);
+ if (block.HasCaught())
+ return false;
+ *output = cppValue;
+ return true;
+}
+
+bool V8TestPrivateScriptInterface::nodeMethodWithVariousArguments(LocalFrame* frame, PassRefPtrWillBeRawPtr<Document> document, PassRefPtrWillBeRawPtr<Node> node, int value1, double value2, String string, RefPtrWillBeRawPtr<Node>* output)
+{
+ v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privateScriptWorld());
+ if (context.IsEmpty())
+ return false;
+ ScriptState* scriptState = ScriptState::from(context);
+ if (!scriptState->executionContext() || !scriptState->domWindow())
+ return false;
+
+ ScriptState::Scope scope(scriptState);
+ v8::Handle<v8::Value> windowWrapper = toV8(scriptState->domWindow(), scriptState->context()->Global(), scriptState->isolate());
+
+ v8::Handle<v8::Value> documentHandle = toV8(document, scriptState->context()->Global(), scriptState->isolate());
+ v8::Handle<v8::Value> nodeHandle = toV8(node, scriptState->context()->Global(), scriptState->isolate());
+ v8::Handle<v8::Value> value1Handle = v8::Integer::New(scriptState->isolate(), value1);
+ v8::Handle<v8::Value> value2Handle = v8::Number::New(scriptState->isolate(), value2);
+ v8::Handle<v8::Value> stringHandle = v8String(scriptState->isolate(), string);
+ v8::Handle<v8::Value> argv[] = { documentHandle, nodeHandle, value1Handle, value2Handle, stringHandle };
+ // FIXME: Support exceptions thrown from Blink-in-JS.
+ v8::TryCatch block;
+ v8::Handle<v8::Value> v8Value = PrivateScriptController::run(scriptState, "TestPrivateScriptInterface", "nodeMethodWithVariousArguments", windowWrapper, 5, argv);
+ if (block.HasCaught())
+ return false;
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeMethodWithVariousArguments", "TestPrivateScriptInterface", scriptState->context()->Global(), scriptState->isolate());
+ Node* cppValue = V8Node::toNativeWithTypeCheck(scriptState->isolate(), v8Value);
+ if (block.HasCaught())
+ return false;
+ *output = cppValue;
+ return true;
+}
+
+} // namespace WebCore
« no previous file with comments | « Source/bindings/tests/results/V8TestPrivateScriptInterface.h ('k') | Source/bindings/v8/DOMWrapperWorld.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698