summaryrefslogtreecommitdiffstats
path: root/webkit/port
diff options
context:
space:
mode:
authordglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-02 18:59:21 +0000
committerdglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-02 18:59:21 +0000
commitd02e43a80f0fae032501e68d38bd562976b9d866 (patch)
tree7dde5a6afc05a1bc7a1645fd9c558a7941560410 /webkit/port
parent93e503337da16175761eaa6fbc10af5b8b2e5506 (diff)
downloadchromium_src-d02e43a80f0fae032501e68d38bd562976b9d866.zip
chromium_src-d02e43a80f0fae032501e68d38bd562976b9d866.tar.gz
chromium_src-d02e43a80f0fae032501e68d38bd562976b9d866.tar.bz2
Hook up upstreamed V8 bindings, Chromium side
R=mark Review URL: http://codereview.chromium.org/27336 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10713 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-rw-r--r--webkit/port/bindings/v8/ScheduledAction.h21
-rw-r--r--webkit/port/bindings/v8/ScriptCachedFrameData.h52
-rw-r--r--webkit/port/bindings/v8/ScriptCallFrame.cpp65
-rw-r--r--webkit/port/bindings/v8/ScriptCallFrame.h75
-rw-r--r--webkit/port/bindings/v8/ScriptCallStack.cpp60
-rw-r--r--webkit/port/bindings/v8/ScriptCallStack.h59
-rw-r--r--webkit/port/bindings/v8/ScriptInstance.cpp83
-rw-r--r--webkit/port/bindings/v8/ScriptInstance.h63
-rw-r--r--webkit/port/bindings/v8/ScriptSourceCode.h72
-rwxr-xr-xwebkit/port/bindings/v8/ScriptState.h50
-rw-r--r--webkit/port/bindings/v8/ScriptString.h66
-rw-r--r--webkit/port/bindings/v8/ScriptValue.cpp48
-rw-r--r--webkit/port/bindings/v8/ScriptValue.h129
-rw-r--r--webkit/port/bindings/v8/v8_custom.cpp1077
14 files changed, 2 insertions, 1918 deletions
diff --git a/webkit/port/bindings/v8/ScheduledAction.h b/webkit/port/bindings/v8/ScheduledAction.h
deleted file mode 100644
index c2a1d88..0000000
--- a/webkit/port/bindings/v8/ScheduledAction.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ScheduledAction_h
-#define ScheduledAction_h
-
-namespace WebCore {
-
-class ScriptExecutionContext;
-
-class ScheduledAction {
-public:
- virtual ~ScheduledAction() { }
- virtual void execute(ScriptExecutionContext* window) = 0;
-};
-
-}
-
-#endif
-
diff --git a/webkit/port/bindings/v8/ScriptCachedFrameData.h b/webkit/port/bindings/v8/ScriptCachedFrameData.h
deleted file mode 100644
index d6f655d..0000000
--- a/webkit/port/bindings/v8/ScriptCachedFrameData.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2008, 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 ScriptCachedPageData_h
-#define ScriptCachedPageData_h
-
-// We don't use WebKit's page caching, so this implementation is just a stub.
-
-namespace WebCore {
- class Frame;
- class DOMWindow;
-
- class ScriptCachedFrameData {
- public:
- ScriptCachedFrameData(Frame*) { }
- ~ScriptCachedFrameData() { }
-
- void restore(Frame*) { }
- void clear() { }
- DOMWindow* domWindow() const { return 0; }
- };
-
-} // namespace WebCore
-
-#endif // ScriptCachedPageData_h
diff --git a/webkit/port/bindings/v8/ScriptCallFrame.cpp b/webkit/port/bindings/v8/ScriptCallFrame.cpp
deleted file mode 100644
index bfcdd37..0000000
--- a/webkit/port/bindings/v8/ScriptCallFrame.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2008, 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 "ScriptCallFrame.h"
-
-#include "PlatformString.h"
-#include "v8.h"
-#include "v8_binding.h"
-#include "v8_proxy.h"
-#include "ScriptValue.h"
-
-namespace WebCore {
-
- ScriptCallFrame::ScriptCallFrame(const String& functionName,
- const String& urlString,
- int lineNumber,
- const v8::Arguments& arguments,
- unsigned int skipArgumentCount)
- : m_functionName(functionName)
- , m_sourceURL(urlString)
- , m_lineNumber(lineNumber)
- {
- for (int i = 0; i < arguments.Length(); ++i) {
- m_arguments.append(ScriptValue(arguments[i]));
- }
- }
-
- ScriptCallFrame::~ScriptCallFrame()
- {
- }
-
- const ScriptValue& ScriptCallFrame::argumentAt(unsigned index) const
- {
- ASSERT(m_arguments.size() > index);
- return m_arguments[index];
- }
-
-} // namespace WebCore
diff --git a/webkit/port/bindings/v8/ScriptCallFrame.h b/webkit/port/bindings/v8/ScriptCallFrame.h
deleted file mode 100644
index bf6f1a7..0000000
--- a/webkit/port/bindings/v8/ScriptCallFrame.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) 2008, 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 ScriptCallFrame_h
-#define ScriptCallFrame_h
-
-#include "KURL.h"
-#include <wtf/Vector.h>
-#include "ScriptString.h"
-
-namespace v8 {
- class Arguments;
-}
-
-namespace WebCore {
- class ScriptValue;
-
- // FIXME: Implement retrieving line number and source URL and storing here
- // for all call frames, not just the first one.
- // See <https://bugs.webkit.org/show_bug.cgi?id=22556> and
- // <https://bugs.webkit.org/show_bug.cgi?id=21180>
- class ScriptCallFrame {
- public:
- ScriptCallFrame(const String& functionName,
- const String& urlString,
- int lineNumber,
- const v8::Arguments&,
- unsigned skipArgumentCount);
- ~ScriptCallFrame();
-
- const ScriptString& functionName() const { return m_functionName; }
- const KURL& sourceURL() const { return m_sourceURL; }
- unsigned lineNumber() const { return m_lineNumber; }
-
- // argument retrieval methods
- const ScriptValue& argumentAt(unsigned) const;
- unsigned argumentCount() const { return m_arguments.size(); }
-
- private:
- ScriptString m_functionName;
- KURL m_sourceURL;
- unsigned m_lineNumber;
-
- Vector<ScriptValue> m_arguments;
- };
-
-} // namespace WebCore
-
-#endif // ScriptCallFrame_h
diff --git a/webkit/port/bindings/v8/ScriptCallStack.cpp b/webkit/port/bindings/v8/ScriptCallStack.cpp
deleted file mode 100644
index 0ebb912..0000000
--- a/webkit/port/bindings/v8/ScriptCallStack.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2008, 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 "ScriptCallStack.h"
-
-#include "v8.h"
-#include "v8_binding.h"
-#include "v8_proxy.h"
-
-namespace WebCore {
-
-ScriptCallStack::ScriptCallStack(const v8::Arguments& arguments,
- unsigned skipArgumentCount)
- : m_lastCaller(String(), V8Proxy::GetSourceName(),
- V8Proxy::GetSourceLineNumber() + 1, arguments,
- skipArgumentCount)
-{
-}
-
-ScriptCallStack::~ScriptCallStack()
-{
-}
-
-const ScriptCallFrame& ScriptCallStack::at(unsigned index) const
-{
- // Currently, only one ScriptCallFrame is supported. When we can get
- // a full stack trace from V8, we can do this right.
- ASSERT(index == 0);
-
- return m_lastCaller;
-}
-
-} // namespace WebCore
diff --git a/webkit/port/bindings/v8/ScriptCallStack.h b/webkit/port/bindings/v8/ScriptCallStack.h
deleted file mode 100644
index d3cfe04..0000000
--- a/webkit/port/bindings/v8/ScriptCallStack.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2008, 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 ScriptCallStack_h
-#define ScriptCallStack_h
-
-#include "ScriptCallFrame.h"
-#include "ScriptValue.h"
-#include <wtf/Noncopyable.h>
-
-namespace v8 {
- class Arguments;
-}
-
-namespace WebCore {
-
- class ScriptCallStack : public Noncopyable {
- public:
- ScriptCallStack(const v8::Arguments&, unsigned skipArgumentCount = 0);
- ~ScriptCallStack();
-
- // frame retrieval methods
- const ScriptCallFrame &at(unsigned) const;
- // TODO(dglazkov): implement retrieving and storing call stack trace
- unsigned size() const { return 1; }
-
- private:
- ScriptCallFrame m_lastCaller;
- };
-
-} // namespace WebCore
-
-#endif // ScriptCallStack_h
diff --git a/webkit/port/bindings/v8/ScriptInstance.cpp b/webkit/port/bindings/v8/ScriptInstance.cpp
deleted file mode 100644
index 4c9f64b..0000000
--- a/webkit/port/bindings/v8/ScriptInstance.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2008, 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 "ScriptInstance.h"
-
-#include "v8_proxy.h"
-#include <wtf/Assertions.h>
-
-namespace WebCore {
-
-V8ScriptInstance::V8ScriptInstance()
-{
-}
-
-V8ScriptInstance::V8ScriptInstance(v8::Handle<v8::Object> instance)
-{
- set(instance);
-}
-
-V8ScriptInstance::~V8ScriptInstance()
-{
- clear();
-}
-
-v8::Persistent<v8::Object> V8ScriptInstance::instance()
-{
- return m_instance;
-}
-
-void V8ScriptInstance::clear()
-{
- if (m_instance.IsEmpty())
- return;
-#ifndef NDEBUG
- V8Proxy::UnregisterGlobalHandle(this, m_instance);
-#endif
- m_instance.Dispose();
- m_instance.Clear();
-}
-
-void V8ScriptInstance::set(v8::Handle<v8::Object> instance)
-{
- clear();
- if (instance.IsEmpty())
- return;
-
- m_instance = v8::Persistent<v8::Object>::New(instance);
-#ifndef NDEBUG
- V8Proxy::RegisterGlobalHandle(SCRIPTINSTANCE, this, m_instance);
-#endif
-
-}
-
-
-} // namespace WebCore
diff --git a/webkit/port/bindings/v8/ScriptInstance.h b/webkit/port/bindings/v8/ScriptInstance.h
deleted file mode 100644
index b45c87b..0000000
--- a/webkit/port/bindings/v8/ScriptInstance.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2008, 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 ScriptInstance_h
-#define ScriptInstance_h
-
-#include "v8.h"
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-class V8ScriptInstance : public RefCounted<V8ScriptInstance> {
-public:
- static PassRefPtr<V8ScriptInstance> create(v8::Handle<v8::Object> instance)
- {
- return adoptRef(new V8ScriptInstance(instance));
- }
- V8ScriptInstance();
- V8ScriptInstance(v8::Handle<v8::Object>);
- ~V8ScriptInstance();
- v8::Persistent<v8::Object> instance();
-
-private:
- void clear();
- void set(v8::Handle<v8::Object>);
- mutable v8::Persistent<v8::Object> m_instance;
-};
-
-typedef RefPtr<V8ScriptInstance> ScriptInstance;
-typedef PassRefPtr<V8ScriptInstance> PassScriptInstance;
-
-} // namespace WebCore
-
-#endif // ScriptInstance_h
diff --git a/webkit/port/bindings/v8/ScriptSourceCode.h b/webkit/port/bindings/v8/ScriptSourceCode.h
deleted file mode 100644
index 63071a9..0000000
--- a/webkit/port/bindings/v8/ScriptSourceCode.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2008, 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 ScriptSourceCode_h
-#define ScriptSourceCode_h
-
-#include "CachedScript.h"
-#include "KURL.h"
-#include "PlatformString.h"
-
-namespace WebCore {
-
-class ScriptSourceCode {
-public:
- ScriptSourceCode(const String& source, const KURL& url = KURL(), int startLine = 1)
- : m_source(source)
- , m_url(url)
- , m_startLine(startLine)
- {
- }
-
- // We lose the encoding information from CachedScript.
- // Not sure if that matters.
- ScriptSourceCode(CachedScript* cs)
- : m_source(cs->script())
- , m_url(cs->url())
- , m_startLine(1)
- {
- }
-
- bool isEmpty() const { return m_source.isEmpty(); }
-
- const String& source() const { return m_source; }
- const KURL& url() const { return m_url; }
- int startLine() const { return m_startLine; }
-
-private:
- String m_source;
- KURL m_url;
- int m_startLine;
-};
-
-} // namespace WebCore
-
-#endif // ScriptSourceCode_h
diff --git a/webkit/port/bindings/v8/ScriptState.h b/webkit/port/bindings/v8/ScriptState.h
deleted file mode 100755
index 3991037..0000000
--- a/webkit/port/bindings/v8/ScriptState.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2008, 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 ScriptState_h
-#define ScriptState_h
-
-#include <v8.h>
-
-namespace WebCore {
- class ScriptState {
- public:
- bool hadException() { return !m_exception.IsEmpty(); }
- void setException(v8::Local<v8::Value> exception)
- {
- m_exception = exception;
- }
- v8::Local<v8::Value> exception() { return m_exception; }
-
- private:
- v8::Local<v8::Value> m_exception;
- };
-}
-
-#endif // ScriptState_h
diff --git a/webkit/port/bindings/v8/ScriptString.h b/webkit/port/bindings/v8/ScriptString.h
deleted file mode 100644
index e6eb036..0000000
--- a/webkit/port/bindings/v8/ScriptString.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2008, 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 ScriptString_h
-#define ScriptString_h
-
-#include "PlatformString.h"
-
-namespace WebCore {
-
-class ScriptString {
-public:
- ScriptString(const String& s) : m_str(s) {}
- ScriptString(const char* s) : m_str(s) {}
-
- operator String() const { return m_str; }
-
- bool isNull() const { return m_str.isNull(); }
- size_t size() const { return m_str.length(); }
-
- ScriptString& operator=(const char* s)
- {
- m_str = s;
- return *this;
- }
-
- ScriptString& operator+=(const String& s)
- {
- m_str += s;
- return *this;
- }
-
-private:
- String m_str;
-};
-
-} // namespace WebCore
-
-#endif // ScriptString_h
diff --git a/webkit/port/bindings/v8/ScriptValue.cpp b/webkit/port/bindings/v8/ScriptValue.cpp
deleted file mode 100644
index b6c105d..0000000
--- a/webkit/port/bindings/v8/ScriptValue.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008 Apple 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.
- * 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 WARRANTIES, 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.
- */
-
-#include "config.h"
-#include "ScriptValue.h"
-
-#include "v8_binding.h"
-
-namespace WebCore {
-
-bool ScriptValue::getString(String& result) const
-{
- if (m_value.IsEmpty())
- return false;
-
- if (!m_value->IsString())
- return false;
-
- result = ToWebCoreString(m_value);
- return true;
-}
-
-} // namespace WebCore
diff --git a/webkit/port/bindings/v8/ScriptValue.h b/webkit/port/bindings/v8/ScriptValue.h
deleted file mode 100644
index ff3556f..0000000
--- a/webkit/port/bindings/v8/ScriptValue.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2008, 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 ScriptValue_h
-#define ScriptValue_h
-
-#include "v8.h"
-
-#ifndef NDEBUG
-#include "v8_proxy.h" // for register and unregister global handles.
-#endif
-
-namespace WebCore {
-
-class String;
-
-class ScriptValue {
-public:
- ScriptValue() {}
-
- ScriptValue(v8::Handle<v8::Value> value)
- {
- if (!value.IsEmpty()) {
- m_value = v8::Persistent<v8::Value>::New(value);
-#ifndef NDEBUG
- V8Proxy::RegisterGlobalHandle(SCRIPTVALUE, this, m_value);
-#endif
- }
- }
-
- ScriptValue(const ScriptValue& value)
- {
- if (!value.m_value.IsEmpty()) {
- m_value = v8::Persistent<v8::Value>::New(value.m_value);
-#ifndef NDEBUG
- V8Proxy::RegisterGlobalHandle(SCRIPTVALUE, this, m_value);
-#endif
- }
- }
-
- ScriptValue& operator=(const ScriptValue& value)
- {
- if (this == &value)
- return *this;
-
- clear();
- if (!value.m_value.IsEmpty()) {
- m_value = v8::Persistent<v8::Value>::New(value.m_value);
-#ifndef NDEBUG
- V8Proxy::RegisterGlobalHandle(SCRIPTVALUE, this, m_value);
-#endif
- }
-
- return *this;
- }
-
- bool operator==(const ScriptValue value) const
- {
- return m_value == value.m_value;
- }
-
- bool operator!=(const ScriptValue value) const
- {
- return !operator==(value);
- }
-
- bool isNull() const
- {
- return m_value->IsNull();
- }
-
- bool isUndefined() const
- {
- return m_value->IsUndefined();
- }
-
- void clear() {
- if (!m_value.IsEmpty()) {
-#ifndef NDEBUG
- V8Proxy::UnregisterGlobalHandle(this, m_value);
-#endif
- m_value.Dispose();
- m_value.Clear();
- }
- }
-
- ~ScriptValue()
- {
- clear();
- }
-
- v8::Handle<v8::Value> v8Value() const { return m_value; }
- bool getString(String& result) const;
-
-private:
- mutable v8::Persistent<v8::Value> m_value;
-};
-
-} // namespace WebCore
-
-#endif // ScriptValue_h
diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp
index 23bd5e9b..ecbe1b8 100644
--- a/webkit/port/bindings/v8/v8_custom.cpp
+++ b/webkit/port/bindings/v8/v8_custom.cpp
@@ -120,371 +120,12 @@
namespace WebCore {
-class V8ScheduledAction : public ScheduledAction {
- public:
- V8ScheduledAction(v8::Handle<v8::Function> func, int argc,
- v8::Handle<v8::Value> argv[]);
- explicit V8ScheduledAction(const WebCore::String& code) : m_argc(0),
- m_argv(0), m_code(code) { }
- virtual ~V8ScheduledAction();
- virtual void execute(ScriptExecutionContext* window);
-
- private:
- v8::Persistent<v8::Function> m_func;
- int m_argc;
- v8::Persistent<v8::Value>* m_argv;
-
- ScriptSourceCode m_code;
-};
-
-V8ScheduledAction::V8ScheduledAction(v8::Handle<v8::Function> func, int argc,
- v8::Handle<v8::Value> argv[])
- : m_code(String(), KURL(), 0) {
- m_func = v8::Persistent<v8::Function>::New(func);
-
-#ifndef NDEBUG
- V8Proxy::RegisterGlobalHandle(SCHEDULED_ACTION, this, m_func);
-#endif
-
- m_argc = argc;
- if (argc > 0) {
- m_argv = new v8::Persistent<v8::Value>[argc];
- for (int i = 0; i < argc; i++) {
- m_argv[i] = v8::Persistent<v8::Value>::New(argv[i]);
-
-#ifndef NDEBUG
- V8Proxy::RegisterGlobalHandle(SCHEDULED_ACTION, this, m_argv[i]);
-#endif
- }
- } else {
- m_argv = NULL;
- }
-}
-
-
-V8ScheduledAction::~V8ScheduledAction() {
- if (!m_func.IsEmpty()) {
-#ifndef NDEBUG
- V8Proxy::UnregisterGlobalHandle(this, m_func);
-#endif
- m_func.Dispose();
-
- for (int i = 0; i < m_argc; i++) {
-#ifndef NDEBUG
- V8Proxy::UnregisterGlobalHandle(this, m_argv[i]);
-#endif
- m_argv[i].Dispose();
- }
- if (m_argc > 0) {
- delete[] m_argv;
- }
- }
-}
-
-
-void V8ScheduledAction::execute(ScriptExecutionContext* script_context) {
- // TODO(ager): Timeouts for running the javascript code are not set.
- V8Proxy* proxy = V8Proxy::retrieve(script_context);
- if (!proxy) return;
-
- v8::HandleScope handle_scope;
- v8::Local<v8::Context> context = proxy->GetContext();
- if (context.IsEmpty()) return; // JS may not be enabled.
-
- v8::Context::Scope scope(context);
-
- proxy->setTimerCallback(true);
-
- if (!m_func.IsEmpty() && m_func->IsFunction()) {
- proxy->CallFunction(v8::Persistent<v8::Function>::Cast(m_func),
- context->Global(), m_argc, m_argv);
- } else {
- proxy->Evaluate(m_code.url(), m_code.startLine() - 1, m_code.source(), 0);
- }
-
- if (script_context->isDocument()) {
- Document* doc = static_cast<Document*>(script_context);
- doc->updateRendering();
- }
-
- proxy->setTimerCallback(false);
-}
-
-
-CALLBACK_FUNC_DECL(DOMParserConstructor) {
- INC_STATS("DOM.DOMParser.Contructor");
- return V8Proxy::ConstructDOMObject<V8ClassIndex::DOMPARSER,
- DOMParser>(args);
-}
-
-CALLBACK_FUNC_DECL(MessageChannelConstructor) {
- INC_STATS("DOM.MessageChannel.Constructor");
- if (!args.IsConstructCall()) {
- V8Proxy::ThrowError(V8Proxy::TYPE_ERROR,
- "DOM object constructor cannot be called as a function.");
- return v8::Undefined();
- }
-
- // Get the document.
- Frame* frame = V8Proxy::retrieveFrame();
- if (!frame)
- return v8::Undefined();
- Document* document = frame->document();
-
- // 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<MessageChannel> obj = MessageChannel::create(document);
-
- // Create wrappers for the two associated MessagePorts.
- v8::Handle<v8::Value> port1_wrapper =
- V8Proxy::ToV8Object(V8ClassIndex::MESSAGEPORT, obj->port1());
- v8::Handle<v8::Value> port2_wrapper =
- V8Proxy::ToV8Object(V8ClassIndex::MESSAGEPORT, obj->port2());
-
- v8::Handle<v8::Object> wrapper_object = args.Holder();
-
- // Setup the standard wrapper object internal fields.
- V8Proxy::SetDOMWrapper(
- wrapper_object, V8ClassIndex::MESSAGECHANNEL, obj.get());
-
- obj->ref();
- V8Proxy::SetJSWrapperForDOMObject(
- obj.get(), v8::Persistent<v8::Object>::New(wrapper_object));
-
- // Create references from the MessageChannel wrapper to the two
- // MessagePort wrappers to make sure that the MessagePort wrappers
- // stay alive as long as the MessageChannel wrapper is around.
- wrapper_object->SetInternalField(kMessageChannelPort1Index, port1_wrapper);
- wrapper_object->SetInternalField(kMessageChannelPort2Index, port2_wrapper);
-
- // Return the wrapper object which will be the result of the call to
- // new.
- return wrapper_object;
-}
-
-
-CALLBACK_FUNC_DECL(WebKitCSSMatrixConstructor) {
- INC_STATS("DOM.WebKitCSSMatrix.Constructor");
- String s;
- if (args.Length() >= 1)
- s = ToWebCoreString(args[0]);
-
- // Create the matrix.
- ExceptionCode ec = 0;
- RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(s, ec);
- if (ec != 0) {
- V8Proxy::SetDOMException(ec);
- return v8::Undefined();
- }
-
- // Transform the holder into a wrapper object for the matrix.
- V8Proxy::SetDOMWrapper(args.Holder(),
- V8ClassIndex::ToInt(V8ClassIndex::WEBKITCSSMATRIX),
- matrix.get());
- // Add the wrapper to the DOM object map.
- matrix->ref();
- V8Proxy::SetJSWrapperForDOMObject(
- matrix.get(),
- v8::Persistent<v8::Object>::New(args.Holder()));
- return args.Holder();
-}
-
CALLBACK_FUNC_DECL(WebKitPointConstructor) {
INC_STATS("DOM.WebKitPoint.Constructor");
return V8Proxy::ConstructDOMObject<V8ClassIndex::WEBKITPOINT,
WebKitPoint>(args);
}
-CALLBACK_FUNC_DECL(XMLSerializerConstructor) {
- INC_STATS("DOM.XMLSerializer.Constructor");
- return V8Proxy::ConstructDOMObject<V8ClassIndex::XMLSERIALIZER,
- XMLSerializer>(args);
-}
-
-
-CALLBACK_FUNC_DECL(XPathEvaluatorConstructor) {
- INC_STATS("DOM.XPathEvaluator.Constructor");
- return V8Proxy::ConstructDOMObject<V8ClassIndex::XPATHEVALUATOR,
- XPathEvaluator>(args);
-}
-
-
-CALLBACK_FUNC_DECL(XSLTProcessorConstructor) {
- INC_STATS("DOM.XSLTProcessor.Constructor");
- return V8Proxy::ConstructDOMObject<V8ClassIndex::XSLTPROCESSOR,
- XSLTProcessor>(args);
-}
-
-
-CALLBACK_FUNC_DECL(XSLTProcessorImportStylesheet) {
- INC_STATS("DOM.XSLTProcessor.importStylesheet");
- // Return undefined if argument does not have the correct type.
- if (!V8Node::HasInstance(args[0]))
- return v8::Undefined();
-
- XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
- V8ClassIndex::XSLTPROCESSOR, args.Holder());
-
- Node* node = V8Proxy::DOMWrapperToNode<Node>(args[0]);
- imp->importStylesheet(node);
- return v8::Undefined();
-}
-
-
-CALLBACK_FUNC_DECL(XSLTProcessorTransformToFragment) {
- INC_STATS("DOM.XSLTProcessor.transformToFragment");
- // Return undefined if arguments do not have correct types.
- if (!V8Node::HasInstance(args[0]) || !V8Document::HasInstance(args[1]))
- return v8::Undefined();
-
- XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
- V8ClassIndex::XSLTPROCESSOR, args.Holder());
-
- Node* source = V8Proxy::DOMWrapperToNode<Node>(args[0]);
- Document* owner =
- V8Proxy::DOMWrapperToNode<Document>(args[1]);
- RefPtr<DocumentFragment> result = imp->transformToFragment(source, owner);
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-
-CALLBACK_FUNC_DECL(XSLTProcessorTransformToDocument) {
- INC_STATS("DOM.XSLTProcessor.transformToDocument");
- // Return undefined if argument does not have the correct type.
- if (!V8Node::HasInstance(args[0]))
- return v8::Undefined();
-
- XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
- V8ClassIndex::XSLTPROCESSOR, args.Holder());
-
- Node* source = V8Proxy::DOMWrapperToNode<Node>(args[0]);
- if (!source)
- return v8::Undefined();
- RefPtr<Document> result = imp->transformToDocument(source);
- // Return undefined if no result was found.
- if (!result)
- return v8::Undefined();
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-
-CALLBACK_FUNC_DECL(XSLTProcessorSetParameter) {
- INC_STATS("DOM.XSLTProcessor.setParameter");
- // Bail out if localName or value is null or undefined.
- if (args[1]->IsNull() || args[1]->IsUndefined() ||
- args[2]->IsNull() || args[2]->IsUndefined()) {
- return v8::Undefined();
- }
-
- XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
- V8ClassIndex::XSLTPROCESSOR, args.Holder());
-
- String namespaceURI = ToWebCoreString(args[0]);
- String localName = ToWebCoreString(args[1]);
- String value = ToWebCoreString(args[2]);
- imp->setParameter(namespaceURI, localName, value);
- return v8::Undefined();
-}
-
-
-CALLBACK_FUNC_DECL(XSLTProcessorGetParameter) {
- INC_STATS("DOM.XSLTProcessor.getParameter");
- // Bail out if localName is null or undefined.
- if (args[1]->IsNull() || args[1]->IsUndefined()) {
- return v8::Undefined();
- }
-
- XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
- V8ClassIndex::XSLTPROCESSOR, args.Holder());
-
- String namespaceURI = ToWebCoreString(args[0]);
- String localName = ToWebCoreString(args[1]);
- String result = imp->getParameter(namespaceURI, localName);
- // Return undefined if the string is null.
- if (result.isNull()) return v8::Undefined();
- return v8String(result);
-}
-
-
-CALLBACK_FUNC_DECL(XSLTProcessorRemoveParameter) {
- INC_STATS("DOM.XSLTProcessor.removeParameter");
- // Bail out if localName is null or undefined.
- if (args[1]->IsNull() || args[1]->IsUndefined())
- return v8::Undefined();
-
- XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
- V8ClassIndex::XSLTPROCESSOR, args.Holder());
-
- String namespaceURI = ToWebCoreString(args[0]);
- String localName = ToWebCoreString(args[1]);
- imp->removeParameter(namespaceURI, localName);
- return v8::Undefined();
-}
-
-
-// ---- Canvas support ----
-static v8::Handle<v8::Value> CanvasStyleToV8Object(CanvasStyle* style) {
- if (style->canvasGradient()) {
- return V8Proxy::ToV8Object(V8ClassIndex::CANVASGRADIENT,
- style->canvasGradient());
- }
- if (style->canvasPattern()) {
- return V8Proxy::ToV8Object(V8ClassIndex::CANVASPATTERN,
- style->canvasPattern());
- }
- return v8String(style->color());
-}
-
-static PassRefPtr<CanvasStyle> V8ObjectToCanvasStyle(v8::Handle<v8::Value> value)
-{
- if (value->IsString())
- return CanvasStyle::create(ToWebCoreString(value));
-
- if (V8CanvasGradient::HasInstance(value)) {
- CanvasGradient* gradient =
- V8Proxy::DOMWrapperToNative<CanvasGradient>(value);
- return CanvasStyle::create(gradient);
- }
-
- if (V8CanvasPattern::HasInstance(value)) {
- CanvasPattern* pattern =
- V8Proxy::DOMWrapperToNative<CanvasPattern>(value);
- return CanvasStyle::create(pattern);
- }
-
- return 0;
-}
-
-
-ACCESSOR_GETTER(CanvasRenderingContext2DStrokeStyle) {
- CanvasRenderingContext2D* impl =
- V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
- CanvasStyle* strokeStyle = impl->strokeStyle();
- return CanvasStyleToV8Object(strokeStyle);
-}
-
-
-ACCESSOR_SETTER(CanvasRenderingContext2DStrokeStyle) {
- CanvasRenderingContext2D* impl =
- V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
- impl->setStrokeStyle(V8ObjectToCanvasStyle(value));
-}
-
-ACCESSOR_GETTER(CanvasRenderingContext2DFillStyle) {
- CanvasRenderingContext2D* impl =
- V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
- CanvasStyle* fillStyle = impl->fillStyle();
- return CanvasStyleToV8Object(fillStyle);
-}
-
-
-ACCESSOR_SETTER(CanvasRenderingContext2DFillStyle) {
- CanvasRenderingContext2D* impl =
- V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
- impl->setFillStyle(V8ObjectToCanvasStyle(value));
-}
-
-
// DOMImplementation is a singleton in WebCore. If we use our normal
// mapping from DOM objects to V8 wrappers, the same wrapper will be
// shared for all frames in the same process. This is a major
@@ -534,215 +175,6 @@ ACCESSOR_SETTER(DocumentLocation) {
}
-ACCESSOR_GETTER(EventSrcElement) {
- Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
- EventTarget* target = event->target();
- return V8Proxy::EventTargetToV8Object(target);
-}
-
-
-ACCESSOR_GETTER(EventReturnValue) {
- Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
- return event->defaultPrevented() ? v8::False() : v8::True();
-}
-
-
-ACCESSOR_SETTER(EventReturnValue) {
- Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
- bool v = value->BooleanValue();
- event->setDefaultPrevented(!v);
-}
-
-
-ACCESSOR_GETTER(EventDataTransfer) {
- Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
-
- if (event->isDragEvent()) {
- MouseEvent* impl = static_cast<MouseEvent*>(event);
- Clipboard* clipboard = impl->clipboard();
- return V8Proxy::ToV8Object(V8ClassIndex::CLIPBOARD, clipboard);
- }
-
- return v8::Undefined();
-}
-
-
-ACCESSOR_GETTER(EventClipboardData) {
- Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
-
- if (event->isClipboardEvent()) {
- ClipboardEvent* impl = static_cast<ClipboardEvent*>(event);
- Clipboard* clipboard = impl->clipboard();
- return V8Proxy::ToV8Object(V8ClassIndex::CLIPBOARD, clipboard);
- }
-
- return v8::Undefined();
-}
-
-
-INDEXED_PROPERTY_GETTER(DOMStringList) {
- INC_STATS("DOM.DOMStringList.IndexedPropertyGetter");
- DOMStringList* imp =
- V8Proxy::DOMWrapperToNative<DOMStringList>(info.Holder());
- return v8String(imp->item(index));
-}
-
-
-CALLBACK_FUNC_DECL(DOMStringListItem) {
- INC_STATS("DOM.DOMStringListItem()");
- if (args.Length() == 0)
- return v8::Null();
- uint32_t index = args[0]->Uint32Value();
-
- DOMStringList* imp =
- V8Proxy::DOMWrapperToNative<DOMStringList>(args.Holder());
- if (index >= imp->length())
- return v8::Null();
-
- return v8String(imp->item(index));
-}
-
-
-NAMED_PROPERTY_DELETER(HTMLDocument) {
- // Only handle document.all. Insert the marker object into the
- // shadow internal field to signal that document.all is no longer
- // shadowed.
- String key = ToWebCoreString(name);
- if (key == "all") {
- ASSERT(info.Holder()->InternalFieldCount() ==
- kHTMLDocumentInternalFieldCount);
- v8::Local<v8::Value> marker =
- info.Holder()->GetInternalField(kHTMLDocumentMarkerIndex);
- info.Holder()->SetInternalField(kHTMLDocumentShadowIndex, marker);
- return v8::True();
- }
- return v8::Handle<v8::Boolean>();
-}
-
-
-NAMED_PROPERTY_SETTER(HTMLDocument)
-{
- INC_STATS("DOM.HTMLDocument.NamedPropertySetter");
- // Only handle document.all. We insert the value into the shadow
- // internal field from which the getter will retrieve it.
- String key = ToWebCoreString(name);
- if (key == "all") {
- ASSERT(info.Holder()->InternalFieldCount() ==
- kHTMLDocumentInternalFieldCount);
- info.Holder()->SetInternalField(kHTMLDocumentShadowIndex, value);
- }
- return v8::Handle<v8::Value>();
-}
-
-
-NAMED_PROPERTY_GETTER(HTMLDocument)
-{
- INC_STATS("DOM.HTMLDocument.NamedPropertyGetter");
- AtomicString key = ToWebCoreString(name);
-
- // Special case for document.all. If the value in the shadow
- // internal field is not the marker object, then document.all has
- // been temporarily shadowed and we return the value.
- if (key == "all") {
- ASSERT(info.Holder()->InternalFieldCount() == kHTMLDocumentInternalFieldCount);
- v8::Local<v8::Value> marker = info.Holder()->GetInternalField(kHTMLDocumentMarkerIndex);
- v8::Local<v8::Value> value = info.Holder()->GetInternalField(kHTMLDocumentShadowIndex);
- if (marker != value)
- return value;
- }
-
- HTMLDocument* imp = V8Proxy::DOMWrapperToNode<HTMLDocument>(info.Holder());
-
- // Fast case for named elements that are not there.
- if (!imp->hasNamedItem(key.impl()) && !imp->hasExtraNamedItem(key.impl()))
- return v8::Handle<v8::Value>();
-
- RefPtr<HTMLCollection> items = imp->documentNamedItems(key);
- if (items->length() == 0)
- return v8::Handle<v8::Value>();
- if (items->length() == 1) {
- Node* node = items->firstItem();
- Frame* frame = 0;
- if (node->hasTagName(HTMLNames::iframeTag) &&
- (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
- return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
- return V8Proxy::NodeToV8Object(node);
- }
- return V8Proxy::ToV8Object(V8ClassIndex::HTMLCOLLECTION, items.get());
-}
-
-
-NAMED_PROPERTY_GETTER(HTMLFrameSetElement)
-{
- INC_STATS("DOM.HTMLFrameSetElement.NamedPropertyGetter");
- HTMLFrameSetElement* imp =
- V8Proxy::DOMWrapperToNode<HTMLFrameSetElement>(info.Holder());
- String key = ToWebCoreString(name);
- Node* frame = imp->children()->namedItem(key);
- if (frame && frame->hasTagName(HTMLNames::frameTag)) {
- Document* doc = static_cast<HTMLFrameElement*>(frame)->contentDocument();
- if (doc) {
- Frame* content_frame = doc->frame();
- if (content_frame)
- return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, content_frame->domWindow());
- }
- return v8::Undefined();
- }
- return v8::Handle<v8::Value>();
-}
-
-
-INDEXED_PROPERTY_GETTER(NamedNodeMap) {
- INC_STATS("DOM.NamedNodeMap.IndexedPropertyGetter");
- NamedNodeMap* imp = V8Proxy::ToNativeObject<NamedNodeMap>(
- V8ClassIndex::NAMEDNODEMAP, info.Holder());
- RefPtr<Node> result = imp->item(index);
- if (!result) return v8::Handle<v8::Value>();
-
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-NAMED_PROPERTY_GETTER(NamedNodeMap) {
- INC_STATS("DOM.NamedNodeMap.NamedPropertyGetter");
- // Search the prototype chain first.
- v8::Handle<v8::Value> value =
- info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
- if (!value.IsEmpty())
- return value;
-
- // Then look for IDL defined properties on the object itself.
- if (info.Holder()->HasRealNamedCallbackProperty(name))
- return v8::Handle<v8::Value>();
-
- // Finally, search the DOM.
- NamedNodeMap* imp = V8Proxy::ToNativeObject<NamedNodeMap>(
- V8ClassIndex::NAMEDNODEMAP, info.Holder());
- String prop_name = ToWebCoreString(name);
- RefPtr<Node> result = imp->getNamedItem(prop_name);
- if (!result) return v8::Handle<v8::Value>();
-
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-
-NAMED_PROPERTY_GETTER(NodeList) {
- INC_STATS("DOM.NodeList.NamedPropertyGetter");
- NodeList* list = V8Proxy::ToNativeObject<NodeList>(
- V8ClassIndex::NODELIST, info.Holder());
- String prop_name = ToWebCoreString(name);
-
- // Length property cannot be overridden.
- if (prop_name == "length")
- return v8::Number::New(list->length());
-
- RefPtr<Node> result = list->itemWithName(prop_name);
- if (result)
- return V8Proxy::NodeToV8Object(result.get());
-
- return v8::Handle<v8::Value>();
-}
-
-
INDEXED_PROPERTY_GETTER(HTMLFormElement) {
INC_STATS("DOM.HTMLFormElement.IndexedPropertyGetter");
HTMLFormElement* form =
@@ -809,177 +241,6 @@ INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection) {
return OptionsCollectionSetter(index, value, select);
}
-// Check for a CSS prefix.
-// Passed prefix is all lowercase.
-// First character of the prefix within the property name may be upper or lowercase.
-// Other characters in the prefix within the property name must be lowercase.
-// The prefix within the property name must be followed by a capital letter.
-static bool hasCSSPropertyNamePrefix(const String& propertyName, const char* prefix)
-{
-#ifndef NDEBUG
- ASSERT(*prefix);
- for (const char* p = prefix; *p; ++p)
- ASSERT(WTF::isASCIILower(*p));
- ASSERT(propertyName.length());
-#endif
-
- if (WTF::toASCIILower(propertyName[0]) != prefix[0])
- return false;
-
- unsigned length = propertyName.length();
- for (unsigned i = 1; i < length; ++i) {
- if (!prefix[i])
- return WTF::isASCIIUpper(propertyName[i]);
- if (propertyName[i] != prefix[i])
- return false;
- }
- return false;
-}
-
-// When getting properties on CSSStyleDeclarations, the name used from
-// Javascript and the actual name of the property are not the same, so
-// we have to do the following translation. The translation turns upper
-// case characters into lower case characters and inserts dashes to
-// separate words.
-//
-// Example: 'backgroundPositionY' -> 'background-position-y'
-//
-// Also, certain prefixes such as 'pos', 'css-' and 'pixel-' are stripped
-// and the pixel_or_pos_prefix out parameter is used to indicate whether or
-// not the property name was prefixed with 'pos-' or 'pixel-'.
-static String cssPropertyName(const String& propertyName, bool* hadPixelOrPosPrefix = 0)
-{
- if (hadPixelOrPosPrefix)
- *hadPixelOrPosPrefix = false;
-
- unsigned length = propertyName.length();
- if (!length)
- return String();
-
- Vector<UChar> name;
- name.reserveCapacity(length);
-
- unsigned i = 0;
-
- if (hasCSSPropertyNamePrefix(propertyName, "css"))
- i += 3;
- else if (hasCSSPropertyNamePrefix(propertyName, "pixel")) {
- i += 5;
- if (hadPixelOrPosPrefix)
- *hadPixelOrPosPrefix = true;
- } else if (hasCSSPropertyNamePrefix(propertyName, "pos")) {
- i += 3;
- if (hadPixelOrPosPrefix)
- *hadPixelOrPosPrefix = true;
- } else if (hasCSSPropertyNamePrefix(propertyName, "webkit")
- || hasCSSPropertyNamePrefix(propertyName, "khtml")
- || hasCSSPropertyNamePrefix(propertyName, "apple"))
- name.append('-');
- else {
- if (WTF::isASCIIUpper(propertyName[0]))
- return String();
- }
-
- name.append(WTF::toASCIILower(propertyName[i++]));
-
- for (; i < length; ++i) {
- UChar c = propertyName[i];
- if (!WTF::isASCIIUpper(c))
- name.append(c);
- else {
- name.append('-');
- name.append(WTF::toASCIILower(c));
- }
- }
-
- return String::adopt(name);
-}
-
-NAMED_PROPERTY_GETTER(CSSStyleDeclaration) {
- INC_STATS("DOM.CSSStyleDeclaration.NamedPropertyGetter");
- // First look for API defined attributes on the style declaration
- // object.
- if (info.Holder()->HasRealNamedCallbackProperty(name))
- return v8::Handle<v8::Value>();
-
- // Search the style declaration.
- CSSStyleDeclaration* imp = V8Proxy::ToNativeObject<CSSStyleDeclaration>(
- V8ClassIndex::CSSSTYLEDECLARATION, info.Holder());
-
- bool pixel_or_pos;
- String p = ToWebCoreString(name);
- String prop = cssPropertyName(p, &pixel_or_pos);
-
- // Do not handle non-property names.
- if (!CSSStyleDeclaration::isPropertyName(prop)) {
- return v8::Handle<v8::Value>();
- }
-
- RefPtr<CSSValue> v = imp->getPropertyCSSValue(prop);
- if (v) {
- if (pixel_or_pos && v->cssValueType() == CSSValue::CSS_PRIMITIVE_VALUE) {
- RefPtr<CSSPrimitiveValue> primitive_value =
- static_pointer_cast<CSSPrimitiveValue>(v);
- return v8::Number::New(
- primitive_value->getFloatValue(CSSPrimitiveValue::CSS_PX));
- }
- return v8StringOrNull(v->cssText());
- }
-
- String result = imp->getPropertyValue(prop);
- if (result.isNull())
- result = ""; // convert null to empty string.
-
- // The 'filter' attribute is made undetectable in KJS/WebKit
- // to avoid confusion with IE's filter extension.
- if (prop == "filter") {
- return v8UndetectableString(result);
- }
- return v8String(result);
-}
-
-
-NAMED_PROPERTY_SETTER(CSSStyleDeclaration) {
- INC_STATS("DOM.CSSStyleDeclaration.NamedPropertySetter");
- CSSStyleDeclaration* imp = V8Proxy::ToNativeObject<CSSStyleDeclaration>(
- V8ClassIndex::CSSSTYLEDECLARATION, info.Holder());
- String property_name = ToWebCoreString(name);
- int ec = 0;
-
- bool pixel_or_pos;
- String prop = cssPropertyName(property_name, &pixel_or_pos);
- if (!CSSStyleDeclaration::isPropertyName(prop)) {
- return v8::Handle<v8::Value>(); // do not block the call
- }
-
- String prop_value = valueToStringWithNullCheck(value);
- if (pixel_or_pos) prop_value += "px";
- imp->setProperty(prop, prop_value, ec);
-
- V8Proxy::SetDOMException(ec);
- return value;
-}
-
-
-NAMED_PROPERTY_GETTER(StyleSheetList) {
- INC_STATS("DOM.StyleSheetList.NamedPropertyGetter");
- // Look for local properties first.
- if (info.Holder()->HasRealNamedProperty(name)) {
- return v8::Handle<v8::Value>();
- }
-
- // Search style sheet.
- StyleSheetList* imp = V8Proxy::ToNativeObject<StyleSheetList>(
- V8ClassIndex::STYLESHEETLIST, info.Holder());
- String key = ToWebCoreString(name);
- HTMLStyleElement* item = imp->getNamedItem(key);
- if (item) {
- return V8Proxy::ToV8Object(V8ClassIndex::HTMLSTYLEELEMENT, item);
- }
- return v8::Handle<v8::Value>();
-}
-
-
// CanvasRenderingContext2D ----------------------------------------------------
// Helper macro for converting v8 values into floats (expected by many of the
@@ -1396,133 +657,6 @@ CALLBACK_FUNC_DECL(CanvasRenderingContext2DPutImageData) {
return v8::Undefined();
}
-
-// Clipboard -------------------------------------------------------------------
-
-
-ACCESSOR_GETTER(ClipboardTypes) {
- INC_STATS("DOM.Clipboard.types()");
- Clipboard* imp =
- V8Proxy::ToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD,
- info.Holder());
-
- HashSet<String> types = imp->types();
- if (types.isEmpty())
- return v8::Null();
-
- v8::Local<v8::Array> result = v8::Array::New(types.size());
- HashSet<String>::const_iterator end = types.end();
- int index = 0;
- for (HashSet<String>::const_iterator it = types.begin();
- it != end;
- ++it, ++index) {
- result->Set(v8::Integer::New(index), v8String(*it));
- }
- return result;
-}
-
-
-CALLBACK_FUNC_DECL(ClipboardClearData) {
- INC_STATS("DOM.Clipboard.clearData()");
- Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>(
- V8ClassIndex::CLIPBOARD, args.Holder());
-
- if (args.Length() == 0) {
- imp->clearAllData();
- return v8::Undefined();
- }
-
- if (args.Length() == 1) {
- String v = ToWebCoreString(args[0]);
- imp->clearData(v);
- return v8::Undefined();
- }
-
- V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR,
- "clearData: Invalid number of arguments");
- return v8::Undefined();
-}
-
-
-CALLBACK_FUNC_DECL(ClipboardGetData) {
- INC_STATS("DOM.Clipboard.getData()");
- Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>(
- V8ClassIndex::CLIPBOARD, args.Holder());
-
- if (args.Length() != 1) {
- V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR,
- "getData: Invalid number of arguments");
- return v8::Undefined();
- }
-
- bool success;
- String v = ToWebCoreString(args[0]);
- String result = imp->getData(v, success);
- if (success) return v8String(result);
- return v8::Undefined();
-}
-
-CALLBACK_FUNC_DECL(ClipboardSetData) {
- INC_STATS("DOM.Clipboard.setData()");
- Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>(
- V8ClassIndex::CLIPBOARD, args.Holder());
-
- if (args.Length() != 2) {
- V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR,
- "setData: Invalid number of arguments");
- return v8::Undefined();
- }
-
- String type = ToWebCoreString(args[0]);
- String data = ToWebCoreString(args[1]);
- bool result = imp->setData(type, data);
- return result ? v8::True() : v8::False();
-}
-
-
-CALLBACK_FUNC_DECL(ClipboardSetDragImage) {
- INC_STATS("DOM.Clipboard.setDragImage()");
- Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>(
- V8ClassIndex::CLIPBOARD, args.Holder());
-
- if (!imp->isForDragging())
- return v8::Undefined();
-
- if (args.Length() != 3) {
- V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR,
- "setDragImage: Invalid number of arguments");
- return v8::Undefined();
- }
-
- int x = ToInt32(args[1]);
- int y = ToInt32(args[2]);
-
- Node* node = 0;
- if (V8Node::HasInstance(args[0]))
- node = V8Proxy::DOMWrapperToNode<Node>(args[0]);
- if (!node) {
- V8Proxy::ThrowError(V8Proxy::TYPE_ERROR,
- "setDragImageFromElement: Invalid first argument");
- return v8::Undefined();
- }
-
- if (!node->isElementNode()) {
- V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR,
- "setDragImageFromElement: Invalid first argument");
- return v8::Undefined();
- }
-
- if (static_cast<Element*>(node)->hasLocalName(HTMLNames::imgTag) &&
- !node->inDocument())
- imp->setDragImage(static_cast<HTMLImageElement*>(node)->cachedImage(),
- IntPoint(x, y));
- else
- imp->setDragImageElement(node, IntPoint(x, y));
-
- return v8::Undefined();
-}
-
-
static bool AllowSettingSrcToJavascriptURL(Element* element, String name,
String value) {
// Need to parse value as URL first in order to check its protocol.
@@ -1736,7 +870,7 @@ v8::Handle<v8::Value> V8Custom::WindowSetTimeoutImpl(const v8::Arguments& args,
return v8::Undefined();
id = DOMTimer::install(script_context,
- new V8ScheduledAction(string_function), timeout,
+ new ScheduledAction(string_function), timeout,
single_shot);
} else if (function->IsFunction()) {
int param_count = num_arguments >= 2 ? num_arguments - 2 : 0;
@@ -1749,7 +883,7 @@ v8::Handle<v8::Value> V8Custom::WindowSetTimeoutImpl(const v8::Arguments& args,
}
// params is passed to action, and released in action's destructor
- ScheduledAction* action = new V8ScheduledAction(
+ ScheduledAction* action = new ScheduledAction(
v8::Handle<v8::Function>::Cast(function), param_count, params);
delete[] params;
@@ -1967,213 +1101,6 @@ CALLBACK_FUNC_DECL(DOMWindowNOP)
}
-// Node -------------------------------------------------------------
-
-CALLBACK_FUNC_DECL(NodeAddEventListener) {
- INC_STATS("DOM.Node.addEventListener()");
- Node* node = V8Proxy::DOMWrapperToNode<Node>(args.Holder());
-
- V8Proxy* proxy = V8Proxy::retrieve(node->document()->frame());
- if (!proxy)
- return v8::Undefined();
-
- RefPtr<EventListener> listener =
- proxy->FindOrCreateV8EventListener(args[1], false);
- if (listener) {
- String type = ToWebCoreString(args[0]);
- bool useCapture = args[2]->BooleanValue();
- node->addEventListener(type, listener, useCapture);
- }
- return v8::Undefined();
-}
-
-CALLBACK_FUNC_DECL(NodeRemoveEventListener) {
- INC_STATS("DOM.Node.removeEventListener()");
- Node* node = V8Proxy::DOMWrapperToNode<Node>(args.Holder());
-
- V8Proxy* proxy = V8Proxy::retrieve(node->document()->frame());
- // It is possbile that the owner document of the node is detached
- // from the frame, return immediately in this case.
- // See issue 878909
- if (!proxy)
- return v8::Undefined();
-
- RefPtr<EventListener> listener =
- proxy->FindV8EventListener(args[1], false);
- if (listener) {
- String type = ToWebCoreString(args[0]);
- bool useCapture = args[2]->BooleanValue();
- node->removeEventListener(type, listener.get(), useCapture);
- }
-
- return v8::Undefined();
-}
-
-
-// Navigator ------------------------------------------------------------------
-ACCESSOR_GETTER(NavigatorAppVersion) {
- INC_STATS("DOM.Navigator.appVersion");
- v8::Handle<v8::Object> holder = info.Holder();
- Navigator* imp = V8Proxy::ToNativeObject<Navigator>(V8ClassIndex::NAVIGATOR,
- holder);
- String v = ToString(imp->appVersion());
- return v8StringOrUndefined(v);
-}
-
-
-// TreeWalker ------------------------------------------------------------------
-
-CALLBACK_FUNC_DECL(TreeWalkerParentNode) {
- INC_STATS("DOM.TreeWalker.parentNode()");
- TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
- V8ClassIndex::TREEWALKER, args.Holder());
-
- ScriptState state;
- RefPtr<Node> result = treeWalker->parentNode(&state);
- if (state.hadException()) {
- v8::ThrowException(state.exception());
- return v8::Undefined();
- }
- if (!result) return v8::Null();
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-CALLBACK_FUNC_DECL(TreeWalkerFirstChild) {
- INC_STATS("DOM.TreeWalker.firstChild()");
- TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
- V8ClassIndex::TREEWALKER, args.Holder());
-
- ScriptState state;
- RefPtr<Node> result = treeWalker->firstChild(&state);
- if (state.hadException()) {
- v8::ThrowException(state.exception());
- return v8::Undefined();
- }
- if (!result) return v8::Null();
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-CALLBACK_FUNC_DECL(TreeWalkerLastChild) {
- INC_STATS("DOM.TreeWalker.lastChild()");
- TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
- V8ClassIndex::TREEWALKER, args.Holder());
-
- ScriptState state;
- RefPtr<Node> result = treeWalker->lastChild(&state);
- if (state.hadException()) {
- v8::ThrowException(state.exception());
- return v8::Undefined();
- }
- if (!result) return v8::Null();
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-CALLBACK_FUNC_DECL(TreeWalkerNextNode) {
- INC_STATS("DOM.TreeWalker.nextNode()");
- TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
- V8ClassIndex::TREEWALKER, args.Holder());
-
- ScriptState state;
- RefPtr<Node> result = treeWalker->nextNode(&state);
- if (state.hadException()) {
- v8::ThrowException(state.exception());
- return v8::Undefined();
- }
- if (!result) return v8::Null();
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-CALLBACK_FUNC_DECL(TreeWalkerPreviousNode) {
- INC_STATS("DOM.TreeWalker.previousNode()");
- TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
- V8ClassIndex::TREEWALKER, args.Holder());
-
- ScriptState state;
- RefPtr<Node> result = treeWalker->previousNode(&state);
- if (state.hadException()) {
- v8::ThrowException(state.exception());
- return v8::Undefined();
- }
- if (!result) return v8::Null();
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-CALLBACK_FUNC_DECL(TreeWalkerNextSibling) {
- INC_STATS("DOM.TreeWalker.nextSibling()");
- TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
- V8ClassIndex::TREEWALKER, args.Holder());
-
- ScriptState state;
- RefPtr<Node> result = treeWalker->nextSibling(&state);
- if (state.hadException()) {
- v8::ThrowException(state.exception());
- return v8::Undefined();
- }
- if (!result) return v8::Null();
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-CALLBACK_FUNC_DECL(TreeWalkerPreviousSibling) {
- INC_STATS("DOM.TreeWalker.previousSibling()");
- TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
- V8ClassIndex::TREEWALKER, args.Holder());
-
- ScriptState state;
- RefPtr<Node> result = treeWalker->previousSibling(&state);
- if (state.hadException()) {
- v8::ThrowException(state.exception());
- return v8::Undefined();
- }
- if (!result) return v8::Null();
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-CALLBACK_FUNC_DECL(NodeIteratorNextNode) {
- INC_STATS("DOM.NodeIterator.nextNode()");
- NodeIterator* nodeIterator = V8Proxy::ToNativeObject<NodeIterator>(
- V8ClassIndex::NODEITERATOR, args.Holder());
-
- ExceptionCode ec = 0;
- ScriptState state;
- RefPtr<Node> result = nodeIterator->nextNode(&state, ec);
- if (ec != 0) {
- V8Proxy::SetDOMException(ec);
- return v8::Null();
- }
- if (state.hadException()) {
- v8::ThrowException(state.exception());
- return v8::Undefined();
- }
- if (!result) return v8::Null();
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-CALLBACK_FUNC_DECL(NodeIteratorPreviousNode) {
- INC_STATS("DOM.NodeIterator.previousNode()");
- NodeIterator* nodeIterator = V8Proxy::ToNativeObject<NodeIterator>(
- V8ClassIndex::NODEITERATOR, args.Holder());
-
- ExceptionCode ec = 0;
- ScriptState state;
- RefPtr<Node> result = nodeIterator->previousNode(&state, ec);
- if (ec != 0) {
- V8Proxy::SetDOMException(ec);
- return v8::Null();
- }
- if (state.hadException()) {
- v8::ThrowException(state.exception());
- return v8::Undefined();
- }
- if (!result) return v8::Null();
- return V8Proxy::NodeToV8Object(result.get());
-}
-
-CALLBACK_FUNC_DECL(NodeFilterAcceptNode) {
- INC_STATS("DOM.NodeFilter.acceptNode()");
- V8Proxy::SetDOMException(NOT_SUPPORTED_ERR);
- return v8::Undefined();
-}
-
CALLBACK_FUNC_DECL(HTMLFormElementSubmit) {
INC_STATS("DOM.HTMLFormElement.submit()");