summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/v8
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-05-11 18:35:50 +0100
committerBen Murdoch <benm@google.com>2010-05-14 10:23:05 +0100
commit21939df44de1705786c545cd1bf519d47250322d (patch)
treeef56c310f5c0cdc379c2abb2e212308a3281ce20 /WebCore/bindings/v8
parent4ff1d8891d520763f17675827154340c7c740f90 (diff)
downloadexternal_webkit-21939df44de1705786c545cd1bf519d47250322d.zip
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.gz
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.bz2
Merge Webkit at r58956: Initial merge by Git.
Change-Id: I1d9fb60ea2c3f2ddc04c17a871acdb39353be228
Diffstat (limited to 'WebCore/bindings/v8')
-rw-r--r--WebCore/bindings/v8/ScriptCallStack.cpp74
-rw-r--r--WebCore/bindings/v8/ScriptCallStack.h62
-rw-r--r--WebCore/bindings/v8/ScriptController.cpp1
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.cpp138
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.h34
-rw-r--r--WebCore/bindings/v8/ScriptEventListener.cpp23
-rw-r--r--WebCore/bindings/v8/ScriptEventListener.h3
-rw-r--r--WebCore/bindings/v8/ScriptProfileNode.cpp6
-rw-r--r--WebCore/bindings/v8/V8AbstractEventListener.cpp6
-rw-r--r--WebCore/bindings/v8/V8GCController.cpp7
-rw-r--r--WebCore/bindings/v8/V8NPObject.cpp12
-rw-r--r--WebCore/bindings/v8/V8Proxy.cpp3
-rw-r--r--WebCore/bindings/v8/V8Proxy.h23
-rw-r--r--WebCore/bindings/v8/WorkerScriptController.h1
-rw-r--r--WebCore/bindings/v8/WorldContextHandle.cpp5
-rw-r--r--WebCore/bindings/v8/custom/V8ConsoleCustom.cpp12
-rw-r--r--WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp81
-rw-r--r--WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.h67
-rw-r--r--WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp16
-rw-r--r--WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.h68
-rw-r--r--WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp83
-rw-r--r--WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.h67
-rw-r--r--WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp79
-rw-r--r--WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h68
-rw-r--r--WebCore/bindings/v8/custom/V8DatabaseCallback.cpp79
-rw-r--r--WebCore/bindings/v8/custom/V8DatabaseCallback.h68
-rw-r--r--WebCore/bindings/v8/custom/V8DatabaseCustom.cpp18
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp12
-rw-r--r--WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp6
-rw-r--r--WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp48
-rw-r--r--WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp82
-rw-r--r--WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp19
-rw-r--r--WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp9
-rw-r--r--WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp128
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp358
-rw-r--r--WebCore/bindings/v8/test/TestObj.idl71
-rw-r--r--WebCore/bindings/v8/test/V8TestObj.cpp459
-rw-r--r--WebCore/bindings/v8/test/V8TestObj.h53
-rw-r--r--WebCore/bindings/v8/test/run_tests.py58
39 files changed, 260 insertions, 2147 deletions
diff --git a/WebCore/bindings/v8/ScriptCallStack.cpp b/WebCore/bindings/v8/ScriptCallStack.cpp
index 95e874b..6ca952e 100644
--- a/WebCore/bindings/v8/ScriptCallStack.cpp
+++ b/WebCore/bindings/v8/ScriptCallStack.cpp
@@ -33,13 +33,16 @@
#include "ScriptController.h"
#include "ScriptDebugServer.h"
+#include "V8Binding.h"
+#include <v8-debug.h>
#include <v8.h>
-
-#include "V8Binding.h"
+#include <wtf/StdLibExtras.h> // For DEFINE_STATIC_LOCAL
namespace WebCore {
+v8::Persistent<v8::Context> ScriptCallStack::s_utilityContext;
+
ScriptCallStack* ScriptCallStack::create(const v8::Arguments& arguments, unsigned skipArgumentCount) {
String sourceName;
int sourceLineNumber;
@@ -51,10 +54,14 @@ ScriptCallStack* ScriptCallStack::create(const v8::Arguments& arguments, unsigne
bool ScriptCallStack::callLocation(String* sourceName, int* sourceLineNumber, String* functionName)
{
+<<<<<<< HEAD:WebCore/bindings/v8/ScriptCallStack.cpp
#if PLATFORM(ANDROID)
return false;
#else
if (!ScriptDebugServer::topStackFrame(*sourceName, *sourceLineNumber, *functionName))
+=======
+ if (!topStackFrame(*sourceName, *sourceLineNumber, *functionName))
+>>>>>>> webkit.org at r58956:WebCore/bindings/v8/ScriptCallStack.cpp
return false;
*sourceLineNumber += 1;
return true;
@@ -79,4 +86,67 @@ const ScriptCallFrame& ScriptCallStack::at(unsigned index) const
return m_lastCaller;
}
+// Create the utility context for holding JavaScript functions used internally
+// which are not visible to JavaScript executing on the page.
+void ScriptCallStack::createUtilityContext()
+{
+ ASSERT(s_utilityContext.IsEmpty());
+
+ v8::HandleScope scope;
+ v8::Handle<v8::ObjectTemplate> globalTemplate = v8::ObjectTemplate::New();
+ s_utilityContext = v8::Context::New(0, globalTemplate);
+ v8::Context::Scope contextScope(s_utilityContext);
+
+ // Compile JavaScript function for retrieving the source line, the source
+ // name and the symbol name for the top JavaScript stack frame.
+ DEFINE_STATIC_LOCAL(const char*, topStackFrame,
+ ("function topStackFrame(exec_state) {"
+ " if (!exec_state.frameCount())"
+ " return undefined;"
+ " var frame = exec_state.frame(0);"
+ " var func = frame.func();"
+ " var scriptName;"
+ " if (func.resolved() && func.script())"
+ " scriptName = func.script().name();"
+ " return [scriptName, frame.sourceLine(), (func.name() || func.inferredName())];"
+ "}"));
+ v8::Script::Compile(v8::String::New(topStackFrame))->Run();
+}
+
+bool ScriptCallStack::topStackFrame(String& sourceName, int& lineNumber, String& functionName)
+{
+ v8::HandleScope scope;
+ v8::Handle<v8::Context> v8UtilityContext = utilityContext();
+ if (v8UtilityContext.IsEmpty())
+ return false;
+ v8::Context::Scope contextScope(v8UtilityContext);
+ v8::Handle<v8::Function> topStackFrame;
+ topStackFrame = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("topStackFrame")));
+ if (topStackFrame.IsEmpty())
+ return false;
+ v8::Handle<v8::Value> value = v8::Debug::Call(topStackFrame);
+ if (value.IsEmpty())
+ return false;
+ // If there is no top stack frame, we still return success, but fill the input params with defaults.
+ if (value->IsUndefined()) {
+ // Fallback to setting lineNumber to 0, and source and function name to "undefined".
+ sourceName = toWebCoreString(value);
+ lineNumber = 0;
+ functionName = toWebCoreString(value);
+ return true;
+ }
+ if (!value->IsArray())
+ return false;
+ v8::Local<v8::Object> jsArray = value->ToObject();
+ v8::Local<v8::Value> sourceNameValue = jsArray->Get(0);
+ v8::Local<v8::Value> lineNumberValue = jsArray->Get(1);
+ v8::Local<v8::Value> functionNameValue = jsArray->Get(2);
+ if (sourceNameValue.IsEmpty() || lineNumberValue.IsEmpty() || functionNameValue.IsEmpty())
+ return false;
+ sourceName = toWebCoreString(sourceNameValue);
+ lineNumber = lineNumberValue->Int32Value();
+ functionName = toWebCoreString(functionNameValue);
+ return true;
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptCallStack.h b/WebCore/bindings/v8/ScriptCallStack.h
index 2433bde..11ec3bb 100644
--- a/WebCore/bindings/v8/ScriptCallStack.h
+++ b/WebCore/bindings/v8/ScriptCallStack.h
@@ -42,26 +42,48 @@ namespace v8 {
namespace WebCore {
- class ScriptCallStack : public Noncopyable {
- public:
- static ScriptCallStack* create(const v8::Arguments&, unsigned skipArgumentCount = 0);
- ~ScriptCallStack();
-
- static bool callLocation(String* sourceName, int* sourceLineNumber, String* functionName);
-
- const ScriptCallFrame& at(unsigned) const;
- // FIXME: implement retrieving and storing call stack trace
- unsigned size() const { return 1; }
-
- ScriptState* state() const { return m_scriptState; }
- ScriptState* globalState() const { return m_scriptState; }
-
- private:
- ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber, String funcName);
-
- ScriptCallFrame m_lastCaller;
- ScriptState* m_scriptState;
- };
+class ScriptCallStack : public Noncopyable {
+public:
+ static ScriptCallStack* create(const v8::Arguments&, unsigned skipArgumentCount = 0);
+ ~ScriptCallStack();
+
+ static bool callLocation(String* sourceName, int* sourceLineNumber, String* functionName);
+
+ const ScriptCallFrame& at(unsigned) const;
+ // FIXME: implement retrieving and storing call stack trace
+ unsigned size() const { return 1; }
+
+ ScriptState* state() const { return m_scriptState; }
+ ScriptState* globalState() const { return m_scriptState; }
+
+private:
+ ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber, String funcName);
+
+ // Function for retrieving the source name, line number and function name for the top
+ // JavaScript stack frame.
+ //
+ // It will return true if the caller information was successfully retrieved and written
+ // into the function parameters, otherwise the function will return false. It may
+ // fail due to a stack overflow in the underlying JavaScript implementation, handling
+ // of such exception is up to the caller.
+ static bool topStackFrame(String& sourceName, int& lineNumber, String& functionName);
+
+ static void createUtilityContext();
+
+ // Returns a local handle of the utility context.
+ static v8::Local<v8::Context> utilityContext()
+ {
+ if (s_utilityContext.IsEmpty())
+ createUtilityContext();
+ return v8::Local<v8::Context>::New(s_utilityContext);
+ }
+
+ ScriptCallFrame m_lastCaller;
+ ScriptState* m_scriptState;
+
+ // Utility context holding JavaScript functions used internally.
+ static v8::Persistent<v8::Context> s_utilityContext;
+};
} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index ee15eaa..0f94a2e 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -68,6 +68,7 @@ void ScriptController::initializeThreading()
static bool initializedThreading = false;
if (!initializedThreading) {
WTF::initializeThreading();
+ WTF::initializeMainThread();
initializedThreading = true;
}
}
diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp
index 54d7694..ce258fb 100644
--- a/WebCore/bindings/v8/ScriptDebugServer.cpp
+++ b/WebCore/bindings/v8/ScriptDebugServer.cpp
@@ -44,8 +44,6 @@
namespace WebCore {
-v8::Persistent<v8::Context> ScriptDebugServer::s_utilityContext;
-
ScriptDebugServer::MessageLoopDispatchHandler ScriptDebugServer::s_messageLoopDispatchHandler = 0;
ScriptDebugServer& ScriptDebugServer::shared()
@@ -81,11 +79,10 @@ void ScriptDebugServer::addListener(ScriptDebugListener* listener, Page* page)
m_listenersMap.set(page, listener);
V8Proxy* proxy = V8Proxy::retrieve(page->mainFrame());
v8::Local<v8::Context> context = proxy->mainWorldContext();
- String contextData = toWebCoreStringWithNullCheck(context->GetData());
- m_contextDataMap.set(listener, contextData);
v8::Handle<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("getScripts")));
- v8::Handle<v8::Value> value = v8::Debug::Call(getScriptsFunction);
+ v8::Handle<v8::Value> argv[] = { context->GetData() };
+ v8::Handle<v8::Value> value = getScriptsFunction->Call(m_debuggerScript.get(), 1, argv);
if (value.IsEmpty())
return;
ASSERT(!value->IsUndefined() && value->IsArray());
@@ -175,6 +172,35 @@ void ScriptDebugServer::setBreakpointsActivated(bool enabled)
#endif
}
+ScriptDebugServer::PauseOnExceptionsState ScriptDebugServer::pauseOnExceptionsState()
+{
+#if ENABLE(V8_SCRIPT_DEBUG_SERVER)
+ ensureDebuggerScriptCompiled();
+ v8::HandleScope scope;
+ v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
+
+ v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("pauseOnExceptionsState")));
+ v8::Handle<v8::Value> argv[] = { v8::Handle<v8::Value>() };
+ v8::Handle<v8::Value> result = currentCallFrameFunction->Call(m_debuggerScript.get(), 0, argv);
+ return static_cast<ScriptDebugServer::PauseOnExceptionsState>(result->Int32Value());
+#else
+ return DontPauseOnExceptions;
+#endif
+}
+
+void ScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState)
+{
+#if ENABLE(V8_SCRIPT_DEBUG_SERVER)
+ ensureDebuggerScriptCompiled();
+ v8::HandleScope scope;
+ v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
+
+ v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("setPauseOnExceptionsState")));
+ v8::Handle<v8::Value> argv[] = { v8::Int32::New(pauseOnExceptionsState) };
+ currentCallFrameFunction->Call(m_debuggerScript.get(), 1, argv);
+#endif
+}
+
void ScriptDebugServer::continueProgram()
{
#if ENABLE(V8_SCRIPT_DEBUG_SERVER)
@@ -216,26 +242,15 @@ ScriptState* ScriptDebugServer::currentCallFrameState()
return m_currentCallFrameState;
}
-v8::Handle<v8::Value> ScriptDebugServer::currentCallFrameV8()
-{
-#if ENABLE(V8_SCRIPT_DEBUG_SERVER)
- if (!m_currentCallFrame.get().IsEmpty())
- return m_currentCallFrame.get();
-
- // Check on a bp.
- v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("currentCallFrame")));
- v8::Handle<v8::Value> argv[] = { m_executionState.get() };
- v8::Handle<v8::Value> result = currentCallFrameFunction->Call(m_debuggerScript.get(), 1, argv);
- m_currentCallFrame.set(result);
- return result;
-#else
- return v8::Handle<v8::Value>();
-#endif
-}
-
PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::currentCallFrame()
{
- return JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle<v8::Object>::Cast(currentCallFrameV8()));
+ if (!m_currentCallFrame) {
+ v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("currentCallFrame")));
+ v8::Handle<v8::Value> argv[] = { m_executionState.get() };
+ v8::Handle<v8::Value> currentCallFrameV8 = currentCallFrameFunction->Call(m_debuggerScript.get(), 1, argv);
+ m_currentCallFrame = JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle<v8::Object>::Cast(currentCallFrameV8));
+ }
+ return m_currentCallFrame;
}
void ScriptDebugServer::onV8DebugMessage(const v8::Debug::Message& message)
@@ -268,7 +283,7 @@ void ScriptDebugServer::handleV8DebugMessage(const v8::Debug::Message& message)
return;
// Ignore unsupported event types.
- if (message.GetEvent() != v8::AfterCompile && message.GetEvent() != v8::Break)
+ if (message.GetEvent() != v8::AfterCompile && message.GetEvent() != v8::Break && message.GetEvent() != v8::Exception)
return;
v8::Handle<v8::Context> context = message.GetEventContext();
@@ -286,11 +301,13 @@ void ScriptDebugServer::handleV8DebugMessage(const v8::Debug::Message& message)
if (global.IsEmpty())
return;
+ bool handled = false;
Frame* frame = V8Proxy::retrieveFrame(context);
if (frame) {
ScriptDebugListener* listener = m_listenersMap.get(frame->page());
if (listener) {
if (message.GetEvent() == v8::AfterCompile) {
+ handled = true;
v8::Context::Scope contextScope(v8::Debug::GetDebugContext());
v8::Local<v8::Object> args = v8::Object::New();
args->Set(v8::String::New("eventData"), message.GetEventData());
@@ -300,7 +317,8 @@ void ScriptDebugServer::handleV8DebugMessage(const v8::Debug::Message& message)
ASSERT(value->IsObject());
v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
dispatchDidParseSource(listener, object);
- } else if (message.GetEvent() == v8::Break) {
+ } else if (message.GetEvent() == v8::Break || message.GetEvent() == v8::Exception) {
+ handled = true;
m_executionState.set(message.GetExecutionState());
m_currentCallFrameState = mainWorldScriptState(frame);
listener->didPause();
@@ -308,14 +326,13 @@ void ScriptDebugServer::handleV8DebugMessage(const v8::Debug::Message& message)
}
}
}
+
+ if (!handled && !message.WillStartRunning())
+ continueProgram();
}
void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Object> object)
{
- String contextData = toWebCoreStringWithNullCheck(object->Get(v8::String::New("contextData")));
- if (contextData != m_contextDataMap.get(listener))
- return;
-
listener->didParseSource(
toWebCoreStringWithNullCheck(object->Get(v8::String::New("id"))),
toWebCoreStringWithNullCheck(object->Get(v8::String::New("name"))),
@@ -339,69 +356,6 @@ void ScriptDebugServer::didResume()
m_executionState.clear();
}
-// Create the utility context for holding JavaScript functions used internally
-// which are not visible to JavaScript executing on the page.
-void ScriptDebugServer::createUtilityContext()
-{
- ASSERT(s_utilityContext.IsEmpty());
-
- v8::HandleScope scope;
- v8::Handle<v8::ObjectTemplate> globalTemplate = v8::ObjectTemplate::New();
- s_utilityContext = v8::Context::New(0, globalTemplate);
- v8::Context::Scope contextScope(s_utilityContext);
-
- // Compile JavaScript function for retrieving the source line, the source
- // name and the symbol name for the top JavaScript stack frame.
- DEFINE_STATIC_LOCAL(const char*, topStackFrame,
- ("function topStackFrame(exec_state) {"
- " if (!exec_state.frameCount())"
- " return undefined;"
- " var frame = exec_state.frame(0);"
- " var func = frame.func();"
- " var scriptName;"
- " if (func.resolved() && func.script())"
- " scriptName = func.script().name();"
- " return [scriptName, frame.sourceLine(), (func.name() || func.inferredName())];"
- "}"));
- v8::Script::Compile(v8::String::New(topStackFrame))->Run();
-}
-
-bool ScriptDebugServer::topStackFrame(String& sourceName, int& lineNumber, String& functionName)
-{
- v8::HandleScope scope;
- v8::Handle<v8::Context> v8UtilityContext = utilityContext();
- if (v8UtilityContext.IsEmpty())
- return false;
- v8::Context::Scope contextScope(v8UtilityContext);
- v8::Handle<v8::Function> topStackFrame;
- topStackFrame = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("topStackFrame")));
- if (topStackFrame.IsEmpty())
- return false;
- v8::Handle<v8::Value> value = v8::Debug::Call(topStackFrame);
- if (value.IsEmpty())
- return false;
- // If there is no top stack frame, we still return success, but fill the input params with defaults.
- if (value->IsUndefined()) {
- // Fallback to setting lineNumber to 0, and source and function name to "undefined".
- sourceName = toWebCoreString(value);
- lineNumber = 0;
- functionName = toWebCoreString(value);
- return true;
- }
- if (!value->IsArray())
- return false;
- v8::Local<v8::Object> jsArray = value->ToObject();
- v8::Local<v8::Value> sourceNameValue = jsArray->Get(0);
- v8::Local<v8::Value> lineNumberValue = jsArray->Get(1);
- v8::Local<v8::Value> functionNameValue = jsArray->Get(2);
- if (sourceNameValue.IsEmpty() || lineNumberValue.IsEmpty() || functionNameValue.IsEmpty())
- return false;
- sourceName = toWebCoreString(sourceNameValue);
- lineNumber = lineNumberValue->Int32Value();
- functionName = toWebCoreString(functionNameValue);
- return true;
-}
-
} // namespace WebCore
#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h
index 04857e4..6ef0afd 100644
--- a/WebCore/bindings/v8/ScriptDebugServer.h
+++ b/WebCore/bindings/v8/ScriptDebugServer.h
@@ -33,7 +33,7 @@
#if ENABLE(JAVASCRIPT_DEBUGGER)
-#include "OwnHandle.h"
+#include "JavaScriptCallFrame.h"
#include "PlatformString.h"
#include "ScriptBreakpoint.h"
#include "ScriptState.h"
@@ -45,22 +45,12 @@
namespace WebCore {
-class JavaScriptCallFrame;
class Page;
class ScriptDebugListener;
class ScriptDebugServer : public Noncopyable {
public:
static ScriptDebugServer& shared();
-
- // Function for retrieving the source name, line number and function name for the top
- // JavaScript stack frame.
- //
- // It will return true if the caller information was successfully retrieved and written
- // into the function parameters, otherwise the function will return false. It may
- // fail due to a stack overflow in the underlying JavaScript implementation, handling
- // of such exception is up to the caller.
- static bool topStackFrame(String& sourceName, int& lineNumber, String& functionName);
void addListener(ScriptDebugListener*, Page*);
void removeListener(ScriptDebugListener*, Page*);
@@ -75,8 +65,8 @@ public:
PauseOnAllExceptions,
PauseOnUncaughtExceptions
};
- PauseOnExceptionsState pauseOnExceptionsState() const { return m_pauseOnExceptionsState; }
- void setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState) { m_pauseOnExceptionsState = pauseOnExceptionsState; }
+ PauseOnExceptionsState pauseOnExceptionsState();
+ void setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState);
void pauseProgram() { }
void continueProgram();
@@ -97,7 +87,6 @@ public:
typedef void (*MessageLoopDispatchHandler)(const Vector<WebCore::Page*>&);
static void setMessageLoopDispatchHandler(MessageLoopDispatchHandler messageLoopDispatchHandler) { s_messageLoopDispatchHandler = messageLoopDispatchHandler; }
- v8::Handle<v8::Value> currentCallFrameV8();
PassRefPtr<JavaScriptCallFrame> currentCallFrame();
private:
@@ -115,28 +104,13 @@ private:
void ensureDebuggerScriptCompiled();
void didResume();
- static void createUtilityContext();
-
- // Returns a local handle of the utility context.
- static v8::Local<v8::Context> utilityContext()
- {
- if (s_utilityContext.IsEmpty())
- createUtilityContext();
- return v8::Local<v8::Context>::New(s_utilityContext);
- }
-
- // Utility context holding JavaScript functions used internally.
- static v8::Persistent<v8::Context> s_utilityContext;
-
typedef HashMap<Page*, ScriptDebugListener*> ListenersMap;
ListenersMap m_listenersMap;
- typedef HashMap<ScriptDebugListener*, String> ContextDataMap;
- ContextDataMap m_contextDataMap;
String m_debuggerScriptSource;
PauseOnExceptionsState m_pauseOnExceptionsState;
OwnHandle<v8::Object> m_debuggerScript;
ScriptState* m_currentCallFrameState;
- OwnHandle<v8::Value> m_currentCallFrame;
+ RefPtr<JavaScriptCallFrame> m_currentCallFrame;
OwnHandle<v8::Object> m_executionState;
static MessageLoopDispatchHandler s_messageLoopDispatchHandler;
diff --git a/WebCore/bindings/v8/ScriptEventListener.cpp b/WebCore/bindings/v8/ScriptEventListener.cpp
index fdb6076..cad7a1c 100644
--- a/WebCore/bindings/v8/ScriptEventListener.cpp
+++ b/WebCore/bindings/v8/ScriptEventListener.cpp
@@ -106,7 +106,7 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, Attri
return V8LazyEventListener::create(attr->localName().string(), frame->document()->isSVGDocument(), attr->value(), sourceURL, lineNumber, columnNumber, WorldContextHandle(UseMainWorld));
}
-String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* listener)
+String eventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* listener)
{
if (listener->type() != EventListener::JSEventListenerType)
return "";
@@ -120,4 +120,25 @@ String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState*
return toWebCoreStringWithNullCheck(function);
}
+bool eventListenerHandlerLocation(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* listener, String& sourceName, int& lineNumber)
+{
+ if (listener->type() != EventListener::JSEventListenerType)
+ return false;
+
+ ScriptScope scope(scriptState);
+ V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(listener);
+ v8::Handle<v8::Object> object = v8Listener->getListenerObject(context);
+ if (object.IsEmpty() || !object->IsFunction())
+ return false;
+
+ v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(object);
+ v8::ScriptOrigin origin = function->GetScriptOrigin();
+ if (!origin.ResourceName().IsEmpty()) {
+ sourceName = toWebCoreString(origin.ResourceName());
+ lineNumber = function->GetScriptLineNumber() + 1;
+ return true;
+ }
+ return false;
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptEventListener.h b/WebCore/bindings/v8/ScriptEventListener.h
index ce12a53..7815e29 100644
--- a/WebCore/bindings/v8/ScriptEventListener.h
+++ b/WebCore/bindings/v8/ScriptEventListener.h
@@ -45,7 +45,8 @@ namespace WebCore {
PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node*, Attribute*);
PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame*, Attribute*);
- String getEventListenerHandlerBody(ScriptExecutionContext*, ScriptState*, EventListener*);
+ String eventListenerHandlerBody(ScriptExecutionContext*, ScriptState*, EventListener*);
+ bool eventListenerHandlerLocation(ScriptExecutionContext*, ScriptState*, EventListener*, String& sourceName, int& lineNumber);
} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptProfileNode.cpp b/WebCore/bindings/v8/ScriptProfileNode.cpp
index 3121128..7266c29 100644
--- a/WebCore/bindings/v8/ScriptProfileNode.cpp
+++ b/WebCore/bindings/v8/ScriptProfileNode.cpp
@@ -55,14 +55,12 @@ unsigned long ScriptProfileNode::lineNumber() const
double ScriptProfileNode::totalTime() const
{
- // FIXME: use GetTotalMilliseconds once it is implemented in V8.
- return m_profileNode->GetTotalSamplesCount();
+ return m_profileNode->GetTotalTime();
}
double ScriptProfileNode::selfTime() const
{
- // FIXME: use GetSelfMilliseconds once it is implemented in V8.
- return m_profileNode->GetSelfSamplesCount();
+ return m_profileNode->GetSelfTime();
}
unsigned long ScriptProfileNode::numberOfCalls() const
diff --git a/WebCore/bindings/v8/V8AbstractEventListener.cpp b/WebCore/bindings/v8/V8AbstractEventListener.cpp
index 6dc2b29..b6c53df 100644
--- a/WebCore/bindings/v8/V8AbstractEventListener.cpp
+++ b/WebCore/bindings/v8/V8AbstractEventListener.cpp
@@ -71,6 +71,8 @@ V8AbstractEventListener::~V8AbstractEventListener()
void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event* event)
{
+ ASSERT(event);
+
// The callback function on XMLHttpRequest can clear the event listener and destroys 'this' object. Keep a local reference to it.
// See issue 889829.
RefPtr<V8AbstractEventListener> protect(this);
@@ -86,6 +88,7 @@ void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event
// Get the V8 wrapper for the event object.
v8::Handle<v8::Value> jsEvent = toV8(event);
+ ASSERT(!jsEvent.IsEmpty());
invokeEventHandler(context, event, jsEvent);
}
@@ -114,6 +117,9 @@ void V8AbstractEventListener::setListenerObject(v8::Handle<v8::Object> listener)
void V8AbstractEventListener::invokeEventHandler(ScriptExecutionContext* context, Event* event, v8::Handle<v8::Value> jsEvent)
{
+ // If jsEvent is empty, attempt to set it as a hidden value would crash v8.
+ if (jsEvent.IsEmpty())
+ return;
v8::Local<v8::Context> v8Context = toV8Context(context, worldContext());
if (v8Context.IsEmpty())
diff --git a/WebCore/bindings/v8/V8GCController.cpp b/WebCore/bindings/v8/V8GCController.cpp
index 61b2a88..fa7c357 100644
--- a/WebCore/bindings/v8/V8GCController.cpp
+++ b/WebCore/bindings/v8/V8GCController.cpp
@@ -378,7 +378,12 @@ public:
ActiveDOMObject* activeDOMObject = typeInfo->toActiveDOMObject(wrapper);
if (activeDOMObject && activeDOMObject->hasPendingActivity()) {
ASSERT(!wrapper.IsWeak());
- wrapper.MakeWeak(activeDOMObject, &DOMDataStore::weakActiveDOMObjectCallback);
+ // NOTE: To re-enable weak status of the active object we use
+ // |object| from the map and not |activeDOMObject|. The latter
+ // may be a different pointer (in case ActiveDOMObject is not
+ // the main base class of the object's class) and pointer
+ // identity is required by DOM map functions.
+ wrapper.MakeWeak(object, &DOMDataStore::weakActiveDOMObjectCallback);
}
}
}
diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp
index 1ea6487..84450e5 100644
--- a/WebCore/bindings/v8/V8NPObject.cpp
+++ b/WebCore/bindings/v8/V8NPObject.cpp
@@ -33,7 +33,6 @@
#include "V8NPObject.h"
#include "HTMLPlugInElement.h"
-#include "IdentifierRep.h"
#include "NPV8Object.h"
#include "V8DOMMap.h"
#include "V8HTMLAppletElement.h"
@@ -54,6 +53,17 @@ enum InvokeFunctionType {
InvokeDefault = 3
};
+struct IdentifierRep {
+ int number() const { return m_isString ? 0 : m_value.m_number; }
+ const char* string() const { return m_isString ? m_value.m_string : 0; }
+
+ union {
+ const char* m_string;
+ int m_number;
+ } m_value;
+ bool m_isString;
+};
+
// FIXME: need comments.
// Params: holder could be HTMLEmbedElement or NPObject
static v8::Handle<v8::Value> npObjectInvokeImpl(const v8::Arguments& args, InvokeFunctionType functionId)
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index 0543037..7f52374 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -505,7 +505,7 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8
#if ENABLE(INSPECTOR)
Page* inspectedPage = InspectorTimelineAgent::instanceCount() ? m_frame->page(): 0;
- if (inspectedPage)
+ if (inspectedPage) {
if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) {
v8::ScriptOrigin origin = function->GetScriptOrigin();
String resourceName("undefined");
@@ -517,6 +517,7 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8
timelineAgent->willCallFunction(resourceName, lineNumber);
} else
inspectedPage = 0;
+ }
#endif // !ENABLE(INSPECTOR)
m_recursion++;
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
index 98bc902..cd2ddad 100644
--- a/WebCore/bindings/v8/V8Proxy.h
+++ b/WebCore/bindings/v8/V8Proxy.h
@@ -39,6 +39,7 @@
#include "V8DOMWindowShell.h"
#include "V8DOMWrapper.h"
#include "V8GCController.h"
+#include "V8Utilities.h"
#include "WrapperTypeInfo.h"
#include <v8.h>
#include <wtf/PassRefPtr.h> // so generated bindings don't have to
@@ -304,6 +305,9 @@ namespace WebCore {
template <typename T>
static v8::Handle<v8::Value> constructDOMObject(const v8::Arguments&, WrapperTypeInfo*);
+ template <typename T>
+ static v8::Handle<v8::Value> constructDOMObjectWithScriptExecutionContext(const v8::Arguments&, WrapperTypeInfo*);
+
// Process any pending JavaScript console messages.
static void processConsoleMessages();
@@ -409,6 +413,25 @@ namespace WebCore {
return args.Holder();
}
+ template <typename T>
+ v8::Handle<v8::Value> V8Proxy::constructDOMObjectWithScriptExecutionContext(const v8::Arguments& args, WrapperTypeInfo* type)
+ {
+ if (!args.IsConstructCall())
+ return throwError(V8Proxy::TypeError, "");
+
+ ScriptExecutionContext* context = getScriptExecutionContext();
+ if (!context)
+ return throwError(V8Proxy::ReferenceError, "");
+
+ // Note: it's OK to let this RefPtr go out of scope because we also call
+ // SetDOMWrapper(), which effectively holds a reference to obj.
+ RefPtr<T> obj = T::create(context);
+ V8DOMWrapper::setDOMWrapper(args.Holder(), type, obj.get());
+ obj->ref();
+ V8DOMWrapper::setJSWrapperForDOMObject(obj.get(), v8::Persistent<v8::Object>::New(args.Holder()));
+ return args.Holder();
+ }
+
v8::Local<v8::Context> toV8Context(ScriptExecutionContext*, const WorldContextHandle& worldContext);
diff --git a/WebCore/bindings/v8/WorkerScriptController.h b/WebCore/bindings/v8/WorkerScriptController.h
index 616697a..5e3159f 100644
--- a/WebCore/bindings/v8/WorkerScriptController.h
+++ b/WebCore/bindings/v8/WorkerScriptController.h
@@ -58,6 +58,7 @@ namespace WebCore {
enum ForbidExecutionOption { TerminateRunningScript, LetRunningScriptFinish };
void forbidExecution(ForbidExecutionOption);
+ bool isExecutionForbidden() const { return m_executionForbidden; }
// Returns WorkerScriptController for the currently executing context. 0 will be returned if the current executing context is not the worker context.
static WorkerScriptController* controllerForContext();
diff --git a/WebCore/bindings/v8/WorldContextHandle.cpp b/WebCore/bindings/v8/WorldContextHandle.cpp
index 7ba76d3..24f461f 100644
--- a/WebCore/bindings/v8/WorldContextHandle.cpp
+++ b/WebCore/bindings/v8/WorldContextHandle.cpp
@@ -47,10 +47,9 @@ WorldContextHandle::WorldContextHandle(WorldToUse worldToUse)
v8::Local<v8::Context> WorldContextHandle::adjustedContext(V8Proxy* proxy) const
{
- if (m_worldToUse == UseMainWorld)
+ if (m_worldToUse == UseMainWorld || !m_context || m_context->get().IsEmpty())
return proxy->mainWorldContext();
- if (!m_context || m_context->get().IsEmpty())
- return proxy->context();
+
return v8::Local<v8::Context>::New(m_context->get());
}
diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
index 9026420..4cc6ac2 100644
--- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
@@ -42,17 +42,11 @@ namespace WebCore {
typedef Vector<RefPtr<ScriptProfile> > ProfilesArray;
-v8::Handle<v8::Value> V8Console::profilesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+v8::Handle<v8::Value> V8Console::profilesAccessorGetter(v8::Local<v8::String>, const v8::AccessorInfo&)
{
INC_STATS("DOM.Console.profilesAccessorGetter");
- Console* imp = V8Console::toNative(info.Holder());
- const ProfilesArray& profiles = imp->profiles();
- v8::Handle<v8::Array> result = v8::Array::New(profiles.size());
- int index = 0;
- ProfilesArray::const_iterator end = profiles.end();
- for (ProfilesArray::const_iterator iter = profiles.begin(); iter != end; ++iter)
- result->Set(v8::Integer::New(index++), toV8(iter->get()));
- return result;
+ // FIXME: Provide a real implementation.
+ return v8::Array::New(0);
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp
deleted file mode 100644
index df0cc53..0000000
--- a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(DATABASE)
-
-#include "V8CustomSQLStatementCallback.h"
-
-#include "Frame.h"
-#include "ScriptExecutionContext.h"
-#include "V8CustomVoidCallback.h"
-#include "V8SQLResultSet.h"
-#include "V8SQLTransaction.h"
-
-namespace WebCore {
-
-V8CustomSQLStatementCallback::V8CustomSQLStatementCallback(v8::Local<v8::Object> callback, Frame* frame)
- : m_callback(v8::Persistent<v8::Object>::New(callback))
- , m_frame(frame)
- , m_worldContext(UseCurrentWorld)
-{
-}
-
-V8CustomSQLStatementCallback::~V8CustomSQLStatementCallback()
-{
- m_callback.Dispose();
-}
-
-void V8CustomSQLStatementCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLResultSet* resultSet, bool& raisedException)
-{
- v8::HandleScope handleScope;
-
- v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
- if (v8Context.IsEmpty())
- return;
-
- v8::Context::Scope scope(v8Context);
-
- v8::Handle<v8::Value> argv[] = {
- toV8(transaction),
- toV8(resultSet)
- };
-
- // Protect the frame until the callback returns.
- RefPtr<Frame> protector(m_frame);
-
- bool callbackReturnValue = false;
- raisedException = invokeCallback(m_callback, 2, argv, callbackReturnValue);
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.h b/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.h
deleted file mode 100644
index 31f53e4..0000000
--- a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef V8CustomSQLStatementCallback_h
-#define V8CustomSQLStatementCallback_h
-
-#if ENABLE(DATABASE)
-
-#include "SQLStatementCallback.h"
-#include "WorldContextHandle.h"
-#include <v8.h>
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class Frame;
-
-class V8CustomSQLStatementCallback : public SQLStatementCallback {
-public:
- static PassRefPtr<V8CustomSQLStatementCallback> create(v8::Local<v8::Value> value, Frame* frame)
- {
- ASSERT(value->IsObject());
- return adoptRef(new V8CustomSQLStatementCallback(value->ToObject(), frame));
- }
- virtual ~V8CustomSQLStatementCallback();
-
- virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLResultSet*, bool& raisedException);
-private:
- V8CustomSQLStatementCallback(v8::Local<v8::Object>, Frame*);
-
- v8::Persistent<v8::Object> m_callback;
- RefPtr<Frame> m_frame;
- WorldContextHandle m_worldContext;
-};
-
-} // namespace WebCore
-
-#endif
-
-#endif // V8CustomSQLStatementCallback_h
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
index 2545f24..e033684 100644
--- a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
@@ -32,7 +32,7 @@
#if ENABLE(DATABASE)
-#include "V8CustomSQLStatementErrorCallback.h"
+#include "V8SQLStatementErrorCallback.h"
#include "Frame.h"
#include "ScriptExecutionContext.h"
@@ -42,19 +42,7 @@
namespace WebCore {
-V8CustomSQLStatementErrorCallback::V8CustomSQLStatementErrorCallback(v8::Local<v8::Object> callback, Frame* frame)
- : m_callback(v8::Persistent<v8::Object>::New(callback))
- , m_frame(frame)
- , m_worldContext(UseCurrentWorld)
-{
-}
-
-V8CustomSQLStatementErrorCallback::~V8CustomSQLStatementErrorCallback()
-{
- m_callback.Dispose();
-}
-
-bool V8CustomSQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error)
+bool V8SQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error)
{
v8::HandleScope handleScope;
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.h b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.h
deleted file mode 100644
index c3d7f79..0000000
--- a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef V8CustomSQLStatementErrorCallback_h
-#define V8CustomSQLStatementErrorCallback_h
-
-#if ENABLE(DATABASE)
-
-#include "SQLStatementErrorCallback.h"
-#include "WorldContextHandle.h"
-#include <v8.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class Frame;
-
-class V8CustomSQLStatementErrorCallback : public SQLStatementErrorCallback {
-public:
- static PassRefPtr<V8CustomSQLStatementErrorCallback> create(v8::Local<v8::Value> value, Frame* frame)
- {
- ASSERT(value->IsObject());
- return adoptRef(new V8CustomSQLStatementErrorCallback(value->ToObject(), frame));
- }
- virtual ~V8CustomSQLStatementErrorCallback();
-
- virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLError*);
-private:
- V8CustomSQLStatementErrorCallback(v8::Local<v8::Object>, Frame*);
-
- v8::Persistent<v8::Object> m_callback;
- RefPtr<Frame> m_frame;
- WorldContextHandle m_worldContext;
-};
-
-} // namespace WebCore
-
-#endif
-
-#endif // V8CustomSQLStatementErrorCallback_h
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp
deleted file mode 100644
index efe415c..0000000
--- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2009, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(DATABASE)
-
-#include "V8CustomSQLTransactionCallback.h"
-
-#include "Frame.h"
-#include "ScriptExecutionContext.h"
-#include "V8CustomVoidCallback.h"
-#include "V8SQLTransaction.h"
-
-namespace WebCore {
-
-V8CustomSQLTransactionCallback::V8CustomSQLTransactionCallback(v8::Local<v8::Object> callback, Frame* frame)
- : m_callback(v8::Persistent<v8::Object>::New(callback))
- , m_frame(frame)
- , m_worldContext(UseCurrentWorld)
-{
-}
-
-V8CustomSQLTransactionCallback::~V8CustomSQLTransactionCallback()
-{
- m_callback.Dispose();
-}
-
-
-void V8CustomSQLTransactionCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, bool& raisedException)
-{
- v8::HandleScope handleScope;
-
- v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
- if (v8Context.IsEmpty())
- return;
-
- v8::Context::Scope scope(v8Context);
-
- v8::Handle<v8::Value> argv[] = {
- toV8(transaction)
- };
-
- // Protect the frame until the callback returns.
- RefPtr<Frame> protector(m_frame);
-
- // Step 5: If the callback couldn't be called (e.g. it was null) or if
- // the callback was invoked and raised an exception, jump to the last
- // step (rollback transaction).
- bool callbackReturnValue = false;
- raisedException = invokeCallback(m_callback, 1, argv, callbackReturnValue);
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.h b/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.h
deleted file mode 100644
index 60ad529..0000000
--- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef V8CustomSQLTransactionCallback_h
-#define V8CustomSQLTransactionCallback_h
-
-#if ENABLE(DATABASE)
-
-#include "SQLTransactionCallback.h"
-#include "WorldContextHandle.h"
-#include <v8.h>
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class Frame;
-
-class V8CustomSQLTransactionCallback : public SQLTransactionCallback {
-public:
- static PassRefPtr<V8CustomSQLTransactionCallback> create(v8::Local<v8::Value> value, Frame* frame)
- {
- ASSERT(value->IsObject());
- return adoptRef(new V8CustomSQLTransactionCallback(value->ToObject(), frame));
- }
- virtual ~V8CustomSQLTransactionCallback();
-
- virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, bool& raisedException);
-private:
- V8CustomSQLTransactionCallback(v8::Local<v8::Object>, Frame*);
-
- v8::Persistent<v8::Object> m_callback;
- RefPtr<Frame> m_frame;
- WorldContextHandle m_worldContext;
-};
-
-} // namespace WebCore
-
-#endif
-
-#endif // V8CustomSQLTransactionCallback_h
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp
deleted file mode 100644
index 1ef711a..0000000
--- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2009, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(DATABASE)
-
-#include "V8CustomSQLTransactionErrorCallback.h"
-
-#include "Frame.h"
-#include "ScriptExecutionContext.h"
-#include "V8CustomVoidCallback.h"
-#include "V8SQLError.h"
-
-namespace WebCore {
-
-V8CustomSQLTransactionErrorCallback::V8CustomSQLTransactionErrorCallback(v8::Local<v8::Object> callback, Frame* frame)
- : m_callback(v8::Persistent<v8::Object>::New(callback))
- , m_frame(frame)
- , m_worldContext(UseCurrentWorld)
-{
-}
-
-V8CustomSQLTransactionErrorCallback::~V8CustomSQLTransactionErrorCallback()
-{
- m_callback.Dispose();
-}
-
-void V8CustomSQLTransactionErrorCallback::handleEvent(ScriptExecutionContext* context, SQLError* error)
-{
- v8::HandleScope handleScope;
-
- v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
- if (v8Context.IsEmpty())
- return;
-
- v8::Context::Scope scope(v8Context);
-
- v8::Handle<v8::Value> argv[] = {
- toV8(error)
- };
-
- // Protect the frame until the callback returns.
- RefPtr<Frame> protector(m_frame);
-
- bool callbackReturnValue = false;
- invokeCallback(m_callback, 1, argv, callbackReturnValue);
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h b/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h
deleted file mode 100644
index 72e9e7a..0000000
--- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef V8CustomSQLTransactionErrorCallback_h
-#define V8CustomSQLTransactionErrorCallback_h
-
-#if ENABLE(DATABASE)
-
-#include "SQLTransactionErrorCallback.h"
-#include "WorldContextHandle.h"
-#include <v8.h>
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class Frame;
-
-class V8CustomSQLTransactionErrorCallback : public SQLTransactionErrorCallback {
-public:
- static PassRefPtr<V8CustomSQLTransactionErrorCallback> create(v8::Local<v8::Value> value, Frame* frame)
- {
- ASSERT(value->IsObject());
- return adoptRef(new V8CustomSQLTransactionErrorCallback(value->ToObject(), frame));
- }
- virtual ~V8CustomSQLTransactionErrorCallback();
-
- virtual void handleEvent(ScriptExecutionContext*, SQLError*);
-
-private:
- V8CustomSQLTransactionErrorCallback(v8::Local<v8::Object>, Frame*);
-
- v8::Persistent<v8::Object> m_callback;
- RefPtr<Frame> m_frame;
- WorldContextHandle m_worldContext;
-};
-
-} // namespace WebCore
-
-#endif
-
-#endif // V8CustomSQLTransactionErrorCallback_h
diff --git a/WebCore/bindings/v8/custom/V8DatabaseCallback.cpp b/WebCore/bindings/v8/custom/V8DatabaseCallback.cpp
deleted file mode 100644
index 088d89f..0000000
--- a/WebCore/bindings/v8/custom/V8DatabaseCallback.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2010, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(DATABASE)
-
-#include "V8DatabaseCallback.h"
-
-#include "Frame.h"
-#include "ScriptExecutionContext.h"
-#include "V8CustomVoidCallback.h"
-#include "V8Database.h"
-
-namespace WebCore {
-
-V8DatabaseCallback::V8DatabaseCallback(v8::Local<v8::Object> callback, Frame* frame)
- : m_callback(v8::Persistent<v8::Object>::New(callback))
- , m_frame(frame)
- , m_worldContext(UseCurrentWorld)
-{
-}
-
-V8DatabaseCallback::~V8DatabaseCallback()
-{
- m_callback.Dispose();
-}
-
-void V8DatabaseCallback::handleEvent(ScriptExecutionContext* context, Database* database)
-{
- v8::HandleScope handleScope;
-
- v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
- if (v8Context.IsEmpty())
- return;
-
- v8::Context::Scope scope(v8Context);
-
- v8::Handle<v8::Value> argv[] = {
- toV8(database)
- };
-
- // Protect the frame until the callback returns.
- RefPtr<Frame> protector(m_frame);
-
- bool callbackReturnValue = false;
- invokeCallback(m_callback, 1, argv, callbackReturnValue);
-}
-
-} // namespace WebCore
-
-#endif
diff --git a/WebCore/bindings/v8/custom/V8DatabaseCallback.h b/WebCore/bindings/v8/custom/V8DatabaseCallback.h
deleted file mode 100644
index 064a9a7..0000000
--- a/WebCore/bindings/v8/custom/V8DatabaseCallback.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef V8DatabaseCallback_h
-#define V8DatabaseCallback_h
-
-#if ENABLE(DATABASE)
-
-#include "DatabaseCallback.h"
-#include "WorldContextHandle.h"
-#include <v8.h>
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class Frame;
-
-class V8DatabaseCallback : public DatabaseCallback {
-public:
- static PassRefPtr<V8DatabaseCallback> create(v8::Local<v8::Value> value, Frame* frame)
- {
- ASSERT(value->IsObject());
- return adoptRef(new V8DatabaseCallback(value->ToObject(), frame));
- }
- virtual ~V8DatabaseCallback();
-
- virtual void handleEvent(ScriptExecutionContext*, Database*);
-
-private:
- V8DatabaseCallback(v8::Local<v8::Object>, Frame*);
-
- v8::Persistent<v8::Object> m_callback;
- RefPtr<Frame> m_frame;
- WorldContextHandle m_worldContext;
-};
-
-} // namespace WebCore
-
-#endif
-
-#endif // V8DatabaseCallback_h
diff --git a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
index 9915d77..39e6632 100644
--- a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
@@ -35,8 +35,8 @@
#include "Database.h"
#include "V8Binding.h"
-#include "V8CustomSQLTransactionCallback.h"
-#include "V8CustomSQLTransactionErrorCallback.h"
+#include "V8SQLTransactionCallback.h"
+#include "V8SQLTransactionErrorCallback.h"
#include "V8CustomVoidCallback.h"
#include "V8Proxy.h"
@@ -58,20 +58,20 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg
if (!frame)
return v8::Undefined();
- RefPtr<V8CustomSQLTransactionCallback> callback;
+ RefPtr<V8SQLTransactionCallback> callback;
if (args.Length() > 2) {
if (!args[2]->IsObject())
return throwError("changeVersion transaction callback must be of valid type.");
- callback = V8CustomSQLTransactionCallback::create(args[2], frame);
+ callback = V8SQLTransactionCallback::create(args[2], frame);
}
- RefPtr<V8CustomSQLTransactionErrorCallback> errorCallback;
+ RefPtr<V8SQLTransactionErrorCallback> errorCallback;
if (args.Length() > 3) {
if (!args[3]->IsObject())
return throwError("changeVersion error callback must be of valid type.");
- errorCallback = V8CustomSQLTransactionErrorCallback::create(args[3], frame);
+ errorCallback = V8SQLTransactionErrorCallback::create(args[3], frame);
}
RefPtr<V8CustomVoidCallback> successCallback;
@@ -101,14 +101,14 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r
if (!frame)
return v8::Undefined();
- RefPtr<V8CustomSQLTransactionCallback> callback = V8CustomSQLTransactionCallback::create(args[0], frame);
+ RefPtr<V8SQLTransactionCallback> callback = V8SQLTransactionCallback::create(args[0], frame);
- RefPtr<V8CustomSQLTransactionErrorCallback> errorCallback;
+ RefPtr<V8SQLTransactionErrorCallback> errorCallback;
if (args.Length() > 1 && !isUndefinedOrNull(args[1])) {
if (!args[1]->IsObject())
return throwError("Transaction error callback must be of valid type.");
- errorCallback = V8CustomSQLTransactionErrorCallback::create(args[1], frame);
+ errorCallback = V8SQLTransactionErrorCallback::create(args[1], frame);
}
RefPtr<V8CustomVoidCallback> successCallback;
diff --git a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
index 0a9e8dd..786a96a 100644
--- a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp
@@ -81,16 +81,4 @@ v8::Handle<v8::Value> V8HTMLFormElement::namedPropertyGetter(v8::Local<v8::Strin
return toV8(collection);
}
-v8::Handle<v8::Value> V8HTMLFormElement::submitCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.HTMLFormElement.submit()");
- HTMLFormElement* form = V8HTMLFormElement::toNative(args.Holder());
- Frame* frame = V8Proxy::retrieveFrameForEnteredContext();
- if (!frame)
- return v8::Undefined();
-
- form->submit(frame);
- return v8::Undefined();
-}
-
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 4c091c8..c7cd54c 100644
--- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -161,12 +161,6 @@ v8::Handle<v8::Value> V8InjectedScriptHost::currentCallFrameCallback(const v8::A
INC_STATS("InjectedScriptHost.currentCallFrame()");
return toV8(ScriptDebugServer::shared().currentCallFrame());
}
-
-v8::Handle<v8::Value> V8InjectedScriptHost::isActivationCallback(const v8::Arguments& args)
-{
- INC_STATS("InjectedScriptHost.isActivation()");
- return v8::Boolean::New(true);
-}
#endif
#if ENABLE(DATABASE)
diff --git a/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp b/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp
deleted file mode 100644
index 7bb640b..0000000
--- a/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "V8NodeFilter.h"
-
-#include "ExceptionCode.h"
-#include "NodeFilter.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8NodeFilter::acceptNodeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.NodeFilter.acceptNode()");
- return throwError(NOT_SUPPORTED_ERR);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp b/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
deleted file mode 100644
index 728b3dc..0000000
--- a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "V8NodeIterator.h"
-
-#include "NodeIterator.h"
-#include "ScriptState.h"
-
-#include "V8Binding.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-static inline v8::Handle<v8::Value> toV8(PassRefPtr<Node> object, ExceptionCode ec, ScriptState* state)
-{
- if (ec)
- return throwError(ec);
-
- if (state->hadException())
- return throwError(state->exception());
-
- if (!object)
- return v8::Null();
-
- return toV8(object);
-}
-
-v8::Handle<v8::Value> V8NodeIterator::nextNodeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.NodeIterator.nextNode()");
- NodeIterator* nodeIterator = V8NodeIterator::toNative(args.Holder());
-
- ExceptionCode ec = 0;
- EmptyScriptState state;
- RefPtr<Node> result = nodeIterator->nextNode(&state, ec);
- return toV8(result.release(), ec, &state);
-}
-
-v8::Handle<v8::Value> V8NodeIterator::previousNodeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.NodeIterator.previousNode()");
- NodeIterator* nodeIterator = V8NodeIterator::toNative(args.Holder());
-
- ExceptionCode ec = 0;
- EmptyScriptState state;
- RefPtr<Node> result = nodeIterator->previousNode(&state, ec);
- return toV8(result.release(), ec, &state);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp b/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp
index cdb160d..51a57c0 100644
--- a/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp
@@ -39,25 +39,6 @@
namespace WebCore {
-v8::Handle<v8::Value> V8PopStateEvent::initPopStateEventCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.PopStateEvent.initPopStateEvent");
-
- String typeArg = v8ValueToWebCoreString(args[0]);
- bool canBubbleArg = args[1]->BooleanValue();
- bool cancelableArg = args[2]->BooleanValue();
-
- bool didThrow = false;
- RefPtr<SerializedScriptValue> stateArg = SerializedScriptValue::create(args[3], didThrow);
- if (didThrow)
- return v8::Undefined();
-
- PopStateEvent* event = V8PopStateEvent::toNative(args.Holder());
- event->initPopStateEvent(typeArg, canBubbleArg, cancelableArg, stateArg.release());
-
- return v8::Undefined();
-}
-
v8::Handle<v8::Value> V8PopStateEvent::stateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.PopStateEvent.state");
diff --git a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
index b7e7ff2..4e68b30 100644
--- a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
@@ -37,8 +37,8 @@
#include "Database.h"
#include "SQLValue.h"
#include "V8Binding.h"
-#include "V8CustomSQLStatementCallback.h"
-#include "V8CustomSQLStatementErrorCallback.h"
+#include "V8SQLStatementCallback.h"
+#include "V8SQLStatementErrorCallback.h"
#include "V8Proxy.h"
#include <wtf/Vector.h>
@@ -105,7 +105,7 @@ v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments&
return throwError("Statement callback must be of valid type.", V8Proxy::TypeError);
if (frame)
- callback = V8CustomSQLStatementCallback::create(args[2], frame);
+ callback = V8SQLStatementCallback::create(args[2], frame);
}
RefPtr<SQLStatementErrorCallback> errorCallback;
@@ -114,7 +114,7 @@ v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments&
return throwError("Statement error callback must be of valid type.", V8Proxy::TypeError);
if (frame)
- errorCallback = V8CustomSQLStatementErrorCallback::create(args[3], frame);
+ errorCallback = V8SQLStatementErrorCallback::create(args[3], frame);
}
ExceptionCode ec = 0;
@@ -127,4 +127,3 @@ v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments&
} // namespace WebCore
#endif
-
diff --git a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp b/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
deleted file mode 100644
index 37087df..0000000
--- a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "V8TreeWalker.h"
-
-#include "Node.h"
-#include "ScriptState.h"
-#include "TreeWalker.h"
-
-#include "V8Binding.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-static inline v8::Handle<v8::Value> toV8Object(PassRefPtr<Node> object, ScriptState* state)
-{
- if (state->hadException())
- return throwError(state->exception());
-
- if (!object)
- return v8::Null();
-
- return toV8(object);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::parentNodeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TreeWalker.parentNode()");
- TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
- EmptyScriptState state;
- RefPtr<Node> result = treeWalker->parentNode(&state);
- return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::firstChildCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TreeWalker.firstChild()");
- TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
- EmptyScriptState state;
- RefPtr<Node> result = treeWalker->firstChild(&state);
- return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::lastChildCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TreeWalker.lastChild()");
- TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
- EmptyScriptState state;
- RefPtr<Node> result = treeWalker->lastChild(&state);
- return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::nextNodeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TreeWalker.nextNode()");
- TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
- EmptyScriptState state;
- RefPtr<Node> result = treeWalker->nextNode(&state);
- return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::previousNodeCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TreeWalker.previousNode()");
- TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
- EmptyScriptState state;
- RefPtr<Node> result = treeWalker->previousNode(&state);
- return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::nextSiblingCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TreeWalker.nextSibling()");
- TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
- EmptyScriptState state;
- RefPtr<Node> result = treeWalker->nextSibling(&state);
- return toV8Object(result.release(), &state);
-}
-
-v8::Handle<v8::Value> V8TreeWalker::previousSiblingCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TreeWalker.previousSibling()");
- TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
-
- EmptyScriptState state;
- RefPtr<Node> result = treeWalker->previousSibling(&state);
- return toV8Object(result.release(), &state);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
index 1b8936d..75eff67 100644
--- a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
@@ -105,80 +105,6 @@ static int* jsArrayToIntArray(v8::Handle<v8::Array> array, uint32_t len)
return data;
}
-v8::Handle<v8::Value> V8WebGLRenderingContext::bufferDataCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.bufferData()");
-
- // Forms:
- // * bufferData(GLenum target, WebGLArray data, GLenum usage);
- // - Sets the buffer's data from the given WebGLArray
- // * bufferData(GLenum target, GLsizeiptr size, GLenum usage);
- // - Sets the size of the buffer to the given size in bytes
- if (args.Length() != 3) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- bool ok;
- int target = toInt32(args[0], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int usage = toInt32(args[2], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- if (args[1]->IsInt32()) {
- int size = toInt32(args[1]);
- ExceptionCode exceptionCode;
- context->bufferData(target, size, usage, exceptionCode);
- } else if (V8WebGLArray::HasInstance(args[1])) {
- WebGLArray* array = V8WebGLArray::toNative(args[1]->ToObject());
- ExceptionCode exceptionCode;
- context->bufferData(target, array, usage, exceptionCode);
- } else {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::bufferSubDataCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.bufferSubData()");
-
- // Forms:
- // * bufferSubData(GLenum target, GLintptr offset, WebGLArray data);
- if (args.Length() != 3) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- bool ok;
- int target = toInt32(args[0], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int offset = toInt32(args[1], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- if (!V8WebGLArray::HasInstance(args[2])) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- WebGLArray* array = V8WebGLArray::toNative(args[2]->ToObject());
- ExceptionCode exceptionCode;
- context->bufferSubData(target, offset, array, exceptionCode);
- return v8::Undefined();
-}
-
static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info)
{
switch (info.getType()) {
@@ -443,290 +369,6 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getVertexAttribCallback(const v8:
return getObjectParameter(args, kVertexAttrib);
}
-v8::Handle<v8::Value> V8WebGLRenderingContext::texImage2DCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.texImage2D()");
-
- // Currently supported forms:
- // * void texImage2D(in GLenum target, in GLint level,
- // in GLint internalformat,
- // in GLsizei width, in GLsizei height, in GLint border,
- // in GLenum format, in GLenum type, in WebGLArray pixels);
- // * void texImage2D(in GLenum target, in GLint level, in ImageData pixels,
- // [Optional] in GLboolean flipY, [Optional] in GLboolean premulitplyAlpha);
- // * void texImage2D(in GLenum target, in GLint level, in HTMLImageElement image,
- // [Optional] in GLboolean flipY, [Optional] in GLboolean premultiplyAlpha);
- // * void texImage2D(in GLenum target, in GLint level, in HTMLCanvasElement image,
- // [Optional] in GLboolean flipY, [Optional] in GLboolean premultiplyAlpha);
- // * void texImage2D(in GLenum target, in GLint level, in HTMLVideoElement image,
- // [Optional] in GLboolean flipY, [Optional] in GLboolean premultiplyAlpha);
- if (args.Length() != 3 &&
- args.Length() != 4 &&
- args.Length() != 5 &&
- args.Length() != 9) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- bool ok;
- int target = toInt32(args[0], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int level = toInt32(args[1], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- ExceptionCode ec = 0;
- if (args.Length() == 3 ||
- args.Length() == 4 ||
- args.Length() == 5) {
- bool flipY = false;
- bool premultiplyAlpha = false;
- if (args.Length() >= 4)
- flipY = args[3]->BooleanValue();
- if (args.Length() >= 5)
- premultiplyAlpha = args[4]->BooleanValue();
-
- v8::Handle<v8::Value> arg = args[2];
- if (V8HTMLImageElement::HasInstance(arg)) {
- HTMLImageElement* element = V8HTMLImageElement::toNative(v8::Handle<v8::Object>::Cast(arg));
- context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
- } else if (V8HTMLCanvasElement::HasInstance(arg)) {
- HTMLCanvasElement* element = V8HTMLCanvasElement::toNative(v8::Handle<v8::Object>::Cast(arg));
- context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
- } else if(V8ImageData::HasInstance(arg)) {
- ImageData* imageElement = V8ImageData::toNative(v8::Handle<v8::Object>::Cast(arg));
- context->texImage2D(target, level, imageElement, flipY, premultiplyAlpha, ec);
- } else if (V8HTMLVideoElement::HasInstance(arg)) {
- HTMLVideoElement* element = V8HTMLVideoElement::toNative(v8::Handle<v8::Object>::Cast(arg));
- context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
- }
- else {
- // FIXME: consider different / better exception type.
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- // Fall through
- } else if (args.Length() == 9) {
- int internalformat = toInt32(args[2], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int width = toInt32(args[3], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int height = toInt32(args[4], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int border = toInt32(args[5], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int format = toInt32(args[6], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int type = toInt32(args[7], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- v8::Handle<v8::Value> arg = args[8];
- if (!arg->IsObject())
- // Assume that the user is passing null for texture
- context->texImage2D(target,
- level,
- internalformat,
- width,
- height,
- border,
- format,
- type,
- 0,
- ec);
- else if (V8WebGLArray::HasInstance(arg)) {
- WebGLArray* array = V8WebGLArray::toNative(arg->ToObject());
- context->texImage2D(target,
- level,
- internalformat,
- width,
- height,
- border,
- format,
- type,
- array,
- ec);
- // Fall through
- } else {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- } else {
- ASSERT_NOT_REACHED();
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- return v8::Undefined();
-}
-
-v8::Handle<v8::Value> V8WebGLRenderingContext::texSubImage2DCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.WebGLRenderingContext.texSubImage2D()");
-
- // Currently supported forms:
- // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset,
- // in GLsizei width, in GLsizei height,
- // in GLenum format, in GLenum type, in WebGLArray pixels);
- // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset,
- // in ImageData pixels, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
- // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset,
- // in HTMLImageElement image, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
- // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset,
- // in HTMLCanvasElement canvas, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
- // * void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset,
- // in HTMLVideoElement video, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
-
- if (args.Length() != 5 &&
- args.Length() != 6 &&
- args.Length() != 7 &&
- args.Length() != 9) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- bool ok;
- int target = toInt32(args[0], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int level = toInt32(args[1], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int xoff = toInt32(args[2], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int yoff = toInt32(args[3], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
-
- ExceptionCode ec = 0;
- if (args.Length() == 5 ||
- args.Length() == 6 ||
- args.Length() == 7) {
- bool flipY = false;
- bool premultiplyAlpha = false;
- if (args.Length() >= 6)
- flipY = args[5]->BooleanValue();
- if (args.Length() >= 7)
- premultiplyAlpha = args[6]->BooleanValue();
-
- v8::Handle<v8::Value> arg = args[4];
- if (V8HTMLImageElement::HasInstance(arg)) {
- HTMLImageElement* element = V8HTMLImageElement::toNative(v8::Handle<v8::Object>::Cast(arg));
- context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
- } else if (V8HTMLCanvasElement::HasInstance(arg)) {
- HTMLCanvasElement* element = V8HTMLCanvasElement::toNative(v8::Handle<v8::Object>::Cast(arg));
- context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
- } else if(V8ImageData::HasInstance(arg)) {
- ImageData* imageElement = V8ImageData::toNative(v8::Handle<v8::Object>::Cast(arg));
- context->texSubImage2D(target, level, xoff, yoff, imageElement, flipY, premultiplyAlpha, ec);
- } else if (V8HTMLVideoElement::HasInstance(arg)) {
- HTMLVideoElement* element = V8HTMLVideoElement::toNative(v8::Handle<v8::Object>::Cast(arg));
- context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
- }
- else {
- // FIXME: consider different / better exception type.
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- // Fall through
- } else if (args.Length() == 9) {
- int width = toInt32(args[4], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int height = toInt32(args[5], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int format = toInt32(args[6], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- int type = toInt32(args[7], ok);
- if (!ok) {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- v8::Handle<v8::Value> arg = args[8];
- if (!arg->IsObject())
- // Assume that the user is passing null for texture
- context->texSubImage2D(target,
- level,
- xoff,
- yoff,
- width,
- height,
- format,
- type,
- 0,
- ec);
- else if (V8WebGLArray::HasInstance(arg)) {
- WebGLArray* array = V8WebGLArray::toNative(arg->ToObject());
- context->texSubImage2D(target,
- level,
- xoff,
- yoff,
- width,
- height,
- format,
- type,
- array,
- ec);
- // Fall through
- } else {
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- } else {
- ASSERT_NOT_REACHED();
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
- }
- if (ec) {
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
- }
- return v8::Undefined();
-}
-
enum FunctionToCall {
kUniform1v, kUniform2v, kUniform3v, kUniform4v,
kVertexAttrib1v, kVertexAttrib2v, kVertexAttrib3v, kVertexAttrib4v
diff --git a/WebCore/bindings/v8/test/TestObj.idl b/WebCore/bindings/v8/test/TestObj.idl
deleted file mode 100644
index 662ac64..0000000
--- a/WebCore/bindings/v8/test/TestObj.idl
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary formstrArg, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIEstrArg, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// This IDL file is for testing the V8 generator and for tracking changes
-// in its ouput.
-module test {
- interface TestObj {
- // Attributes
- readonly attribute long readOnlyIntAttr;
- readonly attribute DOMString readOnlyStringAttr;
- readonly attribute TestObj readOnlyTestObjAttr;
- attribute long intAttr;
- attribute DOMString stringAttr;
- attribute TestObj testObjAttr;
-
- // Methods
- void voidMethod();
- void voidMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg);
- long intMethod();
- long intMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg);
- TestObj objMethod();
- TestObj objMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg);
-
- // Exceptions
- void methodWithException() raises(DOMException);
- attribute long attrWithException raises(DOMException);
- attribute long attrWithSetterException getraises(DOMException);
- attribute long attrWithGetterException setraises(DOMException);
-
- // 'Custom' extended attribute
- attribute [Custom] long customAttr;
- [Custom] void customMethod();
- [Custom] void customMethodWithArgs(in long intArg, in DOMString strArg, in TestObj objArg);
-
- // 'Optional' extended attribute
- void methodWithOptionalArg(in [Optional] long opt);
- void methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optional] long opt);
- void methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in long opt2);
-
- // Overloads
- void overloadedMethod(in TestObj objArg, in DOMString strArg);
- void overloadedMethod(in TestObj objArg, in [Optional] long intArg);
- void overloadedMethod(in DOMString strArg);
- void overloadedMethod(in long intArg);
- };
-}
diff --git a/WebCore/bindings/v8/test/V8TestObj.cpp b/WebCore/bindings/v8/test/V8TestObj.cpp
deleted file mode 100644
index d51884e..0000000
--- a/WebCore/bindings/v8/test/V8TestObj.cpp
+++ /dev/null
@@ -1,459 +0,0 @@
-/*
- This file is part of the WebKit open source project.
- This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include "config.h"
-#include "V8TestObj.h"
-
-#include "ExceptionCode.h"
-#include "RuntimeEnabledFeatures.h"
-#include "V8Binding.h"
-#include "V8BindingState.h"
-#include "V8DOMWrapper.h"
-#include "V8IsolatedContext.h"
-#include "V8Proxy.h"
-#include <wtf/GetPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0 };
-
-namespace TestObjInternal {
-
-template <typename T> void V8_USE(T) { }
-
-static v8::Handle<v8::Value> readOnlyIntAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.readOnlyIntAttr._get");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- return v8::Integer::New(imp->readOnlyIntAttr());
-}
-
-static v8::Handle<v8::Value> readOnlyStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.readOnlyStringAttr._get");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- return v8String(imp->readOnlyStringAttr());
-}
-
-static v8::Handle<v8::Value> readOnlyTestObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.readOnlyTestObjAttr._get");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- RefPtr<TestObj> result = imp->readOnlyTestObjAttr();
- v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap().get(result.get()) : v8::Handle<v8::Value>();
- if (wrapper.IsEmpty()) {
- wrapper = toV8(result.get());
- if (!wrapper.IsEmpty())
- V8DOMWrapper::setHiddenReference(info.Holder(), wrapper);
- }
- return wrapper;
-}
-
-static v8::Handle<v8::Value> intAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.intAttr._get");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- return v8::Integer::New(imp->intAttr());
-}
-
-static void intAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.intAttr._set");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- int v = toInt32(value);
- imp->setIntAttr(v);
- return;
-}
-
-static v8::Handle<v8::Value> stringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.stringAttr._get");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- return v8String(imp->stringAttr());
-}
-
-static void stringAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.stringAttr._set");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- V8Parameter<> v = value;
- imp->setStringAttr(v);
- return;
-}
-
-static v8::Handle<v8::Value> testObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.testObjAttr._get");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- return toV8(imp->testObjAttr());
-}
-
-static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.testObjAttr._set");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
- imp->setTestObjAttr(WTF::getPtr(v));
- return;
-}
-
-static v8::Handle<v8::Value> attrWithExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.attrWithException._get");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- return v8::Integer::New(imp->attrWithException());
-}
-
-static void attrWithExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.attrWithException._set");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- int v = toInt32(value);
- imp->setAttrWithException(v);
- return;
-}
-
-static v8::Handle<v8::Value> attrWithSetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.attrWithSetterException._get");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- return v8::Integer::New(imp->attrWithSetterException());
-}
-
-static void attrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.attrWithSetterException._set");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- int v = toInt32(value);
- imp->setAttrWithSetterException(v);
- return;
-}
-
-static v8::Handle<v8::Value> attrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.attrWithGetterException._get");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- return v8::Integer::New(imp->attrWithGetterException());
-}
-
-static void attrWithGetterExceptionAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.TestObj.attrWithGetterException._set");
- TestObj* imp = V8TestObj::toNative(info.Holder());
- int v = toInt32(value);
- imp->setAttrWithGetterException(v);
- return;
-}
-
-static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.voidMethod");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- imp->voidMethod();
- return v8::Handle<v8::Value>();
-}
-
-static v8::Handle<v8::Value> voidMethodWithArgsCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.voidMethodWithArgs");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- int intArg = toInt32(args[0]);
- V8Parameter<> strArg = args[1];
- TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;
- imp->voidMethodWithArgs(intArg, strArg, objArg);
- return v8::Handle<v8::Value>();
-}
-
-static v8::Handle<v8::Value> intMethodCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.intMethod");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- return v8::Integer::New(imp->intMethod());
-}
-
-static v8::Handle<v8::Value> intMethodWithArgsCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.intMethodWithArgs");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- int intArg = toInt32(args[0]);
- V8Parameter<> strArg = args[1];
- TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;
- return v8::Integer::New(imp->intMethodWithArgs(intArg, strArg, objArg));
-}
-
-static v8::Handle<v8::Value> objMethodCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.objMethod");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- return toV8(imp->objMethod());
-}
-
-static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.objMethodWithArgs");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- int intArg = toInt32(args[0]);
- V8Parameter<> strArg = args[1];
- TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;
- return toV8(imp->objMethodWithArgs(intArg, strArg, objArg));
-}
-
-static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.methodWithException");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- ExceptionCode ec = 0;
- {
- imp->methodWithException(ec);
- if (UNLIKELY(ec))
- goto fail;
- return v8::Handle<v8::Value>();
- }
- fail:
- V8Proxy::setDOMException(ec);
- return v8::Handle<v8::Value>();
-}
-
-static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.methodWithOptionalArg");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0) {
- imp->methodWithOptionalArg();
- return v8::Handle<v8::Value>();
- }
- int opt = toInt32(args[0]);
- imp->methodWithOptionalArg(opt);
- return v8::Handle<v8::Value>();
-}
-
-static v8::Handle<v8::Value> methodWithNonOptionalArgAndOptionalArgCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- int nonOpt = toInt32(args[0]);
- if (args.Length() <= 1) {
- imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
- return v8::Handle<v8::Value>();
- }
- int opt = toInt32(args[1]);
- imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
- return v8::Handle<v8::Value>();
-}
-
-static v8::Handle<v8::Value> methodWithNonOptionalArgAndTwoOptionalArgsCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndTwoOptionalArgs");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- int nonOpt = toInt32(args[0]);
- if (args.Length() <= 1) {
- imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
- return v8::Handle<v8::Value>();
- }
- int opt1 = toInt32(args[1]);
- int opt2 = toInt32(args[2]);
- imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
- return v8::Handle<v8::Value>();
-}
-
-static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.overloadedMethod1");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- TestObj* objArg = V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
- V8Parameter<> strArg = args[1];
- imp->overloadedMethod(objArg, strArg);
- return v8::Handle<v8::Value>();
-}
-
-static v8::Handle<v8::Value> overloadedMethod2Callback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.overloadedMethod2");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- TestObj* objArg = V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
- if (args.Length() <= 1) {
- imp->overloadedMethod(objArg);
- return v8::Handle<v8::Value>();
- }
- int intArg = toInt32(args[1]);
- imp->overloadedMethod(objArg, intArg);
- return v8::Handle<v8::Value>();
-}
-
-static v8::Handle<v8::Value> overloadedMethod3Callback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.overloadedMethod3");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- V8Parameter<> strArg = args[0];
- imp->overloadedMethod(strArg);
- return v8::Handle<v8::Value>();
-}
-
-static v8::Handle<v8::Value> overloadedMethod4Callback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.overloadedMethod4");
- TestObj* imp = V8TestObj::toNative(args.Holder());
- int intArg = toInt32(args[0]);
- imp->overloadedMethod(intArg);
- return v8::Handle<v8::Value>();
-}
-
-static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.TestObj.overloadedMethod");
- if ((args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0])) && (args[1]->IsNull() || args[1]->IsUndefined() || args[1]->IsString() || args[1]->IsObject())))
- return overloadedMethod1Callback(args);
- if ((args.Length() == 1 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))) || (args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0]))))
- return overloadedMethod2Callback(args);
- if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
- return overloadedMethod3Callback(args);
- if (args.Length() == 1)
- return overloadedMethod4Callback(args);
- V8Proxy::setDOMException(SYNTAX_ERR);
- return notHandledByInterceptor();
-}
-
-} // namespace TestObjInternal
-
-static const BatchedAttribute TestObjAttrs[] = {
- // Attribute 'readOnlyIntAttr' (Type: 'readonly attribute' ExtAttr: '')
- {"readOnlyIntAttr", TestObjInternal::readOnlyIntAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'readOnlyStringAttr' (Type: 'readonly attribute' ExtAttr: '')
- {"readOnlyStringAttr", TestObjInternal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '')
- {"readOnlyTestObjAttr", TestObjInternal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'intAttr' (Type: 'attribute' ExtAttr: '')
- {"intAttr", TestObjInternal::intAttrAttrGetter, TestObjInternal::intAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '')
- {"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '')
- {"testObjAttr", TestObjInternal::testObjAttrAttrGetter, TestObjInternal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'attrWithException' (Type: 'attribute' ExtAttr: '')
- {"attrWithException", TestObjInternal::attrWithExceptionAttrGetter, TestObjInternal::attrWithExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'attrWithSetterException' (Type: 'attribute' ExtAttr: '')
- {"attrWithSetterException", TestObjInternal::attrWithSetterExceptionAttrGetter, TestObjInternal::attrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'attrWithGetterException' (Type: 'attribute' ExtAttr: '')
- {"attrWithGetterException", TestObjInternal::attrWithGetterExceptionAttrGetter, TestObjInternal::attrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'customAttr' (Type: 'attribute' ExtAttr: 'Custom')
- {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
-};
-static const BatchedCallback TestObjCallbacks[] = {
- {"voidMethod", TestObjInternal::voidMethodCallback},
- {"intMethod", TestObjInternal::intMethodCallback},
- {"objMethod", TestObjInternal::objMethodCallback},
- {"methodWithException", TestObjInternal::methodWithExceptionCallback},
- {"customMethod", V8TestObj::customMethodCallback},
- {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback},
- {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
- {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
- {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
- {"overloadedMethod", TestObjInternal::overloadedMethodCallback},
-};
-static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc)
-{
- v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestObj", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
- TestObjAttrs, sizeof(TestObjAttrs) / sizeof(*TestObjAttrs),
- TestObjCallbacks, sizeof(TestObjCallbacks) / sizeof(*TestObjCallbacks));
- v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
-
-
- // Custom Signature 'voidMethodWithArgs'
- const int voidMethodWithArgsArgc = 3;
- v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
- v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(desc, voidMethodWithArgsArgc, voidMethodWithArgsArgv);
- proto->Set(v8::String::New("voidMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::voidMethodWithArgsCallback, v8::Handle<v8::Value>(), voidMethodWithArgsSignature));
-
- // Custom Signature 'intMethodWithArgs'
- const int intMethodWithArgsArgc = 3;
- v8::Handle<v8::FunctionTemplate> intMethodWithArgsArgv[intMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
- v8::Handle<v8::Signature> intMethodWithArgsSignature = v8::Signature::New(desc, intMethodWithArgsArgc, intMethodWithArgsArgv);
- proto->Set(v8::String::New("intMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::intMethodWithArgsCallback, v8::Handle<v8::Value>(), intMethodWithArgsSignature));
-
- // Custom Signature 'objMethodWithArgs'
- const int objMethodWithArgsArgc = 3;
- v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
- v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv);
- proto->Set(v8::String::New("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjInternal::objMethodWithArgsCallback, v8::Handle<v8::Value>(), objMethodWithArgsSignature));
-
- // Custom toString template
- desc->Set(getToStringName(), getToStringTemplate());
- return desc;
-}
-
-v8::Persistent<v8::FunctionTemplate> V8TestObj::GetRawTemplate()
-{
- static v8::Persistent<v8::FunctionTemplate> V8TestObjRawCache = createRawTemplate();
- return V8TestObjRawCache;
-}
-
-v8::Persistent<v8::FunctionTemplate> V8TestObj::GetTemplate()
-{
- static v8::Persistent<v8::FunctionTemplate> V8TestObjCache = ConfigureV8TestObjTemplate(GetRawTemplate());
- return V8TestObjCache;
-}
-
-TestObj* V8TestObj::toNative(v8::Handle<v8::Object> object)
-{
- return reinterpret_cast<TestObj*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
-}
-
-bool V8TestObj::HasInstance(v8::Handle<v8::Value> value)
-{
- return GetRawTemplate()->HasInstance(value);
-}
-
-
-v8::Handle<v8::Object> V8TestObj::wrap(TestObj* impl)
-{
- v8::Handle<v8::Object> wrapper;
- V8Proxy* proxy = 0;
- wrapper = getDOMObjectMap().get(impl);
- if (!wrapper.IsEmpty())
- return wrapper;
- wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
- if (wrapper.IsEmpty())
- return wrapper;
-
- impl->ref();
- getDOMObjectMap().set(impl, v8::Persistent<v8::Object>::New(wrapper));
- return wrapper;
-}
-
-v8::Handle<v8::Value> toV8(PassRefPtr<TestObj > impl)
-{
- return toV8(impl.get());
-}
-
-v8::Handle<v8::Value> toV8(TestObj* impl)
-{
- if (!impl)
- return v8::Null();
- return V8TestObj::wrap(impl);
-}
-
-void V8TestObj::derefObject(void* object)
-{
- static_cast<TestObj*>(object)->deref();
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/test/V8TestObj.h b/WebCore/bindings/v8/test/V8TestObj.h
deleted file mode 100644
index 5d6770a..0000000
--- a/WebCore/bindings/v8/test/V8TestObj.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- This file is part of the WebKit open source project.
- This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#ifndef V8TestObj_h
-#define V8TestObj_h
-
-#include "StringHash.h"
-#include "TestObj.h"
-#include "WrapperTypeInfo.h"
-#include <v8.h>
-#include <wtf/HashMap.h>
-
-namespace WebCore {
-
-class V8TestObj {
-
-public:
- static bool HasInstance(v8::Handle<v8::Value> value);
- static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
- static v8::Persistent<v8::FunctionTemplate> GetTemplate();
- static TestObj* toNative(v8::Handle<v8::Object>);
- static v8::Handle<v8::Object> wrap(TestObj*);
- static void derefObject(void*);
- static WrapperTypeInfo info;
- static v8::Handle<v8::Value> customMethodCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> customMethodWithArgsCallback(const v8::Arguments&);
- static v8::Handle<v8::Value> customAttrAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info);
- static void customAttrAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
- static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
-};
-
-v8::Handle<v8::Value> toV8(TestObj*);
-v8::Handle<v8::Value> toV8(PassRefPtr<TestObj >);
-}
-
-#endif // V8TestObj_h
diff --git a/WebCore/bindings/v8/test/run_tests.py b/WebCore/bindings/v8/test/run_tests.py
deleted file mode 100644
index e27d559..0000000
--- a/WebCore/bindings/v8/test/run_tests.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2010 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# This script generates h and cpp file for TestObj.idl using the V8 code
-# generator. Please execute the script whenever changes are made to
-# CodeGeneratorV8.pm, and submit the changes in V8TestObj.h/cpp in the same
-# patch. This makes it easier to track and review changes in generated code.
-# To execute, invoke: 'python run_tests.py'
-
-import os
-import sys
-
-
-def test(idlFilePath):
- cmd = ['perl', '-w',
- '-I../../scripts',
- '../../scripts/generate-bindings.pl',
- # idl include directories (path relative to generate-bindings.pl)
- '--include .',
- # place holder for defines (generate-bindings.pl requires it)
- '--defines xxx',
- '--generator V8',
- '--outputDir .',
- idlFilePath]
- os.system(' '.join(cmd))
-
-
-def main(argv):
- scriptDir = os.path.dirname(__file__)
- os.chdir(scriptDir)
- test('TestObj.idl')
-
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv))