summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-06-15 19:36:43 +0100
committerBen Murdoch <benm@google.com>2010-06-16 14:52:28 +0100
commit545e470e52f0ac6a3a072bf559c796b42c6066b6 (patch)
treec0c14763654d84d37577dde512c3d3b4699a9e86 /WebCore/bindings
parent719298a66237d38ea5c05f1547123ad8aacbc237 (diff)
downloadexternal_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.zip
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.gz
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.bz2
Merge webkit.org at r61121: Initial merge by git.
Change-Id: Icd6db395c62285be384d137164d95d7466c98760
Diffstat (limited to 'WebCore/bindings')
-rw-r--r--WebCore/bindings/cpp/WebDOMCString.cpp113
-rw-r--r--WebCore/bindings/cpp/WebDOMCString.h89
-rw-r--r--WebCore/bindings/cpp/WebDOMEventListenerCustom.cpp39
-rw-r--r--WebCore/bindings/cpp/WebDOMEventTarget.cpp155
-rw-r--r--WebCore/bindings/cpp/WebDOMEventTarget.h49
-rw-r--r--WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp50
-rw-r--r--WebCore/bindings/cpp/WebDOMNodeCustom.cpp96
-rw-r--r--WebCore/bindings/cpp/WebDOMObject.h32
-rw-r--r--WebCore/bindings/cpp/WebDOMString.cpp124
-rw-r--r--WebCore/bindings/cpp/WebDOMString.h99
-rw-r--r--WebCore/bindings/cpp/WebExceptionHandler.cpp41
-rw-r--r--WebCore/bindings/cpp/WebExceptionHandler.h40
-rw-r--r--WebCore/bindings/cpp/WebNativeEventListener.cpp53
-rw-r--r--WebCore/bindings/cpp/WebNativeEventListener.h54
-rw-r--r--WebCore/bindings/generic/BindingSecurity.h1
-rw-r--r--WebCore/bindings/generic/RuntimeEnabledFeatures.h2
-rw-r--r--WebCore/bindings/js/JSArrayBufferConstructor.cpp12
-rw-r--r--WebCore/bindings/js/JSArrayBufferConstructor.h2
-rw-r--r--WebCore/bindings/js/JSArrayBufferViewCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSArrayBufferViewHelper.h4
-rw-r--r--WebCore/bindings/js/JSAudioConstructor.cpp18
-rw-r--r--WebCore/bindings/js/JSBindingsAllInOne.cpp2
-rw-r--r--WebCore/bindings/js/JSCallbackData.cpp9
-rw-r--r--WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp24
-rw-r--r--WebCore/bindings/js/JSClipboardCustom.cpp10
-rw-r--r--WebCore/bindings/js/JSConsoleCustom.cpp7
-rw-r--r--WebCore/bindings/js/JSCustomPositionCallback.cpp7
-rw-r--r--WebCore/bindings/js/JSCustomPositionErrorCallback.cpp7
-rw-r--r--WebCore/bindings/js/JSCustomXPathNSResolver.cpp2
-rw-r--r--WebCore/bindings/js/JSDOMBinding.cpp6
-rw-r--r--WebCore/bindings/js/JSDOMWindowCustom.cpp10
-rw-r--r--WebCore/bindings/js/JSDOMWrapper.cpp2
-rw-r--r--WebCore/bindings/js/JSDesktopNotificationsCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSEventListener.cpp2
-rw-r--r--WebCore/bindings/js/JSEventSourceConstructor.cpp18
-rw-r--r--WebCore/bindings/js/JSFloat32ArrayConstructor.cpp86
-rw-r--r--WebCore/bindings/js/JSFloat32ArrayConstructor.h (renamed from WebCore/bindings/js/JSFloatArrayConstructor.h)21
-rw-r--r--WebCore/bindings/js/JSFloat32ArrayCustom.cpp (renamed from WebCore/bindings/js/JSFloatArrayCustom.cpp)14
-rw-r--r--WebCore/bindings/js/JSFloatArrayConstructor.cpp71
-rw-r--r--WebCore/bindings/js/JSGeolocationCustom.cpp13
-rw-r--r--WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp13
-rw-r--r--WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp18
-rw-r--r--WebCore/bindings/js/JSHTMLCollectionCustom.cpp12
-rw-r--r--WebCore/bindings/js/JSHTMLDocumentCustom.cpp7
-rw-r--r--WebCore/bindings/js/JSHTMLInputElementCustom.cpp10
-rw-r--r--WebCore/bindings/js/JSImageConstructor.cpp18
-rw-r--r--WebCore/bindings/js/JSInjectedScriptHostCustom.cpp2
-rw-r--r--WebCore/bindings/js/JSInt16ArrayConstructor.cpp27
-rw-r--r--WebCore/bindings/js/JSInt16ArrayConstructor.h11
-rw-r--r--WebCore/bindings/js/JSInt32ArrayConstructor.cpp27
-rw-r--r--WebCore/bindings/js/JSInt32ArrayConstructor.h11
-rw-r--r--WebCore/bindings/js/JSInt8ArrayConstructor.cpp27
-rw-r--r--WebCore/bindings/js/JSInt8ArrayConstructor.h11
-rw-r--r--WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp3
-rw-r--r--WebCore/bindings/js/JSMessageChannelConstructor.cpp8
-rw-r--r--WebCore/bindings/js/JSMessageChannelConstructor.h2
-rw-r--r--WebCore/bindings/js/JSMessagePortCustom.cpp2
-rw-r--r--WebCore/bindings/js/JSNodeFilterCondition.cpp2
-rw-r--r--WebCore/bindings/js/JSNodeListCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSOptionConstructor.cpp22
-rw-r--r--WebCore/bindings/js/JSPluginElementFunctions.cpp4
-rw-r--r--WebCore/bindings/js/JSSVGMatrixCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSSharedWorkerConstructor.cpp18
-rw-r--r--WebCore/bindings/js/JSUint16ArrayConstructor.cpp27
-rw-r--r--WebCore/bindings/js/JSUint16ArrayConstructor.h11
-rw-r--r--WebCore/bindings/js/JSUint32ArrayConstructor.cpp27
-rw-r--r--WebCore/bindings/js/JSUint32ArrayConstructor.h11
-rw-r--r--WebCore/bindings/js/JSUint8ArrayConstructor.cpp27
-rw-r--r--WebCore/bindings/js/JSUint8ArrayConstructor.h11
-rw-r--r--WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp272
-rw-r--r--WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp10
-rw-r--r--WebCore/bindings/js/JSWebKitPointConstructor.cpp12
-rw-r--r--WebCore/bindings/js/JSWebSocketConstructor.cpp22
-rw-r--r--WebCore/bindings/js/JSWebSocketCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSWorkerConstructor.cpp16
-rw-r--r--WebCore/bindings/js/JSWorkerContextCustom.cpp2
-rw-r--r--WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp59
-rw-r--r--WebCore/bindings/js/JSXMLHttpRequestConstructor.h38
-rw-r--r--WebCore/bindings/js/JSXMLHttpRequestCustom.cpp13
-rw-r--r--WebCore/bindings/js/JSXSLTProcessorConstructor.cpp6
-rw-r--r--WebCore/bindings/js/ScheduledAction.cpp4
-rw-r--r--WebCore/bindings/js/ScriptController.cpp17
-rw-r--r--WebCore/bindings/js/ScriptController.h8
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.cpp40
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.h11
-rw-r--r--WebCore/bindings/js/ScriptFunctionCall.cpp2
-rw-r--r--WebCore/bindings/js/SerializedScriptValue.cpp11
-rw-r--r--WebCore/bindings/js/WorkerScriptController.cpp3
-rw-r--r--WebCore/bindings/objc/WebScriptObject.mm2
-rw-r--r--WebCore/bindings/scripts/CodeGenerator.pm4
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorCPP.pm975
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorGObject.pm27
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorJS.pm208
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorObjC.pm9
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorV8.pm70
-rw-r--r--WebCore/bindings/scripts/IDLParser.pm16
-rw-r--r--WebCore/bindings/scripts/IDLStructure.pm40
-rw-r--r--WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp113
-rw-r--r--WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h65
-rw-r--r--WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp75
-rw-r--r--WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h52
-rw-r--r--WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp441
-rw-r--r--WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h105
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp17
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h6
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp8
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp325
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h99
-rw-r--r--WebCore/bindings/scripts/test/JS/JSTestInterface.cpp8
-rw-r--r--WebCore/bindings/scripts/test/JS/JSTestObj.cpp303
-rw-r--r--WebCore/bindings/scripts/test/JS/JSTestObj.h61
-rw-r--r--WebCore/bindings/scripts/test/ObjC/DOMTestObj.h5
-rw-r--r--WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm30
-rw-r--r--WebCore/bindings/scripts/test/TestObj.idl6
-rw-r--r--WebCore/bindings/scripts/test/V8/V8TestCallback.cpp25
-rw-r--r--WebCore/bindings/scripts/test/V8/V8TestObj.cpp48
-rw-r--r--WebCore/bindings/v8/NPV8Object.cpp1
-rw-r--r--WebCore/bindings/v8/ScriptArray.cpp2
-rw-r--r--WebCore/bindings/v8/ScriptCallStack.cpp1
-rw-r--r--WebCore/bindings/v8/ScriptController.cpp2
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.cpp42
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.h4
-rw-r--r--WebCore/bindings/v8/ScriptEventListener.cpp14
-rw-r--r--WebCore/bindings/v8/ScriptProfiler.cpp4
-rw-r--r--WebCore/bindings/v8/SerializedScriptValue.cpp48
-rw-r--r--WebCore/bindings/v8/SerializedScriptValue.h63
-rw-r--r--WebCore/bindings/v8/V8Binding.cpp2
-rw-r--r--WebCore/bindings/v8/V8DOMWindowShell.cpp44
-rw-r--r--WebCore/bindings/v8/V8DOMWindowShell.h5
-rw-r--r--WebCore/bindings/v8/V8DOMWrapper.cpp3
-rw-r--r--WebCore/bindings/v8/V8GCController.cpp1
-rw-r--r--WebCore/bindings/v8/V8IsolatedContext.cpp1
-rw-r--r--WebCore/bindings/v8/V8NPObject.cpp8
-rw-r--r--WebCore/bindings/v8/V8Proxy.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8ConsoleCustom.cpp20
-rw-r--r--WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp27
-rw-r--r--WebCore/bindings/v8/custom/V8CustomPositionCallback.h9
-rw-r--r--WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp27
-rw-r--r--WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h9
-rw-r--r--WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp12
-rw-r--r--WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp3
-rw-r--r--WebCore/bindings/v8/custom/V8CustomVoidCallback.h2
-rw-r--r--WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp4
-rw-r--r--WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp (renamed from WebCore/bindings/v8/custom/V8FloatArrayCustom.cpp)20
-rw-r--r--WebCore/bindings/v8/custom/V8GeolocationCustom.cpp8
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp78
-rw-r--r--WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8NodeListCustom.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp2
-rwxr-xr-xWebCore/bindings/v8/custom/V8StorageCustom.cpp13
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp34
153 files changed, 4601 insertions, 1387 deletions
diff --git a/WebCore/bindings/cpp/WebDOMCString.cpp b/WebCore/bindings/cpp/WebDOMCString.cpp
new file mode 100644
index 0000000..ab87ac8
--- /dev/null
+++ b/WebCore/bindings/cpp/WebDOMCString.cpp
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebDOMCString.h"
+
+#include "TextEncoding.h"
+#include "WebDOMString.h"
+#include <wtf/text/CString.h>
+
+class WebDOMCStringPrivate : public WTF::CStringBuffer {
+};
+
+void WebDOMCString::reset()
+{
+ if (m_private) {
+ m_private->deref();
+ m_private = 0;
+ }
+}
+
+void WebDOMCString::assign(const WebDOMCString& other)
+{
+ assign(const_cast<WebDOMCStringPrivate*>(other.m_private));
+}
+
+void WebDOMCString::assign(const char* data, size_t length)
+{
+ char* newData;
+ RefPtr<WTF::CStringBuffer> buffer =
+ WTF::CString::newUninitialized(length, newData).buffer();
+ memcpy(newData, data, length);
+ assign(static_cast<WebDOMCStringPrivate*>(buffer.get()));
+}
+
+size_t WebDOMCString::length() const
+{
+ if (!m_private)
+ return 0;
+ // NOTE: The buffer's length includes the null byte.
+ return const_cast<WebDOMCStringPrivate*>(m_private)->length() - 1;
+}
+
+const char* WebDOMCString::data() const
+{
+ if (!m_private)
+ return 0;
+ return const_cast<WebDOMCStringPrivate*>(m_private)->data();
+}
+
+WebDOMString WebDOMCString::utf16() const
+{
+ return WebCore::UTF8Encoding().decode(data(), length());
+}
+
+WebDOMCString WebDOMCString::fromUTF16(const WebUChar* data, size_t length)
+{
+ return WebCore::UTF8Encoding().encode(
+ data, length, WebCore::QuestionMarksForUnencodables);
+}
+
+WebDOMCString WebDOMCString::fromUTF16(const WebUChar* data)
+{
+ size_t len = 0;
+ while (data[len] != WebUChar(0))
+ len++;
+ return fromUTF16(data, len);
+}
+
+WebDOMCString::WebDOMCString(const WTF::CString& s)
+ : m_private(static_cast<WebDOMCStringPrivate*>(s.buffer()))
+{
+ if (m_private)
+ m_private->ref();
+}
+
+WebDOMCString& WebDOMCString::operator=(const WTF::CString& s)
+{
+ assign(static_cast<WebDOMCStringPrivate*>(s.buffer()));
+ return *this;
+}
+
+WebDOMCString::operator WTF::CString() const
+{
+ return m_private;
+}
+
+void WebDOMCString::assign(WebDOMCStringPrivate* p)
+{
+ // Take care to handle the case where m_private == p
+ if (p)
+ p->ref();
+ if (m_private)
+ m_private->deref();
+ m_private = p;
+}
diff --git a/WebCore/bindings/cpp/WebDOMCString.h b/WebCore/bindings/cpp/WebDOMCString.h
new file mode 100644
index 0000000..e02a587
--- /dev/null
+++ b/WebCore/bindings/cpp/WebDOMCString.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebDOMCString_h
+#define WebDOMCString_h
+
+#include <WebDOMObject.h>
+#include <stddef.h> // For size_t
+
+namespace WTF {
+class CString;
+};
+
+// UTF-16 character type
+#if defined(WIN32)
+typedef wchar_t WebUChar;
+#else
+typedef unsigned short WebUChar;
+#endif
+
+class WebDOMCStringPrivate;
+class WebDOMString;
+
+// A single-byte string container with unspecified encoding. It is
+// inexpensive to copy a WebDOMCString object.
+//
+// WARNING: It is not safe to pass a WebDOMCString across threads!!!
+//
+class WebDOMCString {
+public:
+ ~WebDOMCString() { reset(); }
+
+ WebDOMCString() : m_private(0) { }
+
+ WebDOMCString(const char* data, size_t len) : m_private(0)
+ {
+ assign(data, len);
+ }
+
+ WebDOMCString(const WebDOMCString& s) : m_private(0) { assign(s); }
+
+ WebDOMCString& operator=(const WebDOMCString& s)
+ {
+ assign(s);
+ return *this;
+ }
+
+ void reset();
+ void assign(const WebDOMCString&);
+ void assign(const char* data, size_t len);
+
+ size_t length() const;
+ const char* data() const;
+
+ bool isEmpty() const { return !length(); }
+ bool isNull() const { return !m_private; }
+
+ WebDOMString utf16() const;
+
+ static WebDOMCString fromUTF16(const WebUChar* data, size_t length);
+ static WebDOMCString fromUTF16(const WebUChar* data);
+
+ WebDOMCString(const WTF::CString&);
+ WebDOMCString& operator=(const WTF::CString&);
+ operator WTF::CString() const;
+
+private:
+ void assign(WebDOMCStringPrivate*);
+ WebDOMCStringPrivate* m_private;
+};
+
+#endif
diff --git a/WebCore/bindings/cpp/WebDOMEventListenerCustom.cpp b/WebCore/bindings/cpp/WebDOMEventListenerCustom.cpp
new file mode 100644
index 0000000..db31b71
--- /dev/null
+++ b/WebCore/bindings/cpp/WebDOMEventListenerCustom.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebDOMEventListener.h"
+
+#include "WebDOMEvent.h"
+#include "WebNativeEventListener.h"
+#include <wtf/RefPtr.h>
+
+void WebDOMEventListener::handleEvent(const WebDOMEvent& evt)
+{
+ if (!impl())
+ return;
+
+ impl()->handleEvent(0, toWebCore(evt));
+}
+
+WebDOMEventListener toWebKit(WebUserEventListener* value)
+{
+ RefPtr<WebNativeEventListener> listener = WebNativeEventListener::create(value);
+ return WebDOMEventListener(listener.get());
+}
diff --git a/WebCore/bindings/cpp/WebDOMEventTarget.cpp b/WebCore/bindings/cpp/WebDOMEventTarget.cpp
new file mode 100644
index 0000000..2eaef00
--- /dev/null
+++ b/WebCore/bindings/cpp/WebDOMEventTarget.cpp
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebDOMEventTarget.h"
+
+#include "DOMApplicationCache.h"
+#include "DedicatedWorkerContext.h"
+#include "EventSource.h"
+#include "MessagePort.h"
+#include "Node.h"
+#include "Notification.h"
+#include "SharedWorker.h"
+#include "SharedWorkerContext.h"
+#include "ThreadCheck.h"
+#include "WebDOMDOMApplicationCache.h"
+#include "WebDOMDedicatedWorkerContext.h"
+#include "WebDOMEventSource.h"
+#include "WebDOMMessagePort.h"
+#include "WebDOMNode.h"
+#include "WebDOMNotification.h"
+#include "WebDOMSharedWorker.h"
+#include "WebDOMSharedWorkerContext.h"
+#include "WebDOMWebSocket.h"
+#include "WebDOMWorker.h"
+#include "WebDOMXMLHttpRequest.h"
+#include "WebDOMXMLHttpRequestUpload.h"
+#include "WebExceptionHandler.h"
+#include "WebSocket.h"
+#include "Worker.h"
+#include "XMLHttpRequest.h"
+#include "XMLHttpRequestUpload.h"
+
+#include <wtf/RefPtr.h>
+
+struct WebDOMEventTarget::WebDOMEventTargetPrivate {
+ WebDOMEventTargetPrivate(WebCore::EventTarget* object = 0)
+ : impl(object)
+ {
+ }
+
+ RefPtr<WebCore::EventTarget> impl;
+};
+
+WebDOMEventTarget::WebDOMEventTarget()
+ : WebDOMObject()
+ , m_impl(0)
+{
+}
+
+WebDOMEventTarget::WebDOMEventTarget(WebCore::EventTarget* impl)
+ : WebDOMObject()
+ , m_impl(new WebDOMEventTargetPrivate(impl))
+{
+}
+
+WebDOMEventTarget::WebDOMEventTarget(const WebDOMEventTarget& copy)
+ : WebDOMObject()
+{
+ m_impl = copy.impl() ? new WebDOMEventTargetPrivate(copy.impl()) : 0;
+}
+
+WebDOMEventTarget::~WebDOMEventTarget()
+{
+ delete m_impl;
+ m_impl = 0;
+}
+
+WebCore::EventTarget* WebDOMEventTarget::impl() const
+{
+ return m_impl ? m_impl->impl.get() : 0;
+}
+
+WebCore::EventTarget* toWebCore(const WebDOMEventTarget& wrapper)
+{
+ return wrapper.impl();
+}
+
+WebDOMEventTarget toWebKit(WebCore::EventTarget* value)
+{
+#if ENABLE(EVENTSOURCE)
+ if (WebCore::EventSource* eventSource = value->toEventSource())
+ return toWebKit(eventSource);
+#endif
+
+#if ENABLE(SVG) && 0
+ // FIXME: Enable once SVG bindings are generated.
+ // SVGElementInstance supports both toSVGElementInstance and toNode since so much mouse handling code depends on toNode returning a valid node.
+ if (WebCore::SVGElementInstance* instance = value->toSVGElementInstance())
+ return toWebKit(instance);
+#endif
+
+ if (WebCore::Node* node = value->toNode())
+ return toWebKit(node);
+
+ if (WebCore::XMLHttpRequest* xhr = value->toXMLHttpRequest())
+ return toWebKit(xhr);
+
+ if (WebCore::XMLHttpRequestUpload* upload = value->toXMLHttpRequestUpload())
+ return toWebKit(upload);
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ if (WebCore::DOMApplicationCache* cache = value->toDOMApplicationCache())
+ return toWebKit(cache);
+#endif
+
+ if (WebCore::MessagePort* messagePort = value->toMessagePort())
+ return toWebKit(messagePort);
+
+#if ENABLE(WORKERS)
+ if (WebCore::Worker* worker = value->toWorker())
+ return toWebKit(worker);
+
+ if (WebCore::DedicatedWorkerContext* workerContext = value->toDedicatedWorkerContext())
+ return toWebKit(workerContext);
+#endif
+
+#if ENABLE(SHARED_WORKERS)
+ if (WebCore::SharedWorker* sharedWorker = value->toSharedWorker())
+ return toWebKit(sharedWorker);
+
+ if (WebCore::SharedWorkerContext* workerContext = value->toSharedWorkerContext())
+ return toWebKit(workerContext);
+#endif
+
+#if ENABLE(NOTIFICATIONS)
+ if (WebCore::Notification* notification = value->toNotification())
+ return toWebKit(notification);
+#endif
+
+#if ENABLE(WEB_SOCKETS)
+ if (WebCore::WebSocket* webSocket = value->toWebSocket())
+ return toWebKit(webSocket);
+#endif
+
+ ASSERT_NOT_REACHED();
+ return WebDOMEventTarget();
+}
diff --git a/WebCore/bindings/cpp/WebDOMEventTarget.h b/WebCore/bindings/cpp/WebDOMEventTarget.h
new file mode 100644
index 0000000..f5360ca
--- /dev/null
+++ b/WebCore/bindings/cpp/WebDOMEventTarget.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebDOMEventTarget_h
+#define WebDOMEventTarget_h
+
+#include <WebDOMObject.h>
+
+namespace WebCore {
+class EventTarget;
+};
+
+class WebDOMEventTarget : public WebDOMObject {
+public:
+ WebDOMEventTarget();
+ explicit WebDOMEventTarget(WebCore::EventTarget*);
+ WebDOMEventTarget(const WebDOMEventTarget&);
+ ~WebDOMEventTarget();
+
+ WebCore::EventTarget* impl() const;
+
+ // FIXME: Add a possibility to check what kind of EventTarget we have,
+ // to be able to cast eg. a WebDOMEventTarget to a WebDOMNode
+
+protected:
+ struct WebDOMEventTargetPrivate;
+ WebDOMEventTargetPrivate* m_impl;
+};
+
+WebCore::EventTarget* toWebCore(const WebDOMEventTarget&);
+WebDOMEventTarget toWebKit(WebCore::EventTarget*);
+
+#endif
diff --git a/WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp b/WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp
new file mode 100644
index 0000000..aa511ad
--- /dev/null
+++ b/WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebDOMHTMLDocument.h"
+
+#include "CharacterNames.h"
+#include "HTMLDocument.h"
+#include "SegmentedString.h"
+#include "WebExceptionHandler.h"
+
+static inline void documentWrite(const WebDOMString& text, WebCore::HTMLDocument* document, bool addNewline)
+{
+ WebCore::SegmentedString segmentedString = WebCore::String(text);
+ if (addNewline)
+ segmentedString.append(WebCore::SegmentedString(&WebCore::newlineCharacter, 1));
+ document->write(segmentedString);
+}
+
+void WebDOMHTMLDocument::write(const WebDOMString& text)
+{
+ if (!impl())
+ return;
+
+ documentWrite(text, impl(), false);
+}
+
+void WebDOMHTMLDocument::writeln(const WebDOMString& text)
+{
+ if (!impl())
+ return;
+
+ documentWrite(text, impl(), true);
+}
diff --git a/WebCore/bindings/cpp/WebDOMNodeCustom.cpp b/WebCore/bindings/cpp/WebDOMNodeCustom.cpp
new file mode 100644
index 0000000..41abb0c
--- /dev/null
+++ b/WebCore/bindings/cpp/WebDOMNodeCustom.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebDOMNode.h"
+
+#include "Node.h"
+#include "WebDOMEventListener.h"
+#include "WebExceptionHandler.h"
+#include "WebNativeEventListener.h"
+
+WebDOMNode WebDOMNode::insertBefore(const WebDOMNode& newChild, const WebDOMNode& refChild)
+{
+ if (!impl())
+ return WebDOMNode();
+
+ WebCore::ExceptionCode ec = 0;
+ if (impl()->insertBefore(toWebCore(newChild), toWebCore(refChild), ec, true))
+ return newChild;
+
+ webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));
+ return WebDOMNode();
+}
+
+WebDOMNode WebDOMNode::replaceChild(const WebDOMNode& newChild, const WebDOMNode& oldChild)
+{
+ if (!impl())
+ return WebDOMNode();
+
+ WebCore::ExceptionCode ec = 0;
+ if (impl()->replaceChild(toWebCore(newChild), toWebCore(oldChild), ec, true))
+ return oldChild;
+
+ webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));
+ return WebDOMNode();
+}
+
+WebDOMNode WebDOMNode::removeChild(const WebDOMNode& oldChild)
+{
+ if (!impl())
+ return WebDOMNode();
+
+ WebCore::ExceptionCode ec = 0;
+ if (impl()->removeChild(toWebCore(oldChild), ec))
+ return oldChild;
+
+ webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));
+ return WebDOMNode();
+}
+
+WebDOMNode WebDOMNode::appendChild(const WebDOMNode& newChild)
+{
+ if (!impl())
+ return WebDOMNode();
+
+ WebCore::ExceptionCode ec = 0;
+ if (impl()->appendChild(toWebCore(newChild), ec, true))
+ return newChild;
+
+ webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));
+ return WebDOMNode();
+}
+
+void WebDOMNode::addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture)
+{
+ if (!impl())
+ return;
+
+ if (toWebCore(listener))
+ impl()->addEventListener(type, toWebCore(listener), useCapture);
+}
+
+void WebDOMNode::removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture)
+{
+ if (!impl())
+ return;
+
+ if (toWebCore(listener))
+ impl()->removeEventListener(type, toWebCore(listener), useCapture);
+}
diff --git a/WebCore/bindings/cpp/WebDOMObject.h b/WebCore/bindings/cpp/WebDOMObject.h
new file mode 100644
index 0000000..4d1830b
--- /dev/null
+++ b/WebCore/bindings/cpp/WebDOMObject.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebDOMObject_h
+#define WebDOMObject_h
+
+class WebDOMObject {
+protected:
+ WebDOMObject() { }
+ ~WebDOMObject() { }
+};
+
+// Looks akward, though we prefix all classes with WebDOM
+typedef unsigned long long WebDOMDOMTimeStamp;
+
+#endif
diff --git a/WebCore/bindings/cpp/WebDOMString.cpp b/WebCore/bindings/cpp/WebDOMString.cpp
new file mode 100644
index 0000000..d87dedd
--- /dev/null
+++ b/WebCore/bindings/cpp/WebDOMString.cpp
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebDOMString.h"
+
+#include "WebDOMCString.h"
+#include <wtf/text/AtomicString.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+class WebDOMStringPrivate : public WebCore::StringImpl {
+};
+
+void WebDOMString::reset()
+{
+ if (m_private) {
+ m_private->deref();
+ m_private = 0;
+ }
+}
+
+void WebDOMString::assign(const WebDOMString& other)
+{
+ assign(const_cast<WebDOMStringPrivate*>(other.m_private));
+}
+
+void WebDOMString::assign(const WebUChar* data, size_t length)
+{
+ assign(static_cast<WebDOMStringPrivate*>(
+ WebCore::StringImpl::create(data, length).get()));
+}
+
+size_t WebDOMString::length() const
+{
+ return m_private ? const_cast<WebDOMStringPrivate*>(m_private)->length() : 0;
+}
+
+const WebUChar* WebDOMString::data() const
+{
+ return m_private ? const_cast<WebDOMStringPrivate*>(m_private)->characters() : 0;
+}
+
+WebDOMCString WebDOMString::utf8() const
+{
+ return WebCore::String(m_private).utf8();
+}
+
+WebDOMString WebDOMString::fromUTF8(const char* data, size_t length)
+{
+ return WebCore::String::fromUTF8(data, length);
+}
+
+WebDOMString WebDOMString::fromUTF8(const char* data)
+{
+ return WebCore::String::fromUTF8(data);
+}
+
+WebDOMString::WebDOMString(const WebCore::String& s)
+ : m_private(static_cast<WebDOMStringPrivate*>(s.impl()))
+{
+ if (m_private)
+ m_private->ref();
+}
+
+WebDOMString& WebDOMString::operator=(const WebCore::String& s)
+{
+ assign(static_cast<WebDOMStringPrivate*>(s.impl()));
+ return *this;
+}
+
+WebDOMString::operator WebCore::String() const
+{
+ return m_private;
+}
+
+WebDOMString::WebDOMString(const WebCore::AtomicString& s)
+ : m_private(0)
+{
+ assign(s.string());
+}
+
+WebDOMString& WebDOMString::operator=(const WebCore::AtomicString& s)
+{
+ assign(s.string());
+ return *this;
+}
+
+WebDOMString::operator WebCore::AtomicString() const
+{
+ return WebCore::AtomicString(static_cast<WebCore::StringImpl *>(m_private));
+}
+
+bool WebDOMString::equals(const char* string) const
+{
+ return WebCore::equal(m_private, string);
+}
+
+void WebDOMString::assign(WebDOMStringPrivate* p)
+{
+ // Take care to handle the case where m_private == p
+ if (p)
+ p->ref();
+ if (m_private)
+ m_private->deref();
+ m_private = p;
+}
diff --git a/WebCore/bindings/cpp/WebDOMString.h b/WebCore/bindings/cpp/WebDOMString.h
new file mode 100644
index 0000000..ca09ee8
--- /dev/null
+++ b/WebCore/bindings/cpp/WebDOMString.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebDOMString_h
+#define WebDOMString_h
+
+#include <WebDOMCString.h>
+
+namespace WebCore {
+class String;
+class AtomicString;
+}
+
+class WebDOMStringPrivate;
+
+// A UTF-16 string container. It is inexpensive to copy a WebDOMString
+// object.
+//
+// WARNING: It is not safe to pass a WebDOMString across threads!!!
+//
+class WebDOMString {
+public:
+ ~WebDOMString() { reset(); }
+
+ WebDOMString() : m_private(0) { }
+
+ WebDOMString(const WebUChar* data, size_t len) : m_private(0)
+ {
+ assign(data, len);
+ }
+
+ WebDOMString(const WebDOMString& s) : m_private(0) { assign(s); }
+
+ WebDOMString& operator=(const WebDOMString& s)
+ {
+ assign(s);
+ return *this;
+ }
+
+ void reset();
+ void assign(const WebDOMString&);
+ void assign(const WebUChar* data, size_t len);
+
+ size_t length() const;
+ const WebUChar* data() const;
+
+ bool isEmpty() const { return !length(); }
+ bool isNull() const { return !m_private; }
+
+ WebDOMCString utf8() const;
+
+ static WebDOMString fromUTF8(const char* data, size_t length);
+ static WebDOMString fromUTF8(const char* data);
+
+ template <int N> WebDOMString(const char (&data)[N])
+ : m_private(0)
+ {
+ assign(fromUTF8(data, N - 1));
+ }
+
+ template <int N> WebDOMString& operator=(const char (&data)[N])
+ {
+ assign(fromUTF8(data, N - 1));
+ return *this;
+ }
+
+ WebDOMString(const WebCore::String&);
+ WebDOMString& operator=(const WebCore::String&);
+ operator WebCore::String() const;
+
+ WebDOMString(const WebCore::AtomicString&);
+ WebDOMString& operator=(const WebCore::AtomicString&);
+ operator WebCore::AtomicString() const;
+
+ bool equals(const char* string) const;
+
+private:
+ void assign(WebDOMStringPrivate*);
+ WebDOMStringPrivate* m_private;
+};
+
+#endif
diff --git a/WebCore/bindings/cpp/WebExceptionHandler.cpp b/WebCore/bindings/cpp/WebExceptionHandler.cpp
new file mode 100644
index 0000000..f285525
--- /dev/null
+++ b/WebCore/bindings/cpp/WebExceptionHandler.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebExceptionHandler.h"
+
+// To avoid a global static symbol, we declare it in a function
+static inline WebExceptionHandler& globalExceptionHandler()
+{
+ static WebExceptionHandler s_globalExceptionHandler;
+ return s_globalExceptionHandler;
+}
+
+void webInstallExceptionHandler(WebExceptionHandler handler)
+{
+ ASSERT(handler);
+ globalExceptionHandler() = handler;
+}
+
+void webRaiseDOMException(WebDOMExceptionCode ec)
+{
+ ASSERT(ec);
+ if (WebExceptionHandler& handler = globalExceptionHandler())
+ (*handler)(ec);
+}
diff --git a/WebCore/bindings/cpp/WebExceptionHandler.h b/WebCore/bindings/cpp/WebExceptionHandler.h
new file mode 100644
index 0000000..e679254
--- /dev/null
+++ b/WebCore/bindings/cpp/WebExceptionHandler.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebExceptionHandler_h
+#define WebExceptionHandler_h
+
+typedef int WebDOMExceptionCode;
+typedef void (*WebExceptionHandler)(WebDOMExceptionCode);
+
+// Used from the outside to register a callback that gets fired whenever an exception is raised
+void webInstallExceptionHandler(WebExceptionHandler);
+
+// Never used by the bindings, only indirectly by webDOMRaiseError
+void webRaiseDOMException(WebDOMExceptionCode);
+
+// Used from the bindings
+inline void webDOMRaiseError(WebDOMExceptionCode ec)
+{
+ if (ec)
+ webRaiseDOMException(ec);
+}
+
+#endif
diff --git a/WebCore/bindings/cpp/WebNativeEventListener.cpp b/WebCore/bindings/cpp/WebNativeEventListener.cpp
new file mode 100644
index 0000000..ddd7112
--- /dev/null
+++ b/WebCore/bindings/cpp/WebNativeEventListener.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebNativeEventListener.h"
+
+#include "WebDOMEvent.h"
+
+WebNativeEventListener::WebNativeEventListener(WebUserEventListener* listener)
+ : WebCore::EventListener(CPPEventListenerType),
+ m_listener(listener)
+{
+ ASSERT(m_listener);
+ m_listener->ref();
+}
+
+WebNativeEventListener::~WebNativeEventListener()
+{
+ m_listener->deref();
+}
+
+void WebNativeEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event* event)
+{
+ m_listener->handleEvent(toWebKit(event));
+}
+
+bool WebNativeEventListener::reportError(WebCore::ScriptExecutionContext*, const WebCore::String&, const WebCore::String&, int)
+{
+ // FIXME: Implement error handling
+ return false;
+}
+
+bool WebNativeEventListener::operator==(const WebCore::EventListener& other)
+{
+ const WebNativeEventListener* ptrOther = cast(&other);
+ return ptrOther && m_listener == ptrOther->m_listener;
+}
diff --git a/WebCore/bindings/cpp/WebNativeEventListener.h b/WebCore/bindings/cpp/WebNativeEventListener.h
new file mode 100644
index 0000000..fff1b1c
--- /dev/null
+++ b/WebCore/bindings/cpp/WebNativeEventListener.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebNativeEventListener_h
+#define WebNativeEventListener_h
+
+#include "EventListener.h"
+#include "WebDOMEventListener.h"
+
+class WebNativeEventListener : public WebCore::EventListener {
+public:
+ static PassRefPtr<WebNativeEventListener> create(WebUserEventListener* listener)
+ {
+ return adoptRef(new WebNativeEventListener(listener));
+ }
+
+ static const WebNativeEventListener* cast(const WebCore::EventListener* listener)
+ {
+ return listener->type() == CPPEventListenerType
+ ? static_cast<const WebNativeEventListener*>(listener)
+ : 0;
+ }
+
+ virtual ~WebNativeEventListener();
+ virtual bool operator==(const WebCore::EventListener& other);
+
+private:
+ virtual void handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*);
+ virtual bool reportError(WebCore::ScriptExecutionContext*, const WebCore::String& message, const WebCore::String& url, int lineNumber);
+
+protected:
+ WebNativeEventListener(WebUserEventListener*);
+ WebUserEventListener* m_listener;
+};
+
+#endif
diff --git a/WebCore/bindings/generic/BindingSecurity.h b/WebCore/bindings/generic/BindingSecurity.h
index 929b8f4..d7c9dfe 100644
--- a/WebCore/bindings/generic/BindingSecurity.h
+++ b/WebCore/bindings/generic/BindingSecurity.h
@@ -36,6 +36,7 @@
#include "Element.h"
#include "GenericBinding.h"
#include "HTMLFrameElementBase.h"
+#include "HTMLNames.h"
namespace WebCore {
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
index c84465a..2d62a27 100644
--- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
@@ -87,7 +87,7 @@ public:
static bool uint16ArrayEnabled() { return isWebGLEnabled; }
static bool int32ArrayEnabled() { return isWebGLEnabled; }
static bool uint32ArrayEnabled() { return isWebGLEnabled; }
- static bool floatArrayEnabled() { return isWebGLEnabled; }
+ static bool float32ArrayEnabled() { return isWebGLEnabled; }
static bool webGLRenderingContextEnabled() { return isWebGLEnabled; }
static bool webGLArrayBufferEnabled() { return isWebGLEnabled; }
static bool webGLByteArrayEnabled() { return isWebGLEnabled; }
diff --git a/WebCore/bindings/js/JSArrayBufferConstructor.cpp b/WebCore/bindings/js/JSArrayBufferConstructor.cpp
index 2930be8..683f9d1 100644
--- a/WebCore/bindings/js/JSArrayBufferConstructor.cpp
+++ b/WebCore/bindings/js/JSArrayBufferConstructor.cpp
@@ -46,22 +46,22 @@ JSArrayBufferConstructor::JSArrayBufferConstructor(ExecState* exec, JSDOMGlobalO
putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
}
-static JSObject* constructCanvasArrayBuffer(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructCanvasArrayBuffer(ExecState* exec)
{
- JSArrayBufferConstructor* jsConstructor = static_cast<JSArrayBufferConstructor*>(constructor);
+ JSArrayBufferConstructor* jsConstructor = static_cast<JSArrayBufferConstructor*>(exec->callee());
unsigned int size = 0;
- if (args.size() == 1) {
- size = (unsigned int)args.at(0).toInt32(exec);
+ if (exec->argumentCount() == 1) {
+ size = (unsigned int)exec->argument(0).toInt32(exec);
if (isnan(size))
size = 0;
}
RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(size, 1);
if (!buffer.get()){
setDOMException(exec, INDEX_SIZE_ERR);
- return 0;
+ return JSValue::encode(JSValue());
}
- return asObject(toJS(exec, jsConstructor->globalObject(), buffer.get()));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), buffer.get())));
}
JSC::ConstructType JSArrayBufferConstructor::getConstructData(JSC::ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSArrayBufferConstructor.h b/WebCore/bindings/js/JSArrayBufferConstructor.h
index fd03815..fa07a55 100644
--- a/WebCore/bindings/js/JSArrayBufferConstructor.h
+++ b/WebCore/bindings/js/JSArrayBufferConstructor.h
@@ -70,7 +70,7 @@ namespace WebCore {
unsigned length = array->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
void* tempValues;
if (!tryFastCalloc(length, sizeof(T)).getValue(tempValues)) {
- throwError(exec, JSC::GeneralError);
+ throwError(exec, createError(exec, "Error"));
return 0;
}
diff --git a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp b/WebCore/bindings/js/JSArrayBufferViewCustom.cpp
index a865a30..1fb6b49 100644
--- a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp
+++ b/WebCore/bindings/js/JSArrayBufferViewCustom.cpp
@@ -35,7 +35,7 @@
#include "JSUint16Array.h"
#include "JSInt32Array.h"
#include "JSUint32Array.h"
-#include "JSFloatArray.h"
+#include "JSFloat32Array.h"
#include "ArrayBufferView.h"
@@ -50,7 +50,7 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, ArrayBu
if (object) {
if (object->isFloatArray())
- return getDOMObjectWrapper<JSFloatArray>(exec, globalObject, static_cast<FloatArray*>(object));
+ return getDOMObjectWrapper<JSFloat32Array>(exec, globalObject, static_cast<Float32Array*>(object));
if (object->isUnsignedByteArray())
return getDOMObjectWrapper<JSUint8Array>(exec, globalObject, static_cast<Uint8Array*>(object));
if (object->isByteArray())
diff --git a/WebCore/bindings/js/JSArrayBufferViewHelper.h b/WebCore/bindings/js/JSArrayBufferViewHelper.h
index 6b77c0c..f632f38 100644
--- a/WebCore/bindings/js/JSArrayBufferViewHelper.h
+++ b/WebCore/bindings/js/JSArrayBufferViewHelper.h
@@ -41,7 +41,7 @@ template <class T>
JSC::JSValue setWebGLArrayHelper(JSC::ExecState* exec, T* impl, T* (*conversionFunc)(JSC::JSValue))
{
if (exec->argumentCount() < 1)
- return throwError(exec, JSC::SyntaxError);
+ return JSC::throwSyntaxError(exec);
T* array = (*conversionFunc)(exec->argument(0));
if (array) {
@@ -78,7 +78,7 @@ JSC::JSValue setWebGLArrayHelper(JSC::ExecState* exec, T* impl, T* (*conversionF
return JSC::jsUndefined();
}
- return JSC::throwError(exec, JSC::SyntaxError);
+ return JSC::throwSyntaxError(exec);
}
}
diff --git a/WebCore/bindings/js/JSAudioConstructor.cpp b/WebCore/bindings/js/JSAudioConstructor.cpp
index cc791d1..5bbaf41 100644
--- a/WebCore/bindings/js/JSAudioConstructor.cpp
+++ b/WebCore/bindings/js/JSAudioConstructor.cpp
@@ -46,13 +46,13 @@ JSAudioConstructor::JSAudioConstructor(ExecState* exec, JSDOMGlobalObject* globa
putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);
}
-static JSObject* constructAudio(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructAudio(ExecState* exec)
{
- JSAudioConstructor* jsConstructor = static_cast<JSAudioConstructor*>(constructor);
+ JSAudioConstructor* jsConstructor = static_cast<JSAudioConstructor*>(exec->callee());
Document* document = jsConstructor->document();
if (!document)
- return throwError(exec, ReferenceError, "Audio constructor associated document is unavailable");
+ return throwVMError(exec, createReferenceError(exec, "Audio constructor associated document is unavailable"));
// Calling toJS on the document causes the JS document wrapper to be
// added to the window object. This is done to ensure that JSDocument::markChildren
@@ -60,13 +60,13 @@ static JSObject* constructAudio(ExecState* exec, JSObject* constructor, const Ar
toJS(exec, jsConstructor->globalObject(), document);
// FIXME: This converts an undefined argument to the string "undefined", but possibly we
- // should treat it as if no argument was passed instead, by checking the value of args.at
- // rather than looking at args.size.
+ // should treat it as if no argument was passed instead, by checking the value of exec->argument
+ // rather than looking at exec->argumentCount.
String src;
- if (args.size() > 0)
- src = ustringToString(args.at(0).toString(exec));
- return asObject(toJS(exec, jsConstructor->globalObject(),
- HTMLAudioElement::createForJSConstructor(document, src)));
+ if (exec->argumentCount() > 0)
+ src = ustringToString(exec->argument(0).toString(exec));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(),
+ HTMLAudioElement::createForJSConstructor(document, src))));
}
ConstructType JSAudioConstructor::getConstructData(ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp
index 7a105ff..ae31608 100644
--- a/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -127,12 +127,12 @@
#include "JSWorkerContextCustom.cpp"
#include "JSWorkerContextErrorHandler.cpp"
#include "JSWorkerCustom.cpp"
-#include "JSXMLHttpRequestConstructor.cpp"
#include "JSXMLHttpRequestCustom.cpp"
#include "JSXMLHttpRequestUploadCustom.cpp"
#include "JSXSLTProcessorConstructor.cpp"
#include "JSXSLTProcessorCustom.cpp"
#include "JavaScriptCallFrame.cpp"
+#include "MemoryInfo.cpp"
#include "ScheduledAction.cpp"
#include "ScriptArray.cpp"
#include "ScriptCachedFrameData.cpp"
diff --git a/WebCore/bindings/js/JSCallbackData.cpp b/WebCore/bindings/js/JSCallbackData.cpp
index e813da2..6b19639 100644
--- a/WebCore/bindings/js/JSCallbackData.cpp
+++ b/WebCore/bindings/js/JSCallbackData.cpp
@@ -51,7 +51,7 @@ JSValue JSCallbackData::invokeCallback(MarkedArgumentBuffer& args, bool* raisedE
JSValue function = callback()->get(exec, Identifier(exec, "handleEvent"));
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone) {
callType = callback()->getCallData(callData);
if (callType == CallTypeNone)
@@ -60,7 +60,12 @@ JSValue JSCallbackData::invokeCallback(MarkedArgumentBuffer& args, bool* raisedE
}
globalObject()->globalData()->timeoutChecker.start();
- JSValue result = globalObject()->scriptExecutionContext()->isDocument()
+ ScriptExecutionContext* context = globalObject()->scriptExecutionContext();
+ // We will fail to get the context if the frame has been detached.
+ if (!context)
+ return JSValue();
+
+ JSValue result = context->isDocument()
? JSMainThreadExecState::call(exec, function, callType, callData, callback(), args)
: JSC::call(exec, function, callType, callData, callback(), args);
globalObject()->globalData()->timeoutChecker.stop();
diff --git a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
index 416f976..914dea0 100644
--- a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
+++ b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
@@ -121,7 +121,7 @@ JSValue JSCanvasRenderingContext2D::setFillColor(ExecState* exec)
exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec));
break;
default:
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
}
return jsUndefined();
}
@@ -158,7 +158,7 @@ JSValue JSCanvasRenderingContext2D::setStrokeColor(ExecState* exec)
exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec));
break;
default:
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
}
return jsUndefined();
@@ -190,7 +190,7 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec)
// The img parameter can be a <img> or <canvas> element.
JSValue value = exec->argument(0);
if (!value.isObject())
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
JSObject* o = asObject(value);
ExceptionCode ec = 0;
@@ -213,7 +213,7 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec)
setDOMException(exec, ec);
break;
default:
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
}
} else if (o->inherits(&JSHTMLCanvasElement::s_info)) {
HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLElement*>(o)->impl());
@@ -234,7 +234,7 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec)
setDOMException(exec, ec);
break;
default:
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
}
#if ENABLE(VIDEO)
} else if (o->inherits(&JSHTMLVideoElement::s_info)) {
@@ -256,7 +256,7 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec)
setDOMException(exec, ec);
break;
default:
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
}
#endif
} else {
@@ -272,11 +272,11 @@ JSValue JSCanvasRenderingContext2D::drawImageFromRect(ExecState* exec)
JSValue value = exec->argument(0);
if (!value.isObject())
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
JSObject* o = asObject(value);
if (!o->inherits(&JSHTMLImageElement::s_info))
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
context->drawImageFromRect(static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(o)->impl()),
exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec),
exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec),
@@ -326,7 +326,7 @@ JSValue JSCanvasRenderingContext2D::setShadow(ExecState* exec)
exec->argument(6).toFloat(exec), exec->argument(7).toFloat(exec));
break;
default:
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
}
return jsUndefined();
@@ -338,7 +338,7 @@ JSValue JSCanvasRenderingContext2D::createPattern(ExecState* exec)
JSValue value = exec->argument(0);
if (!value.isObject())
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
JSObject* o = asObject(value);
if (o->inherits(&JSHTMLImageElement::s_info)) {
@@ -406,7 +406,7 @@ JSValue JSCanvasRenderingContext2D::fillText(ExecState* exec)
// number arg = y
// optional number arg = maxWidth
if (exec->argumentCount() < 3 || exec->argumentCount() > 4)
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
if (exec->argumentCount() == 4)
context->fillText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec));
@@ -424,7 +424,7 @@ JSValue JSCanvasRenderingContext2D::strokeText(ExecState* exec)
// number arg = y
// optional number arg = maxWidth
if (exec->argumentCount() < 3 || exec->argumentCount() > 4)
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
if (exec->argumentCount() == 4)
context->strokeText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec));
diff --git a/WebCore/bindings/js/JSClipboardCustom.cpp b/WebCore/bindings/js/JSClipboardCustom.cpp
index ad5e055..9bdffdb 100644
--- a/WebCore/bindings/js/JSClipboardCustom.cpp
+++ b/WebCore/bindings/js/JSClipboardCustom.cpp
@@ -78,14 +78,14 @@ JSValue JSClipboard::clearData(ExecState* exec)
}
// FIXME: It does not match the rest of the JS bindings to throw on invalid number of arguments.
- return throwError(exec, SyntaxError, "clearData: Invalid number of arguments");
+ return throwError(exec, createSyntaxError(exec, "clearData: Invalid number of arguments"));
}
JSValue JSClipboard::getData(ExecState* exec)
{
// FIXME: It does not match the rest of the JS bindings to throw on invalid number of arguments.
if (exec->argumentCount() != 1)
- return throwError(exec, SyntaxError, "getData: Invalid number of arguments");
+ return throwError(exec, createSyntaxError(exec, "getData: Invalid number of arguments"));
Clipboard* clipboard = impl();
@@ -106,7 +106,7 @@ JSValue JSClipboard::setDragImage(ExecState* exec)
// FIXME: It does not match the rest of the JS bindings to throw on invalid number of arguments.
if (exec->argumentCount() != 3)
- return throwError(exec, SyntaxError, "setDragImage: Invalid number of arguments");
+ return throwError(exec, createSyntaxError(exec, "setDragImage: Invalid number of arguments"));
int x = exec->argument(1).toInt32(exec);
int y = exec->argument(2).toInt32(exec);
@@ -114,11 +114,11 @@ JSValue JSClipboard::setDragImage(ExecState* exec)
// See if they passed us a node
Node* node = toNode(exec->argument(0));
if (!node)
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
// FIXME: This should probably be a TypeError.
if (!node->isElementNode())
- return throwError(exec, SyntaxError, "setDragImageFromElement: Invalid first argument");
+ return throwError(exec, createSyntaxError(exec, "setDragImageFromElement: Invalid first argument"));
if (static_cast<Element*>(node)->hasLocalName(imgTag) && !node->inDocument())
clipboard->setDragImage(static_cast<HTMLImageElement*>(node)->cachedImage(), IntPoint(x, y));
diff --git a/WebCore/bindings/js/JSConsoleCustom.cpp b/WebCore/bindings/js/JSConsoleCustom.cpp
index 3ad34a3..b9b407c 100644
--- a/WebCore/bindings/js/JSConsoleCustom.cpp
+++ b/WebCore/bindings/js/JSConsoleCustom.cpp
@@ -28,7 +28,9 @@
#include "JSConsole.h"
#include "Console.h"
+#include "JSMemoryInfo.h"
#include "JSScriptProfile.h"
+#include "MemoryInfo.h"
#include "ScriptCallStack.h"
#include "ScriptProfile.h"
#include <runtime/JSArray.h>
@@ -55,4 +57,9 @@ JSValue JSConsole::profiles(ExecState* exec) const
#endif
+JSValue JSConsole::memory(ExecState* exec) const
+{
+ return toJS(exec, MemoryInfo::create());
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/js/JSCustomPositionCallback.cpp b/WebCore/bindings/js/JSCustomPositionCallback.cpp
index cc6d45c..8990520 100644
--- a/WebCore/bindings/js/JSCustomPositionCallback.cpp
+++ b/WebCore/bindings/js/JSCustomPositionCallback.cpp
@@ -38,12 +38,17 @@ namespace WebCore {
using namespace JSC;
JSCustomPositionCallback::JSCustomPositionCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
- : m_data(callback, globalObject)
+ : PositionCallback(globalObject->scriptExecutionContext())
+ , m_data(callback, globalObject)
{
}
void JSCustomPositionCallback::handleEvent(Geoposition* geoposition)
{
+ // ActiveDOMObject will null our pointer to the ScriptExecutionContext when it goes away.
+ if (!scriptExecutionContext())
+ return;
+
RefPtr<JSCustomPositionCallback> protect(this);
JSC::JSLock lock(SilenceAssertionsOnly);
diff --git a/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp b/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp
index c94ae9a..1777387 100644
--- a/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp
+++ b/WebCore/bindings/js/JSCustomPositionErrorCallback.cpp
@@ -38,12 +38,17 @@ namespace WebCore {
using namespace JSC;
JSCustomPositionErrorCallback::JSCustomPositionErrorCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
- : m_data(callback, globalObject)
+ : PositionErrorCallback(globalObject->scriptExecutionContext())
+ , m_data(callback, globalObject)
{
}
void JSCustomPositionErrorCallback::handleEvent(PositionError* positionError)
{
+ // ActiveDOMObject will null our pointer to the ScriptExecutionContext when it goes away.
+ if (!scriptExecutionContext())
+ return;
+
RefPtr<JSCustomPositionErrorCallback> protect(this);
JSC::JSLock lock(SilenceAssertionsOnly);
diff --git a/WebCore/bindings/js/JSCustomXPathNSResolver.cpp b/WebCore/bindings/js/JSCustomXPathNSResolver.cpp
index e7d174f..37f2512 100644
--- a/WebCore/bindings/js/JSCustomXPathNSResolver.cpp
+++ b/WebCore/bindings/js/JSCustomXPathNSResolver.cpp
@@ -73,7 +73,7 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
JSValue function = m_customResolver->get(exec, Identifier(exec, "lookupNamespaceURI"));
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone) {
callType = m_customResolver->getCallData(callData);
if (callType == CallTypeNone) {
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index 87d8cf7..27ac9e4 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -603,7 +603,7 @@ void setDOMException(ExecState* exec, ExceptionCode ec)
}
ASSERT(errorObject);
- exec->setException(errorObject);
+ throwError(exec, errorObject);
}
bool checkNodeSecurity(ExecState* exec, Node* node)
@@ -729,7 +729,7 @@ JSC::JSObject* toJSSequence(ExecState* exec, JSValue value, unsigned& length)
{
JSObject* object = value.getObject();
if (!object) {
- throwError(exec, TypeError);
+ throwTypeError(exec);
return 0;
}
JSValue lengthValue = object->get(exec, exec->propertyNames().length);
@@ -737,7 +737,7 @@ JSC::JSObject* toJSSequence(ExecState* exec, JSValue value, unsigned& length)
return 0;
if (lengthValue.isUndefinedOrNull()) {
- throwError(exec, TypeError);
+ throwTypeError(exec);
return 0;
}
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index eabf962..7e0a785 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -65,7 +65,7 @@
#include "JSUint32ArrayConstructor.h"
#include "JSInt16ArrayConstructor.h"
#include "JSUint16ArrayConstructor.h"
-#include "JSFloatArrayConstructor.h"
+#include "JSFloat32ArrayConstructor.h"
#endif
#include "JSWebKitCSSMatrixConstructor.h"
#include "JSWebKitPointConstructor.h"
@@ -73,7 +73,7 @@
#include "JSWebSocketConstructor.h"
#endif
#include "JSWorkerConstructor.h"
-#include "JSXMLHttpRequestConstructor.h"
+#include "JSXMLHttpRequest.h"
#include "JSXSLTProcessorConstructor.h"
#include "Location.h"
#include "MediaPlayer.h"
@@ -606,9 +606,9 @@ JSValue JSDOMWindow::uint16Array(ExecState* exec) const
return getDOMConstructor<JSUint16ArrayConstructor>(exec, this);
}
-JSValue JSDOMWindow::floatArray(ExecState* exec) const
+JSValue JSDOMWindow::float32Array(ExecState* exec) const
{
- return getDOMConstructor<JSFloatArrayConstructor>(exec, this);
+ return getDOMConstructor<JSFloat32ArrayConstructor>(exec, this);
}
// Temporary aliases to keep current WebGL content working during transition period to TypedArray spec.
@@ -650,7 +650,7 @@ JSValue JSDOMWindow::webGLUnsignedShortArray(ExecState* exec) const
JSValue JSDOMWindow::webGLFloatArray(ExecState* exec) const
{
- return getDOMConstructor<JSFloatArrayConstructor>(exec, this);
+ return getDOMConstructor<JSFloat32ArrayConstructor>(exec, this);
}
#endif
diff --git a/WebCore/bindings/js/JSDOMWrapper.cpp b/WebCore/bindings/js/JSDOMWrapper.cpp
index 3fcdcc1..9548f2f 100644
--- a/WebCore/bindings/js/JSDOMWrapper.cpp
+++ b/WebCore/bindings/js/JSDOMWrapper.cpp
@@ -44,7 +44,7 @@ DOMObject::~DOMObject()
bool DOMObject::defineOwnProperty(ExecState* exec, const Identifier&, PropertyDescriptor&, bool)
{
- throwError(exec, TypeError, "defineProperty is not supported on DOM Objects");
+ throwError(exec, createTypeError(exec, "defineProperty is not supported on DOM Objects"));
return false;
}
diff --git a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
index 3098752..6c4dfb4 100644
--- a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
+++ b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
@@ -50,10 +50,10 @@ JSValue JSNotificationCenter::requestPermission(ExecState* exec)
// Permission request is only valid from page context.
ScriptExecutionContext* context = impl()->context();
if (context->isWorkerContext())
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
if (!exec->argument(0).isObject())
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
PassRefPtr<JSCustomVoidCallback> callback = JSCustomVoidCallback::create(exec->argument(0).getObject(), toJSDOMGlobalObject(static_cast<Document*>(context), exec));
diff --git a/WebCore/bindings/js/JSEventListener.cpp b/WebCore/bindings/js/JSEventListener.cpp
index e25a5d1..ceed445 100644
--- a/WebCore/bindings/js/JSEventListener.cpp
+++ b/WebCore/bindings/js/JSEventListener.cpp
@@ -93,7 +93,7 @@ void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext
JSValue handleEventFunction = jsFunction->get(exec, Identifier(exec, "handleEvent"));
CallData callData;
- CallType callType = handleEventFunction.getCallData(callData);
+ CallType callType = getCallData(handleEventFunction, callData);
if (callType == CallTypeNone) {
handleEventFunction = JSValue();
callType = jsFunction->getCallData(callData);
diff --git a/WebCore/bindings/js/JSEventSourceConstructor.cpp b/WebCore/bindings/js/JSEventSourceConstructor.cpp
index e48489b..4524f70 100644
--- a/WebCore/bindings/js/JSEventSourceConstructor.cpp
+++ b/WebCore/bindings/js/JSEventSourceConstructor.cpp
@@ -56,28 +56,28 @@ JSEventSourceConstructor::JSEventSourceConstructor(ExecState* exec, JSDOMGlobalO
putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
}
-static JSObject* constructEventSource(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructEventSource(ExecState* exec)
{
- if (args.size() < 1)
- return throwError(exec, SyntaxError, "Not enough arguments");
+ if (exec->argumentCount() < 1)
+ return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
- UString url = args.at(0).toString(exec);
+ UString url = exec->argument(0).toString(exec);
if (exec->hadException())
- return 0;
+ return JSValue::encode(JSValue());
- JSEventSourceConstructor* jsConstructor = static_cast<JSEventSourceConstructor*>(constructor);
+ JSEventSourceConstructor* jsConstructor = static_cast<JSEventSourceConstructor*>(exec->callee());
ScriptExecutionContext* context = jsConstructor->scriptExecutionContext();
if (!context)
- return throwError(exec, ReferenceError, "EventSource constructor associated document is unavailable");
+ return throwVMError(exec, createReferenceError(exec, "EventSource constructor associated document is unavailable"));
ExceptionCode ec = 0;
RefPtr<EventSource> eventSource = EventSource::create(ustringToString(url), context, ec);
if (ec) {
setDOMException(exec, ec);
- return 0;
+ return JSValue::encode(JSValue());
}
- return asObject(toJS(exec, jsConstructor->globalObject(), eventSource.release()));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), eventSource.release())));
}
ConstructType JSEventSourceConstructor::getConstructData(ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSFloat32ArrayConstructor.cpp b/WebCore/bindings/js/JSFloat32ArrayConstructor.cpp
new file mode 100644
index 0000000..08cffb5
--- /dev/null
+++ b/WebCore/bindings/js/JSFloat32ArrayConstructor.cpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2009 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.
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(3D_CANVAS)
+
+#include "JSFloat32ArrayConstructor.h"
+
+#include "Document.h"
+#include "Float32Array.h"
+#include "JSArrayBuffer.h"
+#include "JSArrayBufferConstructor.h"
+#include "JSFloat32Array.h"
+#include <runtime/Error.h>
+
+namespace WebCore {
+
+using namespace JSC;
+
+const ClassInfo JSFloat32ArrayConstructor::s_info = { "Float32ArrayConstructor", &JSArrayBufferView::s_info, 0, 0 };
+
+JSFloat32ArrayConstructor::JSFloat32ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
+ : DOMConstructorObject(JSFloat32ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject)
+{
+ putDirect(exec->propertyNames().prototype, JSFloat32ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly);
+}
+
+JSObject* JSFloat32ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
+{
+ return new (exec) JSFloat32ArrayPrototype(globalObject, JSFloat32ArrayPrototype::createStructure(globalObject->objectPrototype()));
+}
+
+bool JSFloat32ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<JSFloat32ArrayConstructor, DOMObject>(exec, JSFloat32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot);
+}
+
+bool JSFloat32ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<JSFloat32ArrayConstructor, DOMObject>(exec, JSFloat32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructCanvasFloatArray(ExecState* exec)
+{
+ ArgList args(exec);
+ JSFloat32ArrayConstructor* jsConstructor = static_cast<JSFloat32ArrayConstructor*>(exec->callee());
+ RefPtr<Float32Array> array = static_cast<Float32Array*>(construct<Float32Array, float>(exec, args).get());
+ if (!array.get()) {
+ setDOMException(exec, INDEX_SIZE_ERR);
+ return JSValue::encode(JSValue());
+ }
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get())));
+}
+
+JSC::ConstructType JSFloat32ArrayConstructor::getConstructData(JSC::ConstructData& constructData)
+{
+ constructData.native.function = constructCanvasFloatArray;
+ return ConstructTypeHost;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_CANVAS)
diff --git a/WebCore/bindings/js/JSFloatArrayConstructor.h b/WebCore/bindings/js/JSFloat32ArrayConstructor.h
index 6d2dae7..c2f8b7e 100644
--- a/WebCore/bindings/js/JSFloatArrayConstructor.h
+++ b/WebCore/bindings/js/JSFloat32ArrayConstructor.h
@@ -23,24 +23,35 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef JSFloatArrayConstructor_h
-#define JSFloatArrayConstructor_h
+#ifndef JSFloat32ArrayConstructor_h
+#define JSFloat32ArrayConstructor_h
#include "JSDOMBinding.h"
#include "JSDocument.h"
namespace WebCore {
- class JSFloatArrayConstructor : public DOMConstructorObject {
+ class JSFloat32ArrayConstructor : public DOMConstructorObject {
+ typedef DOMConstructorObject Base;
public:
- JSFloatArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*);
+ JSFloat32ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*);
+ static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);
+ virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
static const JSC::ClassInfo s_info;
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
private:
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+ protected:
+ static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
};
}
-#endif // JSFloatArrayConstructor_h
+#endif // JSFloat32ArrayConstructor_h
diff --git a/WebCore/bindings/js/JSFloatArrayCustom.cpp b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
index 8a82f98..7965274 100644
--- a/WebCore/bindings/js/JSFloatArrayCustom.cpp
+++ b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
@@ -28,27 +28,27 @@
#if ENABLE(3D_CANVAS)
#include "JSArrayBufferViewHelper.h"
-#include "JSFloatArray.h"
+#include "JSFloat32Array.h"
-#include "FloatArray.h"
+#include "Float32Array.h"
using namespace JSC;
namespace WebCore {
-void JSFloatArray::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSValue value)
+void JSFloat32Array::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSValue value)
{
impl()->set(index, static_cast<float>(value.toNumber(exec)));
}
-JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, FloatArray* object)
+JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Float32Array* object)
{
- return getDOMObjectWrapper<JSFloatArray>(exec, globalObject, object);
+ return getDOMObjectWrapper<JSFloat32Array>(exec, globalObject, object);
}
-JSC::JSValue JSFloatArray::set(JSC::ExecState* exec)
+JSC::JSValue JSFloat32Array::set(JSC::ExecState* exec)
{
- return setWebGLArrayHelper(exec, impl(), toFloatArray);
+ return setWebGLArrayHelper(exec, impl(), toFloat32Array);
}
} // namespace WebCore
diff --git a/WebCore/bindings/js/JSFloatArrayConstructor.cpp b/WebCore/bindings/js/JSFloatArrayConstructor.cpp
deleted file mode 100644
index 57374af..0000000
--- a/WebCore/bindings/js/JSFloatArrayConstructor.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- *
- * 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.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS)
-
-#include "JSFloatArrayConstructor.h"
-
-#include "Document.h"
-#include "FloatArray.h"
-#include "JSArrayBuffer.h"
-#include "JSArrayBufferConstructor.h"
-#include "JSFloatArray.h"
-#include <runtime/Error.h>
-
-namespace WebCore {
-
-using namespace JSC;
-
-const ClassInfo JSFloatArrayConstructor::s_info = { "FloatArrayConstructor", &JSArrayBufferView::s_info, 0, 0 };
-
-JSFloatArrayConstructor::JSFloatArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
- : DOMConstructorObject(JSFloatArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject)
-{
- putDirect(exec->propertyNames().prototype, JSFloatArrayPrototype::self(exec, globalObject), None);
- putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
-}
-
-static JSObject* constructCanvasFloatArray(ExecState* exec, JSObject* constructor, const ArgList& args)
-{
- JSFloatArrayConstructor* jsConstructor = static_cast<JSFloatArrayConstructor*>(constructor);
- RefPtr<FloatArray> array = static_cast<FloatArray*>(construct<FloatArray, float>(exec, args).get());
- if (!array.get()) {
- setDOMException(exec, INDEX_SIZE_ERR);
- return 0;
- }
- return asObject(toJS(exec, jsConstructor->globalObject(), array.get()));
-}
-
-JSC::ConstructType JSFloatArrayConstructor::getConstructData(JSC::ConstructData& constructData)
-{
- constructData.native.function = constructCanvasFloatArray;
- return ConstructTypeHost;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS)
diff --git a/WebCore/bindings/js/JSGeolocationCustom.cpp b/WebCore/bindings/js/JSGeolocationCustom.cpp
index 16849ec..bd36df8 100644
--- a/WebCore/bindings/js/JSGeolocationCustom.cpp
+++ b/WebCore/bindings/js/JSGeolocationCustom.cpp
@@ -31,12 +31,15 @@
#include "DOMWindow.h"
#include "ExceptionCode.h"
#include "Geolocation.h"
-#include "GeolocationService.h"
#include "JSCustomPositionCallback.h"
#include "JSCustomPositionErrorCallback.h"
#include "JSDOMWindow.h"
#include "PositionOptions.h"
-#include <runtime/InternalFunction.h>
+#include <runtime/JSFunction.h>
+
+#if !ENABLE(CLIENT_BASED_GEOLOCATION)
+#include "GeolocationService.h"
+#endif
using namespace JSC;
using namespace std;
@@ -46,7 +49,8 @@ namespace WebCore {
static PassRefPtr<PositionCallback> createPositionCallback(ExecState* exec, JSDOMGlobalObject* globalObject, JSValue value)
{
// The spec specifies 'FunctionOnly' for this object.
- if (!value.inherits(&InternalFunction::info)) {
+ // FIXME: This check disallows callable objects created via JSC API. It's not clear what exactly the specification intends to allow.
+ if (!value.inherits(&JSFunction::info)) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return 0;
}
@@ -62,7 +66,8 @@ static PassRefPtr<PositionErrorCallback> createPositionErrorCallback(ExecState*
return 0;
// The spec specifies 'FunctionOnly' for this object.
- if (!value.inherits(&InternalFunction::info)) {
+ // FIXME: This check disallows callable objects created via JSC API. It's not clear what exactly the specification intends to allow.
+ if (!value.inherits(&JSFunction::info)) {
setDOMException(exec, TYPE_MISMATCH_ERR);
return 0;
}
diff --git a/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp b/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
index 3d819ef..a504f25 100644
--- a/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
+++ b/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
@@ -34,6 +34,7 @@
#include "JSNodeList.h"
#include "Node.h"
#include "StaticNodeList.h"
+#include <runtime/JSValue.h>
#include <wtf/Vector.h>
using namespace JSC;
@@ -58,10 +59,10 @@ static JSValue getNamedItems(ExecState* exec, JSHTMLAllCollection* collection, c
// HTMLCollections are strange objects, they support both get and call,
// so that document.forms.item(0) and document.forms(0) both work.
-static JSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec)
{
if (exec->argumentCount() < 1)
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
// Do not use thisObj here. It can be the JSHTMLDocument, in the document.forms(i) case.
JSHTMLAllCollection* jsCollection = static_cast<JSHTMLAllCollection*>(exec->callee());
@@ -75,10 +76,10 @@ static JSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec)
UString string = exec->argument(0).toString(exec);
unsigned index = string.toUInt32(&ok, false);
if (ok)
- return toJS(exec, jsCollection->globalObject(), collection->item(index));
+ return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection->item(index)));
// Support for document.images('<name>') etc.
- return getNamedItems(exec, jsCollection, Identifier(exec, string));
+ return JSValue::encode(getNamedItems(exec, jsCollection, Identifier(exec, string)));
}
// The second arg, if set, is the index of the item we want
@@ -90,13 +91,13 @@ static JSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec)
Node* node = collection->namedItem(pstr);
while (node) {
if (!index)
- return toJS(exec, jsCollection->globalObject(), node);
+ return JSValue::encode(toJS(exec, jsCollection->globalObject(), node));
node = collection->nextNamedItem(pstr);
--index;
}
}
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
CallType JSHTMLAllCollection::getCallData(CallData& callData)
diff --git a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
index a69696a..ae9115e 100644
--- a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
+++ b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
@@ -88,17 +88,21 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec)
JSValue JSHTMLCanvasElement::toDataURL(ExecState* exec)
{
const String& type = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
- double quality = 1.0;
+ HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl());
+ ExceptionCode ec = 0;
+
+ JSC::JSValue result;
+ double quality;
+ double* qualityPtr = 0;
if (exec->argumentCount() > 1) {
JSValue v = exec->argument(1);
- if (v.isNumber())
+ if (v.isNumber()) {
quality = v.toNumber(exec);
- if (!(0.0 <= quality && quality <= 1.0))
- quality = 1.0;
+ qualityPtr = &quality;
+ }
}
- HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl());
- ExceptionCode ec = 0;
- JSC::JSValue result = jsString(exec, canvas->toDataURL(type, quality, ec));
+
+ result = jsString(exec, canvas->toDataURL(type, qualityPtr, ec));
setDOMException(exec, ec);
return result;
}
diff --git a/WebCore/bindings/js/JSHTMLCollectionCustom.cpp b/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
index 24059b7..b0cfd99 100644
--- a/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
+++ b/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
@@ -55,10 +55,10 @@ static JSValue getNamedItems(ExecState* exec, JSHTMLCollection* collection, cons
// HTMLCollections are strange objects, they support both get and call,
// so that document.forms.item(0) and document.forms(0) both work.
-static JSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec)
{
if (exec->argumentCount() < 1)
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
// Do not use thisObj here. It can be the JSHTMLDocument, in the document.forms(i) case.
JSHTMLCollection* jsCollection = static_cast<JSHTMLCollection*>(exec->callee());
@@ -72,10 +72,10 @@ static JSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec)
UString string = exec->argument(0).toString(exec);
unsigned index = string.toUInt32(&ok, false);
if (ok)
- return toJS(exec, jsCollection->globalObject(), collection->item(index));
+ return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection->item(index)));
// Support for document.images('<name>') etc.
- return getNamedItems(exec, jsCollection, Identifier(exec, string));
+ return JSValue::encode(getNamedItems(exec, jsCollection, Identifier(exec, string)));
}
// The second arg, if set, is the index of the item we want
@@ -87,13 +87,13 @@ static JSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec)
Node* node = collection->namedItem(pstr);
while (node) {
if (!index)
- return toJS(exec, jsCollection->globalObject(), node);
+ return JSValue::encode(toJS(exec, jsCollection->globalObject(), node));
node = collection->nextNamedItem(pstr);
--index;
}
}
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
CallType JSHTMLCollection::getCallData(CallData& callData)
diff --git a/WebCore/bindings/js/JSHTMLDocumentCustom.cpp b/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
index 30cb3a2..a0e189e 100644
--- a/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
+++ b/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
@@ -40,8 +40,9 @@
#include "JSDOMWindowShell.h"
#include "JSHTMLCollection.h"
#include "SegmentedString.h"
-#include "Tokenizer.h"
+#include "DocumentParser.h"
#include <runtime/Error.h>
+#include <runtime/JSCell.h>
using namespace JSC;
@@ -110,9 +111,9 @@ JSValue JSHTMLDocument::open(ExecState* exec)
if (wrapper) {
JSValue function = wrapper->get(exec, Identifier(exec, "open"));
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = ::getCallData(function, callData);
if (callType == CallTypeNone)
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
return JSC::call(exec, function, callType, callData, wrapper, ArgList(exec));
}
}
diff --git a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp
index d4be8dc..23db266 100644
--- a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp
+++ b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp
@@ -71,7 +71,7 @@ JSValue JSHTMLInputElement::selectionStart(ExecState* exec) const
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection())
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
return jsNumber(exec, input->selectionStart());
}
@@ -80,7 +80,7 @@ void JSHTMLInputElement::setSelectionStart(ExecState* exec, JSValue value)
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection())
- throwError(exec, TypeError);
+ throwTypeError(exec);
input->setSelectionStart(value.toInt32(exec));
}
@@ -89,7 +89,7 @@ JSValue JSHTMLInputElement::selectionEnd(ExecState* exec) const
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection())
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
return jsNumber(exec, input->selectionEnd());
}
@@ -98,7 +98,7 @@ void JSHTMLInputElement::setSelectionEnd(ExecState* exec, JSValue value)
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection())
- throwError(exec, TypeError);
+ throwTypeError(exec);
input->setSelectionEnd(value.toInt32(exec));
}
@@ -107,7 +107,7 @@ JSValue JSHTMLInputElement::setSelectionRange(ExecState* exec)
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
if (!input->canHaveSelection())
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
int start = exec->argument(0).toInt32(exec);
int end = exec->argument(1).toInt32(exec);
diff --git a/WebCore/bindings/js/JSImageConstructor.cpp b/WebCore/bindings/js/JSImageConstructor.cpp
index a574326..f2ad803 100644
--- a/WebCore/bindings/js/JSImageConstructor.cpp
+++ b/WebCore/bindings/js/JSImageConstructor.cpp
@@ -40,12 +40,12 @@ JSImageConstructor::JSImageConstructor(ExecState* exec, JSDOMGlobalObject* globa
putDirect(exec->propertyNames().prototype, JSHTMLImageElementPrototype::self(exec, globalObject), None);
}
-static JSObject* constructImage(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructImage(ExecState* exec)
{
- JSImageConstructor* jsConstructor = static_cast<JSImageConstructor*>(constructor);
+ JSImageConstructor* jsConstructor = static_cast<JSImageConstructor*>(exec->callee());
Document* document = jsConstructor->document();
if (!document)
- return throwError(exec, ReferenceError, "Image constructor associated document is unavailable");
+ return throwVMError(exec, createReferenceError(exec, "Image constructor associated document is unavailable"));
// Calling toJS on the document causes the JS document wrapper to be
// added to the window object. This is done to ensure that JSDocument::markChildren
@@ -55,17 +55,17 @@ static JSObject* constructImage(ExecState* exec, JSObject* constructor, const Ar
int height;
int* optionalWidth = 0;
int* optionalHeight = 0;
- if (args.size() > 0) {
- width = args.at(0).toInt32(exec);
+ if (exec->argumentCount() > 0) {
+ width = exec->argument(0).toInt32(exec);
optionalWidth = &width;
}
- if (args.size() > 1) {
- height = args.at(1).toInt32(exec);
+ if (exec->argumentCount() > 1) {
+ height = exec->argument(1).toInt32(exec);
optionalHeight = &height;
}
- return asObject(toJS(exec, jsConstructor->globalObject(),
- HTMLImageElement::createForJSConstructor(document, optionalWidth, optionalHeight)));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(),
+ HTMLImageElement::createForJSConstructor(document, optionalWidth, optionalHeight))));
}
ConstructType JSImageConstructor::getConstructData(ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index c13ea0c..a0d75f8 100644
--- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -88,7 +88,7 @@ ScriptObject InjectedScriptHost::createInjectedScript(const String& source, Scri
return ScriptObject();
JSValue functionValue = comp.value();
CallData callData;
- CallType callType = functionValue.getCallData(callData);
+ CallType callType = getCallData(functionValue, callData);
if (callType == CallTypeNone)
return ScriptObject();
diff --git a/WebCore/bindings/js/JSInt16ArrayConstructor.cpp b/WebCore/bindings/js/JSInt16ArrayConstructor.cpp
index c8f725f..aaed578 100644
--- a/WebCore/bindings/js/JSInt16ArrayConstructor.cpp
+++ b/WebCore/bindings/js/JSInt16ArrayConstructor.cpp
@@ -46,19 +46,34 @@ const ClassInfo JSInt16ArrayConstructor::s_info = { "Int16ArrayConstructor", &JS
JSInt16ArrayConstructor::JSInt16ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorObject(JSInt16ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject)
{
- putDirect(exec->propertyNames().prototype, JSInt16ArrayPrototype::self(exec, globalObject), None);
- putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
+ putDirect(exec->propertyNames().prototype, JSInt16ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly);
}
-static JSObject* constructCanvasShortArray(ExecState* exec, JSObject* constructor, const ArgList& args)
+JSObject* JSInt16ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
- JSInt16ArrayConstructor* jsConstructor = static_cast<JSInt16ArrayConstructor*>(constructor);
+ return new (exec) JSInt16ArrayPrototype(globalObject, JSInt16ArrayPrototype::createStructure(globalObject->objectPrototype()));
+}
+
+bool JSInt16ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<JSInt16ArrayConstructor, DOMObject>(exec, JSInt16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot);
+}
+
+bool JSInt16ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<JSInt16ArrayConstructor, DOMObject>(exec, JSInt16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructCanvasShortArray(ExecState* exec)
+{
+ ArgList args(exec);
+ JSInt16ArrayConstructor* jsConstructor = static_cast<JSInt16ArrayConstructor*>(exec->callee());
RefPtr<Int16Array> array = static_cast<Int16Array*>(construct<Int16Array, short>(exec, args).get());
if (!array.get()) {
setDOMException(exec, INDEX_SIZE_ERR);
- return 0;
+ return JSValue::encode(JSValue());
}
- return asObject(toJS(exec, jsConstructor->globalObject(), array.get()));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get())));
}
JSC::ConstructType JSInt16ArrayConstructor::getConstructData(JSC::ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSInt16ArrayConstructor.h b/WebCore/bindings/js/JSInt16ArrayConstructor.h
index fb132e3..87908a0 100644
--- a/WebCore/bindings/js/JSInt16ArrayConstructor.h
+++ b/WebCore/bindings/js/JSInt16ArrayConstructor.h
@@ -32,13 +32,24 @@
namespace WebCore {
class JSInt16ArrayConstructor : public DOMConstructorObject {
+ typedef DOMConstructorObject Base;
public:
JSInt16ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*);
+ static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);
+ virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
static const JSC::ClassInfo s_info;
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
private:
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+ protected:
+ static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
};
}
diff --git a/WebCore/bindings/js/JSInt32ArrayConstructor.cpp b/WebCore/bindings/js/JSInt32ArrayConstructor.cpp
index 5f79f1f..b44c9ca 100644
--- a/WebCore/bindings/js/JSInt32ArrayConstructor.cpp
+++ b/WebCore/bindings/js/JSInt32ArrayConstructor.cpp
@@ -45,19 +45,34 @@ const ClassInfo JSInt32ArrayConstructor::s_info = { "Int32ArrayConstructor", &JS
JSInt32ArrayConstructor::JSInt32ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorObject(JSInt32ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject)
{
- putDirect(exec->propertyNames().prototype, JSInt32ArrayPrototype::self(exec, globalObject), None);
- putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
+ putDirect(exec->propertyNames().prototype, JSInt32ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly);
}
-static JSObject* constructCanvasIntArray(ExecState* exec, JSObject* constructor, const ArgList& args)
+JSObject* JSInt32ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
- JSInt32ArrayConstructor* jsConstructor = static_cast<JSInt32ArrayConstructor*>(constructor);
+ return new (exec) JSInt32ArrayPrototype(globalObject, JSInt32ArrayPrototype::createStructure(globalObject->objectPrototype()));
+}
+
+bool JSInt32ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<JSInt32ArrayConstructor, DOMObject>(exec, JSInt32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot);
+}
+
+bool JSInt32ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<JSInt32ArrayConstructor, DOMObject>(exec, JSInt32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructCanvasIntArray(ExecState* exec)
+{
+ ArgList args(exec);
+ JSInt32ArrayConstructor* jsConstructor = static_cast<JSInt32ArrayConstructor*>(exec->callee());
RefPtr<Int32Array> array = static_cast<Int32Array*>(construct<Int32Array, int>(exec, args).get());
if (!array.get()) {
setDOMException(exec, INDEX_SIZE_ERR);
- return 0;
+ return JSValue::encode(JSValue());
}
- return asObject(toJS(exec, jsConstructor->globalObject(), array.get()));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get())));
}
JSC::ConstructType JSInt32ArrayConstructor::getConstructData(JSC::ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSInt32ArrayConstructor.h b/WebCore/bindings/js/JSInt32ArrayConstructor.h
index f15358c..6bed3c4 100644
--- a/WebCore/bindings/js/JSInt32ArrayConstructor.h
+++ b/WebCore/bindings/js/JSInt32ArrayConstructor.h
@@ -32,13 +32,24 @@
namespace WebCore {
class JSInt32ArrayConstructor : public DOMConstructorObject {
+ typedef DOMConstructorObject Base;
public:
JSInt32ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*);
+ static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);
+ virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
static const JSC::ClassInfo s_info;
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
private:
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+ protected:
+ static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
};
}
diff --git a/WebCore/bindings/js/JSInt8ArrayConstructor.cpp b/WebCore/bindings/js/JSInt8ArrayConstructor.cpp
index ad922fe..e4c5688 100644
--- a/WebCore/bindings/js/JSInt8ArrayConstructor.cpp
+++ b/WebCore/bindings/js/JSInt8ArrayConstructor.cpp
@@ -45,19 +45,34 @@ const ClassInfo JSInt8ArrayConstructor::s_info = { "Int8ArrayConstructor", &JSAr
JSInt8ArrayConstructor::JSInt8ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorObject(JSInt8ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject)
{
- putDirect(exec->propertyNames().prototype, JSInt8ArrayPrototype::self(exec, globalObject), None);
- putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
+ putDirect(exec->propertyNames().prototype, JSInt8ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly);
}
-static JSObject* constructCanvasByteArray(ExecState* exec, JSObject* constructor, const ArgList& args)
+JSObject* JSInt8ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
- JSInt8ArrayConstructor* jsConstructor = static_cast<JSInt8ArrayConstructor*>(constructor);
+ return new (exec) JSInt8ArrayPrototype(globalObject, JSInt8ArrayPrototype::createStructure(globalObject->objectPrototype()));
+}
+
+bool JSInt8ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<JSInt8ArrayConstructor, DOMObject>(exec, JSInt8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot);
+}
+
+bool JSInt8ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<JSInt8ArrayConstructor, DOMObject>(exec, JSInt8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructCanvasByteArray(ExecState* exec)
+{
+ ArgList args(exec);
+ JSInt8ArrayConstructor* jsConstructor = static_cast<JSInt8ArrayConstructor*>(exec->callee());
RefPtr<Int8Array> array = static_cast<Int8Array*>(construct<Int8Array, signed char>(exec, args).get());
if (!array.get()) {
setDOMException(exec, INDEX_SIZE_ERR);
- return 0;
+ return JSValue::encode(JSValue());
}
- return asObject(toJS(exec, jsConstructor->globalObject(), array.get()));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get())));
}
JSC::ConstructType JSInt8ArrayConstructor::getConstructData(JSC::ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSInt8ArrayConstructor.h b/WebCore/bindings/js/JSInt8ArrayConstructor.h
index 4a9bd3a..96482fc 100644
--- a/WebCore/bindings/js/JSInt8ArrayConstructor.h
+++ b/WebCore/bindings/js/JSInt8ArrayConstructor.h
@@ -32,13 +32,24 @@
namespace WebCore {
class JSInt8ArrayConstructor : public DOMConstructorObject {
+ typedef DOMConstructorObject Base;
public:
JSInt8ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*);
+ static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);
+ virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
static const JSC::ClassInfo s_info;
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
private:
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+ protected:
+ static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
};
}
diff --git a/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp b/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
index 6c04930..0f47b7b 100644
--- a/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
+++ b/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
@@ -30,6 +30,7 @@
#include "JavaScriptCallFrame.h"
#include <runtime/ArrayPrototype.h>
+#include <runtime/Error.h>
using namespace JSC;
@@ -41,7 +42,7 @@ JSValue JSJavaScriptCallFrame::evaluate(ExecState* exec)
JSValue result = impl()->evaluate(exec->argument(0).toString(exec), exception);
if (exception)
- exec->setException(exception);
+ throwError(exec, exception);
return result;
}
diff --git a/WebCore/bindings/js/JSMessageChannelConstructor.cpp b/WebCore/bindings/js/JSMessageChannelConstructor.cpp
index 9721ba3..b188ed5 100644
--- a/WebCore/bindings/js/JSMessageChannelConstructor.cpp
+++ b/WebCore/bindings/js/JSMessageChannelConstructor.cpp
@@ -54,14 +54,14 @@ ConstructType JSMessageChannelConstructor::getConstructData(ConstructData& const
return ConstructTypeHost;
}
-JSObject* JSMessageChannelConstructor::construct(ExecState* exec, JSObject* constructor, const ArgList&)
+EncodedJSValue JSC_HOST_CALL JSMessageChannelConstructor::construct(ExecState* exec)
{
- JSMessageChannelConstructor* jsConstructor = static_cast<JSMessageChannelConstructor*>(constructor);
+ JSMessageChannelConstructor* jsConstructor = static_cast<JSMessageChannelConstructor*>(exec->callee());
ScriptExecutionContext* context = jsConstructor->scriptExecutionContext();
if (!context)
- return throwError(exec, ReferenceError, "MessageChannel constructor associated document is unavailable");
+ return throwVMError(exec, createReferenceError(exec, "MessageChannel constructor associated document is unavailable"));
- return asObject(toJS(exec, jsConstructor->globalObject(), MessageChannel::create(context)));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), MessageChannel::create(context))));
}
} // namespace WebCore
diff --git a/WebCore/bindings/js/JSMessageChannelConstructor.h b/WebCore/bindings/js/JSMessageChannelConstructor.h
index d958760..decf05b 100644
--- a/WebCore/bindings/js/JSMessageChannelConstructor.h
+++ b/WebCore/bindings/js/JSMessageChannelConstructor.h
@@ -38,7 +38,7 @@ namespace WebCore {
static const JSC::ClassInfo s_info;
virtual bool implementsHasInstance() const { return true; }
- static JSC::JSObject* construct(JSC::ExecState*, JSC::JSObject*, const JSC::ArgList&);
+ static JSC::EncodedJSValue JSC_HOST_CALL construct(JSC::ExecState*);
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
};
diff --git a/WebCore/bindings/js/JSMessagePortCustom.cpp b/WebCore/bindings/js/JSMessagePortCustom.cpp
index 79c1811..227d6ed 100644
--- a/WebCore/bindings/js/JSMessagePortCustom.cpp
+++ b/WebCore/bindings/js/JSMessagePortCustom.cpp
@@ -86,7 +86,7 @@ void fillMessagePortArray(JSC::ExecState* exec, JSC::JSValue value, MessagePortA
// Validation of Objects implementing an interface, per WebIDL spec 4.1.15.
RefPtr<MessagePort> port = toMessagePort(value);
if (!port) {
- throwError(exec, TypeError);
+ throwTypeError(exec);
return;
}
portArray[i] = port.release();
diff --git a/WebCore/bindings/js/JSNodeFilterCondition.cpp b/WebCore/bindings/js/JSNodeFilterCondition.cpp
index d34f5c1..b723286 100644
--- a/WebCore/bindings/js/JSNodeFilterCondition.cpp
+++ b/WebCore/bindings/js/JSNodeFilterCondition.cpp
@@ -46,7 +46,7 @@ short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode)
JSLock lock(SilenceAssertionsOnly);
CallData callData;
- CallType callType = m_filter.getCallData(callData);
+ CallType callType = getCallData(m_filter, callData);
if (callType == CallTypeNone)
return NodeFilter::FILTER_ACCEPT;
diff --git a/WebCore/bindings/js/JSNodeListCustom.cpp b/WebCore/bindings/js/JSNodeListCustom.cpp
index 6d51943..dd59c15 100644
--- a/WebCore/bindings/js/JSNodeListCustom.cpp
+++ b/WebCore/bindings/js/JSNodeListCustom.cpp
@@ -36,13 +36,13 @@ using namespace JSC;
namespace WebCore {
// Need to support call so that list(0) works.
-static JSValue JSC_HOST_CALL callNodeList(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callNodeList(ExecState* exec)
{
bool ok;
unsigned index = exec->argument(0).toString(exec).toUInt32(&ok);
if (!ok)
- return jsUndefined();
- return toJS(exec, static_cast<JSNodeList*>(exec->callee())->impl()->item(index));
+ return JSValue::encode(jsUndefined());
+ return JSValue::encode(toJS(exec, static_cast<JSNodeList*>(exec->callee())->impl()->item(index)));
}
CallType JSNodeList::getCallData(CallData& callData)
diff --git a/WebCore/bindings/js/JSOptionConstructor.cpp b/WebCore/bindings/js/JSOptionConstructor.cpp
index 8b29136..d0a51cd 100644
--- a/WebCore/bindings/js/JSOptionConstructor.cpp
+++ b/WebCore/bindings/js/JSOptionConstructor.cpp
@@ -42,31 +42,31 @@ JSOptionConstructor::JSOptionConstructor(ExecState* exec, JSDOMGlobalObject* glo
putDirect(exec->propertyNames().length, jsNumber(exec, 4), ReadOnly|DontDelete|DontEnum);
}
-static JSObject* constructHTMLOptionElement(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructHTMLOptionElement(ExecState* exec)
{
- JSOptionConstructor* jsConstructor = static_cast<JSOptionConstructor*>(constructor);
+ JSOptionConstructor* jsConstructor = static_cast<JSOptionConstructor*>(exec->callee());
Document* document = jsConstructor->document();
if (!document)
- return throwError(exec, ReferenceError, "Option constructor associated document is unavailable");
+ return throwVMError(exec, createReferenceError(exec, "Option constructor associated document is unavailable"));
String data;
- if (!args.at(0).isUndefined())
- data = ustringToString(args.at(0).toString(exec));
+ if ((exec->argumentCount() >= 1) && !exec->argument(0).isUndefined())
+ data = ustringToString(exec->argument(0).toString(exec));
String value;
- if (!args.at(1).isUndefined())
- value = ustringToString(args.at(1).toString(exec));
- bool defaultSelected = args.at(2).toBoolean(exec);
- bool selected = args.at(3).toBoolean(exec);
+ if ((exec->argumentCount() >= 2) && !exec->argument(1).isUndefined())
+ value = ustringToString(exec->argument(1).toString(exec));
+ bool defaultSelected = (exec->argumentCount() >= 3) && exec->argument(2).toBoolean(exec);
+ bool selected = (exec->argumentCount() >= 4) && exec->argument(3).toBoolean(exec);
ExceptionCode ec = 0;
RefPtr<HTMLOptionElement> element = HTMLOptionElement::createForJSConstructor(document, data, value, defaultSelected, selected, ec);
if (ec) {
setDOMException(exec, ec);
- return 0;
+ return JSValue::encode(JSValue());
}
- return asObject(toJS(exec, jsConstructor->globalObject(), element.release()));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), element.release())));
}
ConstructType JSOptionConstructor::getConstructData(ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSPluginElementFunctions.cpp b/WebCore/bindings/js/JSPluginElementFunctions.cpp
index a260782..7cc2e65 100644
--- a/WebCore/bindings/js/JSPluginElementFunctions.cpp
+++ b/WebCore/bindings/js/JSPluginElementFunctions.cpp
@@ -105,13 +105,13 @@ bool runtimeObjectCustomPut(ExecState* exec, const Identifier& propertyName, JSV
return true;
}
-static JSValue JSC_HOST_CALL callPlugin(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callPlugin(ExecState* exec)
{
Instance* instance = pluginInstance(static_cast<JSHTMLElement*>(exec->callee())->impl());
instance->begin();
JSValue result = instance->invokeDefaultMethod(exec);
instance->end();
- return result;
+ return JSValue::encode(result);
}
CallType runtimeObjectGetCallData(HTMLElement* element, CallData& callData)
diff --git a/WebCore/bindings/js/JSSVGMatrixCustom.cpp b/WebCore/bindings/js/JSSVGMatrixCustom.cpp
index 149da8a..56f735e 100644
--- a/WebCore/bindings/js/JSSVGMatrixCustom.cpp
+++ b/WebCore/bindings/js/JSSVGMatrixCustom.cpp
@@ -34,10 +34,10 @@ namespace WebCore {
JSValue JSSVGMatrix::multiply(ExecState* exec)
{
if (exec->argumentCount() < 1)
- return throwError(exec, SyntaxError, "Not enough arguments");
+ return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
if (!exec->argument(0).inherits(&JSSVGMatrix::s_info))
- return throwError(exec, TypeError, "secondMatrix argument was not a SVGMatrix");
+ return throwError(exec, createTypeError(exec, "secondMatrix argument was not a SVGMatrix"));
JSSVGMatrix* matrixObj = static_cast<JSSVGMatrix*>(asObject(exec->argument(0)));
diff --git a/WebCore/bindings/js/JSSharedWorkerConstructor.cpp b/WebCore/bindings/js/JSSharedWorkerConstructor.cpp
index a66b1f7..f2bf6de 100644
--- a/WebCore/bindings/js/JSSharedWorkerConstructor.cpp
+++ b/WebCore/bindings/js/JSSharedWorkerConstructor.cpp
@@ -53,20 +53,20 @@ JSSharedWorkerConstructor::JSSharedWorkerConstructor(ExecState* exec, JSDOMGloba
putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
}
-static JSObject* constructSharedWorker(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructSharedWorker(ExecState* exec)
{
- JSSharedWorkerConstructor* jsConstructor = static_cast<JSSharedWorkerConstructor*>(constructor);
+ JSSharedWorkerConstructor* jsConstructor = static_cast<JSSharedWorkerConstructor*>(exec->callee());
- if (args.size() < 1)
- return throwError(exec, SyntaxError, "Not enough arguments");
+ if (exec->argumentCount() < 1)
+ return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
- UString scriptURL = args.at(0).toString(exec);
+ UString scriptURL = exec->argument(0).toString(exec);
UString name;
- if (args.size() > 1)
- name = args.at(1).toString(exec);
+ if (exec->argumentCount() > 1)
+ name = exec->argument(1).toString(exec);
if (exec->hadException())
- return 0;
+ return JSValue::encode(JSValue());
// FIXME: We need to use both the dynamic scope and the lexical scope (dynamic scope for resolving the worker URL)
DOMWindow* window = asJSDOMWindow(exec->lexicalGlobalObject())->impl();
@@ -74,7 +74,7 @@ static JSObject* constructSharedWorker(ExecState* exec, JSObject* constructor, c
RefPtr<SharedWorker> worker = SharedWorker::create(ustringToString(scriptURL), ustringToString(name), window->document(), ec);
setDOMException(exec, ec);
- return asObject(toJS(exec, jsConstructor->globalObject(), worker.release()));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), worker.release())));
}
ConstructType JSSharedWorkerConstructor::getConstructData(ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSUint16ArrayConstructor.cpp b/WebCore/bindings/js/JSUint16ArrayConstructor.cpp
index 243c3a1..b1770c5 100644
--- a/WebCore/bindings/js/JSUint16ArrayConstructor.cpp
+++ b/WebCore/bindings/js/JSUint16ArrayConstructor.cpp
@@ -45,19 +45,34 @@ const ClassInfo JSUint16ArrayConstructor::s_info = { "Uint16ArrayConstructor", &
JSUint16ArrayConstructor::JSUint16ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorObject(JSUint16ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject)
{
- putDirect(exec->propertyNames().prototype, JSUint16ArrayPrototype::self(exec, globalObject), None);
- putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
+ putDirect(exec->propertyNames().prototype, JSUint16ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly);
}
-static JSObject* constructCanvasUnsignedShortArray(ExecState* exec, JSObject* constructor, const ArgList& args)
+JSObject* JSUint16ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
- JSUint16ArrayConstructor* jsConstructor = static_cast<JSUint16ArrayConstructor*>(constructor);
+ return new (exec) JSUint16ArrayPrototype(globalObject, JSUint16ArrayPrototype::createStructure(globalObject->objectPrototype()));
+}
+
+bool JSUint16ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<JSUint16ArrayConstructor, DOMObject>(exec, JSUint16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot);
+}
+
+bool JSUint16ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<JSUint16ArrayConstructor, DOMObject>(exec, JSUint16ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructCanvasUnsignedShortArray(ExecState* exec)
+{
+ ArgList args(exec);
+ JSUint16ArrayConstructor* jsConstructor = static_cast<JSUint16ArrayConstructor*>(exec->callee());
RefPtr<Uint16Array> array = static_cast<Uint16Array*>(construct<Uint16Array, unsigned short>(exec, args).get());
if (!array.get()) {
setDOMException(exec, INDEX_SIZE_ERR);
- return 0;
+ return JSValue::encode(JSValue());
}
- return asObject(toJS(exec, jsConstructor->globalObject(), array.get()));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get())));
}
JSC::ConstructType JSUint16ArrayConstructor::getConstructData(JSC::ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSUint16ArrayConstructor.h b/WebCore/bindings/js/JSUint16ArrayConstructor.h
index a146d00..b950791 100644
--- a/WebCore/bindings/js/JSUint16ArrayConstructor.h
+++ b/WebCore/bindings/js/JSUint16ArrayConstructor.h
@@ -32,13 +32,24 @@
namespace WebCore {
class JSUint16ArrayConstructor : public DOMConstructorObject {
+ typedef DOMConstructorObject Base;
public:
JSUint16ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*);
+ static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);
+ virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
static const JSC::ClassInfo s_info;
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
private:
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+ protected:
+ static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
};
}
diff --git a/WebCore/bindings/js/JSUint32ArrayConstructor.cpp b/WebCore/bindings/js/JSUint32ArrayConstructor.cpp
index b03f093..46ec9da 100644
--- a/WebCore/bindings/js/JSUint32ArrayConstructor.cpp
+++ b/WebCore/bindings/js/JSUint32ArrayConstructor.cpp
@@ -45,19 +45,34 @@ const ClassInfo JSUint32ArrayConstructor::s_info = { "Uint32ArrayConstructor", &
JSUint32ArrayConstructor::JSUint32ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorObject(JSUint32ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject)
{
- putDirect(exec->propertyNames().prototype, JSUint32ArrayPrototype::self(exec, globalObject), None);
- putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
+ putDirect(exec->propertyNames().prototype, JSUint32ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly);
}
-static JSObject* constructCanvasUnsignedIntArray(ExecState* exec, JSObject* constructor, const ArgList& args)
+JSObject* JSUint32ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
- JSUint32ArrayConstructor* jsConstructor = static_cast<JSUint32ArrayConstructor*>(constructor);
+ return new (exec) JSUint32ArrayPrototype(globalObject, JSUint32ArrayPrototype::createStructure(globalObject->objectPrototype()));
+}
+
+bool JSUint32ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<JSUint32ArrayConstructor, DOMObject>(exec, JSUint32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot);
+}
+
+bool JSUint32ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<JSUint32ArrayConstructor, DOMObject>(exec, JSUint32ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructCanvasUnsignedIntArray(ExecState* exec)
+{
+ ArgList args(exec);
+ JSUint32ArrayConstructor* jsConstructor = static_cast<JSUint32ArrayConstructor*>(exec->callee());
RefPtr<Uint32Array> array = static_cast<Uint32Array*>(construct<Uint32Array, unsigned int>(exec, args).get());
if (!array.get()) {
setDOMException(exec, INDEX_SIZE_ERR);
- return 0;
+ return JSValue::encode(JSValue());
}
- return asObject(toJS(exec, jsConstructor->globalObject(), array.get()));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get())));
}
JSC::ConstructType JSUint32ArrayConstructor::getConstructData(JSC::ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSUint32ArrayConstructor.h b/WebCore/bindings/js/JSUint32ArrayConstructor.h
index a00c071..7cad849 100644
--- a/WebCore/bindings/js/JSUint32ArrayConstructor.h
+++ b/WebCore/bindings/js/JSUint32ArrayConstructor.h
@@ -32,13 +32,24 @@
namespace WebCore {
class JSUint32ArrayConstructor : public DOMConstructorObject {
+ typedef DOMConstructorObject Base;
public:
JSUint32ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*);
+ static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);
+ virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
static const JSC::ClassInfo s_info;
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
private:
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+ protected:
+ static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
};
}
diff --git a/WebCore/bindings/js/JSUint8ArrayConstructor.cpp b/WebCore/bindings/js/JSUint8ArrayConstructor.cpp
index 531b860..0d47b51 100644
--- a/WebCore/bindings/js/JSUint8ArrayConstructor.cpp
+++ b/WebCore/bindings/js/JSUint8ArrayConstructor.cpp
@@ -46,19 +46,34 @@ const ClassInfo JSUint8ArrayConstructor::s_info = { "Uint8ArrayConstructor", &JS
JSUint8ArrayConstructor::JSUint8ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorObject(JSUint8ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject)
{
- putDirect(exec->propertyNames().prototype, JSUint8ArrayPrototype::self(exec, globalObject), None);
- putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
+ putDirect(exec->propertyNames().prototype, JSUint8ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly);
}
-static JSObject* constructCanvasUnsignedByteArray(ExecState* exec, JSObject* constructor, const ArgList& args)
+JSObject* JSUint8ArrayConstructor::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
- JSUint8ArrayConstructor* jsConstructor = static_cast<JSUint8ArrayConstructor*>(constructor);
+ return new (exec) JSUint8ArrayPrototype(globalObject, JSUint8ArrayPrototype::createStructure(globalObject->objectPrototype()));
+}
+
+bool JSUint8ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<JSUint8ArrayConstructor, DOMObject>(exec, JSUint8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, slot);
+}
+
+bool JSUint8ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<JSUint8ArrayConstructor, DOMObject>(exec, JSUint8ArrayPrototype::s_info.staticPropHashTable, this, propertyName, descriptor);
+}
+
+static EncodedJSValue JSC_HOST_CALL constructCanvasUnsignedByteArray(ExecState* exec)
+{
+ ArgList args(exec);
+ JSUint8ArrayConstructor* jsConstructor = static_cast<JSUint8ArrayConstructor*>(exec->callee());
RefPtr<Uint8Array> array = static_cast<Uint8Array*>(construct<Uint8Array, unsigned char>(exec, args).get());
if (!array.get()) {
setDOMException(exec, INDEX_SIZE_ERR);
- return 0;
+ return JSValue::encode(JSValue());
}
- return asObject(toJS(exec, jsConstructor->globalObject(), array.get()));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get())));
}
JSC::ConstructType JSUint8ArrayConstructor::getConstructData(JSC::ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSUint8ArrayConstructor.h b/WebCore/bindings/js/JSUint8ArrayConstructor.h
index 05db4ee..644cf86 100644
--- a/WebCore/bindings/js/JSUint8ArrayConstructor.h
+++ b/WebCore/bindings/js/JSUint8ArrayConstructor.h
@@ -32,13 +32,24 @@
namespace WebCore {
class JSUint8ArrayConstructor : public DOMConstructorObject {
+ typedef DOMConstructorObject Base;
public:
JSUint8ArrayConstructor(JSC::ExecState*, JSDOMGlobalObject*);
+ static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);
+ virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
static const JSC::ClassInfo s_info;
+ static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
private:
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+ protected:
+ static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
};
}
diff --git a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
index 02dae08..eb4f549 100644
--- a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
+++ b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
@@ -36,7 +36,7 @@
#include "JSHTMLImageElement.h"
#include "JSImageData.h"
#include "JSWebGLBuffer.h"
-#include "JSFloatArray.h"
+#include "JSFloat32Array.h"
#include "JSWebGLFramebuffer.h"
#include "JSInt32Array.h"
#include "JSWebGLProgram.h"
@@ -48,7 +48,7 @@
#include "JSWebKitCSSMatrix.h"
#include "NotImplemented.h"
#include "WebGLBuffer.h"
-#include "FloatArray.h"
+#include "Float32Array.h"
#include "WebGLFramebuffer.h"
#include "WebGLGetInfo.h"
#include "Int32Array.h"
@@ -67,45 +67,6 @@ using namespace JSC;
namespace WebCore {
-JSValue JSWebGLRenderingContext::bufferData(JSC::ExecState* exec)
-{
- if (exec->argumentCount() != 3)
- return throwError(exec, SyntaxError);
-
- unsigned target = exec->argument(0).toInt32(exec);
- unsigned usage = exec->argument(2).toInt32(exec);
- ExceptionCode ec = 0;
-
- // If argument 1 is a number, we are initializing this buffer to that size
- if (!exec->argument(1).isObject()) {
- unsigned int count = exec->argument(1).toInt32(exec);
- static_cast<WebGLRenderingContext*>(impl())->bufferData(target, count, usage, ec);
- } else {
- ArrayBufferView* array = toArrayBufferView(exec->argument(1));
- static_cast<WebGLRenderingContext*>(impl())->bufferData(target, array, usage, ec);
- }
-
- setDOMException(exec, ec);
- return jsUndefined();
-}
-
-JSValue JSWebGLRenderingContext::bufferSubData(JSC::ExecState* exec)
-{
- if (exec->argumentCount() != 3)
- return throwError(exec, SyntaxError);
-
- unsigned target = exec->argument(0).toInt32(exec);
- unsigned offset = exec->argument(1).toInt32(exec);
- ExceptionCode ec = 0;
-
- ArrayBufferView* array = toArrayBufferView(exec->argument(2));
-
- static_cast<WebGLRenderingContext*>(impl())->bufferSubData(target, offset, array, ec);
-
- setDOMException(exec, ec);
- return jsUndefined();
-}
-
static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, const WebGLGetInfo& info)
{
switch (info.getType()) {
@@ -152,7 +113,7 @@ enum ObjectType {
static JSValue getObjectParameter(JSWebGLRenderingContext* obj, ExecState* exec, ObjectType objectType)
{
if (exec->argumentCount() != 2)
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(obj->impl());
@@ -200,7 +161,7 @@ JSValue JSWebGLRenderingContext::getBufferParameter(ExecState* exec)
JSValue JSWebGLRenderingContext::getFramebufferAttachmentParameter(ExecState* exec)
{
if (exec->argumentCount() != 3)
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
@@ -224,7 +185,7 @@ JSValue JSWebGLRenderingContext::getFramebufferAttachmentParameter(ExecState* ex
JSValue JSWebGLRenderingContext::getParameter(ExecState* exec)
{
if (exec->argumentCount() != 1)
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
@@ -242,7 +203,7 @@ JSValue JSWebGLRenderingContext::getParameter(ExecState* exec)
JSValue JSWebGLRenderingContext::getProgramParameter(ExecState* exec)
{
if (exec->argumentCount() != 2)
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
@@ -266,7 +227,7 @@ JSValue JSWebGLRenderingContext::getRenderbufferParameter(ExecState* exec)
JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec)
{
if (exec->argumentCount() != 2)
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
@@ -290,7 +251,7 @@ JSValue JSWebGLRenderingContext::getTexParameter(ExecState* exec)
JSValue JSWebGLRenderingContext::getUniform(ExecState* exec)
{
if (exec->argumentCount() != 2)
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
@@ -311,207 +272,6 @@ JSValue JSWebGLRenderingContext::getVertexAttrib(ExecState* exec)
return getObjectParameter(this, exec, kVertexAttrib);
}
-// void texImage2D(in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, in GLint border, in GLenum format, in GLenum type, in ArrayBufferView pixels);
-// void texImage2D(in GLenum target, in GLint level, in ImageData pixels, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
-// void texImage2D(in GLenum target, in GLint level, in HTMLImageElement image, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha);
-// void texImage2D(in GLenum target, in GLint level, in HTMLCanvasElement canvas, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha);
-// void texImage2D(in GLenum target, in GLint level, in HTMLVideoElement video, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha);
-JSValue JSWebGLRenderingContext::texImage2D(ExecState* exec)
-{
- if (exec->argumentCount() < 3 || exec->argumentCount() > 9)
- return throwError(exec, SyntaxError);
-
- ExceptionCode ec = 0;
-
- WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
- unsigned target = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned level = exec->argument(1).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- JSObject* o = 0;
-
- if (exec->argumentCount() <= 5) {
- // This is one of the last 4 forms. Param 2 can be ImageData or <img>, <canvas> or <video> element.
- JSValue value = exec->argument(2);
-
- if (!value.isObject())
- return throwError(exec, TypeError);
-
- o = asObject(value);
-
- bool flipY = exec->argument(3).toBoolean(exec);
- bool premultiplyAlpha = exec->argument(4).toBoolean(exec);
-
- if (o->inherits(&JSImageData::s_info)) {
- ImageData* data = static_cast<ImageData*>(static_cast<JSImageData*>(o)->impl());
- context->texImage2D(target, level, data, flipY, premultiplyAlpha, ec);
- } else if (o->inherits(&JSHTMLImageElement::s_info)) {
- HTMLImageElement* element = static_cast<HTMLImageElement*>(static_cast<JSHTMLImageElement*>(o)->impl());
- context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
- } else if (o->inherits(&JSHTMLCanvasElement::s_info)) {
- HTMLCanvasElement* element = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(o)->impl());
- context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
-#if ENABLE(VIDEO)
- } else if (o->inherits(&JSHTMLVideoElement::s_info)) {
- HTMLVideoElement* element = static_cast<HTMLVideoElement*>(static_cast<JSHTMLVideoElement*>(o)->impl());
- context->texImage2D(target, level, element, flipY, premultiplyAlpha, ec);
-#endif
- } else
- ec = TYPE_MISMATCH_ERR;
- } else {
- if (exec->argumentCount() != 9)
- return throwError(exec, SyntaxError);
-
- // This must be the ArrayBufferView case
- unsigned internalformat = exec->argument(2).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned width = exec->argument(3).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned height = exec->argument(4).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned border = exec->argument(5).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned format = exec->argument(6).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned type = exec->argument(7).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- JSValue value = exec->argument(8);
-
- // For this case passing 0 (for a null array) is allowed
- if (value.isNull())
- context->texImage2D(target, level, internalformat, width, height, border, format, type, 0, ec);
- else if (value.isObject()) {
- o = asObject(value);
-
- if (o->inherits(&JSArrayBufferView::s_info)) {
- // FIXME: Need to check to make sure ArrayBufferView is a Int8Array or Int16Array,
- // depending on the passed type parameter.
- ArrayBufferView* obj = static_cast<ArrayBufferView*>(static_cast<JSArrayBufferView*>(o)->impl());
- context->texImage2D(target, level, internalformat, width, height, border, format, type, obj, ec);
- } else
- return throwError(exec, TypeError);
- } else
- return throwError(exec, TypeError);
- }
-
- setDOMException(exec, ec);
- return jsUndefined();
-}
-
-// 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 ArrayBufferView 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);
-JSValue JSWebGLRenderingContext::texSubImage2D(ExecState* exec)
-{
- if (exec->argumentCount() < 5 || exec->argumentCount() > 9)
- return throwError(exec, SyntaxError);
-
- ExceptionCode ec = 0;
-
- WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
- unsigned target = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned level = exec->argument(1).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned xoff = exec->argument(2).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned yoff = exec->argument(3).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- JSObject* o = 0;
-
- if (exec->argumentCount() <= 7) {
- // This is one of the last 4 forms. Param 4 can be <img>, <canvas> or <video> element, of the format param.
- JSValue value = exec->argument(4);
-
- if (!value.isObject())
- return throwError(exec, SyntaxError);
-
- o = asObject(value);
-
- bool flipY = exec->argument(5).toBoolean(exec);
- bool premultiplyAlpha = exec->argument(6).toBoolean(exec);
-
- if (o->inherits(&JSImageData::s_info)) {
- ImageData* data = static_cast<ImageData*>(static_cast<JSImageData*>(o)->impl());
- context->texSubImage2D(target, level, xoff, yoff, data, flipY, premultiplyAlpha, ec);
- } else if (o->inherits(&JSHTMLImageElement::s_info)) {
- HTMLImageElement* element = static_cast<HTMLImageElement*>(static_cast<JSHTMLImageElement*>(o)->impl());
- context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
- } else if (o->inherits(&JSHTMLCanvasElement::s_info)) {
- HTMLCanvasElement* element = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(o)->impl());
- context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
-#if ENABLE(VIDEO)
- } else if (o->inherits(&JSHTMLVideoElement::s_info)) {
- HTMLVideoElement* element = static_cast<HTMLVideoElement*>(static_cast<JSHTMLVideoElement*>(o)->impl());
- context->texSubImage2D(target, level, xoff, yoff, element, flipY, premultiplyAlpha, ec);
-#endif
- } else
- ec = TYPE_MISMATCH_ERR;
- } else {
- // This must be the ArrayBufferView form
- if (exec->argumentCount() != 9)
- return throwError(exec, SyntaxError);
-
- unsigned width = exec->argument(4).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned height = exec->argument(5).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned format = exec->argument(6).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- unsigned type = exec->argument(7).toInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- JSValue value = exec->argument(8);
- if (!value.isObject())
- context->texSubImage2D(target, level, xoff, yoff, width, height, format, type, 0, ec);
- else {
- o = asObject(value);
-
- if (o->inherits(&JSArrayBufferView::s_info)) {
- ArrayBufferView* obj = static_cast<ArrayBufferView*>(static_cast<JSArrayBufferView*>(o)->impl());
- context->texSubImage2D(target, level, xoff, yoff, width, height, format, type, obj, ec);
- } else
- return throwError(exec, TypeError);
- }
- }
-
- setDOMException(exec, ec);
- return jsUndefined();
-}
-
template<typename T, size_t inlineCapacity>
bool toVector(JSC::ExecState* exec, JSC::JSValue value, Vector<T, inlineCapacity>& vector)
{
@@ -558,7 +318,7 @@ static bool functionForUniform(DataFunctionToCall f)
static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, WebGLRenderingContext* context)
{
if (exec->argumentCount() != 2)
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
WebGLUniformLocation* location = 0;
long index = -1;
@@ -571,7 +331,7 @@ static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, We
if (exec->hadException())
return jsUndefined();
- RefPtr<FloatArray> webGLArray = toFloatArray(exec->argument(1));
+ RefPtr<Float32Array> webGLArray = toFloat32Array(exec->argument(1));
if (exec->hadException())
return jsUndefined();
@@ -610,7 +370,7 @@ static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, We
Vector<float, 64> array;
if (!toVector(exec, exec->argument(1), array))
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
switch (f) {
case f_uniform1v:
@@ -646,7 +406,7 @@ static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, We
static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, WebGLRenderingContext* context)
{
if (exec->argumentCount() != 2)
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
WebGLUniformLocation* location = toWebGLUniformLocation(exec->argument(0));
@@ -683,7 +443,7 @@ static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, We
Vector<int, 64> array;
if (!toVector(exec, exec->argument(1), array))
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
switch (f) {
case f_uniform1v:
@@ -709,7 +469,7 @@ static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, We
static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecState* exec, WebGLRenderingContext* context)
{
if (exec->argumentCount() != 3)
- return throwError(exec, SyntaxError);
+ return throwSyntaxError(exec);
WebGLUniformLocation* location = toWebGLUniformLocation(exec->argument(0));
@@ -720,7 +480,7 @@ static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecStat
if (exec->hadException())
return jsUndefined();
- RefPtr<FloatArray> webGLArray = toFloatArray(exec->argument(2));
+ RefPtr<Float32Array> webGLArray = toFloat32Array(exec->argument(2));
if (exec->hadException())
return jsUndefined();
@@ -744,7 +504,7 @@ static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecStat
Vector<float, 64> array;
if (!toVector(exec, exec->argument(2), array))
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
switch (f) {
case f_uniformMatrix2fv:
diff --git a/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp b/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp
index baf174e..5013a6d 100644
--- a/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp
+++ b/WebCore/bindings/js/JSWebKitCSSMatrixConstructor.cpp
@@ -42,17 +42,17 @@ JSWebKitCSSMatrixConstructor::JSWebKitCSSMatrixConstructor(ExecState* exec, JSDO
putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
}
-static JSObject* constructWebKitCSSMatrix(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWebKitCSSMatrix(ExecState* exec)
{
- JSWebKitCSSMatrixConstructor* jsConstructor = static_cast<JSWebKitCSSMatrixConstructor*>(constructor);
+ JSWebKitCSSMatrixConstructor* jsConstructor = static_cast<JSWebKitCSSMatrixConstructor*>(exec->callee());
String s;
- if (args.size() >= 1)
- s = ustringToString(args.at(0).toString(exec));
+ if (exec->argumentCount() >= 1)
+ s = ustringToString(exec->argument(0).toString(exec));
ExceptionCode ec = 0;
RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(s, ec);
setDOMException(exec, ec);
- return CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), WebKitCSSMatrix, matrix.get());
+ return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), WebKitCSSMatrix, matrix.get()));
}
ConstructType JSWebKitCSSMatrixConstructor::getConstructData(ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSWebKitPointConstructor.cpp b/WebCore/bindings/js/JSWebKitPointConstructor.cpp
index 27cc1db..c62f5b6 100644
--- a/WebCore/bindings/js/JSWebKitPointConstructor.cpp
+++ b/WebCore/bindings/js/JSWebKitPointConstructor.cpp
@@ -43,21 +43,21 @@ JSWebKitPointConstructor::JSWebKitPointConstructor(ExecState* exec, JSDOMGlobalO
putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly|DontDelete|DontEnum);
}
-static JSObject* constructWebKitPoint(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWebKitPoint(ExecState* exec)
{
- JSWebKitPointConstructor* jsConstructor = static_cast<JSWebKitPointConstructor*>(constructor);
+ JSWebKitPointConstructor* jsConstructor = static_cast<JSWebKitPointConstructor*>(exec->callee());
float x = 0;
float y = 0;
- if (args.size() >= 2) {
- x = (float)args.at(0).toNumber(exec);
- y = (float)args.at(1).toNumber(exec);
+ if (exec->argumentCount() >= 2) {
+ x = (float)exec->argument(0).toNumber(exec);
+ y = (float)exec->argument(1).toNumber(exec);
if (isnan(x))
x = 0;
if (isnan(y))
y = 0;
}
- return asObject(toJS(exec, jsConstructor->globalObject(), WebKitPoint::create(x, y)));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), WebKitPoint::create(x, y))));
}
JSC::ConstructType JSWebKitPointConstructor::getConstructData(JSC::ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSWebSocketConstructor.cpp b/WebCore/bindings/js/JSWebSocketConstructor.cpp
index 57b7477..2384c7b 100644
--- a/WebCore/bindings/js/JSWebSocketConstructor.cpp
+++ b/WebCore/bindings/js/JSWebSocketConstructor.cpp
@@ -54,32 +54,32 @@ JSWebSocketConstructor::JSWebSocketConstructor(ExecState* exec, JSDOMGlobalObjec
putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);
}
-static JSObject* constructWebSocket(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWebSocket(ExecState* exec)
{
- JSWebSocketConstructor* jsConstructor = static_cast<JSWebSocketConstructor*>(constructor);
+ JSWebSocketConstructor* jsConstructor = static_cast<JSWebSocketConstructor*>(exec->callee());
ScriptExecutionContext* context = jsConstructor->scriptExecutionContext();
if (!context)
- return throwError(exec, ReferenceError, "WebSocket constructor associated document is unavailable");
+ return throwVMError(exec, createReferenceError(exec, "WebSocket constructor associated document is unavailable"));
- if (args.size() == 0)
- return throwError(exec, SyntaxError, "Not enough arguments");
+ if (!exec->argumentCount())
+ return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
- const String& urlString = ustringToString(args.at(0).toString(exec));
+ const String& urlString = ustringToString(exec->argument(0).toString(exec));
if (exec->hadException())
- return throwError(exec, SyntaxError, "wrong URL");
+ return throwVMError(exec, createSyntaxError(exec, "wrong URL"));
const KURL& url = context->completeURL(urlString);
RefPtr<WebSocket> webSocket = WebSocket::create(context);
ExceptionCode ec = 0;
- if (args.size() < 2)
+ if (exec->argumentCount() < 2)
webSocket->connect(url, ec);
else {
- const String& protocol = ustringToString(args.at(1).toString(exec));
+ const String& protocol = ustringToString(exec->argument(1).toString(exec));
if (exec->hadException())
- return 0;
+ return JSValue::encode(JSValue());
webSocket->connect(url, protocol, ec);
}
setDOMException(exec, ec);
- return CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), WebSocket, webSocket.get());
+ return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), WebSocket, webSocket.get()));
}
ConstructType JSWebSocketConstructor::getConstructData(ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp
index 81b5b9e..eb0fda0 100644
--- a/WebCore/bindings/js/JSWebSocketCustom.cpp
+++ b/WebCore/bindings/js/JSWebSocketCustom.cpp
@@ -48,11 +48,11 @@ namespace WebCore {
JSValue JSWebSocket::send(ExecState* exec)
{
if (exec->argumentCount() < 1)
- return throwError(exec, SyntaxError, "Not enough arguments");
+ return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
const String& msg = ustringToString(exec->argument(0).toString(exec));
if (exec->hadException())
- return throwError(exec, SyntaxError, "bad message data.");
+ return throwError(exec, createSyntaxError(exec, "bad message data."));
ExceptionCode ec = 0;
JSValue ret = jsBoolean(impl()->send(msg, ec));
setDOMException(exec, ec);
diff --git a/WebCore/bindings/js/JSWorkerConstructor.cpp b/WebCore/bindings/js/JSWorkerConstructor.cpp
index 43c685e..13d8ddc 100644
--- a/WebCore/bindings/js/JSWorkerConstructor.cpp
+++ b/WebCore/bindings/js/JSWorkerConstructor.cpp
@@ -49,16 +49,16 @@ JSWorkerConstructor::JSWorkerConstructor(ExecState* exec, JSDOMGlobalObject* glo
putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
}
-static JSObject* constructWorker(ExecState* exec, JSObject* constructor, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWorker(ExecState* exec)
{
- JSWorkerConstructor* jsConstructor = static_cast<JSWorkerConstructor*>(constructor);
+ JSWorkerConstructor* jsConstructor = static_cast<JSWorkerConstructor*>(exec->callee());
- if (args.size() == 0)
- return throwError(exec, SyntaxError, "Not enough arguments");
+ if (!exec->argumentCount())
+ return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
- UString scriptURL = args.at(0).toString(exec);
+ UString scriptURL = exec->argument(0).toString(exec);
if (exec->hadException())
- return 0;
+ return JSValue::encode(JSValue());
// See section 4.8.2 step 14 of WebWorkers for why this is the lexicalGlobalObject.
DOMWindow* window = asJSDOMWindow(exec->lexicalGlobalObject())->impl();
@@ -67,10 +67,10 @@ static JSObject* constructWorker(ExecState* exec, JSObject* constructor, const A
RefPtr<Worker> worker = Worker::create(ustringToString(scriptURL), window->document(), ec);
if (ec) {
setDOMException(exec, ec);
- return 0;
+ return JSValue::encode(JSValue());
}
- return asObject(toJS(exec, jsConstructor->globalObject(), worker.release()));
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), worker.release())));
}
ConstructType JSWorkerConstructor::getConstructData(ConstructData& constructData)
diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp
index 47a867e..2bde58b 100644
--- a/WebCore/bindings/js/JSWorkerContextCustom.cpp
+++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp
@@ -45,7 +45,7 @@
#include "JSWebSocketConstructor.h"
#include "JSWorkerLocation.h"
#include "JSWorkerNavigator.h"
-#include "JSXMLHttpRequestConstructor.h"
+#include "JSXMLHttpRequest.h"
#include "ScheduledAction.h"
#include "WorkerContext.h"
#include "WorkerLocation.h"
diff --git a/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp b/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp
deleted file mode 100644
index 91fff9a..0000000
--- a/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "JSXMLHttpRequestConstructor.h"
-
-#include "JSXMLHttpRequest.h"
-#include "ScriptExecutionContext.h"
-#include "XMLHttpRequest.h"
-#include <runtime/Error.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-ASSERT_CLASS_FITS_IN_CELL(JSXMLHttpRequestConstructor);
-
-const ClassInfo JSXMLHttpRequestConstructor::s_info = { "XMLHttpRequestConstructor", 0, 0, 0 };
-
-JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
- : DOMConstructorObject(JSXMLHttpRequestConstructor::createStructure(globalObject->objectPrototype()), globalObject)
-{
- putDirect(exec->propertyNames().prototype, JSXMLHttpRequestPrototype::self(exec, globalObject), None);
-}
-
-static JSObject* constructXMLHttpRequest(ExecState* exec, JSObject* constructor, const ArgList&)
-{
- JSXMLHttpRequestConstructor* jsConstructor = static_cast<JSXMLHttpRequestConstructor*>(constructor);
- ScriptExecutionContext* context = jsConstructor->scriptExecutionContext();
- if (!context)
- return throwError(exec, ReferenceError, "XMLHttpRequest constructor associated document is unavailable");
-
- RefPtr<XMLHttpRequest> xmlHttpRequest = XMLHttpRequest::create(context);
- return CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), XMLHttpRequest, xmlHttpRequest.get());
-}
-
-ConstructType JSXMLHttpRequestConstructor::getConstructData(ConstructData& constructData)
-{
- constructData.native.function = constructXMLHttpRequest;
- return ConstructTypeHost;
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/js/JSXMLHttpRequestConstructor.h b/WebCore/bindings/js/JSXMLHttpRequestConstructor.h
deleted file mode 100644
index 2cc4fcf..0000000
--- a/WebCore/bindings/js/JSXMLHttpRequestConstructor.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef JSXMLHttpRequestConstructor_h
-#define JSXMLHttpRequestConstructor_h
-
-#include "JSDOMBinding.h"
-
-namespace WebCore {
-
-class JSXMLHttpRequestConstructor : public DOMConstructorObject {
-public:
- JSXMLHttpRequestConstructor(JSC::ExecState*, JSDOMGlobalObject*);
- static const JSC::ClassInfo s_info;
-private:
- virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
- virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
-};
-
-} // namespace WebCore
-
-#endif // JSXMLHttpRequestConstructor_h
diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index 420bf37..da75139 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -65,7 +65,7 @@ void JSXMLHttpRequest::markChildren(MarkStack& markStack)
JSValue JSXMLHttpRequest::open(ExecState* exec)
{
if (exec->argumentCount() < 2)
- return throwError(exec, SyntaxError, "Not enough arguments");
+ return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
const KURL& url = impl()->scriptExecutionContext()->completeURL(ustringToString(exec->argument(1).toString(exec)));
String method = ustringToString(exec->argument(0).toString(exec));
@@ -127,4 +127,15 @@ JSValue JSXMLHttpRequest::responseText(ExecState* exec) const
return jsOwnedStringOrNull(exec, impl()->responseText());
}
+EncodedJSValue JSC_HOST_CALL JSXMLHttpRequestConstructor::constructJSXMLHttpRequest(ExecState* exec)
+{
+ JSXMLHttpRequestConstructor* jsConstructor = static_cast<JSXMLHttpRequestConstructor*>(exec->callee());
+ ScriptExecutionContext* context = jsConstructor->scriptExecutionContext();
+ if (!context)
+ return throwVMError(exec, createReferenceError(exec, "XMLHttpRequest constructor associated document is unavailable"));
+
+ RefPtr<XMLHttpRequest> xmlHttpRequest = XMLHttpRequest::create(context);
+ return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), XMLHttpRequest, xmlHttpRequest.get()));
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp b/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp
index 07fec72..b2ebef3 100644
--- a/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp
+++ b/WebCore/bindings/js/JSXSLTProcessorConstructor.cpp
@@ -47,10 +47,10 @@ JSXSLTProcessorConstructor::JSXSLTProcessorConstructor(ExecState* exec, JSDOMGlo
putDirect(exec->propertyNames().prototype, JSXSLTProcessorPrototype::self(exec, globalObject), None);
}
-static JSObject* constructXSLTProcessor(ExecState* exec, JSObject* constructor, const ArgList&)
+static EncodedJSValue JSC_HOST_CALL constructXSLTProcessor(ExecState* exec)
{
- JSXSLTProcessorConstructor* jsConstructor = static_cast<JSXSLTProcessorConstructor*>(constructor);
- return CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), XSLTProcessor, XSLTProcessor::create().get());
+ JSXSLTProcessorConstructor* jsConstructor = static_cast<JSXSLTProcessorConstructor*>(exec->callee());
+ return JSValue::encode(CREATE_DOM_OBJECT_WRAPPER(exec, jsConstructor->globalObject(), XSLTProcessor, XSLTProcessor::create().get()));
}
ConstructType JSXSLTProcessorConstructor::getConstructData(ConstructData& constructData)
diff --git a/WebCore/bindings/js/ScheduledAction.cpp b/WebCore/bindings/js/ScheduledAction.cpp
index 5a45e87..f69f8bd 100644
--- a/WebCore/bindings/js/ScheduledAction.cpp
+++ b/WebCore/bindings/js/ScheduledAction.cpp
@@ -51,7 +51,7 @@ PassOwnPtr<ScheduledAction> ScheduledAction::create(ExecState* exec, DOMWrapperW
{
JSValue v = exec->argument(0);
CallData callData;
- if (v.getCallData(callData) == CallTypeNone) {
+ if (getCallData(v, callData) == CallTypeNone) {
UString string = v.toString(exec);
if (exec->hadException())
return 0;
@@ -91,7 +91,7 @@ void ScheduledAction::executeFunctionInContext(JSGlobalObject* globalObject, JSV
JSLock lock(SilenceAssertionsOnly);
CallData callData;
- CallType callType = m_function.get().getCallData(callData);
+ CallType callType = getCallData(m_function.get(), callData);
if (callType == CallTypeNone)
return;
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index 3dcbb0b..5c4bd4c 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -87,6 +87,11 @@ ScriptController::~ScriptController()
{
disconnectPlatformScriptObjects();
+ if (m_cacheableBindingRootObject) {
+ m_cacheableBindingRootObject->invalidate();
+ m_cacheableBindingRootObject = 0;
+ }
+
// It's likely that destroying m_windowShells will create a lot of garbage.
if (!m_windowShells.isEmpty()) {
while (!m_windowShells.isEmpty())
@@ -329,6 +334,18 @@ void ScriptController::updateSecurityOrigin()
// Our bindings do not do anything in this case.
}
+Bindings::RootObject* ScriptController::cacheableBindingRootObject()
+{
+ if (!canExecuteScripts(NotAboutToExecuteScript))
+ return 0;
+
+ if (!m_cacheableBindingRootObject) {
+ JSLock lock(SilenceAssertionsOnly);
+ m_cacheableBindingRootObject = Bindings::RootObject::create(0, globalObject(pluginWorld()));
+ }
+ return m_cacheableBindingRootObject.get();
+}
+
Bindings::RootObject* ScriptController::bindingRootObject()
{
if (!canExecuteScripts(NotAboutToExecuteScript))
diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h
index 16fe4f2..ee7cc7d 100644
--- a/WebCore/bindings/js/ScriptController.h
+++ b/WebCore/bindings/js/ScriptController.h
@@ -158,6 +158,7 @@ public:
PassScriptInstance createScriptInstanceForWidget(Widget*);
JSC::Bindings::RootObject* bindingRootObject();
+ JSC::Bindings::RootObject* cacheableBindingRootObject();
PassRefPtr<JSC::Bindings::RootObject> createRootObject(void* nativeHandle);
@@ -195,8 +196,13 @@ private:
bool m_paused;
bool m_allowPopupsFromPlugin;
- // The root object used for objects bound outside the context of a plugin.
+ // The root object used for objects bound outside the context of a plugin, such
+ // as NPAPI plugins. The plugins using these objects prevent a page from being cached so they
+ // are safe to invalidate() when WebKit navigates away from the page that contains them.
RefPtr<JSC::Bindings::RootObject> m_bindingRootObject;
+ // Unlike m_bindingRootObject these objects are used in pages that are cached, so they are not invalidate()'d.
+ // This ensures they are still available when the page is restored.
+ RefPtr<JSC::Bindings::RootObject> m_cacheableBindingRootObject;
RootObjectMap m_rootObjects;
#if ENABLE(NETSCAPE_PLUGIN_API)
NPObject* m_windowScriptNPObject;
diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp
index 94d7e73..eb0923b 100644
--- a/WebCore/bindings/js/ScriptDebugServer.cpp
+++ b/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -126,13 +126,15 @@ void ScriptDebugServer::pageCreated(Page* page)
page->setDebugger(this);
}
+bool ScriptDebugServer::isDebuggerAlwaysEnabled()
+{
+ return false;
+}
+
bool ScriptDebugServer::hasListenersInterestedInPage(Page* page)
{
ASSERT_ARG(page, page);
- if (hasGlobalListeners())
- return true;
-
return m_pageListenersMap.contains(page);
}
@@ -238,6 +240,12 @@ void ScriptDebugServer::stepOutOfFunction()
m_doneProcessingDebuggerEvents = true;
}
+bool ScriptDebugServer::editScriptSource(const String&, const String&, String&)
+{
+ // FIXME(40300): implement this.
+ return false;
+}
+
JavaScriptCallFrame* ScriptDebugServer::currentCallFrame()
{
if (!m_paused)
@@ -257,7 +265,7 @@ void ScriptDebugServer::dispatchDidContinue(ScriptDebugListener* listener)
listener->didContinue();
}
-void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source)
+void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, ScriptWorldType worldType)
{
String sourceID = ustringToString(JSC::UString::from(source.provider()->asID()));
String url = ustringToString(source.provider()->url());
@@ -267,7 +275,7 @@ void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, con
Vector<ScriptDebugListener*> copy;
copyToVector(listeners, copy);
for (size_t i = 0; i < copy.size(); ++i)
- copy[i]->didParseSource(sourceID, url, data, firstLine);
+ copy[i]->didParseSource(sourceID, url, data, firstLine, worldType);
}
void ScriptDebugServer::dispatchFailedToParseSource(const ListenerSet& listeners, const SourceCode& source, int errorLine, const String& errorMessage)
@@ -291,6 +299,13 @@ static Page* toPage(JSGlobalObject* globalObject)
return frame ? frame->page() : 0;
}
+static ScriptWorldType currentWorldType(ExecState* exec)
+{
+ if (currentWorld(exec) == mainThreadNormalWorld())
+ return MAIN_WORLD;
+ return EXTENSIONS_WORLD;
+}
+
void ScriptDebugServer::detach(JSGlobalObject* globalObject)
{
// If we're detaching from the currently executing global object, manually tear down our
@@ -313,23 +328,18 @@ void ScriptDebugServer::sourceParsed(ExecState* exec, const SourceCode& source,
if (!page)
return;
+ ScriptWorldType worldType = currentWorldType(exec);
+
m_callingListeners = true;
bool isError = errorLine != -1;
- if (hasGlobalListeners()) {
- if (isError)
- dispatchFailedToParseSource(m_listeners, source, errorLine, ustringToString(errorMessage));
- else
- dispatchDidParseSource(m_listeners, source);
- }
-
if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) {
ASSERT(!pageListeners->isEmpty());
if (isError)
dispatchFailedToParseSource(*pageListeners, source, errorLine, ustringToString(errorMessage));
else
- dispatchDidParseSource(*pageListeners, source);
+ dispatchDidParseSource(*pageListeners, source, worldType);
}
m_callingListeners = false;
@@ -352,8 +362,6 @@ void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback
ASSERT(hasListeners());
- dispatchFunctionToListeners(m_listeners, callback);
-
if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) {
ASSERT(!pageListeners->isEmpty());
dispatchFunctionToListeners(*pageListeners, callback);
@@ -574,7 +582,7 @@ void ScriptDebugServer::didAddListener(Page* page)
void ScriptDebugServer::didRemoveListener(Page* page)
{
- if (hasGlobalListeners() || (page && hasListenersInterestedInPage(page)))
+ if (page && hasListenersInterestedInPage(page))
return;
recompileAllJSFunctionsSoon();
diff --git a/WebCore/bindings/js/ScriptDebugServer.h b/WebCore/bindings/js/ScriptDebugServer.h
index cfada27..a45fae4 100644
--- a/WebCore/bindings/js/ScriptDebugServer.h
+++ b/WebCore/bindings/js/ScriptDebugServer.h
@@ -32,6 +32,7 @@
#if ENABLE(JAVASCRIPT_DEBUGGER)
+#include "ScriptDebugListener.h"
#include "PlatformString.h"
#include "ScriptBreakpoint.h"
#include "Timer.h"
@@ -81,6 +82,8 @@ public:
void stepOverStatement();
void stepOutOfFunction();
+ bool editScriptSource(const String& sourceID, const String& newContent, String& newSourceOrErrorMessage);
+
void recompileAllJSFunctionsSoon();
void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0);
@@ -88,6 +91,8 @@ public:
void pageCreated(Page*);
+ bool isDebuggerAlwaysEnabled();
+
private:
typedef HashSet<ScriptDebugListener*> ListenerSet;
typedef void (ScriptDebugServer::*JavaScriptExecutionCallback)(ScriptDebugListener*);
@@ -96,8 +101,7 @@ private:
~ScriptDebugServer();
bool hasBreakpoint(intptr_t sourceID, unsigned lineNumber) const;
- bool hasListeners() const { return !m_listeners.isEmpty() || !m_pageListenersMap.isEmpty(); }
- bool hasGlobalListeners() const { return !m_listeners.isEmpty(); }
+ bool hasListeners() const { return !m_pageListenersMap.isEmpty(); }
bool hasListenersInterestedInPage(Page*);
void setJavaScriptPaused(const PageGroup&, bool paused);
@@ -109,7 +113,7 @@ private:
void dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback callback);
void dispatchDidPause(ScriptDebugListener*);
void dispatchDidContinue(ScriptDebugListener*);
- void dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source);
+ void dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, enum ScriptWorldType);
void dispatchFailedToParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, int errorLine, const String& errorMessage);
void pauseIfNeeded(Page*);
@@ -133,7 +137,6 @@ private:
typedef HashMap<intptr_t, SourceBreakpoints> BreakpointsMap;
PageListenersMap m_pageListenersMap;
- ListenerSet m_listeners;
bool m_callingListeners;
PauseOnExceptionsState m_pauseOnExceptionsState;
bool m_pauseOnNextStatement;
diff --git a/WebCore/bindings/js/ScriptFunctionCall.cpp b/WebCore/bindings/js/ScriptFunctionCall.cpp
index 3784457..9baf809 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/js/ScriptFunctionCall.cpp
@@ -143,7 +143,7 @@ ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions)
}
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
return ScriptValue();
diff --git a/WebCore/bindings/js/SerializedScriptValue.cpp b/WebCore/bindings/js/SerializedScriptValue.cpp
index e761480..90f8d7c 100644
--- a/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -36,6 +36,7 @@
#include "JSImageData.h"
#include <JavaScriptCore/APICast.h>
#include <runtime/DateInstance.h>
+#include <runtime/Error.h>
#include <runtime/ExceptionHelpers.h>
#include <runtime/JSLock.h>
#include <runtime/PropertyNameArray.h>
@@ -454,12 +455,12 @@ struct BaseWalker {
void throwStackOverflow()
{
- m_exec->setException(createStackOverflowError(m_exec));
+ throwError(m_exec, createStackOverflowError(m_exec));
}
void throwInterruptedException()
{
- m_exec->setException(createInterruptedExecutionException(&m_exec->globalData()));
+ throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
}
};
@@ -575,7 +576,7 @@ struct SerializingTreeWalker : public BaseWalker {
return SerializedScriptValueData(toImageData(obj));
CallData unusedData;
- if (value.getCallData(unusedData) == CallTypeNone)
+ if (getCallData(value, unusedData) == CallTypeNone)
return SerializedScriptValueData();
}
// Any other types are expected to serialize as null.
@@ -602,7 +603,7 @@ struct SerializingTreeWalker : public BaseWalker {
{
// Cycle detection
if (!m_cycleDetector.add(inArray).second) {
- m_exec->setException(createTypeError(m_exec, "Cannot post cyclic structures."));
+ throwError(m_exec, createTypeError(m_exec, "Cannot post cyclic structures."));
return false;
}
m_gcBuffer.append(inArray);
@@ -619,7 +620,7 @@ struct SerializingTreeWalker : public BaseWalker {
{
// Cycle detection
if (!m_cycleDetector.add(inObject).second) {
- m_exec->setException(createTypeError(m_exec, "Cannot post cyclic structures."));
+ throwError(m_exec, createTypeError(m_exec, "Cannot post cyclic structures."));
return false;
}
m_gcBuffer.append(inObject);
diff --git a/WebCore/bindings/js/WorkerScriptController.cpp b/WebCore/bindings/js/WorkerScriptController.cpp
index 1d45dfa..6ff8a69 100644
--- a/WebCore/bindings/js/WorkerScriptController.cpp
+++ b/WebCore/bindings/js/WorkerScriptController.cpp
@@ -41,6 +41,7 @@
#include <interpreter/Interpreter.h>
#include <runtime/Completion.h>
#include <runtime/Completion.h>
+#include <runtime/Error.h>
#include <runtime/JSLock.h>
using namespace JSC;
@@ -137,7 +138,7 @@ ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode,
void WorkerScriptController::setException(ScriptValue exception)
{
- m_workerContextWrapper->globalExec()->setException(exception.jsValue());
+ throwError(m_workerContextWrapper->globalExec(), exception.jsValue());
}
void WorkerScriptController::forbidExecution(ForbidExecutionOption option)
diff --git a/WebCore/bindings/objc/WebScriptObject.mm b/WebCore/bindings/objc/WebScriptObject.mm
index 794fc69..3f224f1 100644
--- a/WebCore/bindings/objc/WebScriptObject.mm
+++ b/WebCore/bindings/objc/WebScriptObject.mm
@@ -294,7 +294,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
JSValue function = [self _imp]->get(exec, Identifier(exec, stringToUString(String(name))));
CallData callData;
- CallType callType = function.getCallData(callData);
+ CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
return nil;
diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm
index b8f23dd..7c0f427 100644
--- a/WebCore/bindings/scripts/CodeGenerator.pm
+++ b/WebCore/bindings/scripts/CodeGenerator.pm
@@ -24,6 +24,8 @@
package CodeGenerator;
+use strict;
+
use File::Find;
my $useDocument = "";
@@ -272,7 +274,7 @@ sub ParseInterface
return $interface if $interface->name eq $interfaceName;
}
- die("Could NOT find interface definition for $interface in $filename");
+ die("Could NOT find interface definition for $interfaceName in $filename");
}
# Helpers for all CodeGenerator***.pm modules
diff --git a/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/WebCore/bindings/scripts/CodeGeneratorCPP.pm
new file mode 100644
index 0000000..f441b0e
--- /dev/null
+++ b/WebCore/bindings/scripts/CodeGeneratorCPP.pm
@@ -0,0 +1,975 @@
+
+# Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
+# Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
+# Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
+# Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
+# Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
+# Copyright (C) Research In Motion Limited 2010. All rights reserved.
+#
+# 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
+# aint with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+#
+
+package CodeGeneratorCPP;
+
+use File::stat;
+
+# Global Variables
+my $module = "";
+my $outputDir = "";
+
+my @headerContentHeader = ();
+my @headerContent = ();
+my %headerForwardDeclarations = ();
+
+my @implContentHeader = ();
+my @implContent = ();
+my %implIncludes = ();
+
+# Constants
+my $exceptionInit = "WebCore::ExceptionCode ec = 0;";
+my $exceptionRaiseOnError = "webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));";
+
+# Default License Templates
+my $headerLicenseTemplate = << "EOF";
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig\@gmail.com>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+EOF
+
+my $implementationLicenseTemplate = << "EOF";
+/*
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+EOF
+
+# Default constructor
+sub new
+{
+ my $object = shift;
+ my $reference = { };
+
+ $codeGenerator = shift;
+ $outputDir = shift;
+ shift; # $useLayerOnTop
+ shift; # $preprocessor
+ shift; # $writeDependencies
+
+ bless($reference, $object);
+ return $reference;
+}
+
+sub finish
+{
+ my $object = shift;
+}
+
+# Params: 'domClass' struct
+sub GenerateInterface
+{
+ my $object = shift;
+ my $dataNode = shift;
+ my $defines = shift;
+
+ my $name = $dataNode->name;
+ my $className = GetClassName($name);
+ my $parentClassName = "WebDOM" . GetParentImplClassName($dataNode);
+
+ # Start actual generation.
+ $object->GenerateHeader($dataNode);
+ $object->GenerateImplementation($dataNode);
+
+ # Write changes.
+ $object->WriteData("WebDOM" . $name);
+}
+
+# Params: 'idlDocument' struct
+sub GenerateModule
+{
+ my $object = shift;
+ my $dataNode = shift;
+
+ $module = $dataNode->module;
+}
+
+sub GetClassName
+{
+ my $name = $codeGenerator->StripModule(shift);
+
+ # special cases
+ return "WebDOMString" if $codeGenerator->IsStringType($name) or $name eq "SerializedScriptValue";
+ return "WebDOMAbstractView" if $name eq "DOMWindow";
+ return "WebDOMObject" if $name eq "DOMObject";
+ return "bool" if $name eq "boolean";
+ return $name if $codeGenerator->IsPrimitiveType($name);
+
+ return "WebDOM$name";
+}
+
+sub GetImplClassName
+{
+ my $name = $codeGenerator->StripModule(shift);
+
+ return "DOMWindow" if $name eq "AbstractView";
+ return $name;
+}
+
+sub GetParentImplClassName
+{
+ my $dataNode = shift;
+
+ if (@{$dataNode->parents} eq 0) {
+ return "EventTarget" if $dataNode->extendedAttributes->{"EventTarget"};
+ return "Object";
+ }
+
+ return $codeGenerator->StripModule($dataNode->parents(0));
+}
+
+sub GetParent
+{
+ my $dataNode = shift;
+ my $numParents = @{$dataNode->parents};
+
+ my $parent = "";
+ if ($numParents eq 0) {
+ $parent = "WebDOMObject";
+ $parent = "WebDOMEventTarget" if $dataNode->extendedAttributes->{"EventTarget"};
+ } elsif ($numParents eq 1) {
+ my $parentName = $codeGenerator->StripModule($dataNode->parents(0));
+ $parent = "WebDOM" . $parentName;
+ } else {
+ my @parents = @{$dataNode->parents};
+ my $firstParent = $codeGenerator->StripModule(shift(@parents));
+ $parent = "WebDOM" . $firstParent;
+ }
+
+ return $parent;
+}
+
+sub ShouldSkipTypeInImplementation
+{
+ my $typeInfo = shift;
+
+ return 1 if $typeInfo->signature->extendedAttributes->{"Custom"}
+ and !$typeInfo->signature->extendedAttributes->{"NoCPPCustom"};
+
+ return 1 if $typeInfo->signature->extendedAttributes->{"CustomArgumentHandling"}
+ or $typeInfo->signature->extendedAttributes->{"CustomGetter"}
+ or $typeInfo->signature->extendedAttributes->{"NeedsUserGestureCheck"};
+
+ # FIXME: We don't generate bindings for SVG related interfaces yet
+ return 1 if $typeInfo->signature->name =~ /getSVGDocument/;
+
+ return 1 if $typeInfo->signature->name =~ /Constructor/;
+ return 0;
+}
+
+sub ShouldSkipTypeInHeader
+{
+ my $typeInfo = shift;
+
+ # FIXME: We currently ignore any attribute/function needing custom code
+ return 1 if $typeInfo->signature->extendedAttributes->{"CustomArgumentHandling"}
+ or $typeInfo->signature->extendedAttributes->{"CustomGetter"};
+
+ # FIXME: We don't generate bindings for SVG related interfaces yet
+ return 1 if $typeInfo->signature->name =~ /getSVGDocument/;
+
+ return 1 if $typeInfo->signature->name =~ /Constructor/;
+ return 0;
+}
+
+sub GetCPPType
+{
+ my $type = shift;
+ my $useConstReference = shift;
+ my $name = GetClassName($type);
+
+ return "int" if $type eq "long";
+ return "unsigned" if $name eq "unsigned long";
+ return "unsigned short" if $type eq "CompareHow";
+
+ if ($codeGenerator->IsStringType($type)) {
+ if ($useConstReference) {
+ return "const $name&";
+ }
+
+ return $name;
+ }
+
+ return $name if $codeGenerator->IsPrimitiveType($type) or $type eq "DOMTimeStamp";
+ return "const $name&" if $useConstReference;
+ return $name;
+}
+
+sub ConversionNeeded
+{
+ my $type = $codeGenerator->StripModule(shift);
+ return !$codeGenerator->IsNonPointerType($type) && !$codeGenerator->IsStringType($type);
+}
+
+sub GetCPPTypeGetter
+{
+ my $argName = shift;
+ my $type = $codeGenerator->StripModule(shift);
+
+ return $argName if $codeGenerator->IsPrimitiveType($type) or $codeGenerator->IsStringType($type);
+ return "static_cast<WebCore::Range::CompareHow>($argName)" if $type eq "CompareHow";
+ return "WebCore::SerializedScriptValue::create(WebCore::String($argName))" if $type eq "SerializedScriptValue";
+ return "toWebCore($argName)";
+}
+
+sub AddForwardDeclarationsForType
+{
+ my $type = $codeGenerator->StripModule(shift);
+ my $public = shift;
+
+ return if $codeGenerator->IsNonPointerType($type) or $codeGenerator->IsStringType($type);
+
+ my $class = GetClassName($type);
+ $headerForwardDeclarations{$class} = 1 if $public;
+}
+
+sub AddIncludesForType
+{
+ my $type = $codeGenerator->StripModule(shift);
+
+ return if $codeGenerator->IsNonPointerType($type);
+ return if $type =~ /cconstructor/;
+
+ if ($codeGenerator->IsStringType($type)) {
+ $implIncludes{"AtomicString.h"} = 1;
+ $implIncludes{"KURL.h"} = 1;
+ $implIncludes{"WebDOMString.h"} = 1;
+ return;
+ }
+
+ if ($type eq "DOMObject") {
+ $implIncludes{"WebDOMObject.h"} = 1;
+ return;
+ }
+
+ if ($type eq "DOMWindow") {
+ $implIncludes{"DOMWindow.h"} = 1;
+ $implIncludes{"WebDOMAbstractView.h"} = 1;
+ return;
+ }
+
+ if ($type eq "EventListener") {
+ $implIncludes{"WebNativeEventListener.h"} = 1;
+ return;
+ }
+
+ if ($type eq "SerializedScriptValue") {
+ $implIncludes{"SerializedScriptValue.h"} = 1;
+ return;
+ }
+
+ $implIncludes{"Node.h"} = 1 if $type eq "NodeList";
+ $implIncludes{"CSSMutableStyleDeclaration.h"} = 1 if $type eq "CSSStyleDeclaration";
+
+ # Default, include the same named file (the implementation) and the same name prefixed with "WebDOM".
+ $implIncludes{"$type.h"} = 1 unless $type eq "DOMObject";
+ $implIncludes{"WebDOM$type.h"} = 1;
+}
+
+sub GenerateConditionalStringFromAttributeValue
+{
+ my $conditional = shift;
+ if ($conditional =~ /&/) {
+ return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")";
+ } elsif ($conditional =~ /\|/) {
+ return "ENABLE(" . join(") || ENABLE(", split(/\|/, $conditional)) . ")";
+ } else {
+ return "ENABLE(" . $conditional . ")";
+ }
+}
+
+sub GenerateConditionalString
+{
+ my $node = shift;
+ my $conditional = $node->extendedAttributes->{"Conditional"};
+ if ($conditional) {
+ return GenerateConditionalStringFromAttributeValue($conditional);
+ } else {
+ return "";
+ }
+}
+
+sub GenerateHeader
+{
+ my $object = shift;
+ my $dataNode = shift;
+
+ my $interfaceName = $dataNode->name;
+ my $className = GetClassName($interfaceName);
+ my $implClassName = GetImplClassName($interfaceName);
+ my $implClassNameWithNamespace = "WebCore::" . $implClassName;
+
+ my $parentName = "";
+ $parentName = GetParent($dataNode);
+
+ my $numConstants = @{$dataNode->constants};
+ my $numAttributes = @{$dataNode->attributes};
+ my $numFunctions = @{$dataNode->functions};
+
+ # - Add default header template
+ @headerContentHeader = split("\r", $headerLicenseTemplate);
+ push(@headerContentHeader, "\n#ifndef $className" . "_h");
+ push(@headerContentHeader, "\n#define $className" . "_h\n\n");
+
+ my $conditionalString = GenerateConditionalString($dataNode);
+ push(@headerContentHeader, "#if ${conditionalString}\n\n") if $conditionalString;
+
+ # - INCLUDES -
+
+ my %headerIncludes = ();
+ $headerIncludes{"WebDOMString.h"} = 1;
+ $headerIncludes{"$parentName.h"} = 1;
+ foreach my $include (sort keys(%headerIncludes)) {
+ push(@headerContentHeader, "#include <$include>\n");
+ }
+
+ push(@headerContent, "class $className");
+ push(@headerContent, " : public $parentName") if $parentName;
+ push(@headerContent, " {\n");
+ push(@headerContent, "public:\n");
+
+ # Constructor
+ push(@headerContent, " $className();\n");
+ push(@headerContent, " explicit $className($implClassNameWithNamespace*);\n");
+
+ # Copy constructor on classes which have the d-ptr
+ if (@{$dataNode->parents} eq 0) {
+ push(@headerContent, " $className(const $className&);\n");
+ }
+
+ # Destructor
+ if (@{$dataNode->parents} eq 0) {
+ push(@headerContent, " ~$className();\n");
+ }
+
+ push(@headerContent, "\n");
+ $headerForwardDeclarations{$implClassNameWithNamespace} = 1;
+
+ # - Add constants.
+ if ($numConstants > 0) {
+ my @headerConstants = ();
+
+ # FIXME: we need a way to include multiple enums.
+ foreach my $constant (@{$dataNode->constants}) {
+ my $constantName = $constant->name;
+ my $constantValue = $constant->value;
+
+ my $output = "WEBDOM_" . $constantName . " = " . $constantValue;
+ push(@headerConstants, " " . $output);
+ }
+
+ my $combinedConstants = join(",\n", @headerConstants);
+
+ push(@headerContent, " ");
+ push(@headerContent, "enum {\n");
+ push(@headerContent, $combinedConstants);
+ push(@headerContent, "\n ");
+ push(@headerContent, "};\n\n");
+ }
+
+ my @headerAttributes = ();
+
+ # - Add attribute getters/setters.
+ if ($numAttributes > 0) {
+ foreach my $attribute (@{$dataNode->attributes}) {
+ next if ShouldSkipTypeInHeader($attribute);
+
+ my $attributeName = $attribute->signature->name;
+ my $attributeType = GetCPPType($attribute->signature->type, 0);
+ my $attributeIsReadonly = ($attribute->type =~ /^readonly/);
+ my $property = " " . $attributeType . ($attributeType =~ /\*$/ ? "" : " ") . $attributeName . "() const";
+
+ my $availabilityMacro = "";
+ my $declarationSuffix = ";\n";
+
+ AddForwardDeclarationsForType($attribute->signature->type, 1);
+
+ $attributeType = GetCPPType($attribute->signature->type, 1);
+ my $setterName = "set" . ucfirst($attributeName);
+
+ $property .= $declarationSuffix;
+ push(@headerAttributes, $property);
+ if (!$attributeIsReadonly and !$attribute->signature->extendedAttributes->{"Replaceable"}) {
+ $property = " void $setterName($attributeType)";
+ $property .= $declarationSuffix;
+ push(@headerAttributes, $property);
+ }
+ }
+
+ push(@headerContent, @headerAttributes) if @headerAttributes > 0;
+ }
+
+ my @headerFunctions = ();
+ my @deprecatedHeaderFunctions = ();
+ my @interfaceFunctions = ();
+
+ # - Add functions.
+ if ($numFunctions > 0) {
+ foreach my $function (@{$dataNode->functions}) {
+ next if ShouldSkipTypeInHeader($function);
+ my $functionName = $function->signature->name;
+
+ my $returnType = GetCPPType($function->signature->type, 0);
+ my $numberOfParameters = @{$function->parameters};
+ my %typesToForwardDeclare = ($function->signature->type => 1);
+
+ my $parameterIndex = 0;
+ my $functionSig = "$returnType $functionName(";
+ my $methodName = $functionName;
+ foreach my $param (@{$function->parameters}) {
+ my $paramName = $param->name;
+ my $paramType = GetCPPType($param->type, 1);
+ $typesToForwardDeclare{$param->type} = 1;
+
+ $functionSig .= ", " if $parameterIndex >= 1;
+ $functionSig .= "$paramType $paramName";
+ $parameterIndex++;
+ }
+ $functionSig .= ")";
+ if ($dataNode->extendedAttributes->{"PureInterface"}) {
+ push(@interfaceFunctions, " virtual " . $functionSig . " = 0;\n");
+ }
+ my $functionDeclaration = $functionSig;
+ $functionDeclaration .= ";\n";
+
+ foreach my $type (keys %typesToForwardDeclare) {
+ # add any forward declarations to the public header if a deprecated version will be generated
+ AddForwardDeclarationsForType($type, 1);
+ }
+
+ push(@headerFunctions, " ");
+ push(@headerFunctions, $functionDeclaration);
+ }
+
+ if (@headerFunctions > 0) {
+ push(@headerContent, "\n") if @headerAttributes > 0;
+ push(@headerContent, @headerFunctions);
+ }
+ }
+
+ push(@headerContent, "\n");
+ push(@headerContent, " $implClassNameWithNamespace* impl() const;\n");
+
+ if (@{$dataNode->parents} eq 0) {
+ push(@headerContent, "\nprotected:\n");
+ push(@headerContent, " struct ${className}Private;\n");
+ push(@headerContent, " ${className}Private* m_impl;\n");
+ }
+
+ push(@headerContent, "};\n\n");
+
+ # for PureInterface classes also add the interface that the client code needs to
+ # implement
+ if ($dataNode->extendedAttributes->{"PureInterface"}) {
+ push(@headerContent, "class WebUser$interfaceName {\n");
+ push(@headerContent, "public:\n");
+ push(@headerContent, " virtual void ref() = 0;\n");
+ push(@headerContent, " virtual void deref() = 0;\n\n");
+ push(@headerContent, @interfaceFunctions);
+ push(@headerContent, "\nprotected:\n");
+ push(@headerContent, " virtual ~WebUser$interfaceName() {}\n");
+ push(@headerContent, "};\n\n");
+ }
+
+ push(@headerContent, "WebCore::$implClassName* toWebCore(const $className&);\n");
+ push(@headerContent, "$className toWebKit(WebCore::$implClassName*);\n");
+ if ($dataNode->extendedAttributes->{"PureInterface"}) {
+ push(@headerContent, "$className toWebKit(WebUser$interfaceName*);\n");
+ }
+ push(@headerContent, "\n#endif\n");
+ push(@headerContent, "#endif // ${conditionalString}\n\n") if $conditionalString;
+}
+
+sub AddEarlyReturnStatement
+{
+ my $returnType = shift;
+
+ if (!defined($returnType) or $returnType eq "void") {
+ $returnType = "";
+ } elsif ($codeGenerator->IsPrimitiveType($returnType)) {
+ $returnType = " 0";
+ } elsif ($returnType eq "bool") {
+ $returnType = " false";
+ } else {
+ $returnType = " $returnType()";
+ }
+
+ # TODO: We could set exceptions here, if we want that
+ my $statement = " if (!impl())\n";
+ $statement .= " return$returnType;\n\n";
+ return $statement;
+}
+
+sub AddReturnStatement
+{
+ my $typeInfo = shift;
+ my $returnValue = shift;
+
+ # Used to invoke KURLs "const String&" operator
+ if ($codeGenerator->IsStringType($typeInfo->signature->type)) {
+ return " return static_cast<const WebCore::String&>($returnValue);\n";
+ }
+
+ return " return $returnValue;\n";
+}
+
+sub GenerateImplementation
+{
+ my $object = shift;
+ my $dataNode = shift;
+
+ my @ancestorInterfaceNames = ();
+
+ if (@{$dataNode->parents} > 1) {
+ $codeGenerator->AddMethodsConstantsAndAttributesFromParentClasses($dataNode, \@ancestorInterfaceNames);
+ }
+
+ my $interfaceName = $dataNode->name;
+ my $className = GetClassName($interfaceName);
+ my $implClassName = GetImplClassName($interfaceName);
+ my $parentImplClassName = GetParentImplClassName($dataNode);
+ my $implClassNameWithNamespace = "WebCore::" . $implClassName;
+ my $baseClass = "WebDOM$parentImplClassName";
+ my $conditional = $dataNode->extendedAttributes->{"Conditional"};
+
+ my $numAttributes = @{$dataNode->attributes};
+ my $numFunctions = @{$dataNode->functions};
+
+ # - Add default header template.
+ @implContentHeader = split("\r", $implementationLicenseTemplate);
+
+ # - INCLUDES -
+ push(@implContentHeader, "\n#include \"config.h\"\n");
+ my $conditionalString = GenerateConditionalString($dataNode);
+ push(@implContentHeader, "\n#if ${conditionalString}\n\n") if $conditionalString;
+ push(@implContentHeader, "#include \"$className.h\"\n\n");
+
+ $implIncludes{"WebExceptionHandler.h"} = 1;
+ $implIncludes{"$implClassName.h"} = 1;
+ @implContent = ();
+
+ push(@implContent, "#include <wtf/GetPtr.h>\n");
+ push(@implContent, "#include <wtf/RefPtr.h>\n\n");
+
+ # Private datastructure, encapsulating WebCore types
+ if (@{$dataNode->parents} eq 0) {
+ push(@implContent, "struct ${className}::${className}Private {\n");
+ push(@implContent, " ${className}Private($implClassNameWithNamespace* object = 0)\n");
+ push(@implContent, " : impl(object)\n");
+ push(@implContent, " {\n");
+ push(@implContent, " }\n\n");
+ push(@implContent, " RefPtr<$implClassNameWithNamespace> impl;\n");
+ push(@implContent, "};\n\n");
+ }
+
+ # Constructor
+ push(@implContent, "${className}::$className()\n");
+ push(@implContent, " : ${baseClass}()\n");
+ push(@implContent, " , m_impl(0)\n") if (@{$dataNode->parents} eq 0);
+ push(@implContent, "{\n");
+ push(@implContent, "}\n\n");
+
+ push(@implContent, "${className}::$className($implClassNameWithNamespace* impl)\n");
+ if (@{$dataNode->parents} eq 0) {
+ push(@implContent, " : ${baseClass}()\n");
+ push(@implContent, " , m_impl(new ${className}Private(impl))\n");
+ push(@implContent, "{\n");
+ push(@implContent, "}\n\n");
+
+ push(@implContent, "${className}::${className}(const ${className}& copy)\n");
+ push(@implContent, " : ${baseClass}()\n");
+ push(@implContent, "{\n");
+ push(@implContent, " m_impl = copy.impl() ? new ${className}Private(copy.impl()) : 0;\n");
+ push(@implContent, "}\n\n");
+
+ push(@implContent, "$implClassNameWithNamespace* ${className}::impl() const\n");
+ push(@implContent, "{\n");
+ push(@implContent, " return m_impl ? m_impl->impl.get() : 0;\n");
+ push(@implContent, "}\n\n");
+
+ # Destructor
+ push(@implContent, "${className}::~$className()\n");
+ push(@implContent, "{\n");
+ push(@implContent, " delete m_impl;\n");
+ push(@implContent, " m_impl = 0;\n");
+ push(@implContent, "}\n\n");
+ } else {
+ push(@implContent, " : ${baseClass}(impl)\n");
+ push(@implContent, "{\n");
+ push(@implContent, "}\n\n");
+
+ push(@implContent, "$implClassNameWithNamespace* ${className}::impl() const\n");
+ push(@implContent, "{\n");
+ push(@implContent, " return static_cast<$implClassNameWithNamespace*>(${baseClass}::impl());\n");
+ push(@implContent, "}\n\n");
+ }
+
+ # START implementation
+ %attributeNames = ();
+
+ # - Attributes
+ if ($numAttributes > 0) {
+ foreach my $attribute (@{$dataNode->attributes}) {
+ next if ShouldSkipTypeInImplementation($attribute);
+ AddIncludesForType($attribute->signature->type);
+
+ my $idlType = $codeGenerator->StripModule($attribute->signature->type);
+
+ my $attributeName = $attribute->signature->name;
+ my $attributeType = GetCPPType($attribute->signature->type, 0);
+ my $attributeIsReadonly = ($attribute->type =~ /^readonly/);
+
+ $attributeNames{$attributeName} = 1;
+
+ # - GETTER
+ my $getterSig = "$attributeType $className\:\:$attributeName() const\n";
+ my $hasGetterException = @{$attribute->getterExceptions};
+ my $getterContentHead;
+ my $reflect = $attribute->signature->extendedAttributes->{"Reflect"};
+ my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"};
+ if ($reflect || $reflectURL) {
+ my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL);
+ my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName);
+ $implIncludes{"${namespace}.h"} = 1;
+ my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute";
+ $getterContentHead = "impl()->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr";
+ } else {
+ $getterContentHead = "impl()->" . $codeGenerator->WK_lcfirst($attributeName) . "(";
+ }
+ my $getterContentTail = ")";
+
+ # Special cases
+ my @customGetterContent = ();
+ if ($attribute->signature->extendedAttributes->{"ConvertToString"}) {
+ $getterContentHead = "WebCore::String::number(" . $getterContentHead;
+ $getterContentTail .= ")";
+ } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) {
+ $getterContentTail .= ".toInt()";
+ } elsif ($attribute->signature->type eq "SerializedScriptValue") {
+ $getterContentHead = "$getterContentHead";
+ $getterContentTail .= "->toString()";
+ } elsif (ConversionNeeded($attribute->signature->type)) {
+ $getterContentHead = "toWebKit(WTF::getPtr($getterContentHead";
+ $getterContentTail .= "))";
+ }
+
+ my $getterContent;
+ if ($hasGetterException) {
+ $getterContent = $getterContentHead . "ec" . $getterContentTail;
+ } else {
+ $getterContent = $getterContentHead . $getterContentTail;
+ }
+
+ my $attributeConditionalString = GenerateConditionalString($attribute->signature);
+ push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString;
+
+ push(@implContent, $getterSig);
+ push(@implContent, "{\n");
+ push(@implContent, AddEarlyReturnStatement($attributeType));
+ push(@implContent, @customGetterContent);
+ if ($hasGetterException) {
+ # Differentiated between when the return type is a pointer and
+ # not for white space issue (ie. Foo *result vs. int result).
+ if ($attributeType =~ /\*$/) {
+ $getterContent = $attributeType . "result = " . $getterContent;
+ } else {
+ $getterContent = $attributeType . " result = " . $getterContent;
+ }
+
+ push(@implContent, " $exceptionInit\n");
+ push(@implContent, " $getterContent;\n");
+ push(@implContent, " $exceptionRaiseOnError\n");
+ push(@implContent, AddReturnStatement($attribute, "result"));
+ } else {
+ push(@implContent, AddReturnStatement($attribute, $getterContent));
+ }
+ push(@implContent, "}\n\n");
+
+ # - SETTER
+ if (!$attributeIsReadonly and !$attribute->signature->extendedAttributes->{"Replaceable"}) {
+ # Exception handling
+ my $hasSetterException = @{$attribute->setterExceptions};
+
+ my $coreSetterName = "set" . $codeGenerator->WK_ucfirst($attributeName);
+ my $setterName = "set" . ucfirst($attributeName);
+ my $argName = "new" . ucfirst($attributeName);
+ my $arg = GetCPPTypeGetter($argName, $idlType);
+
+ # The definition of ConvertFromString and ConvertToString is flipped for the setter
+ if ($attribute->signature->extendedAttributes->{"ConvertFromString"}) {
+ $arg = "WebCore::String::number($arg)";
+ } elsif ($attribute->signature->extendedAttributes->{"ConvertToString"}) {
+ $arg = "WebCore::String($arg).toInt()";
+ }
+
+ my $attributeType = GetCPPType($attribute->signature->type, 1);
+ push(@implContent, "void $className\:\:$setterName($attributeType $argName)\n");
+ push(@implContent, "{\n");
+ push(@implContent, AddEarlyReturnStatement());
+
+ my $reflect = $attribute->signature->extendedAttributes->{"Reflect"};
+ my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"};
+ push(@implContent, " $exceptionInit\n") if $hasSetterException;
+ my $ec = $hasSetterException ? ", ec" : "";
+ if ($reflect || $reflectURL) {
+ my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL);
+ my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName);
+ $implIncludes{"${namespace}.h"} = 1;
+ push(@implContent, " impl()->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, $arg$ec);\n");
+ } else {
+ push(@implContent, " impl()->$coreSetterName($arg$ec);\n");
+ }
+ push(@implContent, " $exceptionRaiseOnError\n") if $hasSetterException;
+ push(@implContent, "}\n\n");
+ }
+
+ push(@implContent, "#endif\n") if $attributeConditionalString;
+ }
+ }
+
+ # - Functions
+ if ($numFunctions > 0) {
+ foreach my $function (@{$dataNode->functions}) {
+ # Treat PureInterface as Custom as well, since the WebCore versions will take a script context as well
+ next if ShouldSkipTypeInImplementation($function) || $dataNode->extendedAttributes->{"PureInterface"};
+ AddIncludesForType($function->signature->type);
+
+ my $functionName = $function->signature->name;
+ my $returnType = GetCPPType($function->signature->type, 0);
+ my $hasParameters = @{$function->parameters};
+ my $raisesExceptions = @{$function->raisesExceptions};
+
+ my @parameterNames = ();
+ my @needsAssert = ();
+ my %needsCustom = ();
+
+ my $parameterIndex = 0;
+
+ # FIXME: Handle Callback support, we're just passing 0 as ScriptExecutionContext for now.
+ push(@parameterNames, "0") if ($dataNode->extendedAttributes->{"Callback"});
+
+ my $functionSig = "$returnType $className\:\:$functionName(";
+ foreach my $param (@{$function->parameters}) {
+ my $paramName = $param->name;
+ my $paramType = GetCPPType($param->type, 1);
+
+ # make a new parameter name if the original conflicts with a property name
+ $paramName = "in" . ucfirst($paramName) if $attributeNames{$paramName};
+
+ AddIncludesForType($param->type);
+
+ my $idlType = $codeGenerator->StripModule($param->type);
+ my $implGetter = GetCPPTypeGetter($paramName, $idlType);
+
+ push(@parameterNames, $implGetter);
+ $needsCustom{"NodeToReturn"} = $paramName if $param->extendedAttributes->{"Return"};
+
+ unless ($codeGenerator->IsPrimitiveType($idlType) or $codeGenerator->IsStringType($idlType)) {
+ push(@needsAssert, " ASSERT($paramName);\n");
+ }
+
+ $functionSig .= ", " if $parameterIndex >= 1;
+ $functionSig .= "$paramType $paramName";
+ $parameterIndex++;
+ }
+
+ $functionSig .= ")";
+
+ my @functionContent = ();
+ push(@parameterNames, "ec") if $raisesExceptions;
+ my $content = "impl()->" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")";
+
+ if ($returnType eq "void") {
+ # Special case 'void' return type.
+ if ($raisesExceptions) {
+ push(@functionContent, " $exceptionInit\n");
+ push(@functionContent, " $content;\n");
+ push(@functionContent, " $exceptionRaiseOnError\n");
+ } else {
+ push(@functionContent, " $content;\n");
+ }
+ } elsif (defined $needsCustom{"NodeToReturn"}) {
+ # TODO: This is important to enable, once we care about custom code!
+
+ # Special case the insertBefore, replaceChild, removeChild
+ # and appendChild functions from DOMNode
+ my $toReturn = $needsCustom{"NodeToReturn"};
+ if ($raisesExceptions) {
+ push(@functionContent, " $exceptionInit\n");
+ push(@functionContent, " if ($content)\n");
+ push(@functionContent, " return $toReturn;\n");
+ push(@functionContent, " $exceptionRaiseOnError\n");
+ push(@functionContent, " return $className();\n");
+ } else {
+ push(@functionContent, " if ($content)\n");
+ push(@functionContent, " return $toReturn;\n");
+ push(@functionContent, " return NULL;\n");
+ }
+ } else {
+ if (ConversionNeeded($function->signature->type)) {
+ $content = "toWebKit(WTF::getPtr($content))";
+ }
+
+ if ($raisesExceptions) {
+ # Differentiated between when the return type is a pointer and
+ # not for white space issue (ie. Foo *result vs. int result).
+ if ($returnType =~ /\*$/) {
+ $content = $returnType . "result = " . $content;
+ } else {
+ $content = $returnType . " result = " . $content;
+ }
+
+ push(@functionContent, " $exceptionInit\n");
+ push(@functionContent, " $content;\n");
+ push(@functionContent, " $exceptionRaiseOnError\n");
+ push(@functionContent, " return result;\n");
+ } else {
+ push(@functionContent, " return $content;\n");
+ }
+ }
+
+ push(@implContent, "$functionSig\n");
+ push(@implContent, "{\n");
+ push(@implContent, AddEarlyReturnStatement($returnType));
+ push(@implContent, @functionContent);
+ push(@implContent, "}\n\n");
+
+ # Clear the hash
+ %needsCustom = ();
+ }
+ }
+
+ # END implementation
+
+ # Generate internal interfaces
+ push(@implContent, "WebCore::$implClassName* toWebCore(const $className& wrapper)\n");
+ push(@implContent, "{\n");
+ push(@implContent, " return wrapper.impl();\n");
+ push(@implContent, "}\n\n");
+
+ push(@implContent, "$className toWebKit(WebCore::$implClassName* value)\n");
+ push(@implContent, "{\n");
+ push(@implContent, " return $className(value);\n");
+ push(@implContent, "}\n");
+
+ # - End the ifdef conditional if necessary
+ push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
+}
+
+# Internal helper
+sub WriteData
+{
+ my $object = shift;
+ my $name = shift;
+
+ # Open files for writing...
+ my $headerFileName = "$outputDir/" . $name . ".h";
+ my $implFileName = "$outputDir/" . $name . ".cpp";
+
+ # Remove old files.
+ unlink($headerFileName);
+ unlink($implFileName);
+
+ # Write public header.
+ open(HEADER, ">$headerFileName") or die "Couldn't open file $headerFileName";
+
+ print HEADER @headerContentHeader;
+ print HEADER "\n";
+ foreach my $class (sort keys(%headerForwardDeclarations)) {
+ if ($class =~ /::/) {
+ my $namespacePart = $class;
+ $namespacePart =~ s/::.*//;
+
+ my $classPart = $class;
+ $classPart =~ s/${namespacePart}:://;
+
+ print HEADER "namespace $namespacePart {\nclass $classPart;\n};\n\n";
+ } else {
+ print HEADER "class $class;\n"
+ }
+ }
+
+ my $hasForwardDeclarations = keys(%headerForwardDeclarations);
+ print HEADER "\n" if $hasForwardDeclarations;
+ print HEADER @headerContent;
+ close(HEADER);
+
+ @headerContentHeader = ();
+ @headerContent = ();
+ %headerForwardDeclarations = ();
+
+ # Write implementation file.
+ open(IMPL, ">$implFileName") or die "Couldn't open file $implFileName";
+
+ print IMPL @implContentHeader;
+
+ foreach my $include (sort keys(%implIncludes)) {
+ # "className.h" is already included right after config.h, silence check-webkit-style
+ next if $include eq "$name.h";
+ print IMPL "#include \"$include\"\n";
+ }
+
+ print IMPL @implContent;
+ close(IMPL);
+
+ @implContentHeader = ();
+ @implContent = ();
+ %implIncludes = ();
+}
+
+1;
diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm
index b331f97..e98c661 100644
--- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm
@@ -362,7 +362,7 @@ sub GenerateProperty {
}
if (grep {$_ eq $attribute} @writeableProperties) {
- push(@txtSetProps, " case ${propEnum}:\n {\n");
+ push(@txtSetProps, " case ${propEnum}:\n {\n");
push(@txtSetProps, " WebCore::ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions};
push(@txtSetProps, " ${setterContentHead}");
push(@txtSetProps, ", ec") if @{$attribute->setterExceptions};
@@ -370,7 +370,7 @@ sub GenerateProperty {
push(@txtSetProps, " break;\n }\n");
}
- push(@txtGetProps, " case ${propEnum}:\n {\n");
+ push(@txtGetProps, " case ${propEnum}:\n {\n");
my $exception = "";
if (@{$attribute->getterExceptions}) {
@@ -471,6 +471,16 @@ sub GenerateEventListener {
my $object = shift;
my $interfaceName = shift;
+ # This marks event listeners in some subclasses of Element. We
+ # cannot add them, otherwise we'll get runtime errors because of
+ # duplicated signal definitions between a class and some ancestor.
+
+ # FIXME: it would be very good to be a lot more precise in how we
+ # do this...
+ if ($attribute->signature->extendedAttributes->{"WindowEventListener"}) {
+ return;
+ }
+
my $name = $attribute->signature->name;
my $domSignalName = substr($name, 2);
my $gobjectSignalName = EventSignalName($domSignalName);
@@ -548,7 +558,7 @@ EOF
if (scalar @writeableProperties > 0) {
$txtSetProps = << "EOF";
- ${className} *self = WEBKIT_DOM_${clsCaps}(object);
+ ${className}* self = WEBKIT_DOM_${clsCaps}(object);
$privFunction
EOF
push(@txtSetProps, $txtSetProps);
@@ -587,6 +597,9 @@ EOF
EOF
push(@txtSetProps, $txtSetProps);
+ # Do not insert extra spaces when interpolating array variables
+ $" = "";
+
$implContent = << "EOF";
static void ${lowerCaseIfaceName}_finalize(GObject* object)
@@ -747,7 +760,7 @@ sub GenerateFunction {
my $returnType = GetGlibTypeName($functionSigType);
my $returnValueIsGDOMType = IsGDOMClassType($functionSigType);
- my $functionSig = "$className *self";
+ my $functionSig = "${className}* self";
my $callImplParams = "";
@@ -799,8 +812,8 @@ sub GenerateFunction {
$functionSig .= ", GError **error";
}
- push(@hBody, "WEBKIT_API $returnType\n$functionName ($functionSig);\n\n");
- push(@cBody, "$returnType\n$functionName ($functionSig)\n{\n");
+ push(@hBody, "WEBKIT_API $returnType\n$functionName($functionSig);\n\n");
+ push(@cBody, "$returnType\n$functionName($functionSig)\n{\n");
if ($conditionalMethods{$functionName}) {
push(@cBody, "#if ENABLE($conditionalMethods{$functionName})\n");
@@ -969,7 +982,7 @@ EOF
push(@cBody, "#endif\n");
}
- push(@cBody, "\n}\n\n");
+ push(@cBody, "}\n\n");
}
sub ClassHasFunction {
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index bffd046..c3521bf 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -172,16 +172,16 @@ sub GenerateEventListenerCall
push(@GenerateEventListenerImpl, <<END);
JSValue correspondingElementWrapper = toJS(exec, imp->correspondingElement());
if (!correspondingElementWrapper.isObject())
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
END
}
push(@GenerateEventListenerImpl, <<END);
JSValue listener = exec->argument(1);
if (!listener.isObject())
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
imp->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean(exec));
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
END
return @GenerateEventListenerImpl;
}
@@ -984,12 +984,18 @@ sub GenerateHeader
push(@headerContent, "};\n\n");
+ # Conditionally emit the constructor object's declaration
+ if ($dataNode->extendedAttributes->{"CustomConstructFunction"}) {
+ GenerateConstructorDeclaration(\@headerContent, $className, $dataNode);
+ }
+
+
if ($numFunctions > 0) {
push(@headerContent,"// Functions\n\n");
foreach my $function (@{$dataNode->functions}) {
next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
my $functionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name);
- push(@headerContent, "JSC::JSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*);\n");
+ push(@headerContent, "JSC::EncodedJSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*);\n");
}
}
@@ -1115,7 +1121,7 @@ sub GenerateParametersCheckExpression
# these are acceptable values for a DOMString argument (any Object can
# be converted to a string via .toString).
push(@andExpression, "(${value}.isNull() || ${value}.isUndefined() || ${value}.isString() || ${value}.isObject())") if $codeGenerator->IsStringType($type);
- push(@andExpression, "(${value}.isNull() || asObject(${value})->inherits(JS${type}::s_info)") unless IsNativeType($type);
+ push(@andExpression, "(${value}.isNull() || ${value}.isObject() && asObject(${value})->inherits(&JS${type}::s_info))") unless IsNativeType($type);
$parameterIndex++;
}
@@ -1154,7 +1160,7 @@ sub GenerateOverloadedPrototypeFunction
my $functionName = "js${implClassName}PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name);
- push(@implContent, "JSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n");
+ push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n");
push(@implContent, <<END);
{
END
@@ -1164,7 +1170,7 @@ END
push(@implContent, " return ${functionName}$overload->{overloadIndex}(exec);\n");
}
push(@implContent, <<END);
- return throwError(exec, TypeError);
+ return JSValue::encode(throwTypeError(exec));
}
END
@@ -1231,10 +1237,10 @@ sub GenerateImplementation
\@hashKeys, \@hashSpecials,
\@hashValue1, \@hashValue2);
- my $protoClassName;
- $protoClassName = "${className}Prototype";
+ my $protoClassName = "${className}Prototype";
- push(@implContent, constructorFor($className, $protoClassName, $interfaceName, $visibleClassName, $dataNode));
+ GenerateConstructorDeclaration(\@implContent, $className, $dataNode) unless $dataNode->extendedAttributes->{"CustomConstructFunction"};
+ GenerateConstructorDefinition(\@implContent, $className, $protoClassName, $interfaceName, $visibleClassName, $dataNode);
}
# - Add functions and constants to a hashtable definition
@@ -1786,11 +1792,14 @@ sub GenerateImplementation
if ($function->{overloads} && @{$function->{overloads}} > 1) {
# Append a number to an overloaded method's name to make it unique:
$functionName = $functionName . $function->{overloadIndex};
+ # Make this function static to avoid compiler warnings, since we
+ # don't generate a prototype for it in the header.
+ push(@implContent, "static ");
}
my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name);
- push(@implContent, "JSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n");
+ push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n");
push(@implContent, "{\n");
$implIncludes{"<runtime/Error.h>"} = 1;
@@ -1798,22 +1807,22 @@ sub GenerateImplementation
if ($interfaceName eq "DOMWindow") {
push(@implContent, " $className* castedThis = toJSDOMWindow(exec->hostThisValue().toThisObject(exec));\n");
push(@implContent, " if (!castedThis)\n");
- push(@implContent, " return throwError(exec, TypeError);\n");
+ push(@implContent, " return throwVMTypeError(exec);\n");
} elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) {
push(@implContent, " $className* castedThis = to${className}(exec->hostThisValue().toThisObject(exec));\n");
push(@implContent, " if (!castedThis)\n");
- push(@implContent, " return throwError(exec, TypeError);\n");
+ push(@implContent, " return throwVMTypeError(exec);\n");
} else {
push(@implContent, " JSValue thisValue = exec->hostThisValue();\n");
push(@implContent, " if (!thisValue.inherits(&${className}::s_info))\n");
- push(@implContent, " return throwError(exec, TypeError);\n");
+ push(@implContent, " return throwVMTypeError(exec);\n");
push(@implContent, " $className* castedThis = static_cast<$className*>(asObject(thisValue));\n");
}
if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} &&
!$function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) {
push(@implContent, " if (!castedThis->allowsAccessFrom(exec))\n");
- push(@implContent, " return jsUndefined();\n");
+ push(@implContent, " return JSValue::encode(jsUndefined());\n");
}
# Special case for JSSVGLengthList / JSSVGTransformList / JSSVGPointList / JSSVGNumberList
@@ -1832,12 +1841,12 @@ sub GenerateImplementation
}
if ($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}) {
- push(@implContent, " return castedThis->" . $functionImplementationName . "(exec);\n");
+ push(@implContent, " return JSValue::encode(castedThis->" . $functionImplementationName . "(exec));\n");
} elsif ($svgPODListType) {
$implIncludes{"JS${svgPODListType}.h"} = 1;
$implIncludes{"JSSVGPODListCustom.h"} = 1;
- push(@implContent, " return JSSVGPODListCustom::$functionImplementationName<$className, " . GetNativeType($svgPODListType)
- . ">(castedThis, exec, to" . $svgPODListType . ");\n");
+ push(@implContent, " return JSValue::encode(JSSVGPODListCustom::$functionImplementationName<$className, " . GetNativeType($svgPODListType)
+ . ">(castedThis, exec, to" . $svgPODListType . "));\n");
} else {
push(@implContent, " $implType* imp = static_cast<$implType*>(castedThis->impl());\n");
push(@implContent, " $podType podImp(*imp);\n") if $podType;
@@ -1848,9 +1857,9 @@ sub GenerateImplementation
if ($requiresAllArguments) {
push(@implContent, " if (exec->argumentCount() < $numParameters)\n");
if ($requiresAllArguments eq "Raise") {
- push(@implContent, " return throwError(exec, SyntaxError, \"Not enough arguments\");\n");
+ push(@implContent, " return throwVMError(exec, createSyntaxError(exec, \"Not enough arguments\"));\n");
} else {
- push(@implContent, " return jsUndefined();\n");
+ push(@implContent, " return JSValue::encode(jsUndefined());\n");
}
}
@@ -1860,7 +1869,7 @@ sub GenerateImplementation
if ($function->signature->extendedAttributes->{"SVGCheckSecurityDocument"}) {
push(@implContent, " if (!checkNodeSecurity(exec, imp->getSVGDocument(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n");
- push(@implContent, " return jsUndefined();\n");
+ push(@implContent, " return JSValue::encode(jsUndefined());\n");
$implIncludes{"JSDOMBinding.h"} = 1;
}
@@ -1869,6 +1878,7 @@ sub GenerateImplementation
} elsif ($function->signature->name eq "removeEventListener") {
push(@implContent, GenerateEventListenerCall($className, "remove"));
} else {
+ my $argsIndex = 0;
my $paramIndex = 0;
my $functionString = ($podType ? "podImp." : "imp->") . $functionImplementationName . "(";
@@ -1885,10 +1895,15 @@ sub GenerateImplementation
if ($callWith eq "DynamicFrame") {
push(@implContent, " Frame* dynamicFrame = toDynamicFrame(exec);\n");
push(@implContent, " if (!dynamicFrame)\n");
- push(@implContent, " return jsUndefined();\n");
+ push(@implContent, " return JSValue::encode(jsUndefined());\n");
$callWithArg = "dynamicFrame";
} elsif ($callWith eq "ScriptState") {
$callWithArg = "exec";
+ } elsif ($callWith eq "ScriptExecutionContext") {
+ push(@implContent, " ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();\n");
+ push(@implContent, " if (!scriptContext)\n");
+ push(@implContent, " return JSValue::encode(jsUndefined());\n");
+ $callWithArg = "scriptContext";
}
$functionString .= ", " if $paramIndex;
$functionString .= $callWithArg;
@@ -1902,7 +1917,7 @@ sub GenerateImplementation
push(@implContent, "\n int argsCount = exec->argumentCount();\n");
$hasOptionalArguments = 1;
}
- push(@implContent, " if (argsCount < " . ($paramIndex + 1) . ") {\n");
+ push(@implContent, " if (argsCount < " . ($argsIndex + 1) . ") {\n");
GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $podType, $implClassName);
push(@implContent, " }\n\n");
}
@@ -1911,15 +1926,15 @@ sub GenerateImplementation
if ($parameter->type eq "XPathNSResolver") {
push(@implContent, " RefPtr<XPathNSResolver> customResolver;\n");
- push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(exec->argument($paramIndex));\n");
+ push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(exec->argument($argsIndex));\n");
push(@implContent, " if (!resolver) {\n");
- push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, exec->argument($paramIndex));\n");
+ push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, exec->argument($argsIndex));\n");
push(@implContent, " if (exec->hadException())\n");
- push(@implContent, " return jsUndefined();\n");
+ push(@implContent, " return JSValue::encode(jsUndefined());\n");
push(@implContent, " resolver = customResolver.get();\n");
push(@implContent, " }\n");
} else {
- push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($paramIndex)") . ";\n");
+ push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n");
# If a parameter is "an index" and it's negative it should throw an INDEX_SIZE_ERR exception.
# But this needs to be done in the bindings, because the type is unsigned and the fact that it
@@ -1928,7 +1943,7 @@ sub GenerateImplementation
$implIncludes{"ExceptionCode.h"} = 1;
push(@implContent, " if ($name < 0) {\n");
push(@implContent, " setDOMException(exec, INDEX_SIZE_ERR);\n");
- push(@implContent, " return jsUndefined();\n");
+ push(@implContent, " return JSValue::encode(jsUndefined());\n");
push(@implContent, " }\n");
}
}
@@ -1940,6 +1955,7 @@ sub GenerateImplementation
} else {
$functionString .= $name;
}
+ $argsIndex++;
$paramIndex++;
}
@@ -2221,7 +2237,7 @@ sub GenerateImplementationFunctionCall()
push(@implContent, $indent . "$functionString;\n");
push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions};
push(@implContent, $indent . "imp->commitChange(podImp, castedThis);\n") if $podType;
- push(@implContent, $indent . "return jsUndefined();\n");
+ push(@implContent, $indent . "return JSValue::encode(jsUndefined());\n");
} else {
push(@implContent, "\n" . $indent . "JSC::JSValue result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThis") . ";\n");
push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions};
@@ -2229,7 +2245,7 @@ sub GenerateImplementationFunctionCall()
$callWith = $function->signature->extendedAttributes->{"CallWith"};
if ($callWith and $callWith eq "ScriptState") {
push(@implContent, $indent . "if (exec->hadException())\n");
- push(@implContent, $indent . " return jsUndefined();\n");
+ push(@implContent, $indent . " return JSValue::encode(jsUndefined());\n");
}
if ($podType and not $function->signature->extendedAttributes->{"Immutable"}) {
@@ -2238,7 +2254,7 @@ sub GenerateImplementationFunctionCall()
push(@implContent, $indent . "imp->commitChange(podImp, castedThis);\n");
}
- push(@implContent, $indent . "return result;\n");
+ push(@implContent, $indent . "return JSValue::encode(result);\n");
}
}
@@ -2702,86 +2718,94 @@ sub WriteData
}
}
-sub constructorFor
+sub GenerateConstructorDeclaration
{
+ my $outputArray = shift;
my $className = shift;
- my $protoClassName = shift;
- my $interfaceName = shift;
- my $visibleClassName = shift;
my $dataNode = shift;
+
my $constructorClassName = "${className}Constructor";
my $canConstruct = $dataNode->extendedAttributes->{"CanBeConstructed"};
my $callWith = $dataNode->extendedAttributes->{"CallWith"};
-my $implContent = << "EOF";
-class ${constructorClassName} : public DOMConstructorObject {
-public:
- ${constructorClassName}(ExecState* exec, JSDOMGlobalObject* globalObject)
- : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject)
- {
- putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), DontDelete | ReadOnly);
- }
- virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
- virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
- virtual const ClassInfo* classInfo() const { return &s_info; }
- static const ClassInfo s_info;
+ push(@$outputArray, "class ${constructorClassName} : public DOMConstructorObject {\n");
+ push(@$outputArray, "public:\n");
+ push(@$outputArray, " ${constructorClassName}(JSC::ExecState*, JSDOMGlobalObject*);\n\n");
- static PassRefPtr<Structure> createStructure(JSValue proto)
- {
- return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
- }
-
-protected:
- static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags;
-EOF
+ push(@$outputArray, " virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n");
+ push(@$outputArray, " virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n");
+ push(@$outputArray, " virtual const JSC::ClassInfo* classInfo() const { return &s_info; }\n");
+ push(@$outputArray, " static const JSC::ClassInfo s_info;\n");
- if ($canConstruct) {
-$implContent .= << "EOF";
- static JSObject* construct${interfaceName}(ExecState* exec, JSObject* constructor, const ArgList&)
- {
-EOF
+ push(@$outputArray, " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n");
+ push(@$outputArray, " {\n");
+ push(@$outputArray, " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);\n");
+ push(@$outputArray, " }\n");
- my $constructorArg = "";
- if ($callWith and $callWith eq "ScriptExecutionContext") {
- $constructorArg = "context";
-$implContent .= << "EOF";
- ScriptExecutionContext* context = static_cast<${constructorClassName}*>(constructor)->scriptExecutionContext();
- if (!context)
- return throwError(exec, ReferenceError);
-EOF
- }
+ push(@$outputArray, "protected:\n");
+ push(@$outputArray, " static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;\n");
-$implContent .= << "EOF";
- return asObject(toJS(exec, static_cast<${constructorClassName}*>(constructor)->globalObject(), ${interfaceName}::create(${constructorArg})));
- }
- virtual ConstructType getConstructData(ConstructData& constructData)
- {
- constructData.native.function = construct${interfaceName};
- return ConstructTypeHost;
- }
-EOF
+ if ($canConstruct) {
+ push(@$outputArray, " static JSC::EncodedJSValue JSC_HOST_CALL construct${className}(JSC::ExecState*);\n");
+ push(@$outputArray, " virtual JSC::ConstructType getConstructData(JSC::ConstructData&);\n");
}
+ push(@$outputArray, "};\n\n");
+}
-$implContent .= << "EOF";
-};
+sub GenerateConstructorDefinition
+{
+ my $outputArray = shift;
-const ClassInfo ${constructorClassName}::s_info = { "${visibleClassName}Constructor", 0, &${constructorClassName}Table, 0 };
+ my $className = shift;
+ my $protoClassName = shift;
+ my $interfaceName = shift;
+ my $visibleClassName = shift;
+ my $dataNode = shift;
-bool ${constructorClassName}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
-{
- return getStaticValueSlot<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, slot);
-}
+ my $constructorClassName = "${className}Constructor";
+ my $canConstruct = $dataNode->extendedAttributes->{"CanBeConstructed"};
+ my $customConstructFunction = $dataNode->extendedAttributes->{"CustomConstructFunction"};
+ my $callWith = $dataNode->extendedAttributes->{"CallWith"};
-bool ${constructorClassName}::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
-{
- return getStaticValueDescriptor<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, descriptor);
-}
+ push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleClassName}Constructor\", 0, &${constructorClassName}Table, 0 };\n\n");
-EOF
+ push(@$outputArray, "${constructorClassName}::${constructorClassName}(ExecState* exec, JSDOMGlobalObject* globalObject)\n");
+ push(@$outputArray, " : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject)\n");
+ push(@$outputArray, "{\n");
+ push(@$outputArray, " putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), DontDelete | ReadOnly);\n");
+ push(@$outputArray, "}\n\n");
+
+ push(@$outputArray, "bool ${constructorClassName}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n");
+ push(@$outputArray, "{\n");
+ push(@$outputArray, " return getStaticValueSlot<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, slot);\n");
+ push(@$outputArray, "}\n\n");
- $implJSCInclude{"JSNumberCell.h"} = 1; # FIXME: What is this for?
+ push(@$outputArray, "bool ${constructorClassName}::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)\n");
+ push(@$outputArray, "{\n");
+ push(@$outputArray, " return getStaticValueDescriptor<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, descriptor);\n");
+ push(@$outputArray, "}\n\n");
- return $implContent;
+ if ($canConstruct) {
+ if (!$customConstructFunction) {
+ push(@$outputArray, "EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct${className}(ExecState* exec)\n");
+ push(@$outputArray, "{\n");
+ my $constructorArg = "";
+ if ($callWith and $callWith eq "ScriptExecutionContext") {
+ $constructorArg = "context";
+ push(@$outputArray, " ScriptExecutionContext* context = static_cast<${constructorClassName}*>(exec->callee())->scriptExecutionContext();\n");
+ push(@$outputArray, " if (!context)\n");
+ push(@$outputArray, " return throwVMError(exec, createReferenceError(exec, \"Reference error\"));\n");
+ }
+ push(@$outputArray, " return JSValue::encode(asObject(toJS(exec, static_cast<${constructorClassName}*>(exec->callee())->globalObject(), ${interfaceName}::create(${constructorArg}))));\n");
+ push(@$outputArray, "}\n\n");
+ }
+
+ push(@$outputArray, "ConstructType ${constructorClassName}::getConstructData(ConstructData& constructData)\n");
+ push(@$outputArray, "{\n");
+ push(@$outputArray, " constructData.native.function = construct${className};\n");
+ push(@$outputArray, " return ConstructTypeHost;\n");
+ push(@$outputArray, "}\n\n");
+ }
}
1;
diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
index 89da48d..daead72 100644
--- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
@@ -5,6 +5,7 @@
# Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
# Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
+# Copyright (C) 2010 Google Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -740,8 +741,8 @@ sub GenerateHeader
foreach my $attribute (@{$dataNode->attributes}) {
my $attributeName = $attribute->signature->name;
- if ($attributeName eq "id" or $attributeName eq "hash") {
- # Special case attributes id and hash to be idName and hashName to avoid ObjC naming conflict.
+ if ($attributeName eq "id" or $attributeName eq "hash" or $attributeName eq "description") {
+ # Special case some attributes (like id and hash) to have a "Name" suffix to avoid ObjC naming conflicts.
$attributeName .= "Name";
} elsif ($attributeName eq "frame") {
# Special case attribute frame to be frameBorders.
@@ -1157,8 +1158,8 @@ sub GenerateImplementation
my $attributeClassName = GetClassName($attribute->signature->type);
my $attributeInterfaceName = $attributeName;
- if ($attributeName eq "id" or $attributeName eq "hash") {
- # Special case attributes id and hash to be idName and hashName to avoid ObjC naming conflict.
+ if ($attributeName eq "id" or $attributeName eq "hash" or $attributeName eq "description") {
+ # Special case some attributes (like id and hash) to have a "Name" suffix to avoid ObjC naming conflicts.
$attributeInterfaceName .= "Name";
} elsif ($attributeName eq "frame") {
# Special case attribute frame to be frameBorders.
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 058d1cc..e471500 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -273,6 +273,13 @@ END
END
}
+ if ($implClassName eq "HTMLDocument") {
+ push(@headerContent, <<END);
+ static v8::Local<v8::Object> WrapInShadowObject(v8::Local<v8::Object> wrapper, Node* impl);
+ static v8::Handle<v8::Value> GetNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key);
+END
+ }
+
my @enabledAtRuntime;
foreach my $function (@{$dataNode->functions}) {
my $name = $function->signature->name;
@@ -289,7 +296,7 @@ END
}
}
- if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) {
+ if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) {
push(@headerContent, <<END);
static v8::Handle<v8::Value> constructorCallback(const v8::Arguments& args);
END
@@ -360,9 +367,6 @@ sub GetInternalFields
if (IsSubType($dataNode, "Document")) {
push(@customInternalFields, "implementationIndex");
- if ($name eq "HTMLDocument") {
- push(@customInternalFields, ("markerIndex", "shadowIndex"));
- }
} elsif ($name eq "DOMWindow") {
push(@customInternalFields, "enteredIsolatedWorldIndex");
}
@@ -399,7 +403,6 @@ END
my %indexerSpecialCases = (
"Storage" => 1,
"HTMLAppletElement" => 1,
- "HTMLDocument" => 1,
"HTMLEmbedElement" => 1,
"HTMLObjectElement" => 1
);
@@ -426,42 +429,47 @@ sub GenerateHeaderNamedAndIndexedPropertyAccessors
if ($interfaceName eq "HTMLSelectElement" || $interfaceName eq "HTMLAppletElement" || $interfaceName eq "HTMLEmbedElement" || $interfaceName eq "HTMLObjectElement") {
$hasCustomNamedGetter = 1;
}
+ if ($interfaceName eq "HTMLDocument") {
+ $hasCustomNamedGetter = 0;
+ $hasCustomIndexedGetter = 0;
+ }
my $isIndexerSpecialCase = exists $indexerSpecialCases{$interfaceName};
if ($hasCustomIndexedGetter || $isIndexerSpecialCase) {
push(@headerContent, <<END);
- static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t, const v8::AccessorInfo&);
END
}
if ($isIndexerSpecialCase || $hasCustomIndexedSetter) {
push(@headerContent, <<END);
- static v8::Handle<v8::Value> indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> indexedPropertySetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&);
END
}
if ($hasCustomDeleters) {
push(@headerContent, <<END);
- static v8::Handle<v8::Boolean> indexedPropertyDeleter(uint32_t index, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Boolean> indexedPropertyDeleter(uint32_t, const v8::AccessorInfo&);
END
}
if ($hasCustomNamedGetter) {
push(@headerContent, <<END);
- static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&);
END
}
if ($hasCustomNamedSetter) {
push(@headerContent, <<END);
- static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&);
END
}
- if ($hasCustomDeleters || $interfaceName eq "HTMLDocument") {
+ if ($hasCustomDeleters) {
push(@headerContent, <<END);
- static v8::Handle<v8::Boolean> namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Boolean> namedPropertyDeleter(v8::Local<v8::String>, const v8::AccessorInfo&);
END
}
if ($hasCustomEnumerator) {
push(@headerContent, <<END);
- static v8::Handle<v8::Array> namedPropertyEnumerator(const v8::AccessorInfo& info);
+ static v8::Handle<v8::Array> namedPropertyEnumerator(const v8::AccessorInfo&);
+ static v8::Handle<v8::Integer> namedPropertyQuery(v8::Local<v8::String>, const v8::AccessorInfo&);
END
}
}
@@ -1504,6 +1512,10 @@ sub GenerateImplementationNamedPropertyGetter
$hasCustomGetter = 1;
}
+ if ($interfaceName eq "HTMLDocument") {
+ $hasCustomGetter = 0;
+ }
+
my $hasGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $hasCustomGetter || $namedPropertyGetter;
if (!$hasGetter) {
return;
@@ -1519,8 +1531,7 @@ END
}
my $hasSetter = $dataNode->extendedAttributes->{"DelegatingPutFunction"};
- # FIXME: Try to remove hard-coded HTMLDocument reference by aligning handling of document.all with JSC bindings.
- my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"} || $interfaceName eq "HTMLDocument";
+ my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"};
my $hasEnumerator = $dataNode->extendedAttributes->{"CustomGetPropertyNames"};
my $setOn = "Instance";
@@ -1536,7 +1547,8 @@ END
push(@implContent, " desc->${setOn}Template()->SetNamedPropertyHandler(V8${interfaceName}::namedPropertyGetter, ");
push(@implContent, $hasSetter ? "V8${interfaceName}::namedPropertySetter, " : "0, ");
- push(@implContent, "0, "); # NamedPropertyQuery -- not being used at the moment.
+ # If there is a custom enumerator, there MUST be custom query to properly communicate property attributes.
+ push(@implContent, $hasEnumerator ? "V8${interfaceName}::namedPropertyQuery, " : "0, ");
push(@implContent, $hasDeleter ? "V8${interfaceName}::namedPropertyDeleter, " : "0, ");
push(@implContent, $hasEnumerator ? "V8${interfaceName}::namedPropertyEnumerator" : "0");
push(@implContent, ");\n");
@@ -1780,7 +1792,7 @@ END
push(@implContentDecls, "} // namespace ${interfaceName}Internal\n\n");
# In namespace WebCore, add generated implementation for 'CanBeConstructed'.
- if ($dataNode->extendedAttributes->{"CanBeConstructed"} && !$dataNode->extendedAttributes->{"CustomConstructor"}) {
+ if ($dataNode->extendedAttributes->{"CanBeConstructed"} && !$dataNode->extendedAttributes->{"CustomConstructor"} && !$dataNode->extendedAttributes->{"V8CustomConstructor"}) {
my $v8ConstructFunction;
my $callWith = $dataNode->extendedAttributes->{"CallWith"};
if ($callWith and $callWith eq "ScriptExecutionContext") {
@@ -1858,7 +1870,7 @@ END
END
}
- if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) {
+ if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) {
push(@implContent, <<END);
desc->SetCallHandler(V8${interfaceName}::constructorCallback);
END
@@ -2003,6 +2015,11 @@ END
instance->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheck, V8DOMWindow::indexedSecurityCheck, v8::External::Wrap(&V8DOMWindow::info), false);
END
}
+ if ($interfaceName eq "HTMLDocument") {
+ push(@implContent, <<END);
+ desc->SetHiddenPrototype(true);
+END
+ }
if ($interfaceName eq "Location") {
push(@implContent, <<END);
@@ -2220,6 +2237,7 @@ sub GenerateCallbackImplementation
$implIncludes{"V8CustomVoidCallback.h"} = 1;
$implIncludes{"V8Proxy.h"} = 1;
+ push(@implContent, "#include <wtf/Assertions.h>\n\n");
push(@implContent, "namespace WebCore {\n\n");
push(@implContent, <<END);
${className}::${className}(v8::Local<v8::Object> callback)
@@ -2261,15 +2279,20 @@ END
push(@implContent, " if (v8Context.IsEmpty())\n");
push(@implContent, " return true;\n\n");
push(@implContent, " v8::Context::Scope scope(v8Context);\n\n");
- push(@implContent, " v8::Handle<v8::Value> argv[] = {\n");
my @argvs = ();
foreach my $param (@params) {
my $paramName = $param->name;
- push(@argvs, " toV8(${paramName})");
+ push(@implContent, " v8::Handle<v8::Value> ${paramName}Handle = toV8(${paramName});\n");
+ push(@implContent, " if (${paramName}Handle.IsEmpty()) {\n");
+ push(@implContent, " CRASH();\n");
+ push(@implContent, " return true;\n");
+ push(@implContent, " }\n");
+ push(@argvs, " ${paramName}Handle");
}
- push(@implContent, join(",\n", @argvs));
+ push(@implContent, "\n v8::Handle<v8::Value> argv[] = {\n");
+ push(@implContent, join(",\n", @argvs));
push(@implContent, "\n };\n\n");
push(@implContent, " bool callbackReturnValue = false;\n");
push(@implContent, " return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, context);\n");
@@ -2531,6 +2554,11 @@ sub GenerateFunctionCallString()
$result .= $indent . "EmptyScriptState state;\n";
$callWithArg = "&state";
$hasScriptState = 1;
+ } elsif ($callWith eq "ScriptExecutionContext") {
+ $result .= $indent . "ScriptExecutionContext* scriptContext = getScriptExecutionContext();\n";
+ $result .= $indent . "if (!scriptContext)\n";
+ $result .= $indent . " return v8::Undefined();\n";
+ $callWithArg = "scriptContext";
}
$functionString .= ", " if $index;
$functionString .= $callWithArg;
diff --git a/WebCore/bindings/scripts/IDLParser.pm b/WebCore/bindings/scripts/IDLParser.pm
index 5b7beb3..3df96ab 100644
--- a/WebCore/bindings/scripts/IDLParser.pm
+++ b/WebCore/bindings/scripts/IDLParser.pm
@@ -21,6 +21,8 @@
package IDLParser;
+use strict;
+
use IPC::Open2;
use IDLStructure;
@@ -82,7 +84,7 @@ sub Parse
print " | *** Starting to parse $fileName...\n |\n" unless $beQuiet;
- $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), (map { "-D$_" } split(' ', $defines)), $fileName);
+ my $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), (map { "-D$_" } split(' ', $defines)), $fileName);
close PP_IN;
my @documentContent = <PP_OUT>;
close PP_OUT;
@@ -148,7 +150,7 @@ sub dumpExtendedAttributes
}
my @temp;
- while (($name, $value) = each(%{$attrs})) {
+ while ((my $name, my $value) = each(%{$attrs})) {
push(@temp, "$name=$value");
}
@@ -163,11 +165,11 @@ sub parseExtendedAttributes
my %attrs = ();
foreach my $value (split(/\s*,\s*/, $str)) {
- ($name,$value) = split(/\s*=\s*/, $value, 2);
+ (my $name, my $val) = split(/\s*=\s*/, $value, 2);
# Attributes with no value are set to be true
- $value = 1 unless defined $value;
- $attrs{$name} = $value;
+ $val = 1 unless defined $val;
+ $attrs{$name} = $val;
die("Invalid extended attribute name: '$name'\n") if $name =~ /\s/;
}
@@ -232,9 +234,9 @@ sub ParseInterface
# Match identifier of the interface, and enclosed data...
$data =~ /$IDLStructure::interfaceSelector/;
- $interfaceExtendedAttributes = (defined($1) ? $1 : " "); chop($interfaceExtendedAttributes);
+ my $interfaceExtendedAttributes = (defined($1) ? $1 : " "); chop($interfaceExtendedAttributes);
$interfaceName = (defined($2) ? $2 : die("Parsing error!\nSource:\n$data\n)"));
- $interfaceBase = (defined($3) ? $3 : "");
+ my $interfaceBase = (defined($3) ? $3 : "");
$interfaceData = (defined($4) ? $4 : die("Parsing error!\nSource:\n$data\n)"));
# Fill in known parts of the domClass datastructure now...
diff --git a/WebCore/bindings/scripts/IDLStructure.pm b/WebCore/bindings/scripts/IDLStructure.pm
index e060252..d61fce1 100644
--- a/WebCore/bindings/scripts/IDLStructure.pm
+++ b/WebCore/bindings/scripts/IDLStructure.pm
@@ -21,6 +21,8 @@
package IDLStructure;
+use strict;
+
use Class::Struct;
# Used to represent a parsed IDL document
@@ -70,36 +72,36 @@ struct( domConstant => {
});
# Helpers
-$idlId = '[a-zA-Z0-9]'; # Generic identifier
-$idlIdNs = '[a-zA-Z0-9:]'; # Generic identifier including namespace
-$idlIdNsList = '[a-zA-Z0-9:,\ ]'; # List of Generic identifiers including namespace
+our $idlId = '[a-zA-Z0-9]'; # Generic identifier
+our $idlIdNs = '[a-zA-Z0-9:]'; # Generic identifier including namespace
+our $idlIdNsList = '[a-zA-Z0-9:,\ ]'; # List of Generic identifiers including namespace
-$idlType = '[a-zA-Z0-9_]'; # Generic type/"value string" identifier
-$idlDataType = '[a-zA-Z0-9\ ]'; # Generic data type identifier
+our $idlType = '[a-zA-Z0-9_]'; # Generic type/"value string" identifier
+our $idlDataType = '[a-zA-Z0-9\ ]'; # Generic data type identifier
# Magic IDL parsing regular expressions
my $supportedTypes = "((?:unsigned )?(?:int|short|(?:long )?long)|(?:$idlIdNs*))";
# Special IDL notations
-$extendedAttributeSyntax = '\[[^]]*\]'; # Used for extended attributes
+our $extendedAttributeSyntax = '\[[^]]*\]'; # Used for extended attributes
# Regular expression based IDL 'syntactical tokenizer' used in the IDLParser
-$moduleSelector = 'module\s*(' . $idlId . '*)\s*{';
-$moduleNSSelector = 'module\s*(' . $idlId . '*)\s*\[ns\s*(' . $idlIdNs . '*)\s*(' . $idlIdNs . '*)\]\s*;';
-$constantSelector = 'const\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*=\s*(' . $idlType . '*)';
-$raisesSelector = 'raises\s*\((' . $idlIdNsList . '*)\s*\)';
-$getterRaisesSelector = '\bgetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)';
-$setterRaisesSelector = '\bsetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)';
+our $moduleSelector = 'module\s*(' . $idlId . '*)\s*{';
+our $moduleNSSelector = 'module\s*(' . $idlId . '*)\s*\[ns\s*(' . $idlIdNs . '*)\s*(' . $idlIdNs . '*)\]\s*;';
+our $constantSelector = 'const\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*=\s*(' . $idlType . '*)';
+our $raisesSelector = 'raises\s*\((' . $idlIdNsList . '*)\s*\)';
+our $getterRaisesSelector = '\bgetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)';
+our $setterRaisesSelector = '\bsetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)';
-$typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)';
+our $typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)';
-$exceptionSelector = 'exception\s*(' . $idlIdNs . '*)\s*([a-zA-Z\s{;]*};)';
-$exceptionSubSelector = '{\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*;\s*}';
+our $exceptionSelector = 'exception\s*(' . $idlIdNs . '*)\s*([a-zA-Z\s{;]*};)';
+our $exceptionSubSelector = '{\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*;\s*}';
-$interfaceSelector = 'interface\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([a-zA-Z0-9_=\s(),;:\[\]&\|]*)';
-$interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]]*)';
-$interfaceParameterSelector = 'in\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)';
+our $interfaceSelector = 'interface\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([a-zA-Z0-9_=\s(),;:\[\]&\|]*)';
+our $interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]]*)';
+our $interfaceParameterSelector = 'in\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)';
-$interfaceAttributeSelector = '\s*(readonly attribute|attribute)\s*(' . $extendedAttributeSyntax . ' )?' . $supportedTypes . '\s*(' . $idlType . '*)';
+our $interfaceAttributeSelector = '\s*(readonly attribute|attribute)\s*(' . $extendedAttributeSyntax . ' )?' . $supportedTypes . '\s*(' . $idlType . '*)';
1;
diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp
new file mode 100644
index 0000000..7235793
--- /dev/null
+++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp
@@ -0,0 +1,113 @@
+/*
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(DATABASE)
+
+#include "WebDOMTestCallback.h"
+
+#include "AtomicString.h"
+#include "Class1.h"
+#include "Class2.h"
+#include "Class3.h"
+#include "KURL.h"
+#include "TestCallback.h"
+#include "WebDOMClass1.h"
+#include "WebDOMClass2.h"
+#include "WebDOMClass3.h"
+#include "WebDOMString.h"
+#include "WebExceptionHandler.h"
+#include <wtf/GetPtr.h>
+#include <wtf/RefPtr.h>
+
+struct WebDOMTestCallback::WebDOMTestCallbackPrivate {
+ WebDOMTestCallbackPrivate(WebCore::TestCallback* object = 0)
+ : impl(object)
+ {
+ }
+
+ RefPtr<WebCore::TestCallback> impl;
+};
+
+WebDOMTestCallback::WebDOMTestCallback()
+ : WebDOMObject()
+ , m_impl(0)
+{
+}
+
+WebDOMTestCallback::WebDOMTestCallback(WebCore::TestCallback* impl)
+ : WebDOMObject()
+ , m_impl(new WebDOMTestCallbackPrivate(impl))
+{
+}
+
+WebDOMTestCallback::WebDOMTestCallback(const WebDOMTestCallback& copy)
+ : WebDOMObject()
+{
+ m_impl = copy.impl() ? new WebDOMTestCallbackPrivate(copy.impl()) : 0;
+}
+
+WebCore::TestCallback* WebDOMTestCallback::impl() const
+{
+ return m_impl ? m_impl->impl.get() : 0;
+}
+
+WebDOMTestCallback::~WebDOMTestCallback()
+{
+ delete m_impl;
+ m_impl = 0;
+}
+
+bool WebDOMTestCallback::callbackWithClass1Param(const WebDOMClass1& class1Param)
+{
+ if (!impl())
+ return false;
+
+ return impl()->callbackWithClass1Param(0, toWebCore(class1Param));
+}
+
+bool WebDOMTestCallback::callbackWithClass2Param(const WebDOMClass2& class2Param, const WebDOMString& strArg)
+{
+ if (!impl())
+ return false;
+
+ return impl()->callbackWithClass2Param(0, toWebCore(class2Param), strArg);
+}
+
+int WebDOMTestCallback::callbackWithNonBoolReturnType(const WebDOMClass3& class3Param)
+{
+ if (!impl())
+ return 0;
+
+ return impl()->callbackWithNonBoolReturnType(0, toWebCore(class3Param));
+}
+
+WebCore::TestCallback* toWebCore(const WebDOMTestCallback& wrapper)
+{
+ return wrapper.impl();
+}
+
+WebDOMTestCallback toWebKit(WebCore::TestCallback* value)
+{
+ return WebDOMTestCallback(value);
+}
+
+#endif // ENABLE(DATABASE)
diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h
new file mode 100644
index 0000000..3fe6837
--- /dev/null
+++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebDOMTestCallback_h
+#define WebDOMTestCallback_h
+
+#if ENABLE(DATABASE)
+
+#include <WebDOMObject.h>
+#include <WebDOMString.h>
+
+namespace WebCore {
+class TestCallback;
+};
+
+class WebDOMClass1;
+class WebDOMClass2;
+class WebDOMClass3;
+class WebDOMClass5;
+class WebDOMClass6;
+
+class WebDOMTestCallback : public WebDOMObject {
+public:
+ WebDOMTestCallback();
+ explicit WebDOMTestCallback(WebCore::TestCallback*);
+ WebDOMTestCallback(const WebDOMTestCallback&);
+ ~WebDOMTestCallback();
+
+ bool callbackWithClass1Param(const WebDOMClass1& class1Param);
+ bool callbackWithClass2Param(const WebDOMClass2& class2Param, const WebDOMString& strArg);
+ int callbackWithNonBoolReturnType(const WebDOMClass3& class3Param);
+ int customCallback(const WebDOMClass5& class5Param, const WebDOMClass6& class6Param);
+
+ WebCore::TestCallback* impl() const;
+
+protected:
+ struct WebDOMTestCallbackPrivate;
+ WebDOMTestCallbackPrivate* m_impl;
+};
+
+WebCore::TestCallback* toWebCore(const WebDOMTestCallback&);
+WebDOMTestCallback toWebKit(WebCore::TestCallback*);
+
+#endif
+#endif // ENABLE(DATABASE)
+
diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp
new file mode 100644
index 0000000..0b20841
--- /dev/null
+++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp
@@ -0,0 +1,75 @@
+/*
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebDOMTestInterface.h"
+
+#include "TestInterface.h"
+#include "WebExceptionHandler.h"
+#include <wtf/GetPtr.h>
+#include <wtf/RefPtr.h>
+
+struct WebDOMTestInterface::WebDOMTestInterfacePrivate {
+ WebDOMTestInterfacePrivate(WebCore::TestInterface* object = 0)
+ : impl(object)
+ {
+ }
+
+ RefPtr<WebCore::TestInterface> impl;
+};
+
+WebDOMTestInterface::WebDOMTestInterface()
+ : WebDOMObject()
+ , m_impl(0)
+{
+}
+
+WebDOMTestInterface::WebDOMTestInterface(WebCore::TestInterface* impl)
+ : WebDOMObject()
+ , m_impl(new WebDOMTestInterfacePrivate(impl))
+{
+}
+
+WebDOMTestInterface::WebDOMTestInterface(const WebDOMTestInterface& copy)
+ : WebDOMObject()
+{
+ m_impl = copy.impl() ? new WebDOMTestInterfacePrivate(copy.impl()) : 0;
+}
+
+WebCore::TestInterface* WebDOMTestInterface::impl() const
+{
+ return m_impl ? m_impl->impl.get() : 0;
+}
+
+WebDOMTestInterface::~WebDOMTestInterface()
+{
+ delete m_impl;
+ m_impl = 0;
+}
+
+WebCore::TestInterface* toWebCore(const WebDOMTestInterface& wrapper)
+{
+ return wrapper.impl();
+}
+
+WebDOMTestInterface toWebKit(WebCore::TestInterface* value)
+{
+ return WebDOMTestInterface(value);
+}
diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h
new file mode 100644
index 0000000..d0cee5b
--- /dev/null
+++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebDOMTestInterface_h
+#define WebDOMTestInterface_h
+
+#include <WebDOMObject.h>
+#include <WebDOMString.h>
+
+namespace WebCore {
+class TestInterface;
+};
+
+
+class WebDOMTestInterface : public WebDOMObject {
+public:
+ WebDOMTestInterface();
+ explicit WebDOMTestInterface(WebCore::TestInterface*);
+ WebDOMTestInterface(const WebDOMTestInterface&);
+ ~WebDOMTestInterface();
+
+
+ WebCore::TestInterface* impl() const;
+
+protected:
+ struct WebDOMTestInterfacePrivate;
+ WebDOMTestInterfacePrivate* m_impl;
+};
+
+WebCore::TestInterface* toWebCore(const WebDOMTestInterface&);
+WebDOMTestInterface toWebKit(WebCore::TestInterface*);
+
+#endif
diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
new file mode 100644
index 0000000..e540a57
--- /dev/null
+++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
@@ -0,0 +1,441 @@
+/*
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebDOMTestObj.h"
+
+#include "AtomicString.h"
+#include "KURL.h"
+#include "SerializedScriptValue.h"
+#include "TestObj.h"
+#include "WebDOMString.h"
+#include "WebExceptionHandler.h"
+#include "WebNativeEventListener.h"
+#include <wtf/GetPtr.h>
+#include <wtf/RefPtr.h>
+
+struct WebDOMTestObj::WebDOMTestObjPrivate {
+ WebDOMTestObjPrivate(WebCore::TestObj* object = 0)
+ : impl(object)
+ {
+ }
+
+ RefPtr<WebCore::TestObj> impl;
+};
+
+WebDOMTestObj::WebDOMTestObj()
+ : WebDOMObject()
+ , m_impl(0)
+{
+}
+
+WebDOMTestObj::WebDOMTestObj(WebCore::TestObj* impl)
+ : WebDOMObject()
+ , m_impl(new WebDOMTestObjPrivate(impl))
+{
+}
+
+WebDOMTestObj::WebDOMTestObj(const WebDOMTestObj& copy)
+ : WebDOMObject()
+{
+ m_impl = copy.impl() ? new WebDOMTestObjPrivate(copy.impl()) : 0;
+}
+
+WebCore::TestObj* WebDOMTestObj::impl() const
+{
+ return m_impl ? m_impl->impl.get() : 0;
+}
+
+WebDOMTestObj::~WebDOMTestObj()
+{
+ delete m_impl;
+ m_impl = 0;
+}
+
+int WebDOMTestObj::readOnlyIntAttr() const
+{
+ if (!impl())
+ return 0;
+
+ return impl()->readOnlyIntAttr();
+}
+
+WebDOMString WebDOMTestObj::readOnlyStringAttr() const
+{
+ if (!impl())
+ return WebDOMString();
+
+ return static_cast<const WebCore::String&>(impl()->readOnlyStringAttr());
+}
+
+WebDOMTestObj WebDOMTestObj::readOnlyTestObjAttr() const
+{
+ if (!impl())
+ return WebDOMTestObj();
+
+ return toWebKit(WTF::getPtr(impl()->readOnlyTestObjAttr()));
+}
+
+int WebDOMTestObj::intAttr() const
+{
+ if (!impl())
+ return 0;
+
+ return impl()->intAttr();
+}
+
+void WebDOMTestObj::setIntAttr(int newIntAttr)
+{
+ if (!impl())
+ return;
+
+ impl()->setIntAttr(newIntAttr);
+}
+
+long long WebDOMTestObj::longLongAttr() const
+{
+ if (!impl())
+ return 0;
+
+ return impl()->longLongAttr();
+}
+
+void WebDOMTestObj::setLongLongAttr(long long newLongLongAttr)
+{
+ if (!impl())
+ return;
+
+ impl()->setLongLongAttr(newLongLongAttr);
+}
+
+unsigned long long WebDOMTestObj::unsignedLongLongAttr() const
+{
+ if (!impl())
+ return 0;
+
+ return impl()->unsignedLongLongAttr();
+}
+
+void WebDOMTestObj::setUnsignedLongLongAttr(unsigned long long newUnsignedLongLongAttr)
+{
+ if (!impl())
+ return;
+
+ impl()->setUnsignedLongLongAttr(newUnsignedLongLongAttr);
+}
+
+WebDOMString WebDOMTestObj::stringAttr() const
+{
+ if (!impl())
+ return WebDOMString();
+
+ return static_cast<const WebCore::String&>(impl()->stringAttr());
+}
+
+void WebDOMTestObj::setStringAttr(const WebDOMString& newStringAttr)
+{
+ if (!impl())
+ return;
+
+ impl()->setStringAttr(newStringAttr);
+}
+
+WebDOMTestObj WebDOMTestObj::testObjAttr() const
+{
+ if (!impl())
+ return WebDOMTestObj();
+
+ return toWebKit(WTF::getPtr(impl()->testObjAttr()));
+}
+
+void WebDOMTestObj::setTestObjAttr(const WebDOMTestObj& newTestObjAttr)
+{
+ if (!impl())
+ return;
+
+ impl()->setTestObjAttr(toWebCore(newTestObjAttr));
+}
+
+int WebDOMTestObj::attrWithException() const
+{
+ if (!impl())
+ return 0;
+
+ return impl()->attrWithException();
+}
+
+void WebDOMTestObj::setAttrWithException(int newAttrWithException)
+{
+ if (!impl())
+ return;
+
+ impl()->setAttrWithException(newAttrWithException);
+}
+
+int WebDOMTestObj::attrWithSetterException() const
+{
+ if (!impl())
+ return 0;
+
+ WebCore::ExceptionCode ec = 0;
+ int result = impl()->attrWithSetterException(ec);
+ webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));
+ return result;
+}
+
+void WebDOMTestObj::setAttrWithSetterException(int newAttrWithSetterException)
+{
+ if (!impl())
+ return;
+
+ WebCore::ExceptionCode ec = 0;
+ impl()->setAttrWithSetterException(newAttrWithSetterException, ec);
+ webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));
+}
+
+int WebDOMTestObj::attrWithGetterException() const
+{
+ if (!impl())
+ return 0;
+
+ return impl()->attrWithGetterException();
+}
+
+void WebDOMTestObj::setAttrWithGetterException(int newAttrWithGetterException)
+{
+ if (!impl())
+ return;
+
+ WebCore::ExceptionCode ec = 0;
+ impl()->setAttrWithGetterException(newAttrWithGetterException, ec);
+ webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));
+}
+
+WebDOMString WebDOMTestObj::scriptStringAttr() const
+{
+ if (!impl())
+ return WebDOMString();
+
+ return static_cast<const WebCore::String&>(impl()->scriptStringAttr());
+}
+
+void WebDOMTestObj::voidMethod()
+{
+ if (!impl())
+ return;
+
+ impl()->voidMethod();
+}
+
+void WebDOMTestObj::voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg)
+{
+ if (!impl())
+ return;
+
+ impl()->voidMethodWithArgs(intArg, strArg, toWebCore(objArg));
+}
+
+int WebDOMTestObj::intMethod()
+{
+ if (!impl())
+ return 0;
+
+ return impl()->intMethod();
+}
+
+int WebDOMTestObj::intMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg)
+{
+ if (!impl())
+ return 0;
+
+ return impl()->intMethodWithArgs(intArg, strArg, toWebCore(objArg));
+}
+
+WebDOMTestObj WebDOMTestObj::objMethod()
+{
+ if (!impl())
+ return WebDOMTestObj();
+
+ return toWebKit(WTF::getPtr(impl()->objMethod()));
+}
+
+WebDOMTestObj WebDOMTestObj::objMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg)
+{
+ if (!impl())
+ return WebDOMTestObj();
+
+ return toWebKit(WTF::getPtr(impl()->objMethodWithArgs(intArg, strArg, toWebCore(objArg))));
+}
+
+WebDOMTestObj WebDOMTestObj::methodThatRequiresAllArgs(const WebDOMString& strArg, const WebDOMTestObj& objArg)
+{
+ if (!impl())
+ return WebDOMTestObj();
+
+ return toWebKit(WTF::getPtr(impl()->methodThatRequiresAllArgs(strArg, toWebCore(objArg))));
+}
+
+WebDOMTestObj WebDOMTestObj::methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg)
+{
+ if (!impl())
+ return WebDOMTestObj();
+
+ WebCore::ExceptionCode ec = 0;
+ WebDOMTestObj result = toWebKit(WTF::getPtr(impl()->methodThatRequiresAllArgsAndThrows(strArg, toWebCore(objArg), ec)));
+ webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));
+ return result;
+}
+
+void WebDOMTestObj::serializedValue(const WebDOMString& serializedArg)
+{
+ if (!impl())
+ return;
+
+ impl()->serializedValue(WebCore::SerializedScriptValue::create(WebCore::String(serializedArg)));
+}
+
+void WebDOMTestObj::methodWithException()
+{
+ if (!impl())
+ return;
+
+ WebCore::ExceptionCode ec = 0;
+ impl()->methodWithException(ec);
+ webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));
+}
+
+void WebDOMTestObj::addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture)
+{
+ if (!impl())
+ return;
+
+ impl()->addEventListener(type, toWebCore(listener), useCapture);
+}
+
+void WebDOMTestObj::removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture)
+{
+ if (!impl())
+ return;
+
+ impl()->removeEventListener(type, toWebCore(listener), useCapture);
+}
+
+void WebDOMTestObj::withDynamicFrame()
+{
+ if (!impl())
+ return;
+
+ impl()->withDynamicFrame();
+}
+
+void WebDOMTestObj::withDynamicFrameAndArg(int intArg)
+{
+ if (!impl())
+ return;
+
+ impl()->withDynamicFrameAndArg(intArg);
+}
+
+void WebDOMTestObj::withDynamicFrameAndOptionalArg(int intArg, int optionalArg)
+{
+ if (!impl())
+ return;
+
+ impl()->withDynamicFrameAndOptionalArg(intArg, optionalArg);
+}
+
+void WebDOMTestObj::withScriptStateVoid()
+{
+ if (!impl())
+ return;
+
+ impl()->withScriptStateVoid();
+}
+
+WebDOMTestObj WebDOMTestObj::withScriptStateObj()
+{
+ if (!impl())
+ return WebDOMTestObj();
+
+ return toWebKit(WTF::getPtr(impl()->withScriptStateObj()));
+}
+
+void WebDOMTestObj::withScriptStateVoidException()
+{
+ if (!impl())
+ return;
+
+ WebCore::ExceptionCode ec = 0;
+ impl()->withScriptStateVoidException(ec);
+ webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));
+}
+
+WebDOMTestObj WebDOMTestObj::withScriptStateObjException()
+{
+ if (!impl())
+ return WebDOMTestObj();
+
+ WebCore::ExceptionCode ec = 0;
+ WebDOMTestObj result = toWebKit(WTF::getPtr(impl()->withScriptStateObjException(ec)));
+ webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));
+ return result;
+}
+
+void WebDOMTestObj::withScriptExecutionContext()
+{
+ if (!impl())
+ return;
+
+ impl()->withScriptExecutionContext();
+}
+
+void WebDOMTestObj::methodWithOptionalArg(int opt)
+{
+ if (!impl())
+ return;
+
+ impl()->methodWithOptionalArg(opt);
+}
+
+void WebDOMTestObj::methodWithNonOptionalArgAndOptionalArg(int nonOpt, int opt)
+{
+ if (!impl())
+ return;
+
+ impl()->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
+}
+
+void WebDOMTestObj::methodWithNonOptionalArgAndTwoOptionalArgs(int nonOpt, int opt1, int opt2)
+{
+ if (!impl())
+ return;
+
+ impl()->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
+}
+
+WebCore::TestObj* toWebCore(const WebDOMTestObj& wrapper)
+{
+ return wrapper.impl();
+}
+
+WebDOMTestObj toWebKit(WebCore::TestObj* value)
+{
+ return WebDOMTestObj(value);
+}
diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
new file mode 100644
index 0000000..7bcd988
--- /dev/null
+++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebDOMTestObj_h
+#define WebDOMTestObj_h
+
+#include <WebDOMObject.h>
+#include <WebDOMString.h>
+
+namespace WebCore {
+class TestObj;
+};
+
+class WebDOMEventListener;
+class WebDOMString;
+class WebDOMTestObj;
+
+class WebDOMTestObj : public WebDOMObject {
+public:
+ WebDOMTestObj();
+ explicit WebDOMTestObj(WebCore::TestObj*);
+ WebDOMTestObj(const WebDOMTestObj&);
+ ~WebDOMTestObj();
+
+ int readOnlyIntAttr() const;
+ WebDOMString readOnlyStringAttr() const;
+ WebDOMTestObj readOnlyTestObjAttr() const;
+ int intAttr() const;
+ void setIntAttr(int);
+ long long longLongAttr() const;
+ void setLongLongAttr(long long);
+ unsigned long long unsignedLongLongAttr() const;
+ void setUnsignedLongLongAttr(unsigned long long);
+ WebDOMString stringAttr() const;
+ void setStringAttr(const WebDOMString&);
+ WebDOMTestObj testObjAttr() const;
+ void setTestObjAttr(const WebDOMTestObj&);
+ int attrWithException() const;
+ void setAttrWithException(int);
+ int attrWithSetterException() const;
+ void setAttrWithSetterException(int);
+ int attrWithGetterException() const;
+ void setAttrWithGetterException(int);
+ int customAttr() const;
+ void setCustomAttr(int);
+ WebDOMString scriptStringAttr() const;
+
+ void voidMethod();
+ void voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg);
+ int intMethod();
+ int intMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg);
+ WebDOMTestObj objMethod();
+ WebDOMTestObj objMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg);
+ WebDOMTestObj methodThatRequiresAllArgs(const WebDOMString& strArg, const WebDOMTestObj& objArg);
+ WebDOMTestObj methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg);
+ void serializedValue(const WebDOMString& serializedArg);
+ void methodWithException();
+ void customMethod();
+ void customMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg);
+ void addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture);
+ void removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture);
+ void withDynamicFrame();
+ void withDynamicFrameAndArg(int intArg);
+ void withDynamicFrameAndOptionalArg(int intArg, int optionalArg);
+ void withDynamicFrameAndUserGesture(int intArg);
+ void withDynamicFrameAndUserGestureASAD(int intArg, int optionalArg);
+ void withScriptStateVoid();
+ WebDOMTestObj withScriptStateObj();
+ void withScriptStateVoidException();
+ WebDOMTestObj withScriptStateObjException();
+ void withScriptExecutionContext();
+ void methodWithOptionalArg(int opt);
+ void methodWithNonOptionalArgAndOptionalArg(int nonOpt, int opt);
+ void methodWithNonOptionalArgAndTwoOptionalArgs(int nonOpt, int opt1, int opt2);
+
+ WebCore::TestObj* impl() const;
+
+protected:
+ struct WebDOMTestObjPrivate;
+ WebDOMTestObjPrivate* m_impl;
+};
+
+WebCore::TestObj* toWebCore(const WebDOMTestObj&);
+WebDOMTestObj toWebKit(WebCore::TestObj*);
+
+#endif
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp
index 505b59b..a67b6ac 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp
@@ -53,7 +53,7 @@ gpointer kit(WebCore::TestCallback* obj)
} // namespace WebKit //
gboolean
-webkit_dom_test_callback_callback_with_class1param (WebKitDOMTestCallback *self, WebKitDOMClass1* class1param)
+webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param)
{
g_return_val_if_fail (self, 0);
WebCore::TestCallback * item = WebKit::core(self);
@@ -62,11 +62,10 @@ webkit_dom_test_callback_callback_with_class1param (WebKitDOMTestCallback *self,
g_return_val_if_fail (_g_class1param, 0);
gboolean res = item->callbackWithClass1Param(_g_class1param);
return res;
-
}
gboolean
-webkit_dom_test_callback_callback_with_class2param (WebKitDOMTestCallback *self, WebKitDOMClass2* class2param, gchar* str_arg)
+webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, gchar* str_arg)
{
g_return_val_if_fail (self, 0);
WebCore::TestCallback * item = WebKit::core(self);
@@ -77,11 +76,10 @@ webkit_dom_test_callback_callback_with_class2param (WebKitDOMTestCallback *self,
WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg);
gboolean res = item->callbackWithClass2Param(_g_class2param, _g_str_arg);
return res;
-
}
glong
-webkit_dom_test_callback_callback_with_non_bool_return_type (WebKitDOMTestCallback *self, WebKitDOMClass3* class3param)
+webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param)
{
g_return_val_if_fail (self, 0);
WebCore::TestCallback * item = WebKit::core(self);
@@ -90,7 +88,6 @@ webkit_dom_test_callback_callback_with_non_bool_return_type (WebKitDOMTestCallba
g_return_val_if_fail (_g_class3param, 0);
glong res = item->callbackWithNonBoolReturnType(_g_class3param);
return res;
-
}
@@ -132,8 +129,8 @@ static void webkit_dom_test_callback_finalize(GObject* object)
static void webkit_dom_test_callback_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
{
- switch (prop_id) {
- default:
+ switch (prop_id) {
+ default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
@@ -142,8 +139,8 @@ static void webkit_dom_test_callback_set_property(GObject* object, guint prop_id
static void webkit_dom_test_callback_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
{
- switch (prop_id) {
- default:
+ switch (prop_id) {
+ default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h
index 088c457..cfc883d 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h
@@ -47,13 +47,13 @@ WEBKIT_API GType
webkit_dom_test_callback_get_type (void);
WEBKIT_API gboolean
-webkit_dom_test_callback_callback_with_class1param (WebKitDOMTestCallback *self, WebKitDOMClass1* class1param);
+webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param);
WEBKIT_API gboolean
-webkit_dom_test_callback_callback_with_class2param (WebKitDOMTestCallback *self, WebKitDOMClass2* class2param, gchar* str_arg);
+webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, gchar* str_arg);
WEBKIT_API glong
-webkit_dom_test_callback_callback_with_non_bool_return_type (WebKitDOMTestCallback *self, WebKitDOMClass3* class3param);
+webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param);
G_END_DECLS
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp
index 17548d9..0d0021d 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp
@@ -85,8 +85,8 @@ static void webkit_dom_test_interface_finalize(GObject* object)
static void webkit_dom_test_interface_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
{
- switch (prop_id) {
- default:
+ switch (prop_id) {
+ default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
@@ -95,8 +95,8 @@ static void webkit_dom_test_interface_set_property(GObject* object, guint prop_i
static void webkit_dom_test_interface_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
{
- switch (prop_id) {
- default:
+ switch (prop_id) {
+ default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
index 2fa8c00..5dfb255 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
@@ -49,16 +49,15 @@ gpointer kit(WebCore::TestObj* obj)
} // namespace WebKit //
void
-webkit_dom_test_obj_void_method (WebKitDOMTestObj *self)
+webkit_dom_test_obj_void_method(WebKitDOMTestObj* self)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->voidMethod();
-
}
void
-webkit_dom_test_obj_void_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg)
+webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
@@ -68,21 +67,19 @@ webkit_dom_test_obj_void_method_with_args (WebKitDOMTestObj *self, glong int_arg
WebCore::TestObj * _g_obj_arg = WebKit::core(obj_arg);
g_return_if_fail (_g_obj_arg);
item->voidMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg);
-
}
glong
-webkit_dom_test_obj_int_method (WebKitDOMTestObj *self)
+webkit_dom_test_obj_int_method(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
glong res = item->intMethod();
return res;
-
}
glong
-webkit_dom_test_obj_int_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg)
+webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
@@ -93,22 +90,20 @@ webkit_dom_test_obj_int_method_with_args (WebKitDOMTestObj *self, glong int_arg,
g_return_val_if_fail (_g_obj_arg, 0);
glong res = item->intMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg);
return res;
-
}
WebKitDOMTestObj*
-webkit_dom_test_obj_obj_method (WebKitDOMTestObj *self)
+webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethod());
WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
return res;
-
}
WebKitDOMTestObj*
-webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg)
+webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
@@ -120,11 +115,10 @@ webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg,
PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg));
WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
return res;
-
}
WebKitDOMTestObj*
-webkit_dom_test_obj_method_that_requires_all_args (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg)
+webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
@@ -136,11 +130,10 @@ webkit_dom_test_obj_method_that_requires_all_args (WebKitDOMTestObj *self, gchar
PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->methodThatRequiresAllArgs(_g_str_arg, _g_obj_arg));
WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
return res;
-
}
WebKitDOMTestObj*
-webkit_dom_test_obj_method_that_requires_all_args_and_throws (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error)
+webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
@@ -158,11 +151,10 @@ webkit_dom_test_obj_method_that_requires_all_args_and_throws (WebKitDOMTestObj *
}
WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
return res;
-
}
void
-webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerializedScriptValue* serialized_arg)
+webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
@@ -170,11 +162,10 @@ webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerialize
WebCore::SerializedScriptValue * _g_serialized_arg = WebKit::core(serialized_arg);
g_return_if_fail (_g_serialized_arg);
item->serializedValue(_g_serialized_arg);
-
}
void
-webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error)
+webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
@@ -185,7 +176,6 @@ webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **erro
WebCore::getExceptionCodeDescription(ec, ecdesc);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
}
-
}
@@ -195,72 +185,65 @@ webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **erro
/* TODO: event function webkit_dom_test_obj_remove_event_listener */
void
-webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self)
+webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->withDynamicFrame();
-
}
void
-webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg)
+webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int_arg)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->withDynamicFrameAndArg(int_arg);
-
}
void
-webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg)
+webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, glong int_arg, glong optional_arg)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->withDynamicFrameAndOptionalArg(int_arg, optional_arg);
-
}
void
-webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg)
+webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->withDynamicFrameAndUserGesture(int_arg);
-
}
void
-webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg)
+webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg);
-
}
void
-webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self)
+webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->withScriptStateVoid();
-
}
WebKitDOMTestObj*
-webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self)
+webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObj());
WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
return res;
-
}
void
-webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GError **error)
+webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GError **error)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
@@ -271,11 +254,10 @@ webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GE
WebCore::getExceptionCodeDescription(ec, ecdesc);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
}
-
}
WebKitDOMTestObj*
-webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GError **error)
+webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GError **error)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
@@ -288,158 +270,150 @@ webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GEr
}
WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
return res;
+}
+void
+webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self)
+{
+ g_return_if_fail (self);
+ WebCore::TestObj * item = WebKit::core(self);
+ item->withScriptExecutionContext();
}
void
-webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt)
+webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->methodWithOptionalArg(opt);
-
}
void
-webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg (WebKitDOMTestObj *self, glong non_opt, glong opt)
+webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestObj* self, glong non_opt, glong opt)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->methodWithNonOptionalArgAndOptionalArg(non_opt, opt);
-
}
void
-webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args (WebKitDOMTestObj *self, glong non_opt, glong opt1, glong opt2)
+webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOMTestObj* self, glong non_opt, glong opt1, glong opt2)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->methodWithNonOptionalArgAndTwoOptionalArgs(non_opt, opt1, opt2);
-
}
glong
-webkit_dom_test_obj_get_read_only_int_attr (WebKitDOMTestObj *self)
+webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
glong res = item->readOnlyIntAttr();
return res;
-
}
gchar*
-webkit_dom_test_obj_get_read_only_string_attr (WebKitDOMTestObj *self)
+webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->readOnlyStringAttr());
return res;
-
}
WebKitDOMTestObj*
-webkit_dom_test_obj_get_read_only_test_obj_attr (WebKitDOMTestObj *self)
+webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->readOnlyTestObjAttr());
WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
return res;
-
}
glong
-webkit_dom_test_obj_get_int_attr (WebKitDOMTestObj *self)
+webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
glong res = item->intAttr();
return res;
-
}
void
-webkit_dom_test_obj_set_int_attr (WebKitDOMTestObj *self, glong value)
+webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->setIntAttr(value);
-
}
gint64
-webkit_dom_test_obj_get_long_long_attr (WebKitDOMTestObj *self)
+webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
gint64 res = item->longLongAttr();
return res;
-
}
void
-webkit_dom_test_obj_set_long_long_attr (WebKitDOMTestObj *self, gint64 value)
+webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->setLongLongAttr(value);
-
}
guint64
-webkit_dom_test_obj_get_unsigned_long_long_attr (WebKitDOMTestObj *self)
+webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
guint64 res = item->unsignedLongLongAttr();
return res;
-
}
void
-webkit_dom_test_obj_set_unsigned_long_long_attr (WebKitDOMTestObj *self, guint64 value)
+webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 value)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->setUnsignedLongLongAttr(value);
-
}
gchar*
-webkit_dom_test_obj_get_string_attr (WebKitDOMTestObj *self)
+webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->stringAttr());
return res;
-
}
void
-webkit_dom_test_obj_set_string_attr (WebKitDOMTestObj *self, gchar* value)
+webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, gchar* value)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail (value);
WebCore::String _g_value = WebCore::String::fromUTF8(value);
item->setStringAttr(_g_value);
-
}
WebKitDOMTestObj*
-webkit_dom_test_obj_get_test_obj_attr (WebKitDOMTestObj *self)
+webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->testObjAttr());
WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get()));
return res;
-
}
void
-webkit_dom_test_obj_set_test_obj_attr (WebKitDOMTestObj *self, WebKitDOMTestObj* value)
+webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
@@ -447,30 +421,27 @@ webkit_dom_test_obj_set_test_obj_attr (WebKitDOMTestObj *self, WebKitDOMTestObj*
WebCore::TestObj * _g_value = WebKit::core(value);
g_return_if_fail (_g_value);
item->setTestObjAttr(_g_value);
-
}
glong
-webkit_dom_test_obj_get_attr_with_exception (WebKitDOMTestObj *self)
+webkit_dom_test_obj_get_attr_with_exception(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
glong res = item->attrWithException();
return res;
-
}
void
-webkit_dom_test_obj_set_attr_with_exception (WebKitDOMTestObj *self, glong value)
+webkit_dom_test_obj_set_attr_with_exception(WebKitDOMTestObj* self, glong value)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->setAttrWithException(value);
-
}
glong
-webkit_dom_test_obj_get_attr_with_setter_exception (WebKitDOMTestObj *self, GError **error)
+webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self, GError **error)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
@@ -482,11 +453,10 @@ webkit_dom_test_obj_get_attr_with_setter_exception (WebKitDOMTestObj *self, GErr
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
}
return res;
-
}
void
-webkit_dom_test_obj_set_attr_with_setter_exception (WebKitDOMTestObj *self, glong value, GError **error)
+webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong value, GError **error)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
@@ -497,21 +467,19 @@ webkit_dom_test_obj_set_attr_with_setter_exception (WebKitDOMTestObj *self, glon
WebCore::getExceptionCodeDescription(ec, ecdesc);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
}
-
}
glong
-webkit_dom_test_obj_get_attr_with_getter_exception (WebKitDOMTestObj *self)
+webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
glong res = item->attrWithGetterException();
return res;
-
}
void
-webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glong value, GError **error)
+webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong value, GError **error)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
@@ -522,17 +490,50 @@ webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glon
WebCore::getExceptionCodeDescription(ec, ecdesc);
g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
}
-
}
gchar*
-webkit_dom_test_obj_get_script_string_attr (WebKitDOMTestObj *self)
+webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->scriptStringAttr());
return res;
+}
+glong
+webkit_dom_test_obj_get_description(WebKitDOMTestObj* self)
+{
+ g_return_val_if_fail (self, 0);
+ WebCore::TestObj * item = WebKit::core(self);
+ glong res = item->description();
+ return res;
+}
+
+glong
+webkit_dom_test_obj_get_id(WebKitDOMTestObj* self)
+{
+ g_return_val_if_fail (self, 0);
+ WebCore::TestObj * item = WebKit::core(self);
+ glong res = item->id();
+ return res;
+}
+
+void
+webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value)
+{
+ g_return_if_fail (self);
+ WebCore::TestObj * item = WebKit::core(self);
+ item->setId(value);
+}
+
+gchar*
+webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self)
+{
+ g_return_val_if_fail (self, 0);
+ WebCore::TestObj * item = WebKit::core(self);
+ gchar* res = convertToUTF8String(item->hash());
+ return res;
}
@@ -566,6 +567,9 @@ enum {
PROP_ATTR_WITH_GETTER_EXCEPTION,
PROP_CUSTOM_ATTR,
PROP_SCRIPT_STRING_ATTR,
+ PROP_DESCRIPTION,
+ PROP_ID,
+ PROP_HASH,
};
@@ -587,42 +591,47 @@ static void webkit_dom_test_obj_finalize(GObject* object)
static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
{
- WebKitDOMTestObj *self = WEBKIT_DOM_TEST_OBJ(object);
+ WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object);
WebCore::TestObj* coreSelf = WebKit::core(self);
- switch (prop_id) {
+ switch (prop_id) {
case PROP_INT_ATTR:
{
- coreSelf->setIntAttr((g_value_get_long(value)) );
- break;
+ coreSelf->setIntAttr((g_value_get_long(value)));
+ break;
}
case PROP_UNSIGNED_LONG_LONG_ATTR:
{
- coreSelf->setUnsignedLongLongAttr((g_value_get_uint64(value)) );
- break;
+ coreSelf->setUnsignedLongLongAttr((g_value_get_uint64(value)));
+ break;
}
case PROP_STRING_ATTR:
{
- coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value)) );
- break;
+ coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value)));
+ break;
}
case PROP_ATTR_WITH_EXCEPTION:
{
- coreSelf->setAttrWithException((g_value_get_long(value)) );
- break;
+ coreSelf->setAttrWithException((g_value_get_long(value)));
+ break;
}
case PROP_ATTR_WITH_SETTER_EXCEPTION:
{
- WebCore::ExceptionCode ec = 0;
- coreSelf->setAttrWithSetterException((g_value_get_long(value)) , ec );
- break;
+ WebCore::ExceptionCode ec = 0;
+ coreSelf->setAttrWithSetterException((g_value_get_long(value)), ec);
+ break;
}
case PROP_ATTR_WITH_GETTER_EXCEPTION:
{
- WebCore::ExceptionCode ec = 0;
- coreSelf->setAttrWithGetterException((g_value_get_long(value)) , ec );
- break;
+ WebCore::ExceptionCode ec = 0;
+ coreSelf->setAttrWithGetterException((g_value_get_long(value)), ec);
+ break;
}
- default:
+ case PROP_ID:
+ {
+ coreSelf->setId((g_value_get_long(value)));
+ break;
+ }
+ default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
@@ -631,73 +640,88 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con
static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
{
- WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object);
+ WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object);
WebCore::TestObj* coreSelf = WebKit::core(self);
- switch (prop_id) {
+ switch (prop_id) {
case PROP_READ_ONLY_INT_ATTR:
{
- g_value_set_long(value, coreSelf->readOnlyIntAttr());
- break;
+ g_value_set_long(value, coreSelf->readOnlyIntAttr());
+ break;
}
case PROP_READ_ONLY_STRING_ATTR:
{
- g_value_take_string(value, convertToUTF8String(coreSelf->readOnlyStringAttr()));
- break;
+ g_value_take_string(value, convertToUTF8String(coreSelf->readOnlyStringAttr()));
+ break;
}
case PROP_READ_ONLY_TEST_OBJ_ATTR:
{
- RefPtr<WebCore::TestObj> ptr = coreSelf->readOnlyTestObjAttr();
+ RefPtr<WebCore::TestObj> ptr = coreSelf->readOnlyTestObjAttr();
g_value_set_object(value, WebKit::kit(ptr.get()));
- break;
+ break;
}
case PROP_INT_ATTR:
{
- g_value_set_long(value, coreSelf->intAttr());
- break;
+ g_value_set_long(value, coreSelf->intAttr());
+ break;
}
case PROP_LONG_LONG_ATTR:
{
- g_value_set_int64(value, coreSelf->longLongAttr());
- break;
+ g_value_set_int64(value, coreSelf->longLongAttr());
+ break;
}
case PROP_UNSIGNED_LONG_LONG_ATTR:
{
- g_value_set_uint64(value, coreSelf->unsignedLongLongAttr());
- break;
+ g_value_set_uint64(value, coreSelf->unsignedLongLongAttr());
+ break;
}
case PROP_STRING_ATTR:
{
- g_value_take_string(value, convertToUTF8String(coreSelf->stringAttr()));
- break;
+ g_value_take_string(value, convertToUTF8String(coreSelf->stringAttr()));
+ break;
}
case PROP_TEST_OBJ_ATTR:
{
- RefPtr<WebCore::TestObj> ptr = coreSelf->testObjAttr();
+ RefPtr<WebCore::TestObj> ptr = coreSelf->testObjAttr();
g_value_set_object(value, WebKit::kit(ptr.get()));
- break;
+ break;
}
case PROP_ATTR_WITH_EXCEPTION:
{
- g_value_set_long(value, coreSelf->attrWithException());
- break;
+ g_value_set_long(value, coreSelf->attrWithException());
+ break;
}
case PROP_ATTR_WITH_SETTER_EXCEPTION:
{
- WebCore::ExceptionCode ec = 0;
- g_value_set_long(value, coreSelf->attrWithSetterException(ec));
- break;
+ WebCore::ExceptionCode ec = 0;
+ g_value_set_long(value, coreSelf->attrWithSetterException(ec));
+ break;
}
case PROP_ATTR_WITH_GETTER_EXCEPTION:
{
- g_value_set_long(value, coreSelf->attrWithGetterException());
- break;
+ g_value_set_long(value, coreSelf->attrWithGetterException());
+ break;
}
case PROP_SCRIPT_STRING_ATTR:
{
- g_value_take_string(value, convertToUTF8String(coreSelf->scriptStringAttr()));
- break;
+ g_value_take_string(value, convertToUTF8String(coreSelf->scriptStringAttr()));
+ break;
+ }
+ case PROP_DESCRIPTION:
+ {
+ g_value_set_long(value, coreSelf->description());
+ break;
+ }
+ case PROP_ID:
+ {
+ g_value_set_long(value, coreSelf->id());
+ break;
}
- default:
+ case PROP_HASH:
+ {
+ g_value_take_string(value, convertToUTF8String(coreSelf->hash()));
+ break;
+ }
+ default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
@@ -720,21 +744,21 @@ static void webkit_dom_test_obj_class_init(WebKitDOMTestObjClass* requestClass)
G_MAXLONG, /* max */
0, /* default */
WEBKIT_PARAM_READABLE));
- g_object_class_install_property(gobjectClass,
+ g_object_class_install_property(gobjectClass,
PROP_READ_ONLY_STRING_ATTR,
g_param_spec_string("read-only-string-attr", /* name */
"test_obj_read-only-string-attr", /* short description */
"read-only gchar* TestObj.read-only-string-attr", /* longer - could do with some extra doc stuff here */
"", /* default */
WEBKIT_PARAM_READABLE));
- g_object_class_install_property(gobjectClass,
+ g_object_class_install_property(gobjectClass,
PROP_READ_ONLY_TEST_OBJ_ATTR,
g_param_spec_object("read-only-test-obj-attr", /* name */
"test_obj_read-only-test-obj-attr", /* short description */
"read-only WebKitDOMTestObj* TestObj.read-only-test-obj-attr", /* longer - could do with some extra doc stuff here */
WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */
WEBKIT_PARAM_READABLE));
- g_object_class_install_property(gobjectClass,
+ g_object_class_install_property(gobjectClass,
PROP_INT_ATTR,
g_param_spec_long("int-attr", /* name */
"test_obj_int-attr", /* short description */
@@ -743,7 +767,7 @@ G_MAXLONG, /* max */
G_MAXLONG, /* max */
0, /* default */
WEBKIT_PARAM_READWRITE));
- g_object_class_install_property(gobjectClass,
+ g_object_class_install_property(gobjectClass,
PROP_LONG_LONG_ATTR,
g_param_spec_int64("long-long-attr", /* name */
"test_obj_long-long-attr", /* short description */
@@ -752,7 +776,7 @@ G_MAXLONG, /* max */
G_MAXINT64, /* max */
0, /* default */
WEBKIT_PARAM_READWRITE));
- g_object_class_install_property(gobjectClass,
+ g_object_class_install_property(gobjectClass,
PROP_UNSIGNED_LONG_LONG_ATTR,
g_param_spec_uint64("unsigned-long-long-attr", /* name */
"test_obj_unsigned-long-long-attr", /* short description */
@@ -761,21 +785,21 @@ G_MAXINT64, /* max */
G_MAXUINT64, /* min */
0, /* default */
WEBKIT_PARAM_READWRITE));
- g_object_class_install_property(gobjectClass,
+ g_object_class_install_property(gobjectClass,
PROP_STRING_ATTR,
g_param_spec_string("string-attr", /* name */
"test_obj_string-attr", /* short description */
"read-write gchar* TestObj.string-attr", /* longer - could do with some extra doc stuff here */
"", /* default */
WEBKIT_PARAM_READWRITE));
- g_object_class_install_property(gobjectClass,
+ g_object_class_install_property(gobjectClass,
PROP_TEST_OBJ_ATTR,
g_param_spec_object("test-obj-attr", /* name */
"test_obj_test-obj-attr", /* short description */
"read-write WebKitDOMTestObj* TestObj.test-obj-attr", /* longer - could do with some extra doc stuff here */
WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */
WEBKIT_PARAM_READWRITE));
- g_object_class_install_property(gobjectClass,
+ g_object_class_install_property(gobjectClass,
PROP_ATTR_WITH_EXCEPTION,
g_param_spec_long("attr-with-exception", /* name */
"test_obj_attr-with-exception", /* short description */
@@ -784,7 +808,7 @@ G_MAXUINT64, /* min */
G_MAXLONG, /* max */
0, /* default */
WEBKIT_PARAM_READWRITE));
- g_object_class_install_property(gobjectClass,
+ g_object_class_install_property(gobjectClass,
PROP_ATTR_WITH_SETTER_EXCEPTION,
g_param_spec_long("attr-with-setter-exception", /* name */
"test_obj_attr-with-setter-exception", /* short description */
@@ -793,7 +817,7 @@ G_MAXLONG, /* max */
G_MAXLONG, /* max */
0, /* default */
WEBKIT_PARAM_READWRITE));
- g_object_class_install_property(gobjectClass,
+ g_object_class_install_property(gobjectClass,
PROP_ATTR_WITH_GETTER_EXCEPTION,
g_param_spec_long("attr-with-getter-exception", /* name */
"test_obj_attr-with-getter-exception", /* short description */
@@ -802,13 +826,38 @@ G_MAXLONG, /* max */
G_MAXLONG, /* max */
0, /* default */
WEBKIT_PARAM_READWRITE));
- g_object_class_install_property(gobjectClass,
+ g_object_class_install_property(gobjectClass,
PROP_SCRIPT_STRING_ATTR,
g_param_spec_string("script-string-attr", /* name */
"test_obj_script-string-attr", /* short description */
"read-only gchar* TestObj.script-string-attr", /* longer - could do with some extra doc stuff here */
"", /* default */
WEBKIT_PARAM_READABLE));
+ g_object_class_install_property(gobjectClass,
+ PROP_DESCRIPTION,
+ g_param_spec_long("description", /* name */
+ "test_obj_description", /* short description */
+ "read-only glong TestObj.description", /* longer - could do with some extra doc stuff here */
+ G_MINLONG, /* min */
+G_MAXLONG, /* max */
+0, /* default */
+ WEBKIT_PARAM_READABLE));
+ g_object_class_install_property(gobjectClass,
+ PROP_ID,
+ g_param_spec_long("id", /* name */
+ "test_obj_id", /* short description */
+ "read-write glong TestObj.id", /* longer - could do with some extra doc stuff here */
+ G_MINLONG, /* min */
+G_MAXLONG, /* max */
+0, /* default */
+ WEBKIT_PARAM_READWRITE));
+ g_object_class_install_property(gobjectClass,
+ PROP_HASH,
+ g_param_spec_string("hash", /* name */
+ "test_obj_hash", /* short description */
+ "read-only gchar* TestObj.hash", /* longer - could do with some extra doc stuff here */
+ "", /* default */
+ WEBKIT_PARAM_READABLE));
}
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
index 282edb8..ef5ccb8 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
@@ -47,34 +47,34 @@ WEBKIT_API GType
webkit_dom_test_obj_get_type (void);
WEBKIT_API void
-webkit_dom_test_obj_void_method (WebKitDOMTestObj *self);
+webkit_dom_test_obj_void_method(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_void_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg);
+webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg);
WEBKIT_API glong
-webkit_dom_test_obj_int_method (WebKitDOMTestObj *self);
+webkit_dom_test_obj_int_method(WebKitDOMTestObj* self);
WEBKIT_API glong
-webkit_dom_test_obj_int_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg);
+webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg);
WEBKIT_API WebKitDOMTestObj*
-webkit_dom_test_obj_obj_method (WebKitDOMTestObj *self);
+webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self);
WEBKIT_API WebKitDOMTestObj*
-webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg);
+webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg);
WEBKIT_API WebKitDOMTestObj*
-webkit_dom_test_obj_method_that_requires_all_args (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg);
+webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg);
WEBKIT_API WebKitDOMTestObj*
-webkit_dom_test_obj_method_that_requires_all_args_and_throws (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error);
+webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error);
WEBKIT_API void
-webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerializedScriptValue* serialized_arg);
+webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg);
WEBKIT_API void
-webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error);
+webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error);
/* TODO: event function webkit_dom_test_obj_add_event_listener */
@@ -83,100 +83,115 @@ webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **erro
/* TODO: event function webkit_dom_test_obj_remove_event_listener */
WEBKIT_API void
-webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self);
+webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg);
+webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int_arg);
WEBKIT_API void
-webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg);
+webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, glong int_arg, glong optional_arg);
WEBKIT_API void
-webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg);
+webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg);
WEBKIT_API void
-webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg);
+webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg);
WEBKIT_API void
-webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self);
+webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self);
WEBKIT_API WebKitDOMTestObj*
-webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self);
+webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GError **error);
+webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GError **error);
WEBKIT_API WebKitDOMTestObj*
-webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GError **error);
+webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GError **error);
WEBKIT_API void
-webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt);
+webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg (WebKitDOMTestObj *self, glong non_opt, glong opt);
+webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt);
WEBKIT_API void
-webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args (WebKitDOMTestObj *self, glong non_opt, glong opt1, glong opt2);
+webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestObj* self, glong non_opt, glong opt);
+
+WEBKIT_API void
+webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOMTestObj* self, glong non_opt, glong opt1, glong opt2);
WEBKIT_API glong
-webkit_dom_test_obj_get_read_only_int_attr (WebKitDOMTestObj *self);
+webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self);
WEBKIT_API gchar*
-webkit_dom_test_obj_get_read_only_string_attr (WebKitDOMTestObj *self);
+webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self);
WEBKIT_API WebKitDOMTestObj*
-webkit_dom_test_obj_get_read_only_test_obj_attr (WebKitDOMTestObj *self);
+webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self);
WEBKIT_API glong
-webkit_dom_test_obj_get_int_attr (WebKitDOMTestObj *self);
+webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_set_int_attr (WebKitDOMTestObj *self, glong value);
+webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value);
WEBKIT_API gint64
-webkit_dom_test_obj_get_long_long_attr (WebKitDOMTestObj *self);
+webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_set_long_long_attr (WebKitDOMTestObj *self, gint64 value);
+webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value);
WEBKIT_API guint64
-webkit_dom_test_obj_get_unsigned_long_long_attr (WebKitDOMTestObj *self);
+webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_set_unsigned_long_long_attr (WebKitDOMTestObj *self, guint64 value);
+webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 value);
WEBKIT_API gchar*
-webkit_dom_test_obj_get_string_attr (WebKitDOMTestObj *self);
+webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_set_string_attr (WebKitDOMTestObj *self, gchar* value);
+webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, gchar* value);
WEBKIT_API WebKitDOMTestObj*
-webkit_dom_test_obj_get_test_obj_attr (WebKitDOMTestObj *self);
+webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self);
+
+WEBKIT_API void
+webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value);
+
+WEBKIT_API glong
+webkit_dom_test_obj_get_attr_with_exception(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_set_test_obj_attr (WebKitDOMTestObj *self, WebKitDOMTestObj* value);
+webkit_dom_test_obj_set_attr_with_exception(WebKitDOMTestObj* self, glong value);
WEBKIT_API glong
-webkit_dom_test_obj_get_attr_with_exception (WebKitDOMTestObj *self);
+webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self, GError **error);
WEBKIT_API void
-webkit_dom_test_obj_set_attr_with_exception (WebKitDOMTestObj *self, glong value);
+webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong value, GError **error);
WEBKIT_API glong
-webkit_dom_test_obj_get_attr_with_setter_exception (WebKitDOMTestObj *self, GError **error);
+webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_set_attr_with_setter_exception (WebKitDOMTestObj *self, glong value, GError **error);
+webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong value, GError **error);
+
+WEBKIT_API gchar*
+webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self);
+
+WEBKIT_API glong
+webkit_dom_test_obj_get_description(WebKitDOMTestObj* self);
WEBKIT_API glong
-webkit_dom_test_obj_get_attr_with_getter_exception (WebKitDOMTestObj *self);
+webkit_dom_test_obj_get_id(WebKitDOMTestObj* self);
WEBKIT_API void
-webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glong value, GError **error);
+webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value);
WEBKIT_API gchar*
-webkit_dom_test_obj_get_script_string_attr (WebKitDOMTestObj *self);
+webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self);
G_END_DECLS
diff --git a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
index a230aef..693a48b 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
+++ b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
@@ -78,12 +78,12 @@ public:
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags;
- static JSObject* constructTestInterface(ExecState* exec, JSObject* constructor, const ArgList&)
+ static EncodedJSValue JSC_HOST_CALL constructTestInterface(ExecState* exec)
{
- ScriptExecutionContext* context = static_cast<JSTestInterfaceConstructor*>(constructor)->scriptExecutionContext();
+ ScriptExecutionContext* context = static_cast<JSTestInterfaceConstructor*>(exec->callee())->scriptExecutionContext();
if (!context)
- return throwError(exec, ReferenceError);
- return asObject(toJS(exec, static_cast<JSTestInterfaceConstructor*>(constructor)->globalObject(), TestInterface::create(context)));
+ return throwVMError(exec, createReferenceError(exec, "Reference error"));
+ return JSValue::encode(asObject(toJS(exec, static_cast<JSTestInterfaceConstructor*>(exec->callee())->globalObject(), TestInterface::create(context))));
}
virtual ConstructType getConstructData(ConstructData& constructData)
{
diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
index 1e563c6..09b69cd 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
+++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
@@ -46,7 +46,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj);
#define THUNK_GENERATOR(generator)
#endif
-static const HashTableValue JSTestObjTableValues[15] =
+static const HashTableValue JSTestObjTableValues[18] =
{
{ "readOnlyIntAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) },
{ "readOnlyStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) },
@@ -61,12 +61,15 @@ static const HashTableValue JSTestObjTableValues[15] =
{ "attrWithGetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithGetterException), (intptr_t)setJSTestObjAttrWithGetterException THUNK_GENERATOR(0) },
{ "customAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCustomAttr), (intptr_t)setJSTestObjCustomAttr THUNK_GENERATOR(0) },
{ "scriptStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjScriptStringAttr), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "description", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjDescription), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "id", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjId), (intptr_t)setJSTestObjId THUNK_GENERATOR(0) },
+ { "hash", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjHash), (intptr_t)0 THUNK_GENERATOR(0) },
{ "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
{ 0, 0, 0, 0 THUNK_GENERATOR(0) }
};
#undef THUNK_GENERATOR
-static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 34, 31, JSTestObjTableValues, 0 };
+static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 65, 63, JSTestObjTableValues, 0 };
/* Hash table for constructor */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
@@ -121,7 +124,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident
#define THUNK_GENERATOR(generator)
#endif
-static const HashTableValue JSTestObjPrototypeTableValues[29] =
+static const HashTableValue JSTestObjPrototypeTableValues[30] =
{
{ "voidMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0 THUNK_GENERATOR(0) },
{ "voidMethodWithArgs", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) },
@@ -147,6 +150,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[29] =
{ "withScriptStateObj", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObj), (intptr_t)0 THUNK_GENERATOR(0) },
{ "withScriptStateVoidException", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoidException), (intptr_t)0 THUNK_GENERATOR(0) },
{ "withScriptStateObjException", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObjException), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "withScriptExecutionContext", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptExecutionContext), (intptr_t)0 THUNK_GENERATOR(0) },
{ "methodWithOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) },
{ "methodWithNonOptionalArgAndOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) },
{ "methodWithNonOptionalArgAndTwoOptionalArgs", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t)3 THUNK_GENERATOR(0) },
@@ -316,6 +320,33 @@ JSValue jsTestObjScriptStringAttr(ExecState* exec, JSValue slotBase, const Ident
return result;
}
+JSValue jsTestObjDescription(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
+ UNUSED_PARAM(exec);
+ TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+ JSValue result = jsNumber(exec, imp->description());
+ return result;
+}
+
+JSValue jsTestObjId(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
+ UNUSED_PARAM(exec);
+ TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+ JSValue result = jsNumber(exec, imp->id());
+ return result;
+}
+
+JSValue jsTestObjHash(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
+ UNUSED_PARAM(exec);
+ TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+ JSValue result = jsString(exec, imp->hash());
+ return result;
+}
+
JSValue jsTestObjConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* domObject = static_cast<JSTestObj*>(asObject(slotBase));
@@ -391,28 +422,35 @@ void setJSTestObjCustomAttr(ExecState* exec, JSObject* thisObject, JSValue value
static_cast<JSTestObj*>(thisObject)->setCustomAttr(exec, value);
}
+void setJSTestObjId(ExecState* exec, JSObject* thisObject, JSValue value)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
+ TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+ imp->setId(value.toInt32(exec));
+}
+
JSValue JSTestObj::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
{
return getDOMConstructor<JSTestObjConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->voidMethod();
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int intArg = exec->argument(0).toInt32(exec);
@@ -420,27 +458,27 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* ex
TestObj* objArg = toTestObj(exec->argument(2));
imp->voidMethodWithArgs(intArg, strArg, objArg);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSC::JSValue result = jsNumber(exec, imp->intMethod());
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int intArg = exec->argument(0).toInt32(exec);
@@ -449,27 +487,27 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exe
JSC::JSValue result = jsNumber(exec, imp->intMethodWithArgs(intArg, strArg, objArg));
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethod()));
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int intArg = exec->argument(0).toInt32(exec);
@@ -478,35 +516,35 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exe
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethodWithArgs(intArg, strArg, objArg)));
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 2)
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
const String& strArg = ustringToString(exec->argument(0).toString(exec));
TestObj* objArg = toTestObj(exec->argument(1));
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgs(strArg, objArg)));
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 2)
- return throwError(exec, SyntaxError, "Not enough arguments");
+ return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
ExceptionCode ec = 0;
const String& strArg = ustringToString(exec->argument(0).toString(exec));
TestObj* objArg = toTestObj(exec->argument(1));
@@ -514,59 +552,59 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThro
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec)));
setDOMException(exec, ec);
- return result;
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, exec->argument(0));
imp->serializedValue(serializedArg);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
imp->methodWithException(ec);
setDOMException(exec, ec);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
- return castedThis->customMethod(exec);
+ return JSValue::encode(castedThis->customMethod(exec));
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
- return castedThis->customMethodWithArgs(exec);
+ return JSValue::encode(castedThis->customMethodWithArgs(exec));
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
@@ -575,178 +613,178 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState
imp->customArgsAndException(intArg, &callStack, ec);
setDOMException(exec, ec);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue listener = exec->argument(1);
if (!listener.isObject())
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec));
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue listener = exec->argument(1);
if (!listener.isObject())
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec));
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
imp->withDynamicFrame(dynamicFrame);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
- return jsUndefined();
- int intArg = exec->argument(1).toInt32(exec);
+ return JSValue::encode(jsUndefined());
+ int intArg = exec->argument(0).toInt32(exec);
imp->withDynamicFrameAndArg(dynamicFrame, intArg);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
- return jsUndefined();
- int intArg = exec->argument(1).toInt32(exec);
+ return JSValue::encode(jsUndefined());
+ int intArg = exec->argument(0).toInt32(exec);
int argsCount = exec->argumentCount();
- if (argsCount < 3) {
+ if (argsCount < 2) {
imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
- int optionalArg = exec->argument(2).toInt32(exec);
+ int optionalArg = exec->argument(1).toInt32(exec);
imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
- return jsUndefined();
- int intArg = exec->argument(1).toInt32(exec);
+ return JSValue::encode(jsUndefined());
+ int intArg = exec->argument(0).toInt32(exec);
imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec));
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
- return jsUndefined();
- int intArg = exec->argument(1).toInt32(exec);
+ return JSValue::encode(jsUndefined());
+ int intArg = exec->argument(0).toInt32(exec);
int argsCount = exec->argumentCount();
- if (argsCount < 3) {
+ if (argsCount < 2) {
imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
- int optionalArg = exec->argument(2).toInt32(exec);
+ int optionalArg = exec->argument(1).toInt32(exec);
imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec));
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->withScriptStateVoid(exec);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->withScriptStateObj(exec)));
if (exec->hadException())
- return jsUndefined();
- return result;
+ return JSValue::encode(jsUndefined());
+ return JSValue::encode(result);
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
imp->withScriptStateVoidException(exec, ec);
setDOMException(exec, ec);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
@@ -755,35 +793,50 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(Exec
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->withScriptStateObjException(exec, ec)));
setDOMException(exec, ec);
if (exec->hadException())
- return jsUndefined();
- return result;
+ return JSValue::encode(jsUndefined());
+ return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionContext(ExecState* exec)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&JSTestObj::s_info))
+ return throwVMTypeError(exec);
+ JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
+ TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+ ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
+ if (!scriptContext)
+ return JSValue::encode(jsUndefined());
+
+ imp->withScriptExecutionContext(scriptContext);
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int argsCount = exec->argumentCount();
if (argsCount < 1) {
imp->methodWithOptionalArg();
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
int opt = exec->argument(0).toInt32(exec);
imp->methodWithOptionalArg(opt);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int nonOpt = exec->argument(0).toInt32(exec);
@@ -791,20 +844,20 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptio
int argsCount = exec->argumentCount();
if (argsCount < 2) {
imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
int opt = exec->argument(1).toInt32(exec);
imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int nonOpt = exec->argument(0).toInt32(exec);
@@ -812,35 +865,35 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOp
int argsCount = exec->argumentCount();
if (argsCount < 2) {
imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
int opt1 = exec->argument(1).toInt32(exec);
int opt2 = exec->argument(2).toInt32(exec);
imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
TestObj* objArg = toTestObj(exec->argument(0));
const String& strArg = ustringToString(exec->argument(1).toString(exec));
imp->overloadedMethod(objArg, strArg);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
TestObj* objArg = toTestObj(exec->argument(0));
@@ -848,52 +901,52 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exe
int argsCount = exec->argumentCount();
if (argsCount < 2) {
imp->overloadedMethod(objArg);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
int intArg = exec->argument(1).toInt32(exec);
imp->overloadedMethod(objArg, intArg);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
const String& strArg = ustringToString(exec->argument(0).toString(exec));
imp->overloadedMethod(strArg);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
- return throwError(exec, TypeError);
+ return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int intArg = exec->argument(0).toInt32(exec);
imp->overloadedMethod(intArg);
- return jsUndefined();
+ return JSValue::encode(jsUndefined());
}
-JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec)
{
- if ((exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info) && (exec->argument(1).isNull() || exec->argument(1).isUndefined() || exec->argument(1).isString() || exec->argument(1).isObject())))
+ if ((exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info)) && (exec->argument(1).isNull() || exec->argument(1).isUndefined() || exec->argument(1).isString() || exec->argument(1).isObject())))
return jsTestObjPrototypeFunctionOverloadedMethod1(exec);
- if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info)) || (exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info)))
+ if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info))) || (exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info))))
return jsTestObjPrototypeFunctionOverloadedMethod2(exec);
if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || exec->argument(0).isUndefined() || exec->argument(0).isString() || exec->argument(0).isObject())))
return jsTestObjPrototypeFunctionOverloadedMethod3(exec);
if (exec->argumentCount() == 1)
return jsTestObjPrototypeFunctionOverloadedMethod4(exec);
- return throwError(exec, TypeError);
+ return throwTypeError(exec);
}
JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestObj* object)
diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.h b/WebCore/bindings/scripts/test/JS/JSTestObj.h
index 38cf8c2..dd84005 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestObj.h
+++ b/WebCore/bindings/scripts/test/JS/JSTestObj.h
@@ -86,34 +86,35 @@ protected:
// Functions
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*);
-JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionContext(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*);
// Attributes
JSC::JSValue jsTestObjReadOnlyIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
@@ -138,6 +139,10 @@ void setJSTestObjAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::J
JSC::JSValue jsTestObjCustomAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjCustomAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjScriptStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+JSC::JSValue jsTestObjDescription(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+JSC::JSValue jsTestObjId(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+void setJSTestObjId(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
+JSC::JSValue jsTestObjHash(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
JSC::JSValue jsTestObjConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
} // namespace WebCore
diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
index 247f4a3..6b50246 100644
--- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
+++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
@@ -56,6 +56,10 @@
- (int)customAttr;
- (void)setCustomAttr:(int)newCustomAttr;
- (NSString *)scriptStringAttr;
+- (int)descriptionName;
+- (int)idName;
+- (void)setIdName:(int)newIdName;
+- (NSString *)hashName;
- (void)voidMethod;
- (void)voidMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg;
- (int)intMethod;
@@ -80,6 +84,7 @@
- (DOMTestObj *)withScriptStateObj;
- (void)withScriptStateVoidException;
- (DOMTestObj *)withScriptStateObjException;
+- (void)withScriptExecutionContext;
- (void)methodWithOptionalArg:(int)opt;
- (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt;
- (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2;
diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
index 0f3fb66..e57ed87 100644
--- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
+++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
@@ -212,6 +212,30 @@
return IMPL->scriptStringAttr();
}
+- (int)descriptionName
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->description();
+}
+
+- (int)idName
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->id();
+}
+
+- (void)setIdName:(int)newIdName
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->setId(newIdName);
+}
+
+- (NSString *)hashName
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->hash();
+}
+
- (void)voidMethod
{
WebCore::JSMainThreadNullState state;
@@ -370,6 +394,12 @@
return result;
}
+- (void)withScriptExecutionContext
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->withScriptExecutionContext();
+}
+
- (void)methodWithOptionalArg:(int)opt
{
WebCore::JSMainThreadNullState state;
diff --git a/WebCore/bindings/scripts/test/TestObj.idl b/WebCore/bindings/scripts/test/TestObj.idl
index bda2586..1cb004c 100644
--- a/WebCore/bindings/scripts/test/TestObj.idl
+++ b/WebCore/bindings/scripts/test/TestObj.idl
@@ -87,6 +87,7 @@ module test {
raises(DOMException);
[CallWith=ScriptState] TestObj withScriptStateObjException()
raises(DOMException);
+ [CallWith=ScriptExecutionContext] void withScriptExecutionContext();
// 'Optional' extended attribute
void methodWithOptionalArg(in [Optional] long opt);
@@ -103,5 +104,10 @@ module test {
void overloadedMethod(in DOMString strArg);
void overloadedMethod(in long intArg);
#endif
+
+ // ObjectiveC reserved words.
+ readonly attribute long description;
+ attribute long id;
+ readonly attribute DOMString hash;
};
}
diff --git a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
index e8be71d..fef199a 100644
--- a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
+++ b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
@@ -29,6 +29,8 @@
#include "V8CustomVoidCallback.h"
#include "V8DOMString.h"
+#include <wtf/Assertions.h>
+
namespace WebCore {
V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback)
@@ -54,8 +56,14 @@ bool V8TestCallback::callbackWithClass1Param(ScriptExecutionContext* context, Cl
v8::Context::Scope scope(v8Context);
+ v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param);
+ if (class1ParamHandle.IsEmpty()) {
+ CRASH();
+ return true;
+ }
+
v8::Handle<v8::Value> argv[] = {
- toV8(class1Param)
+ class1ParamHandle
};
bool callbackReturnValue = false;
@@ -72,9 +80,20 @@ bool V8TestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Cl
v8::Context::Scope scope(v8Context);
+ v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param);
+ if (class2ParamHandle.IsEmpty()) {
+ CRASH();
+ return true;
+ }
+ v8::Handle<v8::Value> strArgHandle = toV8(strArg);
+ if (strArgHandle.IsEmpty()) {
+ CRASH();
+ return true;
+ }
+
v8::Handle<v8::Value> argv[] = {
- toV8(class2Param),
- toV8(strArg)
+ class2ParamHandle,
+ strArgHandle
};
bool callbackReturnValue = false;
diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
index 449e086..69c57bb 100644
--- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
+++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
@@ -218,6 +218,36 @@ static v8::Handle<v8::Value> scriptStringAttrAttrGetter(v8::Local<v8::String> na
return v8StringOrNull(imp->scriptStringAttr());
}
+static v8::Handle<v8::Value> descriptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.description._get");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ return v8::Integer::New(imp->description());
+}
+
+static v8::Handle<v8::Value> idAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.id._get");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ return v8::Integer::New(imp->id());
+}
+
+static void idAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.id._set");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ int v = toInt32(value);
+ imp->setId(v);
+ return;
+}
+
+static v8::Handle<v8::Value> hashAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.hash._get");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ return v8String(imp->hash());
+}
+
static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TestObj.voidMethod");
@@ -507,6 +537,17 @@ static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Argum
return v8::Handle<v8::Value>();
}
+static v8::Handle<v8::Value> withScriptExecutionContextCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.TestObj.withScriptExecutionContext");
+ TestObj* imp = V8TestObj::toNative(args.Holder());
+ ScriptExecutionContext* scriptContext = getScriptExecutionContext();
+ if (!scriptContext)
+ return v8::Undefined();
+ imp->withScriptExecutionContext(scriptContext);
+ return v8::Handle<v8::Value>();
+}
+
static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TestObj.methodWithOptionalArg");
@@ -635,6 +676,12 @@ static const BatchedAttribute TestObjAttrs[] = {
{"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'scriptStringAttr' (Type: 'readonly attribute' ExtAttr: 'ConvertScriptString')
{"scriptStringAttr", TestObjInternal::scriptStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ // Attribute 'description' (Type: 'readonly attribute' ExtAttr: '')
+ {"description", TestObjInternal::descriptionAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ // Attribute 'id' (Type: 'attribute' ExtAttr: '')
+ {"id", TestObjInternal::idAttrGetter, TestObjInternal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ // Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '')
+ {"hash", TestObjInternal::hashAttrGetter, 0, 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},
@@ -655,6 +702,7 @@ static const BatchedCallback TestObjCallbacks[] = {
{"withScriptStateObj", TestObjInternal::withScriptStateObjCallback},
{"withScriptStateVoidException", TestObjInternal::withScriptStateVoidExceptionCallback},
{"withScriptStateObjException", TestObjInternal::withScriptStateObjExceptionCallback},
+ {"withScriptExecutionContext", TestObjInternal::withScriptExecutionContextCallback},
{"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
{"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
{"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp
index d8076f3..af0933f 100644
--- a/WebCore/bindings/v8/NPV8Object.cpp
+++ b/WebCore/bindings/v8/NPV8Object.cpp
@@ -49,7 +49,6 @@
#endif
#include <stdio.h>
-#include <v8.h>
#include <wtf/StringExtras.h>
using namespace WebCore;
diff --git a/WebCore/bindings/v8/ScriptArray.cpp b/WebCore/bindings/v8/ScriptArray.cpp
index 01b0898..a199a6c 100644
--- a/WebCore/bindings/v8/ScriptArray.cpp
+++ b/WebCore/bindings/v8/ScriptArray.cpp
@@ -39,8 +39,6 @@
#include "V8Binding.h"
#include "V8Proxy.h"
-#include <v8.h>
-
namespace WebCore {
ScriptArray::ScriptArray(ScriptState* scriptState, v8::Handle<v8::Array> v8Array)
diff --git a/WebCore/bindings/v8/ScriptCallStack.cpp b/WebCore/bindings/v8/ScriptCallStack.cpp
index 31b05ee..89809b2 100644
--- a/WebCore/bindings/v8/ScriptCallStack.cpp
+++ b/WebCore/bindings/v8/ScriptCallStack.cpp
@@ -37,7 +37,6 @@
#include "V8Binding.h"
#include <v8-debug.h>
-#include <v8.h>
namespace WebCore {
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index f6cf3a4..d3ec33f 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -469,10 +469,12 @@ void ScriptController::updateDocument()
void ScriptController::namedItemAdded(HTMLDocument* doc, const AtomicString& name)
{
+ m_proxy->windowShell()->namedItemAdded(doc, name);
}
void ScriptController::namedItemRemoved(HTMLDocument* doc, const AtomicString& name)
{
+ m_proxy->windowShell()->namedItemRemoved(doc, name);
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp
index fdbb26b..39e409e 100644
--- a/WebCore/bindings/v8/ScriptDebugServer.cpp
+++ b/WebCore/bindings/v8/ScriptDebugServer.cpp
@@ -256,6 +256,40 @@ void ScriptDebugServer::stepOutOfFunction()
#endif
}
+bool ScriptDebugServer::editScriptSource(const String& sourceID, const String& newContent, String& newSourceOrErrorMessage)
+{
+#if ENABLE(V8_SCRIPT_DEBUG_SERVER)
+ ensureDebuggerScriptCompiled();
+ v8::HandleScope scope;
+
+ OwnPtr<v8::Context::Scope> contextScope;
+ if (!m_pausedPage)
+ contextScope.set(new v8::Context::Scope(v8::Debug::GetDebugContext()));
+
+ v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("editScriptSource")));
+ v8::Handle<v8::Value> argv[] = { v8String(sourceID), v8String(newContent) };
+
+ v8::TryCatch tryCatch;
+ tryCatch.SetVerbose(false);
+ v8::Handle<v8::Value> result = function->Call(m_debuggerScript.get(), 2, argv);
+ if (tryCatch.HasCaught()) {
+ v8::Local<v8::Message> message = tryCatch.Message();
+ if (!message.IsEmpty())
+ newSourceOrErrorMessage = toWebCoreStringWithNullOrUndefinedCheck(message->Get());
+ return false;
+ }
+ ASSERT(!result.IsEmpty());
+ newSourceOrErrorMessage = toWebCoreStringWithNullOrUndefinedCheck(result);
+
+ // Call stack may have changed after if the edited function was on the stack.
+ if (m_currentCallFrame)
+ m_currentCallFrame.clear();
+ return true;
+#else
+ return false;
+#endif
+}
+
PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::currentCallFrame()
{
if (!m_currentCallFrame) {
@@ -267,6 +301,11 @@ PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::currentCallFrame()
return m_currentCallFrame;
}
+bool ScriptDebugServer::isDebuggerAlwaysEnabled()
+{
+ return true;
+}
+
#if ENABLE(V8_SCRIPT_DEBUG_SERVER)
void ScriptDebugServer::v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails)
{
@@ -320,7 +359,8 @@ void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8
toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("id"))),
toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("name"))),
toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("source"))),
- object->Get(v8::String::New("lineOffset"))->ToInteger()->Value());
+ object->Get(v8::String::New("lineOffset"))->ToInteger()->Value(),
+ static_cast<ScriptWorldType>(object->Get(v8::String::New("scriptWorldType"))->Int32Value()));
}
void ScriptDebugServer::ensureDebuggerScriptCompiled()
diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h
index 7c8c5cc..9439c16 100644
--- a/WebCore/bindings/v8/ScriptDebugServer.h
+++ b/WebCore/bindings/v8/ScriptDebugServer.h
@@ -74,6 +74,8 @@ public:
void stepOverStatement();
void stepOutOfFunction();
+ bool editScriptSource(const String& sourceID, const String& newContent, String& newSourceOrErrorMessage);
+
void recompileAllJSFunctionsSoon() { }
void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) { }
@@ -92,6 +94,8 @@ public:
PassRefPtr<JavaScriptCallFrame> currentCallFrame();
+ bool isDebuggerAlwaysEnabled();
+
private:
ScriptDebugServer();
~ScriptDebugServer() { }
diff --git a/WebCore/bindings/v8/ScriptEventListener.cpp b/WebCore/bindings/v8/ScriptEventListener.cpp
index cad7a1c..57a2824 100644
--- a/WebCore/bindings/v8/ScriptEventListener.cpp
+++ b/WebCore/bindings/v8/ScriptEventListener.cpp
@@ -36,7 +36,7 @@
#include "EventListener.h"
#include "Frame.h"
#include "ScriptScope.h"
-#include "Tokenizer.h"
+#include "DocumentParser.h"
#include "V8AbstractEventListener.h"
#include "V8Binding.h"
#include "XSSAuditor.h"
@@ -64,10 +64,10 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, Attribu
return 0;
}
- if (frame->document()->tokenizer()) {
+ if (frame->document()->parser()) {
// FIXME: Change to use script->eventHandlerLineNumber() when implemented.
- lineNumber = frame->document()->tokenizer()->lineNumber();
- columnNumber = frame->document()->tokenizer()->columnNumber();
+ lineNumber = frame->document()->parser()->lineNumber();
+ columnNumber = frame->document()->parser()->columnNumber();
}
sourceURL = node->document()->url().string();
}
@@ -97,10 +97,10 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, Attri
return 0;
}
- if (frame->document()->tokenizer()) {
+ if (frame->document()->parser()) {
// FIXME: Change to use script->eventHandlerLineNumber() when implemented.
- lineNumber = frame->document()->tokenizer()->lineNumber();
- columnNumber = frame->document()->tokenizer()->columnNumber();
+ lineNumber = frame->document()->parser()->lineNumber();
+ columnNumber = frame->document()->parser()->columnNumber();
}
sourceURL = frame->document()->url().string();
return V8LazyEventListener::create(attr->localName().string(), frame->document()->isSVGDocument(), attr->value(), sourceURL, lineNumber, columnNumber, WorldContextHandle(UseMainWorld));
diff --git a/WebCore/bindings/v8/ScriptProfiler.cpp b/WebCore/bindings/v8/ScriptProfiler.cpp
index 1f09420..ab0b9fe 100644
--- a/WebCore/bindings/v8/ScriptProfiler.cpp
+++ b/WebCore/bindings/v8/ScriptProfiler.cpp
@@ -46,7 +46,9 @@ void ScriptProfiler::start(ScriptState* state, const String& title)
PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
{
v8::HandleScope hs;
- const v8::CpuProfile* profile = v8::CpuProfiler::StopProfiling(v8String(title));
+ const v8::CpuProfile* profile = state ?
+ v8::CpuProfiler::StopProfiling(v8String(title), state->context()->GetSecurityToken()) :
+ v8::CpuProfiler::StopProfiling(v8String(title));
return profile ? ScriptProfile::create(profile) : 0;
}
diff --git a/WebCore/bindings/v8/SerializedScriptValue.cpp b/WebCore/bindings/v8/SerializedScriptValue.cpp
index 50ac86b..8e91920 100644
--- a/WebCore/bindings/v8/SerializedScriptValue.cpp
+++ b/WebCore/bindings/v8/SerializedScriptValue.cpp
@@ -38,13 +38,13 @@
#include "FileList.h"
#include "ImageData.h"
#include "SharedBuffer.h"
+#include "V8Binding.h"
#include "V8Blob.h"
#include "V8File.h"
#include "V8FileList.h"
#include "V8ImageData.h"
#include "V8Proxy.h"
-#include <v8.h>
#include <wtf/Assertions.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
@@ -1012,6 +1012,52 @@ private:
} // namespace
+void SerializedScriptValue::deserializeAndSetProperty(v8::Handle<v8::Object> object, const char* propertyName,
+ v8::PropertyAttribute attribute, SerializedScriptValue* value)
+{
+ if (!value)
+ return;
+ v8::Handle<v8::Value> deserialized = value->deserialize();
+ object->ForceSet(v8::String::NewSymbol(propertyName), deserialized, attribute);
+}
+
+PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(v8::Handle<v8::Value> value, bool& didThrow)
+{
+ return adoptRef(new SerializedScriptValue(value, didThrow));
+}
+
+PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(v8::Handle<v8::Value> value)
+{
+ bool didThrow;
+ return adoptRef(new SerializedScriptValue(value, didThrow));
+}
+
+PassRefPtr<SerializedScriptValue> SerializedScriptValue::createFromWire(String data)
+{
+ return adoptRef(new SerializedScriptValue(data, WireData));
+}
+
+PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(String data)
+{
+ return adoptRef(new SerializedScriptValue(data, StringValue));
+}
+
+PassRefPtr<SerializedScriptValue> SerializedScriptValue::create()
+{
+ return adoptRef(new SerializedScriptValue());
+}
+
+PassRefPtr<SerializedScriptValue> SerializedScriptValue::release()
+{
+ RefPtr<SerializedScriptValue> result = adoptRef(new SerializedScriptValue(m_data, WireData));
+ m_data = String();
+ return result.release();
+}
+
+SerializedScriptValue::SerializedScriptValue()
+{
+}
+
SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, bool& didThrow)
{
didThrow = false;
diff --git a/WebCore/bindings/v8/SerializedScriptValue.h b/WebCore/bindings/v8/SerializedScriptValue.h
index 8205a42..3710b5a 100644
--- a/WebCore/bindings/v8/SerializedScriptValue.h
+++ b/WebCore/bindings/v8/SerializedScriptValue.h
@@ -32,7 +32,6 @@
#define SerializedScriptValue_h
#include "ScriptValue.h"
-#include "V8Binding.h"
#include <v8.h>
#include <wtf/RefCounted.h>
@@ -40,63 +39,21 @@ namespace WebCore {
class SerializedScriptValue : public RefCounted<SerializedScriptValue> {
public:
- // Deserializes the given value and sets it as a property on the
- // object.
- static void deserializeAndSetProperty(v8::Handle<v8::Object> object,
- const char* propertyName,
- v8::PropertyAttribute attribute,
- SerializedScriptValue* value)
- {
- if (!value)
- return;
- v8::Handle<v8::Value> deserialized = value->deserialize();
- object->ForceSet(v8::String::NewSymbol(propertyName), deserialized, attribute);
- }
+ static void deserializeAndSetProperty(v8::Handle<v8::Object> object, const char* propertyName,
+ v8::PropertyAttribute, SerializedScriptValue*);
- // Creates a serialized representation of the given V8 value.
- static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value> value)
- {
- bool didThrow;
- return adoptRef(new SerializedScriptValue(value, didThrow));
- }
-
- // Creates a serialized representation of the given V8 value.
- //
// If a serialization error occurs (e.g., cyclic input value) this
// function returns an empty representation, schedules a V8 exception to
// be thrown using v8::ThrowException(), and sets |didThrow|. In this case
// the caller must not invoke any V8 operations until control returns to
// V8. When serialization is successful, |didThrow| is false.
- static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value> value, bool& didThrow)
- {
- return adoptRef(new SerializedScriptValue(value, didThrow));
- }
-
- // Creates a serialized value with the given data obtained from a
- // prior call to toWireString().
- static PassRefPtr<SerializedScriptValue> createFromWire(String data)
- {
- return adoptRef(new SerializedScriptValue(data, WireData));
- }
-
- // Creates a serialized representation of WebCore string.
- static PassRefPtr<SerializedScriptValue> create(String data)
- {
- return adoptRef(new SerializedScriptValue(data, StringValue));
- }
+ static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value> value, bool& didThrow);
+ static PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value>);
+ static PassRefPtr<SerializedScriptValue> createFromWire(String data);
+ static PassRefPtr<SerializedScriptValue> create(String data);
+ static PassRefPtr<SerializedScriptValue> create();
- // Creates an empty serialized value.
- static PassRefPtr<SerializedScriptValue> create()
- {
- return adoptRef(new SerializedScriptValue());
- }
-
- PassRefPtr<SerializedScriptValue> release()
- {
- RefPtr<SerializedScriptValue> result = adoptRef(new SerializedScriptValue(m_data, WireData));
- m_data = String();
- return result.release();
- }
+ PassRefPtr<SerializedScriptValue> release();
String toWireString() const { return m_data; }
@@ -110,10 +67,8 @@ private:
WireData
};
- SerializedScriptValue() { }
-
+ SerializedScriptValue();
SerializedScriptValue(v8::Handle<v8::Value>, bool& didThrow);
-
SerializedScriptValue(String data, StringDataMode mode);
String m_data;
diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp
index e0904d7..97805c0 100644
--- a/WebCore/bindings/v8/V8Binding.cpp
+++ b/WebCore/bindings/v8/V8Binding.cpp
@@ -44,8 +44,6 @@
#include "V8Proxy.h"
#include <wtf/text/CString.h>
-#include <v8.h>
-
namespace WebCore {
// WebCoreStringResource is a helper class for v8ExternalString. It is used
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
index c7c77d3..99fea4c 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -50,6 +50,7 @@
#include "V8DOMWindow.h"
#include "V8Document.h"
#include "V8GCForContextDispose.h"
+#include "V8HTMLDocument.h"
#include "V8HiddenPropertyName.h"
#include "V8History.h"
#include "V8Location.h"
@@ -414,6 +415,12 @@ void V8DOMWindowShell::clearDocumentWrapper()
}
}
+static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* document)
+{
+ ASSERT(V8Document::toNative(wrapper) == document);
+ ASSERT(!document->isHTMLDocument() || (V8Document::toNative(v8::Handle<v8::Object>::Cast(wrapper->GetPrototype())) == document));
+}
+
void V8DOMWindowShell::updateDocumentWrapperCache()
{
v8::HandleScope handleScope;
@@ -432,6 +439,10 @@ void V8DOMWindowShell::updateDocumentWrapperCache()
}
v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document());
+ ASSERT(documentWrapper == m_document || m_document.IsEmpty());
+ if (m_document.IsEmpty())
+ updateDocumentWrapper(v8::Handle<v8::Object>::Cast(documentWrapper));
+ checkDocumentWrapper(m_document, m_frame->document());
// If instantiation of the document wrapper fails, clear the cache
// and let the DOMWindow accessor handle access to the document.
@@ -509,6 +520,39 @@ void V8DOMWindowShell::updateDocument()
updateSecurityOrigin();
}
+v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorInfo& info)
+{
+ // FIXME(antonm): consider passing AtomicStringImpl directly.
+ AtomicString name = v8StringToAtomicWebCoreString(property);
+ HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder());
+ ASSERT(htmlDocument);
+ return V8HTMLDocument::GetNamedProperty(htmlDocument, name);
+}
+
+void V8DOMWindowShell::namedItemAdded(HTMLDocument* doc, const AtomicString& name)
+{
+ initContextIfNeeded();
+
+ v8::HandleScope handleScope;
+ v8::Context::Scope contextScope(m_context);
+
+ ASSERT(!m_document.IsEmpty());
+ checkDocumentWrapper(m_document, doc);
+ m_document->SetAccessor(v8String(name), getter);
+}
+
+void V8DOMWindowShell::namedItemRemoved(HTMLDocument* doc, const AtomicString& name)
+{
+ initContextIfNeeded();
+
+ v8::HandleScope handleScope;
+ v8::Context::Scope contextScope(m_context);
+
+ ASSERT(!m_document.IsEmpty());
+ checkDocumentWrapper(m_document, doc);
+ m_document->Delete(v8String(name));
+}
+
void V8DOMWindowShell::updateSecurityOrigin()
{
v8::HandleScope scope;
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.h b/WebCore/bindings/v8/V8DOMWindowShell.h
index f4eaff2..3cf1b52 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.h
+++ b/WebCore/bindings/v8/V8DOMWindowShell.h
@@ -31,6 +31,7 @@
#ifndef V8DOMWindowShell_h
#define V8DOMWindowShell_h
+#include "AtomicString.h"
#include "WrapperTypeInfo.h"
#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
@@ -41,6 +42,7 @@ namespace WebCore {
class DOMWindow;
class Frame;
+class HTMLDocument;
class String;
// V8WindowShell represents all the per-global object state for a Frame that
@@ -54,6 +56,9 @@ public:
// Update document object of the frame.
void updateDocument();
+ void namedItemAdded(HTMLDocument*, const AtomicString&);
+ void namedItemRemoved(HTMLDocument*, const AtomicString&);
+
// Update the security origin of a document
// (e.g., after setting docoument.domain).
void updateSecurityOrigin();
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index f8426dc..596090d 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -82,7 +82,6 @@
#include <algorithm>
#include <utility>
-#include <v8.h>
#include <v8-debug.h>
#include <wtf/Assertions.h>
#include <wtf/OwnArrayPtr.h>
@@ -286,6 +285,8 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, WrapperT
if (!instance.IsEmpty()) {
// Avoid setting the DOM wrapper for failed allocations.
setDOMWrapper(instance, type, impl);
+ if (type == &V8HTMLDocument::info)
+ instance = V8HTMLDocument::WrapInShadowObject(instance, static_cast<Node*>(impl));
}
return instance;
}
diff --git a/WebCore/bindings/v8/V8GCController.cpp b/WebCore/bindings/v8/V8GCController.cpp
index fa7c357..5611199 100644
--- a/WebCore/bindings/v8/V8GCController.cpp
+++ b/WebCore/bindings/v8/V8GCController.cpp
@@ -46,7 +46,6 @@
#include <algorithm>
#include <utility>
-#include <v8.h>
#include <v8-debug.h>
#include <wtf/HashMap.h>
#include <wtf/StdLibExtras.h>
diff --git a/WebCore/bindings/v8/V8IsolatedContext.cpp b/WebCore/bindings/v8/V8IsolatedContext.cpp
index 3237ede..b5e4590 100644
--- a/WebCore/bindings/v8/V8IsolatedContext.cpp
+++ b/WebCore/bindings/v8/V8IsolatedContext.cpp
@@ -38,7 +38,6 @@
#include "ScriptController.h"
#include "V8DOMWindow.h"
#include "V8HiddenPropertyName.h"
-#include <v8.h>
namespace WebCore {
diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp
index f9cc94a..7f2051e 100644
--- a/WebCore/bindings/v8/V8NPObject.cpp
+++ b/WebCore/bindings/v8/V8NPObject.cpp
@@ -243,6 +243,12 @@ v8::Handle<v8::Value> npObjectGetIndexedProperty(v8::Local<v8::Object> self, uin
return npObjectGetProperty(self, identifier, v8::Number::New(index));
}
+v8::Handle<v8::Integer> npObjectQueryProperty(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ NPIdentifier identifier = getStringIdentifier(name);
+ return npObjectGetProperty(info.Holder(), identifier, name).IsEmpty() ? v8::Handle<v8::Integer>() : v8::Integer::New(v8::None);
+}
+
static v8::Handle<v8::Value> npObjectSetProperty(v8::Local<v8::Object> self, NPIdentifier identifier, v8::Local<v8::Value> value)
{
NPObject* npObject = v8ObjectToNPObject(self);
@@ -373,7 +379,7 @@ v8::Local<v8::Object> createV8ObjectForNPObject(NPObject* object, NPObject* root
if (npObjectDesc.IsEmpty()) {
npObjectDesc = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
npObjectDesc->InstanceTemplate()->SetInternalFieldCount(npObjectInternalFieldCount);
- npObjectDesc->InstanceTemplate()->SetNamedPropertyHandler(npObjectNamedPropertyGetter, npObjectNamedPropertySetter, 0, 0, npObjectNamedPropertyEnumerator);
+ npObjectDesc->InstanceTemplate()->SetNamedPropertyHandler(npObjectNamedPropertyGetter, npObjectNamedPropertySetter, npObjectQueryProperty, 0, npObjectNamedPropertyEnumerator);
npObjectDesc->InstanceTemplate()->SetIndexedPropertyHandler(npObjectIndexedPropertyGetter, npObjectIndexedPropertySetter, 0, 0, npObjectIndexedPropertyEnumerator);
npObjectDesc->InstanceTemplate()->SetCallAsFunctionHandler(npObjectInvokeDefaultHandler);
}
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index 7f52374..7a5df96 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -67,7 +67,6 @@
#include <algorithm>
#include <stdio.h>
#include <utility>
-#include <v8.h>
#include <wtf/Assertions.h>
#include <wtf/OwnArrayPtr.h>
#include <wtf/StdLibExtras.h>
diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
index 6ae3a3e..2c89b95 100644
--- a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
@@ -36,7 +36,7 @@
#include "V8Binding.h"
#include "V8Proxy.h"
#include "V8Int8Array.h"
-#include "V8FloatArray.h"
+#include "V8Float32Array.h"
#include "V8Int32Array.h"
#include "V8Int16Array.h"
#include "V8Uint8Array.h"
@@ -52,7 +52,7 @@ v8::Handle<v8::Value> toV8(ArrayBufferView* impl)
if (impl->isByteArray())
return toV8(static_cast<Int8Array*>(impl));
if (impl->isFloatArray())
- return toV8(static_cast<FloatArray*>(impl));
+ return toV8(static_cast<Float32Array*>(impl));
if (impl->isIntArray())
return toV8(static_cast<Int32Array*>(impl));
if (impl->isShortArray())
diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
index 4cc6ac2..7d1cfc1 100644
--- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
@@ -33,8 +33,10 @@
#include "V8Console.h"
#include "Console.h"
+#include "MemoryInfo.h"
#include "ScriptProfile.h"
#include "V8Binding.h"
+#include "V8MemoryInfo.h"
#include "V8Proxy.h"
#include "V8ScriptProfile.h"
@@ -42,11 +44,23 @@ namespace WebCore {
typedef Vector<RefPtr<ScriptProfile> > ProfilesArray;
-v8::Handle<v8::Value> V8Console::profilesAccessorGetter(v8::Local<v8::String>, const v8::AccessorInfo&)
+v8::Handle<v8::Value> V8Console::profilesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.Console.profilesAccessorGetter");
- // FIXME: Provide a real implementation.
- return v8::Array::New(0);
+ 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;
+}
+
+v8::Handle<v8::Value> V8Console::memoryAccessorGetter(v8::Local<v8::String>, const v8::AccessorInfo&)
+{
+ INC_STATS("DOM.Console.memoryAccessorGetter");
+ return toV8(MemoryInfo::create());
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp
index 5e20e376..18f27cb 100644
--- a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp
@@ -26,15 +26,16 @@
#include "config.h"
#include "V8CustomPositionCallback.h"
-#include "Frame.h"
+#include "ScriptExecutionContext.h"
#include "V8CustomVoidCallback.h" // For invokeCallback
#include "V8Geoposition.h"
+#include "V8Proxy.h"
namespace WebCore {
-V8CustomPositionCallback::V8CustomPositionCallback(v8::Local<v8::Object> callback, Frame* frame)
- : m_callback(v8::Persistent<v8::Object>::New(callback))
- , m_frame(frame)
+V8CustomPositionCallback::V8CustomPositionCallback(v8::Local<v8::Object> callback, ScriptExecutionContext* context)
+ : PositionCallback(context)
+ , m_callback(v8::Persistent<v8::Object>::New(callback))
{
}
@@ -47,7 +48,17 @@ void V8CustomPositionCallback::handleEvent(Geoposition* position)
{
v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
+ // ActiveDOMObject will null our pointer to the ScriptExecutionContext when it goes away.
+ ScriptExecutionContext* scriptContext = scriptExecutionContext();
+ if (!scriptContext)
+ return;
+
+ // The lookup of the proxy will fail if the Frame has been detached.
+ V8Proxy* proxy = V8Proxy::retrieve(scriptContext);
+ if (!proxy)
+ return;
+
+ v8::Handle<v8::Context> context = proxy->context();
if (context.IsEmpty())
return;
@@ -57,11 +68,11 @@ void V8CustomPositionCallback::handleEvent(Geoposition* position)
toV8(position)
};
- // Protect the frame until the callback returns.
- RefPtr<Frame> protector(m_frame);
+ // Protect the script context until the callback returns.
+ RefPtr<ScriptExecutionContext> protector(scriptContext);
bool callbackReturnValue = false;
- invokeCallback(m_callback, 1, argv, callbackReturnValue, m_frame->document());
+ invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptContext);
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CustomPositionCallback.h b/WebCore/bindings/v8/custom/V8CustomPositionCallback.h
index d2290ee..61db922 100644
--- a/WebCore/bindings/v8/custom/V8CustomPositionCallback.h
+++ b/WebCore/bindings/v8/custom/V8CustomPositionCallback.h
@@ -27,6 +27,7 @@
#define V8CustomPositionCallback_h
#include "PositionCallback.h"
+
#include <v8.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -35,23 +36,23 @@ namespace WebCore {
class Frame;
class Geoposition;
+class ScriptExecutionContext;
class V8CustomPositionCallback : public PositionCallback {
public:
- static PassRefPtr<V8CustomPositionCallback> create(v8::Local<v8::Value> value, Frame* frame)
+ static PassRefPtr<V8CustomPositionCallback> create(v8::Local<v8::Value> value, ScriptExecutionContext* context)
{
ASSERT(value->IsObject());
- return adoptRef(new V8CustomPositionCallback(value->ToObject(), frame));
+ return adoptRef(new V8CustomPositionCallback(value->ToObject(), context));
}
virtual ~V8CustomPositionCallback();
virtual void handleEvent(Geoposition*);
private:
- V8CustomPositionCallback(v8::Local<v8::Object>, Frame*);
+ V8CustomPositionCallback(v8::Local<v8::Object>, ScriptExecutionContext*);
v8::Persistent<v8::Object> m_callback;
- RefPtr<Frame> m_frame;
};
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp
index bd42d94..36b5e04 100644
--- a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp
@@ -26,15 +26,16 @@
#include "config.h"
#include "V8CustomPositionErrorCallback.h"
-#include "Frame.h"
+#include "ScriptExecutionContext.h"
#include "V8CustomVoidCallback.h" // For invokeCallback
#include "V8PositionError.h"
+#include "V8Proxy.h"
namespace WebCore {
-V8CustomPositionErrorCallback::V8CustomPositionErrorCallback(v8::Local<v8::Object> callback, Frame* frame)
- : m_callback(v8::Persistent<v8::Object>::New(callback))
- , m_frame(frame)
+V8CustomPositionErrorCallback::V8CustomPositionErrorCallback(v8::Local<v8::Object> callback, ScriptExecutionContext* context)
+ : PositionErrorCallback(context)
+ , m_callback(v8::Persistent<v8::Object>::New(callback))
{
}
@@ -47,7 +48,17 @@ void V8CustomPositionErrorCallback::handleEvent(PositionError* error)
{
v8::HandleScope handleScope;
- v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
+ // ActiveDOMObject will null our pointer to the ScriptExecutionContext when it goes away.
+ ScriptExecutionContext* scriptContext = scriptExecutionContext();
+ if (!scriptContext)
+ return;
+
+ // The lookup of the proxy will fail if the Frame has been detached.
+ V8Proxy* proxy = V8Proxy::retrieve(scriptContext);
+ if (!proxy)
+ return;
+
+ v8::Handle<v8::Context> context = proxy->context();
if (context.IsEmpty())
return;
@@ -57,11 +68,11 @@ void V8CustomPositionErrorCallback::handleEvent(PositionError* error)
toV8(error)
};
- // Protect the frame until the callback returns.
- RefPtr<Frame> protector(m_frame);
+ // Protect the script context until the callback returns.
+ RefPtr<ScriptExecutionContext> protector(scriptContext);
bool callbackReturnValue = false;
- invokeCallback(m_callback, 1, argv, callbackReturnValue, m_frame->document());
+ invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptContext);
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h
index aaf56a7..5211b60 100644
--- a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h
+++ b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.h
@@ -27,6 +27,7 @@
#define V8CustomPositionErrorCallback_h
#include "PositionErrorCallback.h"
+
#include <v8.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -35,23 +36,23 @@ namespace WebCore {
class Frame;
class PositionError;
+class ScriptExecutionContext;
class V8CustomPositionErrorCallback : public PositionErrorCallback {
public:
- static PassRefPtr<V8CustomPositionErrorCallback> create(v8::Local<v8::Value> value, Frame* frame)
+ static PassRefPtr<V8CustomPositionErrorCallback> create(v8::Local<v8::Value> value, ScriptExecutionContext* context)
{
ASSERT(value->IsObject());
- return adoptRef(new V8CustomPositionErrorCallback(value->ToObject(), frame));
+ return adoptRef(new V8CustomPositionErrorCallback(value->ToObject(), context));
}
virtual ~V8CustomPositionErrorCallback();
virtual void handleEvent(PositionError*);
private:
- V8CustomPositionErrorCallback(v8::Local<v8::Object>, Frame*);
+ V8CustomPositionErrorCallback(v8::Local<v8::Object>, ScriptExecutionContext*);
v8::Persistent<v8::Object> m_callback;
- RefPtr<Frame> m_frame;
};
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
index 3bdc79b..6603344 100644
--- a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
@@ -39,6 +39,7 @@
#include "V8Proxy.h"
#include "V8SQLError.h"
#include "V8SQLTransaction.h"
+#include <wtf/Assertions.h>
namespace WebCore {
@@ -52,9 +53,16 @@ bool V8SQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, S
v8::Context::Scope scope(v8Context);
+ v8::Handle<v8::Value> transactionHandle = toV8(transaction);
+ v8::Handle<v8::Value> errorHandle = toV8(error);
+ if (transactionHandle.IsEmpty() || errorHandle.IsEmpty()) {
+ CRASH();
+ return true;
+ }
+
v8::Handle<v8::Value> argv[] = {
- toV8(transaction),
- toV8(error)
+ transactionHandle,
+ errorHandle
};
// Protect the context until the callback returns.
diff --git a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp
index bc7bb6c..25e7e0d 100644
--- a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp
@@ -40,6 +40,7 @@ namespace WebCore {
V8CustomVoidCallback::V8CustomVoidCallback(v8::Local<v8::Object> callback, ScriptExecutionContext *context)
: m_callback(v8::Persistent<v8::Object>::New(callback))
, m_scriptExecutionContext(context)
+ , m_worldContext(UseCurrentWorld)
{
}
@@ -52,7 +53,7 @@ void V8CustomVoidCallback::handleEvent()
{
v8::HandleScope handleScope;
- v8::Handle<v8::Context> v8Context = toV8Context(m_scriptExecutionContext.get(), WorldContextHandle(UseCurrentWorld));
+ v8::Handle<v8::Context> v8Context = toV8Context(m_scriptExecutionContext.get(), m_worldContext);
if (v8Context.IsEmpty())
return;
diff --git a/WebCore/bindings/v8/custom/V8CustomVoidCallback.h b/WebCore/bindings/v8/custom/V8CustomVoidCallback.h
index 03a47bc..94bb782 100644
--- a/WebCore/bindings/v8/custom/V8CustomVoidCallback.h
+++ b/WebCore/bindings/v8/custom/V8CustomVoidCallback.h
@@ -32,6 +32,7 @@
#define V8CustomVoidCallback_h
#include "VoidCallback.h"
+#include "WorldContextHandle.h"
#include <v8.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -56,6 +57,7 @@ private:
v8::Persistent<v8::Object> m_callback;
RefPtr<ScriptExecutionContext> m_scriptExecutionContext;
+ WorldContextHandle m_worldContext;
};
// Returns false if callback failed (null, wrong type, or threw exception).
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
index 4867cfe..25564ee 100644
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -72,7 +72,7 @@
#if ENABLE(3D_CANVAS)
#include "V8ArrayBuffer.h"
#include "V8Int8Array.h"
-#include "V8FloatArray.h"
+#include "V8Float32Array.h"
#include "V8Int32Array.h"
#include "V8Int16Array.h"
#include "V8Uint8Array.h"
@@ -308,7 +308,7 @@ v8::Handle<v8::Value> V8DOMWindow::WebGLUnsignedIntArrayAccessorGetter(v8::Local
v8::Handle<v8::Value> V8DOMWindow::WebGLFloatArrayAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
DOMWindow* window = V8DOMWindow::toNative(info.Holder());
- return V8DOMWrapper::getConstructor(&V8FloatArray::info, window);
+ return V8DOMWrapper::getConstructor(&V8Float32Array::info, window);
}
#endif
diff --git a/WebCore/bindings/v8/custom/V8FloatArrayCustom.cpp b/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp
index ebc65db..93c5e91 100644
--- a/WebCore/bindings/v8/custom/V8FloatArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp
@@ -33,34 +33,34 @@
#if ENABLE(3D_CANVAS)
#include "ArrayBuffer.h"
-#include "FloatArray.h"
+#include "Float32Array.h"
#include "V8Binding.h"
#include "V8ArrayBuffer.h"
#include "V8ArrayBufferViewCustom.h"
-#include "V8FloatArray.h"
+#include "V8Float32Array.h"
#include "V8Proxy.h"
namespace WebCore {
-v8::Handle<v8::Value> V8FloatArray::constructorCallback(const v8::Arguments& args)
+v8::Handle<v8::Value> V8Float32Array::constructorCallback(const v8::Arguments& args)
{
- INC_STATS("DOM.FloatArray.Contructor");
+ INC_STATS("DOM.Float32Array.Contructor");
- return constructWebGLArray<FloatArray, float>(args, &info, v8::kExternalFloatArray);
+ return constructWebGLArray<Float32Array, float>(args, &info, v8::kExternalFloatArray);
}
-v8::Handle<v8::Value> V8FloatArray::setCallback(const v8::Arguments& args)
+v8::Handle<v8::Value> V8Float32Array::setCallback(const v8::Arguments& args)
{
- INC_STATS("DOM.FloatArray.set()");
- return setWebGLArrayHelper<FloatArray, V8FloatArray>(args);
+ INC_STATS("DOM.Float32Array.set()");
+ return setWebGLArrayHelper<Float32Array, V8Float32Array>(args);
}
-v8::Handle<v8::Value> toV8(FloatArray* impl)
+v8::Handle<v8::Value> toV8(Float32Array* impl)
{
if (!impl)
return v8::Null();
- v8::Handle<v8::Object> wrapper = V8FloatArray::wrap(impl);
+ v8::Handle<v8::Object> wrapper = V8Float32Array::wrap(impl);
if (!wrapper.IsEmpty())
wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalFloatArray, impl->length());
return wrapper;
diff --git a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
index 7173be1..649c45f 100644
--- a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
@@ -26,8 +26,8 @@
#include "config.h"
#include "V8Geolocation.h"
+#include "Frame.h"
#include "Geolocation.h"
-
#include "V8Binding.h"
#include "V8CustomPositionCallback.h"
#include "V8CustomPositionErrorCallback.h"
@@ -56,8 +56,7 @@ static PassRefPtr<PositionCallback> createPositionCallback(v8::Local<v8::Value>
return 0;
}
- Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
- return V8CustomPositionCallback::create(value, frame);
+ return V8CustomPositionCallback::create(value, getScriptExecutionContext());
}
static PassRefPtr<PositionErrorCallback> createPositionErrorCallback(v8::Local<v8::Value> value, bool& succeeded)
@@ -75,8 +74,7 @@ static PassRefPtr<PositionErrorCallback> createPositionErrorCallback(v8::Local<v
return 0;
}
- Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
- return V8CustomPositionErrorCallback::create(value, frame);
+ return V8CustomPositionErrorCallback::create(value, getScriptExecutionContext());
}
static PassRefPtr<PositionOptions> createPositionOptions(v8::Local<v8::Value> value, bool& succeeded)
diff --git a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
index 66e326c..d2f8c96 100644
--- a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
@@ -105,7 +105,7 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::toDataURLCallback(const v8::Arguments
HTMLCanvasElement* canvas = V8HTMLCanvasElement::toNative(holder);
String type = toWebCoreString(args[0]);
ExceptionCode ec = 0;
- String result = canvas->toDataURL(type, quality, ec);
+ String result = canvas->toDataURL(type, &quality, ec);
V8Proxy::setDOMException(ec);
return v8StringOrUndefined(result);
}
diff --git a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
index 86f2eb5..e6f1b8f 100644
--- a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
@@ -49,48 +49,37 @@
namespace WebCore {
-v8::Handle<v8::Boolean> V8HTMLDocument::namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+v8::Local<v8::Object> V8HTMLDocument::WrapInShadowObject(v8::Local<v8::Object> wrapper, Node* impl)
{
- // Only handle document.all. Insert the marker object into the
- // shadow internal field to signal that document.all is no longer
- // shadowed.
- AtomicString key = v8StringToAtomicWebCoreString(name);
- DEFINE_STATIC_LOCAL(const AtomicString, all, ("all"));
- if (key != all)
- return deletionNotHandledByInterceptor();
-
- ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount);
- v8::Local<v8::Value> marker = info.Holder()->GetInternalField(V8HTMLDocument::markerIndex);
- info.Holder()->SetInternalField(V8HTMLDocument::shadowIndex, marker);
- return v8::True();
-}
-
-v8::Handle<v8::Value> V8HTMLDocument::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
-{
- INC_STATS("DOM.HTMLDocument.NamedPropertyGetter");
- AtomicString key = v8StringToAtomicWebCoreString(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.
- DEFINE_STATIC_LOCAL(const AtomicString, all, ("all"));
- if (key == all) {
- ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount);
- v8::Local<v8::Value> marker = info.Holder()->GetInternalField(V8HTMLDocument::markerIndex);
- v8::Local<v8::Value> value = info.Holder()->GetInternalField(V8HTMLDocument::shadowIndex);
- if (marker != value)
- return value;
+ DEFINE_STATIC_LOCAL(v8::Persistent<v8::Function>, shadowConstructor, ());
+ if (shadowConstructor.IsEmpty()) {
+ v8::Local<v8::FunctionTemplate> shadowTemplate = v8::FunctionTemplate::New();
+ if (shadowTemplate.IsEmpty())
+ return v8::Local<v8::Object>();
+ shadowTemplate->SetClassName(v8::String::New("HTMLDocument"));
+ shadowTemplate->Inherit(V8HTMLDocument::GetTemplate());
+ shadowTemplate->InstanceTemplate()->SetInternalFieldCount(V8HTMLDocument::internalFieldCount);
+ shadowConstructor = v8::Persistent<v8::Function>::New(shadowTemplate->GetFunction());
+ if (shadowConstructor.IsEmpty())
+ return v8::Local<v8::Object>();
}
- HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder());
+ ASSERT(!shadowConstructor.IsEmpty());
+ v8::Local<v8::Object> shadow = shadowConstructor->NewInstance();
+ if (shadow.IsEmpty())
+ return v8::Local<v8::Object>();
+ V8DOMWrapper::setDOMWrapper(shadow, &V8HTMLDocument::info, impl);
+ shadow->SetPrototype(wrapper);
+ return shadow;
+}
- // Fast case for named elements that are not there.
- if (!htmlDocument->hasNamedItem(key.impl()) && !htmlDocument->hasExtraNamedItem(key.impl()))
- return v8::Handle<v8::Value>();
+v8::Handle<v8::Value> V8HTMLDocument::GetNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key)
+{
+ ASSERT(htmlDocument->hasNamedItem(key.impl()) || htmlDocument->hasExtraNamedItem(key.impl()));
RefPtr<HTMLCollection> items = htmlDocument->documentNamedItems(key);
if (!items->length())
- return notHandledByInterceptor();
+ return v8::Handle<v8::Value>();
if (items->length() == 1) {
Node* node = items->firstItem();
@@ -104,13 +93,6 @@ v8::Handle<v8::Value> V8HTMLDocument::namedPropertyGetter(v8::Local<v8::String>
return toV8(items.release());
}
-v8::Handle<v8::Value> V8HTMLDocument::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo &info)
-{
- INC_STATS("DOM.HTMLDocument.IndexedPropertyGetter");
- v8::Local<v8::Integer> indexV8 = v8::Integer::NewFromUnsigned(index);
- return namedPropertyGetter(indexV8->ToString(), info);
-}
-
// HTMLDocument ----------------------------------------------------------------
// Concatenates "args" to a string. If args is empty, returns empty string.
@@ -193,10 +175,8 @@ v8::Handle<v8::Value> V8HTMLDocument::allAccessorGetter(v8::Local<v8::String> na
void V8HTMLDocument::allAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.HTMLDocument.all._set");
- v8::Handle<v8::Object> holder = info.Holder();
- ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount);
- info.Holder()->SetInternalField(V8HTMLDocument::shadowIndex, value);
+ // Just emulate a normal JS behaviour---install a property on this.
+ info.This()->ForceSet(name, value);
}
v8::Handle<v8::Value> toV8(HTMLDocument* impl, bool forceNewObject)
@@ -210,12 +190,6 @@ v8::Handle<v8::Value> toV8(HTMLDocument* impl, bool forceNewObject)
if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame()))
proxy->windowShell()->updateDocumentWrapper(wrapper);
}
- // Create marker object and insert it in two internal fields.
- // This is used to implement temporary shadowing of document.all.
- ASSERT(wrapper->InternalFieldCount() == V8HTMLDocument::internalFieldCount);
- v8::Local<v8::Object> marker = v8::Object::New();
- wrapper->SetInternalField(V8HTMLDocument::markerIndex, marker);
- wrapper->SetInternalField(V8HTMLDocument::shadowIndex, marker);
return wrapper;
}
diff --git a/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp b/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp
index 905b23d..d9da174 100644
--- a/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp
+++ b/WebCore/bindings/v8/custom/V8NamedNodesCollection.cpp
@@ -46,7 +46,7 @@ Node* V8NamedNodesCollection::itemWithName(const AtomicString& id) const
{
for (unsigned i = 0; i < m_nodes.size(); ++i) {
Node* node = m_nodes[i].get();
- if (node->hasAttributes() && node->attributes()->id() == id)
+ if (node->hasID() && static_cast<Element*>(node)->getIdAttribute() == id)
return node;
}
return 0;
diff --git a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp b/WebCore/bindings/v8/custom/V8NodeListCustom.cpp
index 20a5471..8cc3983 100644
--- a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeListCustom.cpp
@@ -45,7 +45,7 @@ v8::Handle<v8::Value> V8NodeList::namedPropertyGetter(v8::Local<v8::String> name
{
INC_STATS("DOM.NodeList.NamedPropertyGetter");
NodeList* list = V8NodeList::toNative(info.Holder());
- String key = toWebCoreString(name);
+ AtomicString key = v8ValueToAtomicWebCoreString(name);
// Length property cannot be overridden.
DEFINE_STATIC_LOCAL(const AtomicString, length, ("length"));
diff --git a/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp b/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp
index 51a57c0..58f34bf 100644
--- a/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8PopStateEventCustom.cpp
@@ -35,8 +35,6 @@
#include "SerializedScriptValue.h"
#include "V8Proxy.h"
-#include <v8.h>
-
namespace WebCore {
v8::Handle<v8::Value> V8PopStateEvent::stateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
diff --git a/WebCore/bindings/v8/custom/V8StorageCustom.cpp b/WebCore/bindings/v8/custom/V8StorageCustom.cpp
index 70d8a09..d0a0d92 100755
--- a/WebCore/bindings/v8/custom/V8StorageCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8StorageCustom.cpp
@@ -79,6 +79,19 @@ v8::Handle<v8::Value> V8Storage::namedPropertyGetter(v8::Local<v8::String> name,
return storageGetter(name, info);
}
+v8::Handle<v8::Integer> V8Storage::namedPropertyQuery(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.Storage.NamedPropertyQuery");
+
+ Storage* storage = V8Storage::toNative(info.Holder());
+ String name = toWebCoreString(v8Name);
+
+ if (storage->contains(name) && name != "length")
+ return v8::Integer::New(v8::None);
+
+ return v8::Handle<v8::Integer>();
+}
+
static v8::Handle<v8::Value> storageSetter(v8::Local<v8::String> v8Name, v8::Local<v8::Value> v8Value, const v8::AccessorInfo& info)
{
Storage* storage = V8Storage::toNative(info.Holder());
diff --git a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
index 7a031b1..5da4b3e 100644
--- a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
@@ -44,7 +44,7 @@
#include "V8ArrayBufferView.h"
#include "V8WebGLBuffer.h"
#include "V8Int8Array.h"
-#include "V8FloatArray.h"
+#include "V8Float32Array.h"
#include "V8WebGLFramebuffer.h"
#include "V8Int32Array.h"
#include "V8WebGLProgram.h"
@@ -392,21 +392,21 @@ static v8::Handle<v8::Value> vertexAttribAndUniformHelperf(const v8::Arguments&
FunctionToCall functionToCall) {
// Forms:
// * glUniform1fv(WebGLUniformLocation location, Array data);
- // * glUniform1fv(WebGLUniformLocation location, FloatArray data);
+ // * glUniform1fv(WebGLUniformLocation location, Float32Array data);
// * glUniform2fv(WebGLUniformLocation location, Array data);
- // * glUniform2fv(WebGLUniformLocation location, FloatArray data);
+ // * glUniform2fv(WebGLUniformLocation location, Float32Array data);
// * glUniform3fv(WebGLUniformLocation location, Array data);
- // * glUniform3fv(WebGLUniformLocation location, FloatArray data);
+ // * glUniform3fv(WebGLUniformLocation location, Float32Array data);
// * glUniform4fv(WebGLUniformLocation location, Array data);
- // * glUniform4fv(WebGLUniformLocation location, FloatArray data);
+ // * glUniform4fv(WebGLUniformLocation location, Float32Array data);
// * glVertexAttrib1fv(GLint index, Array data);
- // * glVertexAttrib1fv(GLint index, FloatArray data);
+ // * glVertexAttrib1fv(GLint index, Float32Array data);
// * glVertexAttrib2fv(GLint index, Array data);
- // * glVertexAttrib2fv(GLint index, FloatArray data);
+ // * glVertexAttrib2fv(GLint index, Float32Array data);
// * glVertexAttrib3fv(GLint index, Array data);
- // * glVertexAttrib3fv(GLint index, FloatArray data);
+ // * glVertexAttrib3fv(GLint index, Float32Array data);
// * glVertexAttrib4fv(GLint index, Array data);
- // * glVertexAttrib4fv(GLint index, FloatArray data);
+ // * glVertexAttrib4fv(GLint index, Float32Array data);
if (args.Length() != 2) {
V8Proxy::setDOMException(SYNTAX_ERR);
@@ -424,8 +424,8 @@ static v8::Handle<v8::Value> vertexAttribAndUniformHelperf(const v8::Arguments&
WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
- if (V8FloatArray::HasInstance(args[1])) {
- FloatArray* array = V8FloatArray::toNative(args[1]->ToObject());
+ if (V8Float32Array::HasInstance(args[1])) {
+ Float32Array* array = V8Float32Array::toNative(args[1]->ToObject());
ASSERT(array != NULL);
ExceptionCode ec = 0;
switch (functionToCall) {
@@ -592,13 +592,13 @@ static v8::Handle<v8::Value> uniformMatrixHelper(const v8::Arguments& args,
{
// Forms:
// * glUniformMatrix2fv(GLint location, GLboolean transpose, Array data);
- // * glUniformMatrix2fv(GLint location, GLboolean transpose, FloatArray data);
+ // * glUniformMatrix2fv(GLint location, GLboolean transpose, Float32Array data);
// * glUniformMatrix3fv(GLint location, GLboolean transpose, Array data);
- // * glUniformMatrix3fv(GLint location, GLboolean transpose, FloatArray data);
+ // * glUniformMatrix3fv(GLint location, GLboolean transpose, Float32Array data);
// * glUniformMatrix4fv(GLint location, GLboolean transpose, Array data);
- // * glUniformMatrix4fv(GLint location, GLboolean transpose, FloatArray data);
+ // * glUniformMatrix4fv(GLint location, GLboolean transpose, Float32Array data);
//
- // FIXME: need to change to accept FloatArray as well.
+ // FIXME: need to change to accept Float32Array as well.
if (args.Length() != 3) {
V8Proxy::setDOMException(SYNTAX_ERR);
return notHandledByInterceptor();
@@ -610,8 +610,8 @@ static v8::Handle<v8::Value> uniformMatrixHelper(const v8::Arguments& args,
WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok);
bool transpose = args[1]->BooleanValue();
- if (V8FloatArray::HasInstance(args[2])) {
- FloatArray* array = V8FloatArray::toNative(args[2]->ToObject());
+ if (V8Float32Array::HasInstance(args[2])) {
+ Float32Array* array = V8Float32Array::toNative(args[2]->ToObject());
ASSERT(array != NULL);
ExceptionCode ec = 0;
switch (matrixSize) {