summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings')
-rw-r--r--WebCore/bindings/generic/RuntimeEnabledFeatures.h1
-rw-r--r--WebCore/bindings/gobject/DOMObjectCache.cpp153
-rw-r--r--WebCore/bindings/gobject/DOMObjectCache.h39
-rw-r--r--WebCore/bindings/gobject/GNUmakefile.am3
-rw-r--r--WebCore/bindings/gobject/GObjectEventListener.cpp1
-rw-r--r--WebCore/bindings/gobject/WebKitDOMBinding.cpp51
-rw-r--r--WebCore/bindings/gobject/WebKitDOMBinding.h16
-rw-r--r--WebCore/bindings/js/JSArrayBufferViewCustom.cpp93
-rw-r--r--WebCore/bindings/js/JSArrayBufferViewHelper.h49
-rw-r--r--WebCore/bindings/js/JSAudioBufferSourceNodeCustom.cpp47
-rw-r--r--WebCore/bindings/js/JSBindingsAllInOne.cpp17
-rw-r--r--WebCore/bindings/js/JSCSSFontFaceRuleCustom.cpp43
-rw-r--r--WebCore/bindings/js/JSCSSImportRuleCustom.cpp46
-rw-r--r--WebCore/bindings/js/JSCSSMediaRuleCustom.cpp46
-rw-r--r--WebCore/bindings/js/JSCSSPageRuleCustom.cpp43
-rw-r--r--WebCore/bindings/js/JSCSSRuleCustom.cpp11
-rw-r--r--WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp3
-rw-r--r--WebCore/bindings/js/JSCSSStyleRuleCustom.cpp43
-rw-r--r--WebCore/bindings/js/JSConsoleCustom.cpp8
-rw-r--r--WebCore/bindings/js/JSConvolverNodeCustom.cpp47
-rw-r--r--WebCore/bindings/js/JSDOMBinding.cpp33
-rw-r--r--WebCore/bindings/js/JSDOMBinding.h27
-rw-r--r--WebCore/bindings/js/JSDOMWindowBase.cpp22
-rw-r--r--WebCore/bindings/js/JSDOMWindowBase.h1
-rw-r--r--WebCore/bindings/js/JSDOMWindowCustom.cpp5
-rw-r--r--WebCore/bindings/js/JSDataViewCustom.cpp174
-rw-r--r--WebCore/bindings/js/JSEventCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSFloat32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSHTMLLinkElementCustom.cpp43
-rw-r--r--WebCore/bindings/js/JSHTMLStyleElementCustom.cpp43
-rw-r--r--WebCore/bindings/js/JSInjectedScriptHostCustom.cpp10
-rw-r--r--WebCore/bindings/js/JSInt16ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSInt32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSInt8ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSJavaScriptAudioNodeCustom.cpp45
-rw-r--r--WebCore/bindings/js/JSProcessingInstructionCustom.cpp43
-rw-r--r--WebCore/bindings/js/JSSVGContextCache.h97
-rw-r--r--WebCore/bindings/js/JSSVGLengthCustom.cpp10
-rw-r--r--WebCore/bindings/js/JSSVGPODListCustom.h199
-rw-r--r--WebCore/bindings/js/JSSVGPODTypeWrapper.h410
-rw-r--r--WebCore/bindings/js/JSSVGPathSegCustom.cpp46
-rw-r--r--WebCore/bindings/js/JSSVGPathSegListCustom.cpp173
-rw-r--r--WebCore/bindings/js/JSUint16ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSUint32ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSUint8ArrayCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSWebKitCSSKeyframeRuleCustom.cpp43
-rw-r--r--WebCore/bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp43
-rw-r--r--WebCore/bindings/js/JSXMLHttpRequestCustom.cpp71
-rw-r--r--WebCore/bindings/js/OptionsObject.h31
-rw-r--r--WebCore/bindings/js/ScriptCallStackFactory.cpp8
-rw-r--r--WebCore/bindings/js/ScriptCallStackFactory.h6
-rw-r--r--WebCore/bindings/js/ScriptHeapSnapshot.h13
-rw-r--r--WebCore/bindings/js/ScriptProfile.cpp2
-rw-r--r--WebCore/bindings/js/ScriptProfile.h2
-rw-r--r--WebCore/bindings/js/ScriptValue.cpp6
-rw-r--r--WebCore/bindings/js/ScriptValue.h3
-rw-r--r--WebCore/bindings/objc/DOMSVG.h1
-rw-r--r--WebCore/bindings/scripts/CodeGenerator.pm5
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorCPP.pm2
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorGObject.pm38
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorJS.pm80
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorObjC.pm25
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorV8.pm169
-rw-r--r--WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp42
-rw-r--r--WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h6
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp7
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp1
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp18
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h3
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp291
-rw-r--r--WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h27
-rw-r--r--WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp4
-rw-r--r--WebCore/bindings/scripts/test/JS/JSTestObj.cpp139
-rw-r--r--WebCore/bindings/scripts/test/JS/JSTestObj.h5
-rw-r--r--WebCore/bindings/scripts/test/ObjC/DOMTestObj.h6
-rw-r--r--WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm32
-rw-r--r--WebCore/bindings/scripts/test/TestObj.idl3
-rw-r--r--WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp15
-rw-r--r--WebCore/bindings/scripts/test/V8/V8TestObj.cpp64
-rw-r--r--WebCore/bindings/v8/DOMDataStore.cpp10
-rw-r--r--WebCore/bindings/v8/DOMDataStore.h7
-rw-r--r--WebCore/bindings/v8/IDBBindingUtilities.cpp3
-rw-r--r--WebCore/bindings/v8/OptionsObject.cpp156
-rw-r--r--WebCore/bindings/v8/OptionsObject.h65
-rw-r--r--WebCore/bindings/v8/ScopedDOMDataStore.cpp2
-rw-r--r--WebCore/bindings/v8/ScriptCallStackFactory.cpp10
-rw-r--r--WebCore/bindings/v8/ScriptCallStackFactory.h13
-rw-r--r--WebCore/bindings/v8/ScriptHeapSnapshot.cpp62
-rw-r--r--WebCore/bindings/v8/ScriptHeapSnapshot.h10
-rw-r--r--WebCore/bindings/v8/ScriptValue.h5
-rw-r--r--WebCore/bindings/v8/StaticDOMDataStore.cpp2
-rw-r--r--WebCore/bindings/v8/StaticDOMDataStore.h1
-rw-r--r--WebCore/bindings/v8/V8Binding.cpp11
-rw-r--r--WebCore/bindings/v8/V8ConsoleMessage.cpp6
-rw-r--r--WebCore/bindings/v8/V8ConsoleMessage.h2
-rw-r--r--WebCore/bindings/v8/V8DOMMap.cpp24
-rw-r--r--WebCore/bindings/v8/V8DOMMap.h4
-rw-r--r--WebCore/bindings/v8/V8NPUtils.cpp4
-rw-r--r--WebCore/bindings/v8/V8Proxy.cpp37
-rw-r--r--WebCore/bindings/v8/V8Proxy.h35
-rw-r--r--WebCore/bindings/v8/V8SVGPODTypeWrapper.h416
-rw-r--r--WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp95
-rw-r--r--WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h77
-rw-r--r--WebCore/bindings/v8/custom/V8ConsoleCustom.cpp20
-rwxr-xr-xWebCore/bindings/v8/custom/V8DataViewCustom.cpp124
-rw-r--r--WebCore/bindings/v8/custom/V8EventCustom.cpp5
-rw-r--r--WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp15
-rw-r--r--WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp14
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp62
109 files changed, 2435 insertions, 2248 deletions
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
index 0ab5120..33432ce 100644
--- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
@@ -102,6 +102,7 @@ public:
static bool int32ArrayEnabled() { return isWebGLEnabled; }
static bool uint32ArrayEnabled() { return isWebGLEnabled; }
static bool float32ArrayEnabled() { return isWebGLEnabled; }
+ static bool dataViewEnabled() { return isWebGLEnabled; }
static bool webGLRenderingContextEnabled() { return isWebGLEnabled; }
static bool webGLArrayBufferEnabled() { return isWebGLEnabled; }
static bool webGLByteArrayEnabled() { return isWebGLEnabled; }
diff --git a/WebCore/bindings/gobject/DOMObjectCache.cpp b/WebCore/bindings/gobject/DOMObjectCache.cpp
new file mode 100644
index 0000000..7bf1679
--- /dev/null
+++ b/WebCore/bindings/gobject/DOMObjectCache.cpp
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2010 Igalia S.L.
+ *
+ * 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 "DOMObjectCache.h"
+
+#include "Document.h"
+#include "Node.h"
+#include <wtf/HashMap.h>
+
+namespace WebKit {
+
+typedef struct {
+ GObject* object;
+ WebCore::Frame* frame;
+ guint timesReturned;
+} DOMObjectCacheData;
+
+typedef HashMap<void*, DOMObjectCacheData*> DOMObjectMap;
+
+static DOMObjectMap& domObjects()
+{
+ static DOMObjectMap staticDOMObjects;
+ return staticDOMObjects;
+}
+
+static WebCore::Frame* getFrameFromHandle(void* objectHandle)
+{
+ WebCore::Node* node = static_cast<WebCore::Node*>(objectHandle);
+ if (!node->inDocument())
+ return 0;
+ WebCore::Document* document = node->document();
+ if (!document)
+ return 0;
+ return document->frame();
+}
+
+void DOMObjectCache::forget(void* objectHandle)
+{
+ DOMObjectCacheData* cacheData = domObjects().get(objectHandle);
+ ASSERT(cacheData);
+ g_slice_free(DOMObjectCacheData, cacheData);
+ domObjects().take(objectHandle);
+}
+
+static void weakRefNotify(gpointer data, GObject* zombie)
+{
+ gboolean* objectDead = static_cast<gboolean*>(data);
+ *objectDead = TRUE;
+}
+
+void DOMObjectCache::clearByFrame(WebCore::Frame* frame)
+{
+ Vector<DOMObjectCacheData*> toUnref;
+
+ // Unreffing the objects removes them from the cache in their
+ // finalize method, so just save them to do that while we are not
+ // iterating the cache itself.
+ DOMObjectMap::iterator end = domObjects().end();
+ for (DOMObjectMap::iterator iter = domObjects().begin(); iter != end; ++iter) {
+ DOMObjectCacheData* data = iter->second;
+ ASSERT(data);
+ if ((!frame || data->frame == frame) && data->timesReturned)
+ toUnref.append(data);
+ }
+
+ Vector<DOMObjectCacheData*>::iterator last = toUnref.end();
+ for (Vector<DOMObjectCacheData*>::iterator it = toUnref.begin(); it != last; ++it) {
+ DOMObjectCacheData* data = *it;
+ // We can't really know what the user has done with the DOM
+ // objects, so in case any of the external references to them
+ // were unreffed (but not all, otherwise the object would be
+ // dead and out of the cache) we'll add a weak ref before we
+ // start to get rid of the cache's own references; if the
+ // object dies in the middle of the process, we'll just stop.
+ gboolean objectDead = FALSE;
+ g_object_weak_ref(data->object, weakRefNotify, &objectDead);
+ // We need to check objectDead first, otherwise the cache data
+ // might be garbage already.
+ while (!objectDead && data->timesReturned > 0) {
+ // If this is the last unref we are going to do,
+ // disconnect the weak ref. We cannot do it afterwards
+ // because the object might be dead at that point.
+ if (data->timesReturned == 1)
+ g_object_weak_unref(data->object, weakRefNotify, &objectDead);
+ data->timesReturned--;
+ g_object_unref(data->object);
+ }
+ }
+}
+
+DOMObjectCache::~DOMObjectCache()
+{
+ clearByFrame();
+}
+
+void* DOMObjectCache::get(void* objectHandle)
+{
+ DOMObjectCacheData* data = domObjects().get(objectHandle);
+ if (!data)
+ return 0;
+
+ // We want to add one ref each time a wrapper is returned, so that
+ // the user can manually unref them if he chooses to.
+ ASSERT(data->object);
+ data->timesReturned++;
+ return g_object_ref(data->object);
+}
+
+void* DOMObjectCache::put(void* objectHandle, void* wrapper)
+{
+ if (domObjects().get(objectHandle))
+ return wrapper;
+
+ DOMObjectCacheData* data = g_slice_new(DOMObjectCacheData);
+ data->object = static_cast<GObject*>(wrapper);
+ data->frame = 0;
+ data->timesReturned = 1;
+
+ domObjects().set(objectHandle, data);
+ return wrapper;
+}
+
+void* DOMObjectCache::put(WebCore::Node* objectHandle, void* wrapper)
+{
+ // call the ::put version that takes void* to do the basic cache
+ // insertion work
+ put(static_cast<void*>(objectHandle), wrapper);
+
+ DOMObjectCacheData* data = domObjects().get(objectHandle);
+ ASSERT(data);
+
+ data->frame = getFrameFromHandle(objectHandle);
+
+ return wrapper;
+}
+
+}
diff --git a/WebCore/bindings/gobject/DOMObjectCache.h b/WebCore/bindings/gobject/DOMObjectCache.h
new file mode 100644
index 0000000..568e8b6
--- /dev/null
+++ b/WebCore/bindings/gobject/DOMObjectCache.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2010 Igalia S.L.
+ *
+ * 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 DOMObjectCache_h
+#define DOMObjectCache_h
+
+namespace WebCore {
+class Node;
+class Frame;
+};
+
+namespace WebKit {
+class DOMObjectCache {
+public:
+ static void* get(void* objectHandle);
+ static void* put(void* objectHandle, void* wrapper);
+ static void* put(WebCore::Node* objectHandle, void* wrapper);
+ static void clearByFrame(WebCore::Frame* frame = 0);
+ static void forget(void* objectHandle);
+ ~DOMObjectCache();
+};
+} // namespace WebKit
+
+#endif
diff --git a/WebCore/bindings/gobject/GNUmakefile.am b/WebCore/bindings/gobject/GNUmakefile.am
index 338d7f9..bf896bd 100644
--- a/WebCore/bindings/gobject/GNUmakefile.am
+++ b/WebCore/bindings/gobject/GNUmakefile.am
@@ -196,6 +196,8 @@ webkitgtk_gdom_built_sources += \
DerivedSources/webkit/WebKitDOMMediaErrorPrivate.h \
DerivedSources/webkit/WebKitDOMMediaList.cpp \
DerivedSources/webkit/WebKitDOMMediaListPrivate.h \
+ DerivedSources/webkit/WebKitDOMMediaQueryList.cpp \
+ DerivedSources/webkit/WebKitDOMMediaQueryListPrivate.h \
DerivedSources/webkit/WebKitDOMMemoryInfo.cpp \
DerivedSources/webkit/WebKitDOMMemoryInfoPrivate.h \
DerivedSources/webkit/WebKitDOMMessagePort.cpp \
@@ -254,6 +256,7 @@ webkitgtk_built_h_api += \
DerivedSources/webkit/WebKitDOMCSSStyleSheet.h \
DerivedSources/webkit/WebKitDOMCSSValue.h \
DerivedSources/webkit/WebKitDOMMediaList.h \
+ DerivedSources/webkit/WebKitDOMMediaQueryList.h \
DerivedSources/webkit/WebKitDOMStyleMedia.h \
DerivedSources/webkit/WebKitDOMStyleSheet.h \
DerivedSources/webkit/WebKitDOMStyleSheetList.h \
diff --git a/WebCore/bindings/gobject/GObjectEventListener.cpp b/WebCore/bindings/gobject/GObjectEventListener.cpp
index 3e0aa2a..27432b9 100644
--- a/WebCore/bindings/gobject/GObjectEventListener.cpp
+++ b/WebCore/bindings/gobject/GObjectEventListener.cpp
@@ -71,6 +71,7 @@ void GObjectEventListener::handleEvent(ScriptExecutionContext*, Event* event)
gboolean handled = FALSE;
WebKitDOMEvent* gobjectEvent = WEBKIT_DOM_EVENT(WebKit::kit(event));
g_signal_emit_by_name(m_object, m_signalName.data(), gobjectEvent, &handled);
+ g_object_unref(gobjectEvent);
}
bool GObjectEventListener::operator==(const EventListener& listener)
diff --git a/WebCore/bindings/gobject/WebKitDOMBinding.cpp b/WebCore/bindings/gobject/WebKitDOMBinding.cpp
index 3c066e3..a9b0897 100644
--- a/WebCore/bindings/gobject/WebKitDOMBinding.cpp
+++ b/WebCore/bindings/gobject/WebKitDOMBinding.cpp
@@ -24,6 +24,7 @@
#include "config.h"
#include "WebKitDOMBinding.h"
+#include "DOMObjectCache.h"
#include "Element.h"
#include "Event.h"
#include "EventException.h"
@@ -44,32 +45,6 @@ namespace WebKit {
using namespace WebCore;
using namespace WebCore::HTMLNames;
-// DOMObjectCache
-
-typedef HashMap<void*, gpointer> DOMObjectMap;
-
-static DOMObjectMap& domObjects()
-{
- static DOMObjectMap staticDOMObjects;
- return staticDOMObjects;
-}
-
-gpointer DOMObjectCache::get(void* objectHandle)
-{
- return domObjects().get(objectHandle);
-}
-
-gpointer DOMObjectCache::put(void* objectHandle, gpointer wrapper)
-{
- domObjects().set(objectHandle, wrapper);
- return wrapper;
-}
-
-void DOMObjectCache::forget(void* objectHandle)
-{
- domObjects().take(objectHandle);
-}
-
// kit methods
static gpointer createWrapper(Node* node)
@@ -94,26 +69,26 @@ static gpointer createWrapper(Node* node)
return DOMObjectCache::put(node, wrappedNode);
}
-gpointer kit(Node* node)
+WebKitDOMNode* kit(Node* node)
{
if (!node)
return 0;
gpointer kitNode = DOMObjectCache::get(node);
if (kitNode)
- return kitNode;
+ return static_cast<WebKitDOMNode*>(kitNode);
- return createWrapper(node);
+ return static_cast<WebKitDOMNode*>(createWrapper(node));
}
-gpointer kit(Element* element)
+WebKitDOMElement* kit(Element* element)
{
if (!element)
return 0;
gpointer kitElement = DOMObjectCache::get(element);
if (kitElement)
- return kitElement;
+ return static_cast<WebKitDOMElement*>(kitElement);
gpointer wrappedElement;
@@ -122,17 +97,17 @@ gpointer kit(Element* element)
else
wrappedElement = wrapElement(element);
- return DOMObjectCache::put(element, wrappedElement);
+ return static_cast<WebKitDOMElement*>(DOMObjectCache::put(element, wrappedElement));
}
-gpointer kit(Event* event)
+WebKitDOMEvent* kit(Event* event)
{
if (!event)
return 0;
gpointer kitEvent = DOMObjectCache::get(event);
if (kitEvent)
- return kitEvent;
+ return static_cast<WebKitDOMEvent*>(kitEvent);
gpointer wrappedEvent;
@@ -143,7 +118,7 @@ gpointer kit(Event* event)
else
wrappedEvent = wrapEvent(event);
- return DOMObjectCache::put(event, wrappedEvent);
+ return static_cast<WebKitDOMEvent*>(DOMObjectCache::put(event, wrappedEvent));
}
static gpointer wrapEventTarget(EventTarget* target)
@@ -163,14 +138,14 @@ static gpointer wrapEventTarget(EventTarget* target)
return DOMObjectCache::put(target, wrappedTarget);
}
-gpointer kit(WebCore::EventTarget* obj)
+WebKitDOMEventTarget* kit(WebCore::EventTarget* obj)
{
g_return_val_if_fail(obj, 0);
if (gpointer ret = DOMObjectCache::get(obj))
- return ret;
+ return static_cast<WebKitDOMEventTarget*>(ret);
- return DOMObjectCache::put(obj, WebKit::wrapEventTarget(obj));
+ return static_cast<WebKitDOMEventTarget*>(DOMObjectCache::put(obj, WebKit::wrapEventTarget(obj)));
}
} // namespace WebKit
diff --git a/WebCore/bindings/gobject/WebKitDOMBinding.h b/WebCore/bindings/gobject/WebKitDOMBinding.h
index 2248f78..ca7840e 100644
--- a/WebCore/bindings/gobject/WebKitDOMBinding.h
+++ b/WebCore/bindings/gobject/WebKitDOMBinding.h
@@ -24,6 +24,7 @@
#ifndef WebKitDOMBinding_h
#define WebKitDOMBinding_h
+#include "webkit/webkitdomdefines.h"
#include <glib.h>
namespace WebCore {
@@ -34,17 +35,10 @@ class EventTarget;
} // namespace WebCore
namespace WebKit {
-gpointer kit(WebCore::Node* node);
-gpointer kit(WebCore::Element* element);
-gpointer kit(WebCore::Event* event);
-gpointer kit(WebCore::EventTarget* target);
-
-class DOMObjectCache {
-public:
- static gpointer get(void* objectHandle);
- static gpointer put(void* objectHandle, gpointer wrapper);
- static void forget(void* objectHandle);
-};
+WebKitDOMNode* kit(WebCore::Node* node);
+WebKitDOMElement* kit(WebCore::Element* element);
+WebKitDOMEvent* kit(WebCore::Event* event);
+WebKitDOMEventTarget* kit(WebCore::EventTarget* target);
} // namespace WebKit
#endif // WebKitDOMBinding_h
diff --git a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp b/WebCore/bindings/js/JSArrayBufferViewCustom.cpp
deleted file mode 100644
index ccbddd2..0000000
--- a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp
+++ /dev/null
@@ -1,93 +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) || ENABLE(BLOB)
-
-#include "config.h"
-#include "JSArrayBufferView.h"
-#include "JSInt8Array.h"
-#include "JSUint8Array.h"
-#include "JSInt16Array.h"
-#include "JSUint16Array.h"
-#include "JSInt32Array.h"
-#include "JSUint32Array.h"
-#include "JSFloat32Array.h"
-
-#include "ArrayBufferView.h"
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, ArrayBufferView* object)
-{
- if (!object)
- return jsUndefined();
-
- if (object) {
- if (object->isFloatArray())
- return getDOMObjectWrapper<JSFloat32Array>(exec, globalObject, static_cast<Float32Array*>(object));
- if (object->isUnsignedByteArray())
- return getDOMObjectWrapper<JSUint8Array>(exec, globalObject, static_cast<Uint8Array*>(object));
- if (object->isByteArray())
- return getDOMObjectWrapper<JSInt8Array>(exec, globalObject, static_cast<Int8Array*>(object));
- if (object->isIntArray())
- return getDOMObjectWrapper<JSInt32Array>(exec, globalObject, static_cast<Int32Array*>(object));
- if (object->isUnsignedIntArray())
- return getDOMObjectWrapper<JSUint32Array>(exec, globalObject, static_cast<Uint32Array*>(object));
- if (object->isShortArray())
- return getDOMObjectWrapper<JSInt16Array>(exec, globalObject, static_cast<Int16Array*>(object));
- if (object->isUnsignedShortArray())
- return getDOMObjectWrapper<JSUint16Array>(exec, globalObject, static_cast<Uint16Array*>(object));
- }
- return jsUndefined();
-}
-
-JSValue JSArrayBufferView::slice(ExecState* exec)
-{
- ArrayBufferView* array = reinterpret_cast<ArrayBufferView*>(impl());
-
- int start, end;
- switch (exec->argumentCount()) {
- case 0:
- start = 0;
- end = array->length();
- break;
- case 1:
- start = exec->argument(0).toInt32(exec);
- end = array->length();
- break;
- default:
- start = exec->argument(0).toInt32(exec);
- end = exec->argument(1).toInt32(exec);
- }
- return toJS(exec, globalObject(), array->slice(start, end));
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSArrayBufferViewHelper.h b/WebCore/bindings/js/JSArrayBufferViewHelper.h
index ba712c6..f34f4b9 100644
--- a/WebCore/bindings/js/JSArrayBufferViewHelper.h
+++ b/WebCore/bindings/js/JSArrayBufferViewHelper.h
@@ -86,16 +86,33 @@ JSC::JSValue setWebGLArrayHelper(JSC::ExecState* exec, T* impl, T* (*conversionF
// Template function used by XXXArrayConstructors.
// If this returns 0, it will already have thrown a JavaScript exception.
template<class C, typename T>
-PassRefPtr<ArrayBufferView> constructArrayBufferView(JSC::ExecState* exec)
+PassRefPtr<C> constructArrayBufferViewWithArrayBufferArgument(JSC::ExecState* exec)
+{
+ RefPtr<ArrayBuffer> buffer = toArrayBuffer(exec->argument(0));
+ if (!buffer)
+ return 0;
+
+ unsigned offset = (exec->argumentCount() > 1) ? exec->argument(1).toUInt32(exec) : 0;
+ if ((buffer->byteLength() - offset) % sizeof(T))
+ throwError(exec, createRangeError(exec, "ArrayBuffer length minus the byteOffset is not a multiple of the element size."));
+ unsigned int length = (buffer->byteLength() - offset) / sizeof(T);
+ if (exec->argumentCount() > 2)
+ length = exec->argument(2).toUInt32(exec);
+ RefPtr<C> array = C::create(buffer, offset, length);
+ if (!array)
+ setDOMException(exec, INDEX_SIZE_ERR);
+ return array;
+}
+
+template<class C, typename T>
+PassRefPtr<C> constructArrayBufferView(JSC::ExecState* exec)
{
// There are 3 constructors:
//
// 1) (in int size)
// 2) (in ArrayBuffer buffer, [Optional] in int offset, [Optional] in unsigned int length)
// 3) (in sequence<T>) - This ends up being a JS "array-like" object
- //
- RefPtr<C> arrayObject;
-
+ //
// For the 0 args case, just create a zero-length view. We could
// consider raising a SyntaxError for this case, but not all
// JavaScript DOM bindings can distinguish between "new
@@ -112,20 +129,10 @@ PassRefPtr<ArrayBufferView> constructArrayBufferView(JSC::ExecState* exec)
}
if (exec->argument(0).isObject()) {
- RefPtr<ArrayBuffer> buffer = toArrayBuffer(exec->argument(0));
- if (buffer) {
- unsigned offset = (exec->argumentCount() > 1) ? exec->argument(1).toUInt32(exec) : 0;
- if ((buffer->byteLength() - offset) % sizeof(T))
- throwError(exec, createRangeError(exec, "ArrayBuffer length minus the byteOffset is not a multiple of the element size."));
- unsigned int length = (buffer->byteLength() - offset) / sizeof(T);
- if (exec->argumentCount() > 2)
- length = exec->argument(2).toUInt32(exec);
- PassRefPtr<ArrayBufferView> array = C::create(buffer, offset, length);
- if (!array)
- setDOMException(exec, INDEX_SIZE_ERR);
- return array;
- }
-
+ RefPtr<C> view = constructArrayBufferViewWithArrayBufferArgument<C, T>(exec);
+ if (view)
+ return view;
+
JSC::JSObject* array = asObject(exec->argument(0));
unsigned length = array->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
void* tempValues;
@@ -142,14 +149,14 @@ PassRefPtr<ArrayBufferView> constructArrayBufferView(JSC::ExecState* exec)
values.get()[i] = static_cast<T>(v.toNumber(exec));
}
- PassRefPtr<ArrayBufferView> result = C::create(values.get(), length);
+ RefPtr<C> result = C::create(values.get(), length);
if (!result)
setDOMException(exec, INDEX_SIZE_ERR);
return result;
}
-
+
int length = exec->argument(0).toInt32(exec);
- PassRefPtr<ArrayBufferView> result;
+ RefPtr<C> result;
if (length >= 0)
result = C::create(static_cast<unsigned>(length));
if (!result)
diff --git a/WebCore/bindings/js/JSAudioBufferSourceNodeCustom.cpp b/WebCore/bindings/js/JSAudioBufferSourceNodeCustom.cpp
new file mode 100644
index 0000000..8ca7f1f
--- /dev/null
+++ b/WebCore/bindings/js/JSAudioBufferSourceNodeCustom.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(WEB_AUDIO)
+
+#include "AudioBufferSourceNode.h"
+
+#include "AudioBuffer.h"
+#include "JSAudioBuffer.h"
+#include "JSAudioBufferSourceNode.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSAudioBufferSourceNode::setBuffer(ExecState*, JSValue value)
+{
+ AudioBufferSourceNode* imp = static_cast<AudioBufferSourceNode*>(impl());
+ imp->setBuffer(toAudioBuffer(value));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)
diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp
index e46b050..7fc5740 100644
--- a/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -32,9 +32,14 @@
#include "JSAudioConstructor.cpp"
#include "JSBindingState.cpp"
#include "JSCDATASectionCustom.cpp"
+#include "JSCSSFontFaceRuleCustom.cpp"
+#include "JSCSSImportRuleCustom.cpp"
+#include "JSCSSMediaRuleCustom.cpp"
+#include "JSCSSPageRuleCustom.cpp"
#include "JSCSSRuleCustom.cpp"
#include "JSCSSRuleListCustom.cpp"
#include "JSCSSStyleDeclarationCustom.cpp"
+#include "JSCSSStyleRuleCustom.cpp"
#include "JSCSSValueCustom.cpp"
#include "JSCallbackData.cpp"
#include "JSCanvasRenderingContext2DCustom.cpp"
@@ -51,6 +56,9 @@
#include "JSDOMBinding.cpp"
#include "JSDOMFormDataCustom.cpp"
#include "JSDOMGlobalObject.cpp"
+#include "JSDOMMimeTypeArrayCustom.cpp"
+#include "JSDOMPluginArrayCustom.cpp"
+#include "JSDOMPluginCustom.cpp"
#include "JSDOMStringMapCustom.cpp"
#include "JSDOMWindowBase.cpp"
#include "JSDOMWindowCustom.cpp"
@@ -82,10 +90,12 @@
#include "JSHTMLFrameElementCustom.cpp"
#include "JSHTMLFrameSetElementCustom.cpp"
#include "JSHTMLInputElementCustom.cpp"
+#include "JSHTMLLinkElementCustom.cpp"
#include "JSHTMLObjectElementCustom.cpp"
#include "JSHTMLOptionsCollectionCustom.cpp"
#include "JSHTMLOutputElementCustom.cpp"
#include "JSHTMLSelectElementCustom.cpp"
+#include "JSHTMLStyleElementCustom.cpp"
#include "JSHistoryCustom.cpp"
#include "JSImageConstructor.cpp"
#include "JSImageDataCustom.cpp"
@@ -98,7 +108,6 @@
#include "JSMessageChannelCustom.cpp"
#include "JSMessageEventCustom.cpp"
#include "JSMessagePortCustom.cpp"
-#include "JSDOMMimeTypeArrayCustom.cpp"
#include "JSNamedNodeMapCustom.cpp"
#include "JSNavigatorCustom.cpp"
#include "JSNodeCustom.cpp"
@@ -107,17 +116,15 @@
#include "JSNodeIteratorCustom.cpp"
#include "JSNodeListCustom.cpp"
#include "JSOptionConstructor.cpp"
-#include "JSDOMPluginArrayCustom.cpp"
-#include "JSDOMPluginCustom.cpp"
#include "JSPluginElementFunctions.cpp"
#include "JSPopStateEventCustom.cpp"
+#include "JSProcessingInstructionCustom.cpp"
#include "JSSQLResultSetRowListCustom.cpp"
#include "JSSQLTransactionCustom.cpp"
#include "JSSQLTransactionSyncCustom.cpp"
#include "JSSVGElementInstanceCustom.cpp"
#include "JSSVGLengthCustom.cpp"
#include "JSSVGPathSegCustom.cpp"
-#include "JSSVGPathSegListCustom.cpp"
#include "JSScriptProfileNodeCustom.cpp"
#include "JSSharedWorkerCustom.cpp"
#include "JSStorageCustom.cpp"
@@ -127,6 +134,8 @@
#include "JSTouchCustom.cpp"
#include "JSTouchListCustom.cpp"
#include "JSTreeWalkerCustom.cpp"
+#include "JSWebKitCSSKeyframeRuleCustom.cpp"
+#include "JSWebKitCSSKeyframesRuleCustom.cpp"
#include "JSWebKitCSSMatrixCustom.cpp"
#include "JSWebKitPointCustom.cpp"
#include "JSWebSocketCustom.cpp"
diff --git a/WebCore/bindings/js/JSCSSFontFaceRuleCustom.cpp b/WebCore/bindings/js/JSCSSFontFaceRuleCustom.cpp
new file mode 100644
index 0000000..a08c180
--- /dev/null
+++ b/WebCore/bindings/js/JSCSSFontFaceRuleCustom.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCSSFontFaceRule.h"
+
+#include "CSSFontFaceRule.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSCSSFontFaceRule::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ if (CSSMutableStyleDeclaration* style = static_cast<CSSFontFaceRule*>(impl())->style())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), style);
+}
+
+}
diff --git a/WebCore/bindings/js/JSCSSImportRuleCustom.cpp b/WebCore/bindings/js/JSCSSImportRuleCustom.cpp
new file mode 100644
index 0000000..3db517d
--- /dev/null
+++ b/WebCore/bindings/js/JSCSSImportRuleCustom.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCSSImportRule.h"
+
+#include "CSSImportRule.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSCSSImportRule::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ if (CSSStyleSheet* sheet = static_cast<CSSImportRule*>(impl())->styleSheet())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), sheet);
+
+ if (MediaList* media = static_cast<CSSImportRule*>(impl())->media())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), media);
+}
+
+}
diff --git a/WebCore/bindings/js/JSCSSMediaRuleCustom.cpp b/WebCore/bindings/js/JSCSSMediaRuleCustom.cpp
new file mode 100644
index 0000000..b5230fc
--- /dev/null
+++ b/WebCore/bindings/js/JSCSSMediaRuleCustom.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCSSMediaRule.h"
+
+#include "CSSMediaRule.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSCSSMediaRule::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ if (MediaList* media = static_cast<CSSMediaRule*>(impl())->media())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), media);
+
+ if (CSSRuleList* rules = static_cast<CSSMediaRule*>(impl())->cssRules())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), rules);
+}
+
+}
diff --git a/WebCore/bindings/js/JSCSSPageRuleCustom.cpp b/WebCore/bindings/js/JSCSSPageRuleCustom.cpp
new file mode 100644
index 0000000..c7ac04b
--- /dev/null
+++ b/WebCore/bindings/js/JSCSSPageRuleCustom.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCSSPageRule.h"
+
+#include "CSSPageRule.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSCSSPageRule::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ if (CSSMutableStyleDeclaration* style = static_cast<CSSPageRule*>(impl())->style())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), style);
+}
+
+}
diff --git a/WebCore/bindings/js/JSCSSRuleCustom.cpp b/WebCore/bindings/js/JSCSSRuleCustom.cpp
index 20b3ab4..4d226d0 100644
--- a/WebCore/bindings/js/JSCSSRuleCustom.cpp
+++ b/WebCore/bindings/js/JSCSSRuleCustom.cpp
@@ -47,6 +47,17 @@ using namespace JSC;
namespace WebCore {
+void JSCSSRule::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ if (CSSStyleSheet* parentStyleSheet = impl()->parentStyleSheet())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), parentStyleSheet);
+
+ if (CSSRule* parentRule = impl()->parentRule())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), parentRule);
+}
+
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSRule* rule)
{
if (!rule)
diff --git a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
index 458ad5b..1a448ee 100644
--- a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
+++ b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
@@ -47,6 +47,9 @@ void JSCSSStyleDeclaration::markChildren(MarkStack& markStack)
CSSStyleDeclaration* declaration = impl();
JSGlobalData& globalData = *Heap::heap(this)->globalData();
+ if (CSSRule* parentRule = declaration->parentRule())
+ markDOMObjectWrapper(markStack, globalData, parentRule);
+
if (declaration->isMutableStyleDeclaration()) {
CSSMutableStyleDeclaration* mutableDeclaration = static_cast<CSSMutableStyleDeclaration*>(declaration);
CSSMutableStyleDeclaration::const_iterator end = mutableDeclaration->end();
diff --git a/WebCore/bindings/js/JSCSSStyleRuleCustom.cpp b/WebCore/bindings/js/JSCSSStyleRuleCustom.cpp
new file mode 100644
index 0000000..61745ec
--- /dev/null
+++ b/WebCore/bindings/js/JSCSSStyleRuleCustom.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCSSStyleRule.h"
+
+#include "CSSStyleRule.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSCSSStyleRule::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ if (CSSMutableStyleDeclaration* style = static_cast<CSSStyleRule*>(impl())->style())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), style);
+}
+
+}
diff --git a/WebCore/bindings/js/JSConsoleCustom.cpp b/WebCore/bindings/js/JSConsoleCustom.cpp
index 6df88f6..6a4fb17 100644
--- a/WebCore/bindings/js/JSConsoleCustom.cpp
+++ b/WebCore/bindings/js/JSConsoleCustom.cpp
@@ -57,23 +57,23 @@ JSValue JSConsole::profiles(ExecState* exec) const
JSValue JSConsole::profile(ExecState* exec)
{
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, 1));
+ RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, 1));
const String& title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
if (exec->hadException())
return jsUndefined();
- impl()->profile(title, exec, callStack.release());
+ impl()->profile(title, exec, callStack);
return jsUndefined();
}
JSValue JSConsole::profileEnd(ExecState* exec)
{
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, 1));
+ RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, 1));
const String& title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
if (exec->hadException())
return jsUndefined();
- impl()->profileEnd(title, exec, callStack.release());
+ impl()->profileEnd(title, exec, callStack);
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSConvolverNodeCustom.cpp b/WebCore/bindings/js/JSConvolverNodeCustom.cpp
new file mode 100644
index 0000000..db7e244
--- /dev/null
+++ b/WebCore/bindings/js/JSConvolverNodeCustom.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(WEB_AUDIO)
+
+#include "ConvolverNode.h"
+
+#include "AudioBuffer.h"
+#include "JSAudioBuffer.h"
+#include "JSConvolverNode.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSConvolverNode::setBuffer(ExecState*, JSValue value)
+{
+ ConvolverNode* imp = static_cast<ConvolverNode*>(impl());
+ imp->setBuffer(toAudioBuffer(value));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index e4cff4a..0d94b44 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -35,8 +35,10 @@
#include "HTMLCanvasElement.h"
#include "HTMLFrameElementBase.h"
#include "HTMLImageElement.h"
+#include "HTMLLinkElement.h"
#include "HTMLNames.h"
#include "HTMLScriptElement.h"
+#include "HTMLStyleElement.h"
#include "JSBinding.h"
#include "JSBindingState.h"
#include "JSDOMCoreException.h"
@@ -50,6 +52,7 @@
#include "JSXMLHttpRequestException.h"
#include "KURL.h"
#include "MessagePort.h"
+#include "ProcessingInstruction.h"
#include "RangeException.h"
#include "ScriptCachedFrameData.h"
#include "ScriptController.h"
@@ -231,7 +234,7 @@ void cacheDOMNodeWrapper(JSC::ExecState* exec, Document* document, Node* node, J
static inline bool isObservableThroughDOM(JSNode* jsNode, DOMWrapperWorld* world)
{
- // Certain conditions implicitly make a JS DOM node wrapper observable
+ // Certain conditions implicitly make existence of a JS DOM node wrapper observable
// through the DOM, even if no explicit reference to it remains.
Node* node = jsNode->impl();
@@ -253,19 +256,22 @@ static inline bool isObservableThroughDOM(JSNode* jsNode, DOMWrapperWorld* world
// those objects through the DOM must reflect those properties.
// FIXME: It would be better if this logic could be in the node next to
// the custom markChildren functions rather than here.
+ // Note that for some compound objects like stylesheets and CSSStyleDeclarations,
+ // we don't descend to check children for custom properties, and just conservatively
+ // keep the node wrappers protecting them alive.
if (node->isElementNode()) {
if (NamedNodeMap* attributes = static_cast<Element*>(node)->attributeMap()) {
if (DOMObject* wrapper = world->m_wrappers.uncheckedGet(attributes)) {
+ // FIXME: This check seems insufficient, because NamedNodeMap items can have custom properties themselves.
+ // Maybe it would be OK to just keep the wrapper alive, as it is done for CSSOM objects below.
if (wrapper->hasCustomProperties())
return true;
}
}
if (node->isStyledElement()) {
if (CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(node)->inlineStyleDecl()) {
- if (DOMObject* wrapper = world->m_wrappers.uncheckedGet(style)) {
- if (wrapper->hasCustomProperties())
- return true;
- }
+ if (world->m_wrappers.uncheckedGet(style))
+ return true;
}
}
if (static_cast<Element*>(node)->hasTagName(canvasTag)) {
@@ -275,6 +281,21 @@ static inline bool isObservableThroughDOM(JSNode* jsNode, DOMWrapperWorld* world
return true;
}
}
+ } else if (static_cast<Element*>(node)->hasTagName(linkTag)) {
+ if (StyleSheet* sheet = static_cast<HTMLLinkElement*>(node)->sheet()) {
+ if (world->m_wrappers.uncheckedGet(sheet))
+ return true;
+ }
+ } else if (static_cast<Element*>(node)->hasTagName(styleTag)) {
+ if (StyleSheet* sheet = static_cast<HTMLStyleElement*>(node)->sheet()) {
+ if (world->m_wrappers.uncheckedGet(sheet))
+ return true;
+ }
+ }
+ } else if (node->nodeType() == Node::PROCESSING_INSTRUCTION_NODE) {
+ if (StyleSheet* sheet = static_cast<ProcessingInstruction*>(node)->sheet()) {
+ if (world->m_wrappers.uncheckedGet(sheet))
+ return true;
}
}
} else {
@@ -611,7 +632,7 @@ void setDOMException(ExecState* exec, ExceptionCode ec)
break;
#if ENABLE(SVG)
case SVGExceptionType:
- errorObject = toJS(exec, globalObject, SVGException::create(description).get(), 0 /* no context on purpose */);
+ errorObject = toJS(exec, globalObject, SVGException::create(description).get());
break;
#endif
#if ENABLE(XPATH)
diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h
index 64a3dad..54e9cf6 100644
--- a/WebCore/bindings/js/JSDOMBinding.h
+++ b/WebCore/bindings/js/JSDOMBinding.h
@@ -25,7 +25,6 @@
#include "JSDOMGlobalObject.h"
#include "JSDOMWrapper.h"
#include "DOMWrapperWorld.h"
-#include "JSSVGContextCache.h"
#include "Document.h"
#include <runtime/Completion.h>
#include <runtime/Lookup.h>
@@ -50,10 +49,6 @@ namespace WebCore {
typedef int ExceptionCode;
-#if ENABLE(SVG)
- class SVGElement;
-#endif
-
// FIXME: This class should collapse into DOMObject once all DOMObjects are
// updated to store a globalObject pointer.
class DOMObjectWithGlobalPointer : public DOMObject {
@@ -185,28 +180,6 @@ namespace WebCore {
return createDOMObjectWrapper<WrapperClass>(exec, globalObject, object);
}
-#if ENABLE(SVG)
- #define CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, className, object, context) createDOMObjectWrapper<JS##className>(exec, globalObject, static_cast<className*>(object), context)
- template<class WrapperClass, class DOMClass> inline DOMObject* createDOMObjectWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* object, SVGElement* context)
- {
- DOMObject* wrapper = createDOMObjectWrapper<WrapperClass, DOMClass>(exec, globalObject, object);
- ASSERT(wrapper);
- if (context)
- JSSVGContextCache::addWrapper(wrapper, context);
- return wrapper;
- }
- template<class WrapperClass, class DOMClass> inline JSC::JSValue getDOMObjectWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* object, SVGElement* context)
- {
- if (!object)
- return JSC::jsNull();
- if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, object)) {
- ASSERT(JSSVGContextCache::svgContextForDOMObject(wrapper) == context);
- return wrapper;
- }
- return createDOMObjectWrapper<WrapperClass, DOMClass>(exec, globalObject, object, context);
- }
-#endif
-
#define CREATE_DOM_NODE_WRAPPER(exec, globalObject, className, object) createDOMNodeWrapper<JS##className>(exec, globalObject, static_cast<className*>(object))
template<class WrapperClass, class DOMClass> inline JSNode* createDOMNodeWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* node)
{
diff --git a/WebCore/bindings/js/JSDOMWindowBase.cpp b/WebCore/bindings/js/JSDOMWindowBase.cpp
index e2b50d0..ad4e2f7 100644
--- a/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -60,7 +60,7 @@ JSDOMWindowBase::JSDOMWindowBase(NonNullPassRefPtr<Structure> structure, PassRef
GlobalPropertyInfo(Identifier(globalExec(), "window"), d()->shell, DontDelete | ReadOnly)
};
- addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo));
+ addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
}
void JSDOMWindowBase::updateDocument()
@@ -118,6 +118,26 @@ bool JSDOMWindowBase::supportsProfiling() const
#endif
}
+bool JSDOMWindowBase::supportsRichSourceInfo() const
+{
+#if !ENABLE(JAVASCRIPT_DEBUGGER) || !ENABLE(INSPECTOR)
+ return false;
+#else
+ Frame* frame = impl()->frame();
+ if (!frame)
+ return false;
+
+ Page* page = frame->page();
+ if (!page)
+ return false;
+
+ bool enabled = page->inspectorController()->enabled();
+ ASSERT(enabled || !debugger());
+ ASSERT(enabled || !supportsProfiling());
+ return enabled;
+#endif
+}
+
bool JSDOMWindowBase::shouldInterruptScript() const
{
ASSERT(impl()->frame());
diff --git a/WebCore/bindings/js/JSDOMWindowBase.h b/WebCore/bindings/js/JSDOMWindowBase.h
index cafca73..fbef808 100644
--- a/WebCore/bindings/js/JSDOMWindowBase.h
+++ b/WebCore/bindings/js/JSDOMWindowBase.h
@@ -60,6 +60,7 @@ namespace WebCore {
virtual JSC::ExecState* globalExec();
virtual bool supportsProfiling() const;
+ virtual bool supportsRichSourceInfo() const;
virtual bool shouldInterruptScript() const;
bool allowsAccessFrom(JSC::ExecState*) const;
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index 7119ea6..95fcdc1 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -53,6 +53,7 @@
#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "JSArrayBuffer.h"
+#include "JSDataView.h"
#include "JSInt8Array.h"
#include "JSUint8Array.h"
#include "JSInt32Array.h"
@@ -606,6 +607,10 @@ JSValue JSDOMWindow::float32Array(ExecState* exec) const
return getDOMConstructor<JSFloat32ArrayConstructor>(exec, this);
}
+JSValue JSDOMWindow::dataView(ExecState* exec) const
+{
+ return getDOMConstructor<JSDataViewConstructor>(exec, this);
+}
#endif
JSValue JSDOMWindow::xmlHttpRequest(ExecState* exec) const
diff --git a/WebCore/bindings/js/JSDataViewCustom.cpp b/WebCore/bindings/js/JSDataViewCustom.cpp
new file mode 100644
index 0000000..f17e0e1
--- /dev/null
+++ b/WebCore/bindings/js/JSDataViewCustom.cpp
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+
+#include "JSDataView.h"
+
+#include "DataView.h"
+#include "ExceptionCode.h"
+#include "JSArrayBufferViewHelper.h"
+#include <wtf/MathExtras.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+enum DataViewAccessType {
+ AccessDataViewMemberAsInt8,
+ AccessDataViewMemberAsUint8,
+ AccessDataViewMemberAsFloat32,
+ AccessDataViewMemberAsFloat64
+};
+
+JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, DataView* object)
+{
+ return getDOMObjectWrapper<JSDataView>(exec, globalObject, object);
+}
+
+EncodedJSValue JSC_HOST_CALL JSDataViewConstructor::constructJSDataView(ExecState* exec)
+{
+ if (exec->argument(0).isNull() || !exec->argument(0).isObject())
+ return throwVMTypeError(exec);
+
+ RefPtr<DataView> view = constructArrayBufferViewWithArrayBufferArgument<DataView, char>(exec);
+ if (!view.get()) {
+ setDOMException(exec, INDEX_SIZE_ERR);
+ return JSValue::encode(jsUndefined());
+ }
+
+ JSDataViewConstructor* jsConstructor = static_cast<JSDataViewConstructor*>(exec->callee());
+ return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), view.get())));
+}
+
+static JSValue getDataViewMember(ExecState* exec, DataViewAccessType type)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&JSDataView::s_info))
+ return throwTypeError(exec);
+ JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
+ DataView* imp = static_cast<DataView*>(castedThis->impl());
+ if (exec->argumentCount() < 1)
+ return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
+ ExceptionCode ec = 0;
+ unsigned byteOffset = exec->argument(0).toUInt32(exec);
+ if (exec->hadException())
+ return jsUndefined();
+
+ bool littleEndian = false;
+ if (exec->argumentCount() > 1 && (type == AccessDataViewMemberAsFloat32 || type == AccessDataViewMemberAsFloat64)) {
+ littleEndian = exec->argument(1).toBoolean(exec);
+ if (exec->hadException())
+ return jsUndefined();
+ }
+
+ JSC::JSValue result;
+ switch (type) {
+ case AccessDataViewMemberAsInt8:
+ result = jsNumber(imp->getInt8(byteOffset, ec));
+ break;
+ case AccessDataViewMemberAsUint8:
+ result = jsNumber(imp->getUint8(byteOffset, ec));
+ break;
+ case AccessDataViewMemberAsFloat32:
+ case AccessDataViewMemberAsFloat64: {
+ double value = (type == AccessDataViewMemberAsFloat32) ? imp->getFloat32(byteOffset, littleEndian, ec) : imp->getFloat64(byteOffset, littleEndian, ec);
+ result = isnan(value) ? JSValue(nonInlineNaN()) : jsNumber(value);
+ break;
+ } default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ setDOMException(exec, ec);
+ return result;
+}
+
+JSValue JSC_HOST_CALL JSDataView::getInt8(ExecState* exec)
+{
+ return getDataViewMember(exec, AccessDataViewMemberAsInt8);
+}
+
+JSValue JSC_HOST_CALL JSDataView::getUint8(ExecState* exec)
+{
+ return getDataViewMember(exec, AccessDataViewMemberAsUint8);
+}
+
+JSValue JSC_HOST_CALL JSDataView::getFloat32(ExecState* exec)
+{
+ return getDataViewMember(exec, AccessDataViewMemberAsFloat32);
+}
+
+JSValue JSC_HOST_CALL JSDataView::getFloat64(ExecState* exec)
+{
+ return getDataViewMember(exec, AccessDataViewMemberAsFloat64);
+}
+
+static JSValue setDataViewMember(ExecState* exec, DataViewAccessType type)
+{
+ JSValue thisValue = exec->hostThisValue();
+ if (!thisValue.inherits(&JSDataView::s_info))
+ return throwTypeError(exec);
+ JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
+ DataView* imp = static_cast<DataView*>(castedThis->impl());
+ if (exec->argumentCount() < 2)
+ return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
+ ExceptionCode ec = 0;
+ unsigned byteOffset = exec->argument(0).toUInt32(exec);
+ if (exec->hadException())
+ return jsUndefined();
+ int value = exec->argument(1).toInt32(exec);
+ if (exec->hadException())
+ return jsUndefined();
+
+ switch (type) {
+ case AccessDataViewMemberAsInt8:
+ imp->setInt8(byteOffset, static_cast<char>(value), ec);
+ break;
+ case AccessDataViewMemberAsUint8:
+ imp->setUint8(byteOffset, static_cast<unsigned char>(value), ec);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ setDOMException(exec, ec);
+ return jsUndefined();
+}
+
+JSValue JSC_HOST_CALL JSDataView::setInt8(ExecState* exec)
+{
+ return setDataViewMember(exec, AccessDataViewMemberAsInt8);
+}
+
+JSValue JSC_HOST_CALL JSDataView::setUint8(ExecState* exec)
+{
+ return setDataViewMember(exec, AccessDataViewMemberAsUint8);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSEventCustom.cpp b/WebCore/bindings/js/JSEventCustom.cpp
index d671dee..fd80360 100644
--- a/WebCore/bindings/js/JSEventCustom.cpp
+++ b/WebCore/bindings/js/JSEventCustom.cpp
@@ -51,6 +51,7 @@
#include "JSPageTransitionEvent.h"
#include "JSPopStateEvent.h"
#include "JSProgressEvent.h"
+#include "JSSpeechInputEvent.h"
#include "JSTextEvent.h"
#include "JSUIEvent.h"
#include "JSWebKitAnimationEvent.h"
@@ -68,6 +69,7 @@
#include "PageTransitionEvent.h"
#include "PopStateEvent.h"
#include "ProgressEvent.h"
+#include "SpeechInputEvent.h"
#include "TextEvent.h"
#include "UIEvent.h"
#include "WebKitAnimationEvent.h"
@@ -193,6 +195,10 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
else if (event->isAudioProcessingEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, AudioProcessingEvent, event);
#endif
+#if ENABLE(INPUT_SPEECH)
+ else if (event->isSpeechInputEvent())
+ wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SpeechInputEvent, event);
+#endif
else
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, Event, event);
diff --git a/WebCore/bindings/js/JSFloat32ArrayCustom.cpp b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
index 671ee68..880d68c 100644
--- a/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
@@ -27,10 +27,10 @@
#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-#include "JSArrayBufferViewHelper.h"
#include "JSFloat32Array.h"
#include "Float32Array.h"
+#include "JSArrayBufferViewHelper.h"
using namespace JSC;
@@ -54,7 +54,7 @@ JSC::JSValue JSFloat32Array::set(JSC::ExecState* exec)
EncodedJSValue JSC_HOST_CALL JSFloat32ArrayConstructor::constructJSFloat32Array(ExecState* exec)
{
JSFloat32ArrayConstructor* jsConstructor = static_cast<JSFloat32ArrayConstructor*>(exec->callee());
- RefPtr<Float32Array> array = static_cast<Float32Array*>(constructArrayBufferView<Float32Array, float>(exec).get());
+ RefPtr<Float32Array> array = constructArrayBufferView<Float32Array, float>(exec);
if (!array.get())
// Exception has already been thrown.
return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSHTMLLinkElementCustom.cpp b/WebCore/bindings/js/JSHTMLLinkElementCustom.cpp
new file mode 100644
index 0000000..8cc8d5f
--- /dev/null
+++ b/WebCore/bindings/js/JSHTMLLinkElementCustom.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSHTMLLinkElement.h"
+
+#include "HTMLLinkElement.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSHTMLLinkElement::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ if (StyleSheet* sheet = static_cast<HTMLLinkElement*>(impl())->sheet())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), sheet);
+}
+
+}
diff --git a/WebCore/bindings/js/JSHTMLStyleElementCustom.cpp b/WebCore/bindings/js/JSHTMLStyleElementCustom.cpp
new file mode 100644
index 0000000..9b0d1a7
--- /dev/null
+++ b/WebCore/bindings/js/JSHTMLStyleElementCustom.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSHTMLStyleElement.h"
+
+#include "HTMLStyleElement.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSHTMLStyleElement::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ if (StyleSheet* sheet = static_cast<HTMLStyleElement*>(impl())->sheet())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), sheet);
+}
+
+}
diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index 9cf4604..de72dea 100644
--- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -95,7 +95,6 @@ ScriptObject InjectedScriptHost::createInjectedScript(const String& source, Scri
args.append(toJS(scriptState, globalObject, this));
args.append(globalThisValue);
args.append(jsNumber(id));
- args.append(jsString(scriptState, String("JSC")));
JSValue result = JSC::call(scriptState, functionValue, callType, callData, globalThisValue, args);
if (result.isObject())
return ScriptObject(scriptState, result.getObject());
@@ -137,6 +136,15 @@ JSValue JSInjectedScriptHost::nodeForId(ExecState* exec)
return toJS(exec, node);
}
+JSValue JSInjectedScriptHost::internalConstructorName(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ UString result = exec->argument(0).toThisObject(exec)->className();
+ return jsString(exec, result);
+}
+
JSValue JSInjectedScriptHost::pushNodePathToFrontend(ExecState* exec)
{
if (exec->argumentCount() < 3)
diff --git a/WebCore/bindings/js/JSInt16ArrayCustom.cpp b/WebCore/bindings/js/JSInt16ArrayCustom.cpp
index 797568c..e08da8a 100644
--- a/WebCore/bindings/js/JSInt16ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSInt16ArrayCustom.cpp
@@ -27,10 +27,10 @@
#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-#include "JSArrayBufferViewHelper.h"
#include "JSInt16Array.h"
#include "Int16Array.h"
+#include "JSArrayBufferViewHelper.h"
using namespace JSC;
@@ -54,7 +54,7 @@ JSC::JSValue JSInt16Array::set(JSC::ExecState* exec)
EncodedJSValue JSC_HOST_CALL JSInt16ArrayConstructor::constructJSInt16Array(ExecState* exec)
{
JSInt16ArrayConstructor* jsConstructor = static_cast<JSInt16ArrayConstructor*>(exec->callee());
- RefPtr<Int16Array> array = static_cast<Int16Array*>(constructArrayBufferView<Int16Array, short>(exec).get());
+ RefPtr<Int16Array> array = constructArrayBufferView<Int16Array, short>(exec);
if (!array.get())
// Exception has already been thrown.
return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSInt32ArrayCustom.cpp b/WebCore/bindings/js/JSInt32ArrayCustom.cpp
index 53e6ec6..5aa64bb 100644
--- a/WebCore/bindings/js/JSInt32ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSInt32ArrayCustom.cpp
@@ -27,10 +27,10 @@
#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-#include "JSArrayBufferViewHelper.h"
#include "JSInt32Array.h"
#include "Int32Array.h"
+#include "JSArrayBufferViewHelper.h"
using namespace JSC;
@@ -54,7 +54,7 @@ JSC::JSValue JSInt32Array::set(JSC::ExecState* exec)
EncodedJSValue JSC_HOST_CALL JSInt32ArrayConstructor::constructJSInt32Array(ExecState* exec)
{
JSInt32ArrayConstructor* jsConstructor = static_cast<JSInt32ArrayConstructor*>(exec->callee());
- RefPtr<Int32Array> array = static_cast<Int32Array*>(constructArrayBufferView<Int32Array, int>(exec).get());
+ RefPtr<Int32Array> array = constructArrayBufferView<Int32Array, int>(exec);
if (!array.get())
// Exception has already been thrown.
return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSInt8ArrayCustom.cpp b/WebCore/bindings/js/JSInt8ArrayCustom.cpp
index 7556d6a..b63de54 100644
--- a/WebCore/bindings/js/JSInt8ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSInt8ArrayCustom.cpp
@@ -27,10 +27,10 @@
#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-#include "JSArrayBufferViewHelper.h"
#include "JSInt8Array.h"
#include "Int8Array.h"
+#include "JSArrayBufferViewHelper.h"
#include <runtime/Error.h>
using namespace JSC;
@@ -55,7 +55,7 @@ JSC::JSValue JSInt8Array::set(JSC::ExecState* exec)
EncodedJSValue JSC_HOST_CALL JSInt8ArrayConstructor::constructJSInt8Array(ExecState* exec)
{
JSInt8ArrayConstructor* jsConstructor = static_cast<JSInt8ArrayConstructor*>(exec->callee());
- RefPtr<Int8Array> array = static_cast<Int8Array*>(constructArrayBufferView<Int8Array, signed char>(exec).get());
+ RefPtr<Int8Array> array = constructArrayBufferView<Int8Array, signed char>(exec);
if (!array.get())
// Exception has already been thrown.
return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSJavaScriptAudioNodeCustom.cpp b/WebCore/bindings/js/JSJavaScriptAudioNodeCustom.cpp
new file mode 100644
index 0000000..9acabf3
--- /dev/null
+++ b/WebCore/bindings/js/JSJavaScriptAudioNodeCustom.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(WEB_AUDIO)
+
+#include "JavaScriptAudioNode.h"
+
+#include "JSJavaScriptAudioNode.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSJavaScriptAudioNode::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+ static_cast<JavaScriptAudioNode*>(impl())->markJSEventListeners(markStack);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)
diff --git a/WebCore/bindings/js/JSProcessingInstructionCustom.cpp b/WebCore/bindings/js/JSProcessingInstructionCustom.cpp
new file mode 100644
index 0000000..868e319
--- /dev/null
+++ b/WebCore/bindings/js/JSProcessingInstructionCustom.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSProcessingInstruction.h"
+
+#include "ProcessingInstruction.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSProcessingInstruction::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ if (StyleSheet* sheet = static_cast<ProcessingInstruction*>(impl())->sheet())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), sheet);
+}
+
+}
diff --git a/WebCore/bindings/js/JSSVGContextCache.h b/WebCore/bindings/js/JSSVGContextCache.h
deleted file mode 100644
index 75ed324..0000000
--- a/WebCore/bindings/js/JSSVGContextCache.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- Copyright (C) Research In Motion Limited 2009-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 JSSVGContextCache_h
-#define JSSVGContextCache_h
-
-#if ENABLE(SVG)
-#include "SVGElement.h"
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-class DOMObject;
-
-class JSSVGContextCache : public Noncopyable {
-public:
- typedef HashMap<DOMObject*, SVGElement*> WrapperMap;
-
- static WrapperMap& wrapperMap()
- {
- DEFINE_STATIC_LOCAL(WrapperMap, s_wrapperMap, ());
- return s_wrapperMap;
- }
-
- static void addWrapper(DOMObject* wrapper, SVGElement* context)
- {
- ASSERT(wrapper);
- ASSERT(context);
-
- pair<WrapperMap::iterator, bool> result = wrapperMap().add(wrapper, context);
- if (result.second) {
- WrapperMap::iterator& it = result.first;
- ASSERT_UNUSED(it, it->second == context);
- }
- }
-
- static void forgetWrapper(DOMObject* wrapper)
- {
- ASSERT(wrapper);
-
- WrapperMap& map = wrapperMap();
- WrapperMap::iterator it = map.find(wrapper);
- if (it == map.end())
- return;
-
- map.remove(it);
- }
-
- static void propagateSVGDOMChange(DOMObject* wrapper, const QualifiedName& attributeName)
- {
- WrapperMap& map = wrapperMap();
- WrapperMap::iterator it = map.find(wrapper);
- if (it == map.end())
- return;
-
- SVGElement* context = it->second;
- ASSERT(context);
-
- context->svgAttributeChanged(attributeName);
- }
-
- static SVGElement* svgContextForDOMObject(DOMObject* wrapper)
- {
- ASSERT(wrapper);
-
- WrapperMap& map = wrapperMap();
- WrapperMap::iterator it = map.find(wrapper);
- if (it == map.end())
- return 0;
-
- SVGElement* context = it->second;
- ASSERT(context);
- return context;
- }
-
-};
-
-}
-
-#endif
-#endif
diff --git a/WebCore/bindings/js/JSSVGLengthCustom.cpp b/WebCore/bindings/js/JSSVGLengthCustom.cpp
index 9a9138c..5b668c4 100644
--- a/WebCore/bindings/js/JSSVGLengthCustom.cpp
+++ b/WebCore/bindings/js/JSSVGLengthCustom.cpp
@@ -45,6 +45,11 @@ JSValue JSSVGLength::value(ExecState* exec) const
void JSSVGLength::setValue(ExecState* exec, JSValue value)
{
+ if (impl()->role() == AnimValRole) {
+ setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
+ return;
+ }
+
if (!value.isUndefinedOrNull() && !value.isNumber() && !value.isBoolean()) {
throwVMTypeError(exec);
return;
@@ -64,6 +69,11 @@ void JSSVGLength::setValue(ExecState* exec, JSValue value)
JSValue JSSVGLength::convertToSpecifiedUnits(ExecState* exec)
{
+ if (impl()->role() == AnimValRole) {
+ setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
+ return jsUndefined();
+ }
+
SVGLength& podImp = impl()->propertyReference();
// Mimic the behaviour of RequiresAllArguments=Raise.
diff --git a/WebCore/bindings/js/JSSVGPODListCustom.h b/WebCore/bindings/js/JSSVGPODListCustom.h
deleted file mode 100644
index c2af93f..0000000
--- a/WebCore/bindings/js/JSSVGPODListCustom.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (C) Research In Motion Limited 2010. All rights reserved.
- * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- * 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.
- */
-
-#ifndef JSSVGPODListCustom_h
-#define JSSVGPODListCustom_h
-
-#include "JSSVGContextCache.h"
-#include "JSSVGPODTypeWrapper.h"
-#include "SVGList.h"
-
-namespace WebCore {
-
-namespace JSSVGPODListCustom {
-
-// Helper structure only containing public typedefs, as C++ does not allow templatized typedefs
-template<typename PODType>
-struct JSSVGPODListTraits {
- typedef SVGPODListItem<PODType> PODListItem;
- typedef SVGList<RefPtr<PODListItem> > PODList;
- typedef PODType (*ConversionCallback)(JSC::JSValue);
-};
-
-template<typename JSPODListType, typename PODType>
-static JSC::JSValue finishGetter(JSC::ExecState* exec, ExceptionCode& ec, JSPODListType* wrapper,
- PassRefPtr<typename JSSVGPODListTraits<PODType>::PODListItem> item)
-{
- if (ec) {
- setDOMException(exec, ec);
- return JSC::jsUndefined();
- }
-
- typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
-
- SVGElement* context = JSSVGContextCache::svgContextForDOMObject(wrapper);
- return toJS(exec, wrapper->globalObject(),
- JSSVGPODTypeWrapperCreatorForList<PODType>::create(item.get(), listImp->associatedAttributeName()).get(), context);
-}
-
-template<typename JSPODListType, typename PODType>
-static JSC::JSValue finishSetter(JSC::ExecState* exec, ExceptionCode& ec, JSPODListType* wrapper,
- PassRefPtr<typename JSSVGPODListTraits<PODType>::PODListItem> item)
-{
- if (ec) {
- setDOMException(exec, ec);
- return JSC::jsUndefined();
- }
-
- typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
-
- const QualifiedName& attributeName = listImp->associatedAttributeName();
- JSSVGContextCache::propagateSVGDOMChange(wrapper, attributeName);
-
- SVGElement* context = JSSVGContextCache::svgContextForDOMObject(wrapper);
- return toJS(exec, wrapper->globalObject(),
- JSSVGPODTypeWrapperCreatorForList<PODType>::create(item.get(), attributeName).get(), context);
-}
-
-template<typename JSPODListType, typename PODType>
-static JSC::JSValue finishSetterReadOnlyResult(JSC::ExecState* exec, ExceptionCode& ec, JSPODListType* wrapper,
- PassRefPtr<typename JSSVGPODListTraits<PODType>::PODListItem> item)
-{
- if (ec) {
- setDOMException(exec, ec);
- return JSC::jsUndefined();
- }
-
- typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- JSSVGContextCache::propagateSVGDOMChange(wrapper, listImp->associatedAttributeName());
- return toJS(exec, wrapper->globalObject(),
- JSSVGStaticPODTypeWrapper<PODType>::create(*item).get(), 0 /* no context on purpose */);
-}
-
-template<typename JSPODListType, typename PODType>
-static JSC::JSValue clear(JSPODListType* wrapper, JSC::ExecState* exec,
- typename JSSVGPODListTraits<PODType>::ConversionCallback)
-{
- ExceptionCode ec = 0;
- typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- listImp->clear(ec);
-
- if (ec)
- setDOMException(exec, ec);
- else
- JSSVGContextCache::propagateSVGDOMChange(wrapper, listImp->associatedAttributeName());
-
- return JSC::jsUndefined();
-}
-
-template<typename JSPODListType, typename PODType>
-static JSC::JSValue initialize(JSPODListType* wrapper, JSC::ExecState* exec,
- typename JSSVGPODListTraits<PODType>::ConversionCallback conversion)
-{
- ExceptionCode ec = 0;
- typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishSetter<JSPODListType, PODType>(exec, ec, wrapper,
- listImp->initialize(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(exec->argument(0))), ec));
-}
-
-template<typename JSPODListType, typename PODType>
-static JSC::JSValue getItem(JSPODListType* wrapper, JSC::ExecState* exec,
- typename JSSVGPODListTraits<PODType>::ConversionCallback)
-{
- bool indexOk = false;
- unsigned index = finiteInt32Value(exec->argument(0), exec, indexOk);
- if (!indexOk) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSC::jsUndefined();
- }
-
- ExceptionCode ec = 0;
- typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishGetter<JSPODListType, PODType>(exec, ec, wrapper,
- listImp->getItem(index, ec));
-}
-
-template<typename JSPODListType, typename PODType>
-static JSC::JSValue insertItemBefore(JSPODListType* wrapper, JSC::ExecState* exec,
- typename JSSVGPODListTraits<PODType>::ConversionCallback conversion)
-{
- bool indexOk = false;
- unsigned index = finiteInt32Value(exec->argument(1), exec, indexOk);
- if (!indexOk) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSC::jsUndefined();
- }
-
- ExceptionCode ec = 0;
- typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishSetter<JSPODListType, PODType>(exec, ec, wrapper,
- listImp->insertItemBefore(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(exec->argument(0))), index, ec));
-}
-
-template<typename JSPODListType, typename PODType>
-static JSC::JSValue replaceItem(JSPODListType* wrapper, JSC::ExecState* exec,
- typename JSSVGPODListTraits<PODType>::ConversionCallback conversion)
-{
- bool indexOk = false;
- unsigned index = finiteInt32Value(exec->argument(1), exec, indexOk);
- if (!indexOk) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSC::jsUndefined();
- }
-
- ExceptionCode ec = 0;
- typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishSetter<JSPODListType, PODType>(exec, ec, wrapper,
- listImp->replaceItem(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(exec->argument(0))), index, ec));
-}
-
-template<typename JSPODListType, typename PODType>
-static JSC::JSValue removeItem(JSPODListType* wrapper, JSC::ExecState* exec,
- typename JSSVGPODListTraits<PODType>::ConversionCallback)
-{
- bool indexOk = false;
- unsigned index = finiteInt32Value(exec->argument(0), exec, indexOk);
- if (!indexOk) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSC::jsUndefined();
- }
-
- ExceptionCode ec = 0;
- typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishSetterReadOnlyResult<JSPODListType, PODType>(exec, ec, wrapper,
- listImp->removeItem(index, ec));
-}
-
-template<typename JSPODListType, typename PODType>
-static JSC::JSValue appendItem(JSPODListType* wrapper, JSC::ExecState* exec,
- typename JSSVGPODListTraits<PODType>::ConversionCallback conversion)
-{
- ExceptionCode ec = 0;
- typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishSetter<JSPODListType, PODType>(exec, ec, wrapper,
- listImp->appendItem(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(exec->argument(0))), ec));
-}
-
-}
-
-}
-
-#endif
diff --git a/WebCore/bindings/js/JSSVGPODTypeWrapper.h b/WebCore/bindings/js/JSSVGPODTypeWrapper.h
deleted file mode 100644
index 2329365..0000000
--- a/WebCore/bindings/js/JSSVGPODTypeWrapper.h
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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.
- */
-
-#ifndef JSSVGPODTypeWrapper_h
-#define JSSVGPODTypeWrapper_h
-
-#if ENABLE(SVG)
-#include "JSSVGContextCache.h"
-#include "SVGElement.h"
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-class DOMObject;
-
-template<typename PODType>
-class JSSVGPODTypeWrapper : public RefCounted<JSSVGPODTypeWrapper<PODType> > {
-public:
- virtual ~JSSVGPODTypeWrapper() { }
-
- virtual operator PODType() = 0;
- virtual void commitChange(PODType, DOMObject*) = 0;
-};
-
-// This file contains JS wrapper objects for SVG datatypes, that are passed around by value
-// in WebCore/svg (aka. 'POD types'). For instance SVGMatrix is mapped to AffineTransform, and
-// passed around as const reference. SVG DOM demands these objects to be "live", changes to any
-// of the writable attributes of SVGMatrix need to be reflected in the object which exposed the
-// SVGMatrix object (i.e. 'someElement.transform.matrix.a = 50.0', in that case 'SVGTransform').
-// The SVGTransform class stores its "AffineTransform m_matrix" object on the stack. If it would
-// be stored as pointer we could just build an auto-generated JSSVG* wrapper object around it
-// and all changes to that object would automatically affect the AffineTransform* object stored
-// in the SVGTransform object. For the sake of efficiency and memory we don't pass around any
-// primitive values as pointers, so a custom JS wrapper object is needed for all SVG types, that
-// are internally represented by POD types (SVGRect <-> FloatRect, SVGPoint <-> FloatPoint, ...).
-// Those custom wrappers are called JSSVGPODTypeWrapper and are capable of updating the POD types
-// by taking function pointers to the getter & setter functions of the "creator object", the object
-// which exposed a SVG POD type. For example, the JSSVGPODTypeWrapper object wrapping a SVGMatrix
-// object takes (SVGTransform*, &SVGTransform::matrix, &SVGTransform::setMatrix). A JS call like
-// "someElement.transform.matrix.a = 50.0' causes the JSSVGMatrix object to call SVGTransform::setMatrix,
-// method, which in turn notifies 'someElement' that the 'SVGNames::transformAttr' has changed.
-// That's a short sketch of our SVG DOM implementation.
-
-// Represents a JS wrapper object for SVGAnimated* classes, exposing SVG POD types that contain writable properties
-// (Two cases: SVGAnimatedLength exposing SVGLength, SVGAnimatedRect exposing SVGRect)
-
-#if COMPILER(MSVC)
-// GetterMethod and SetterMethod are each 12 bytes. We have to pack to a size
-// greater than or equal to that to avoid an alignment warning (C4121). 16 is
-// the next-largest size allowed for packing, so we use that.
-#pragma pack(push, 16)
-#endif
-template<typename PODType, typename PODTypeCreator>
-class JSSVGDynamicPODTypeWrapper : public JSSVGPODTypeWrapper<PODType> {
-public:
- typedef PODType (PODTypeCreator::*GetterMethod)() const;
- typedef void (PODTypeCreator::*SetterMethod)(const PODType&);
-
- static PassRefPtr<JSSVGDynamicPODTypeWrapper> create(PassRefPtr<PODTypeCreator> creator, GetterMethod getter, SetterMethod setter)
- {
- return adoptRef(new JSSVGDynamicPODTypeWrapper(creator, getter, setter));
- }
-
- virtual operator PODType()
- {
- return (m_creator.get()->*m_getter)();
- }
-
- virtual void commitChange(PODType type, DOMObject* wrapper)
- {
- (m_creator.get()->*m_setter)(type);
- JSSVGContextCache::propagateSVGDOMChange(wrapper, m_creator->associatedAttributeName());
- }
-
-private:
- JSSVGDynamicPODTypeWrapper(PassRefPtr<PODTypeCreator> creator, GetterMethod getter, SetterMethod setter)
- : m_creator(creator)
- , m_getter(getter)
- , m_setter(setter)
- {
- ASSERT(m_creator);
- ASSERT(m_getter);
- ASSERT(m_setter);
- }
-
- virtual ~JSSVGDynamicPODTypeWrapper();
-
- // Update callbacks
- RefPtr<PODTypeCreator> m_creator;
- GetterMethod m_getter;
- SetterMethod m_setter;
-};
-#if COMPILER(MSVC)
-#pragma pack(pop)
-#endif
-
-// Represents a JS wrapper object for SVG POD types (not for SVGAnimated* classes). Any modification to the SVG POD
-// types don't cause any updates unlike JSSVGDynamicPODTypeWrapper. This class is used for return values (ie. getBBox())
-// and for properties where SVG specification explicitly states, that the contents of the POD type are immutable.
-
-template<typename PODType>
-class JSSVGStaticPODTypeWrapper : public JSSVGPODTypeWrapper<PODType> {
-public:
- static PassRefPtr<JSSVGStaticPODTypeWrapper> create(PODType type)
- {
- return adoptRef(new JSSVGStaticPODTypeWrapper(type));
- }
-
- virtual operator PODType()
- {
- return m_podType;
- }
-
- virtual void commitChange(PODType type, DOMObject*)
- {
- m_podType = type;
- }
-
-protected:
- JSSVGStaticPODTypeWrapper(PODType type)
- : m_podType(type)
- {
- }
-
- PODType m_podType;
-};
-
-template<typename PODType, typename ParentTypeArg>
-class JSSVGStaticPODTypeWrapperWithPODTypeParent : public JSSVGStaticPODTypeWrapper<PODType> {
-public:
- typedef JSSVGPODTypeWrapper<ParentTypeArg> ParentType;
-
- static PassRefPtr<JSSVGStaticPODTypeWrapperWithPODTypeParent> create(PODType type, PassRefPtr<ParentType> parent)
- {
- return adoptRef(new JSSVGStaticPODTypeWrapperWithPODTypeParent(type, parent));
- }
-
- virtual void commitChange(PODType type, DOMObject* wrapper)
- {
- JSSVGStaticPODTypeWrapper<PODType>::commitChange(type, wrapper);
- m_parentType->commitChange(ParentTypeArg(type), wrapper);
- }
-
-private:
- JSSVGStaticPODTypeWrapperWithPODTypeParent(PODType type, PassRefPtr<ParentType> parent)
- : JSSVGStaticPODTypeWrapper<PODType>(type)
- , m_parentType(parent)
- {
- }
-
- RefPtr<ParentType> m_parentType;
-};
-
-#if COMPILER(MSVC)
-// GetterMethod and SetterMethod are each 12 bytes. We have to pack to a size
-// greater than or equal to that to avoid an alignment warning (C4121). 16 is
-// the next-largest size allowed for packing, so we use that.
-#pragma pack(push, 16)
-#endif
-template<typename PODType, typename ParentType>
-class JSSVGStaticPODTypeWrapperWithParent : public JSSVGPODTypeWrapper<PODType> {
-public:
- typedef PODType (ParentType::*GetterMethod)() const;
- typedef void (ParentType::*SetterMethod)(const PODType&);
-
- static PassRefPtr<JSSVGStaticPODTypeWrapperWithParent> create(PassRefPtr<ParentType> parent, GetterMethod getter, SetterMethod setter)
- {
- return adoptRef(new JSSVGStaticPODTypeWrapperWithParent(parent, getter, setter));
- }
-
- virtual operator PODType()
- {
- return (m_parent.get()->*m_getter)();
- }
-
- virtual void commitChange(PODType type, DOMObject*)
- {
- (m_parent.get()->*m_setter)(type);
- }
-
-private:
- JSSVGStaticPODTypeWrapperWithParent(PassRefPtr<ParentType> parent, GetterMethod getter, SetterMethod setter)
- : m_parent(parent)
- , m_getter(getter)
- , m_setter(setter)
- {
- ASSERT(m_parent);
- ASSERT(m_getter);
- ASSERT(m_setter);
- }
-
- // Update callbacks
- RefPtr<ParentType> m_parent;
- GetterMethod m_getter;
- SetterMethod m_setter;
-};
-
-template<typename PODType>
-class SVGPODListItem;
-
-// Just like JSSVGDynamicPODTypeWrapper, but only used for SVGList* objects wrapping around POD values.
-
-template<typename PODType>
-class JSSVGPODTypeWrapperCreatorForList : public JSSVGPODTypeWrapper<PODType> {
-public:
- typedef SVGPODListItem<PODType> PODListItemPtrType;
-
- typedef PODType (SVGPODListItem<PODType>::*GetterMethod)() const;
- typedef void (SVGPODListItem<PODType>::*SetterMethod)(const PODType&);
-
- static PassRefPtr<JSSVGPODTypeWrapperCreatorForList> create(PassRefPtr<PODListItemPtrType> creator, const QualifiedName& attributeName)
- {
- return adoptRef(new JSSVGPODTypeWrapperCreatorForList(creator, attributeName));
- }
-
- virtual operator PODType()
- {
- return (m_creator.get()->*m_getter)();
- }
-
- virtual void commitChange(PODType type, DOMObject* wrapper)
- {
- if (!m_setter)
- return;
-
- (m_creator.get()->*m_setter)(type);
- JSSVGContextCache::propagateSVGDOMChange(wrapper, m_associatedAttributeName);
- }
-
-private:
- JSSVGPODTypeWrapperCreatorForList(PassRefPtr<PODListItemPtrType> creator, const QualifiedName& attributeName)
- : m_creator(creator)
- , m_getter(&PODListItemPtrType::value)
- , m_setter(&PODListItemPtrType::setValue)
- , m_associatedAttributeName(attributeName)
- {
- ASSERT(m_creator);
- ASSERT(m_getter);
- ASSERT(m_setter);
- }
-
- // Update callbacks
- RefPtr<PODListItemPtrType> m_creator;
- GetterMethod m_getter;
- SetterMethod m_setter;
- const QualifiedName& m_associatedAttributeName;
-};
-
-// Caching facilities
-template<typename PODType, typename PODTypeCreator>
-struct PODTypeWrapperCacheInfo {
- typedef PODType (PODTypeCreator::*GetterMethod)() const;
- typedef void (PODTypeCreator::*SetterMethod)(const PODType&);
-
- // Empty value
- PODTypeWrapperCacheInfo()
- : creator(0)
- , getter(0)
- , setter(0)
- {
- }
-
- // Deleted value
- PODTypeWrapperCacheInfo(WTF::HashTableDeletedValueType)
- : creator(reinterpret_cast<PODTypeCreator*>(-1))
- , getter(0)
- , setter(0)
- {
- }
- bool isHashTableDeletedValue() const
- {
- return creator == reinterpret_cast<PODTypeCreator*>(-1);
- }
-
- PODTypeWrapperCacheInfo(PODTypeCreator* _creator, GetterMethod _getter, SetterMethod _setter)
- : creator(_creator)
- , getter(_getter)
- , setter(_setter)
- {
- ASSERT(creator);
- ASSERT(getter);
- }
-
- bool operator==(const PODTypeWrapperCacheInfo& other) const
- {
- return creator == other.creator && getter == other.getter && setter == other.setter;
- }
-
- PODTypeCreator* creator;
- GetterMethod getter;
- SetterMethod setter;
-};
-#if COMPILER(MSVC)
-#pragma pack(pop)
-#endif
-
-template<typename PODType, typename PODTypeCreator>
-struct PODTypeWrapperCacheInfoHash {
- typedef PODTypeWrapperCacheInfo<PODType, PODTypeCreator> CacheInfo;
-
- static unsigned hash(const CacheInfo& info)
- {
- return WTF::StringHasher::createBlobHash<sizeof(CacheInfo)>(&info);
- }
-
- static bool equal(const CacheInfo& a, const CacheInfo& b)
- {
- return a == b;
- }
-
- static const bool safeToCompareToEmptyOrDeleted = true;
-};
-
-template<typename PODType, typename PODTypeCreator>
-struct PODTypeWrapperCacheInfoTraits : WTF::GenericHashTraits<PODTypeWrapperCacheInfo<PODType, PODTypeCreator> > {
- typedef PODTypeWrapperCacheInfo<PODType, PODTypeCreator> CacheInfo;
-
- static const bool emptyValueIsZero = true;
- static const bool needsDestruction = false;
-
- static const CacheInfo& emptyValue()
- {
- DEFINE_STATIC_LOCAL(CacheInfo, key, ());
- return key;
- }
-
- static void constructDeletedValue(CacheInfo& slot)
- {
- new (&slot) CacheInfo(WTF::HashTableDeletedValue);
- }
-
- static bool isDeletedValue(const CacheInfo& value)
- {
- return value.isHashTableDeletedValue();
- }
-};
-
-// Used for dynamic read-write attributes
-template<typename PODType, typename PODTypeCreator>
-class JSSVGDynamicPODTypeWrapperCache {
-public:
- typedef PODType (PODTypeCreator::*GetterMethod)() const;
- typedef void (PODTypeCreator::*SetterMethod)(const PODType&);
-
- typedef PODTypeWrapperCacheInfo<PODType, PODTypeCreator> CacheInfo;
- typedef PODTypeWrapperCacheInfoHash<PODType, PODTypeCreator> CacheInfoHash;
- typedef PODTypeWrapperCacheInfoTraits<PODType, PODTypeCreator> CacheInfoTraits;
-
- typedef JSSVGPODTypeWrapper<PODType> WrapperBase;
- typedef JSSVGDynamicPODTypeWrapper<PODType, PODTypeCreator> Wrapper;
- typedef HashMap<CacheInfo, Wrapper*, CacheInfoHash, CacheInfoTraits> WrapperMap;
-
- static WrapperMap& wrapperMap()
- {
- DEFINE_STATIC_LOCAL(WrapperMap, s_wrapperMap, ());
- return s_wrapperMap;
- }
-
- static PassRefPtr<WrapperBase> lookupOrCreateWrapper(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter)
- {
- CacheInfo info(creator, getter, setter);
- pair<typename WrapperMap::iterator, bool> result = wrapperMap().add(info, 0);
- if (!result.second) // pre-existing entry
- return result.first->second;
-
- RefPtr<Wrapper> wrapper = Wrapper::create(creator, getter, setter);
- result.first->second = wrapper.get();
- return wrapper.release();
- }
-
- static void forgetWrapper(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter)
- {
- CacheInfo info(creator, getter, setter);
- wrapperMap().remove(info);
- }
-};
-
-template<typename PODType, typename PODTypeCreator>
-JSSVGDynamicPODTypeWrapper<PODType, PODTypeCreator>::~JSSVGDynamicPODTypeWrapper()
-{
- JSSVGDynamicPODTypeWrapperCache<PODType, PODTypeCreator>::forgetWrapper(m_creator.get(), m_getter, m_setter);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SVG)
-#endif // JSSVGPODTypeWrapper_h
diff --git a/WebCore/bindings/js/JSSVGPathSegCustom.cpp b/WebCore/bindings/js/JSSVGPathSegCustom.cpp
index eac2c4b..f0aa86b 100644
--- a/WebCore/bindings/js/JSSVGPathSegCustom.cpp
+++ b/WebCore/bindings/js/JSSVGPathSegCustom.cpp
@@ -58,58 +58,56 @@ using namespace JSC;
namespace WebCore {
-JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, SVGPathSeg* object, SVGElement* context)
+JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, SVGPathSeg* object)
{
if (!object)
return jsNull();
- if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, object)) {
- ASSERT(JSSVGContextCache::svgContextForDOMObject(wrapper) == context);
+ if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, object))
return wrapper;
- }
switch (object->pathSegType()) {
case SVGPathSeg::PATHSEG_CLOSEPATH:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegClosePath, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegClosePath, object);
case SVGPathSeg::PATHSEG_MOVETO_ABS:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegMovetoAbs, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegMovetoAbs, object);
case SVGPathSeg::PATHSEG_MOVETO_REL:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegMovetoRel, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegMovetoRel, object);
case SVGPathSeg::PATHSEG_LINETO_ABS:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoAbs, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoAbs, object);
case SVGPathSeg::PATHSEG_LINETO_REL:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoRel, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoRel, object);
case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicAbs, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicAbs, object);
case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicRel, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicRel, object);
case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticAbs, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticAbs, object);
case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticRel, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticRel, object);
case SVGPathSeg::PATHSEG_ARC_ABS:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegArcAbs, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegArcAbs, object);
case SVGPathSeg::PATHSEG_ARC_REL:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegArcRel, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegArcRel, object);
case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoHorizontalAbs, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoHorizontalAbs, object);
case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoHorizontalRel, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoHorizontalRel, object);
case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoVerticalAbs, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoVerticalAbs, object);
case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoVerticalRel, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegLinetoVerticalRel, object);
case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicSmoothAbs, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicSmoothAbs, object);
case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicSmoothRel, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoCubicSmoothRel, object);
case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticSmoothAbs, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticSmoothAbs, object);
case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticSmoothRel, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSegCurvetoQuadraticSmoothRel, object);
case SVGPathSeg::PATHSEG_UNKNOWN:
default:
- return CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, SVGPathSeg, object, context);
+ return CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, SVGPathSeg, object);
}
}
diff --git a/WebCore/bindings/js/JSSVGPathSegListCustom.cpp b/WebCore/bindings/js/JSSVGPathSegListCustom.cpp
deleted file mode 100644
index 9767c1a..0000000
--- a/WebCore/bindings/js/JSSVGPathSegListCustom.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * 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(SVG)
-#include "JSSVGPathSegList.h"
-
-#include "Document.h"
-#include "Frame.h"
-#include "JSSVGContextCache.h"
-#include "JSSVGPathSeg.h"
-#include "SVGDocumentExtensions.h"
-#include "SVGElement.h"
-#include "SVGPathSegList.h"
-
-#include <wtf/Assertions.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSValue JSSVGPathSegList::clear(ExecState* exec)
-{
- ExceptionCode ec = 0;
-
- SVGPathSegList* list = impl();
- list->clear(ec);
-
- setDOMException(exec, ec);
-
- JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
- return jsUndefined();
-}
-
-JSValue JSSVGPathSegList::initialize(ExecState* exec)
-{
- ExceptionCode ec = 0;
- SVGPathSeg* newItem = toSVGPathSeg(exec->argument(0));
-
- SVGPathSegList* list = impl();
-
- SVGPathSeg* obj = WTF::getPtr(list->initialize(newItem, ec));
- SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
-
- JSValue result = toJS(exec, globalObject(), obj, context);
- setDOMException(exec, ec);
-
- JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
- return result;
-}
-
-JSValue JSSVGPathSegList::getItem(ExecState* exec)
-{
- ExceptionCode ec = 0;
-
- bool indexOk;
- unsigned index = finiteInt32Value(exec->argument(0), exec, indexOk);
- if (!indexOk) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- SVGPathSegList* list = impl();
- SVGPathSeg* obj = WTF::getPtr(list->getItem(index, ec));
- SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
-
- JSValue result = toJS(exec, globalObject(), obj, context);
- setDOMException(exec, ec);
- return result;
-}
-
-JSValue JSSVGPathSegList::insertItemBefore(ExecState* exec)
-{
- ExceptionCode ec = 0;
- SVGPathSeg* newItem = toSVGPathSeg(exec->argument(0));
-
- bool indexOk;
- unsigned index = finiteInt32Value(exec->argument(1), exec, indexOk);
- if (!indexOk) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- SVGPathSegList* list = impl();
- SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
-
- JSValue result = toJS(exec, globalObject(), WTF::getPtr(list->insertItemBefore(newItem, index, ec)), context);
- setDOMException(exec, ec);
-
- JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
- return result;
-}
-
-JSValue JSSVGPathSegList::replaceItem(ExecState* exec)
-{
- ExceptionCode ec = 0;
- SVGPathSeg* newItem = toSVGPathSeg(exec->argument(0));
-
- bool indexOk;
- unsigned index = finiteInt32Value(exec->argument(1), exec, indexOk);
- if (!indexOk) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- SVGPathSegList* list = impl();
- SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
-
- JSValue result = toJS(exec, globalObject(), WTF::getPtr(list->replaceItem(newItem, index, ec)), context);
- setDOMException(exec, ec);
-
- JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
- return result;
-}
-
-JSValue JSSVGPathSegList::removeItem(ExecState* exec)
-{
- ExceptionCode ec = 0;
-
- bool indexOk;
- unsigned index = finiteInt32Value(exec->argument(0), exec, indexOk);
- if (!indexOk) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- SVGPathSegList* list = impl();
-
- RefPtr<SVGPathSeg> obj(list->removeItem(index, ec));
- SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
-
- JSValue result = toJS(exec, globalObject(), obj.get(), context);
- setDOMException(exec, ec);
-
- JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
- return result;
-}
-
-JSValue JSSVGPathSegList::appendItem(ExecState* exec)
-{
- ExceptionCode ec = 0;
- SVGPathSeg* newItem = toSVGPathSeg(exec->argument(0));
-
- SVGPathSegList* list = impl();
- SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
-
- JSValue result = toJS(exec, globalObject(), WTF::getPtr(list->appendItem(newItem, ec)), context);
- setDOMException(exec, ec);
-
- JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
- return result;
-}
-
-}
-
-#endif // ENABLE(SVG)
diff --git a/WebCore/bindings/js/JSUint16ArrayCustom.cpp b/WebCore/bindings/js/JSUint16ArrayCustom.cpp
index 9f12fa7..6a024ee 100644
--- a/WebCore/bindings/js/JSUint16ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSUint16ArrayCustom.cpp
@@ -27,9 +27,9 @@
#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-#include "JSArrayBufferViewHelper.h"
#include "JSUint16Array.h"
+#include "JSArrayBufferViewHelper.h"
#include "Uint16Array.h"
using namespace JSC;
@@ -54,7 +54,7 @@ JSC::JSValue JSUint16Array::set(JSC::ExecState* exec)
EncodedJSValue JSC_HOST_CALL JSUint16ArrayConstructor::constructJSUint16Array(ExecState* exec)
{
JSUint16ArrayConstructor* jsConstructor = static_cast<JSUint16ArrayConstructor*>(exec->callee());
- RefPtr<Uint16Array> array = static_cast<Uint16Array*>(constructArrayBufferView<Uint16Array, unsigned short>(exec).get());
+ RefPtr<Uint16Array> array = constructArrayBufferView<Uint16Array, unsigned short>(exec);
if (!array.get())
// Exception has already been thrown.
return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSUint32ArrayCustom.cpp b/WebCore/bindings/js/JSUint32ArrayCustom.cpp
index c757786..34eb8de 100644
--- a/WebCore/bindings/js/JSUint32ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSUint32ArrayCustom.cpp
@@ -27,9 +27,9 @@
#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-#include "JSArrayBufferViewHelper.h"
#include "JSUint32Array.h"
+#include "JSArrayBufferViewHelper.h"
#include "Uint32Array.h"
using namespace JSC;
@@ -54,7 +54,7 @@ JSC::JSValue JSUint32Array::set(JSC::ExecState* exec)
EncodedJSValue JSC_HOST_CALL JSUint32ArrayConstructor::constructJSUint32Array(ExecState* exec)
{
JSUint32ArrayConstructor* jsConstructor = static_cast<JSUint32ArrayConstructor*>(exec->callee());
- RefPtr<Uint32Array> array = static_cast<Uint32Array*>(constructArrayBufferView<Uint32Array, unsigned int>(exec).get());
+ RefPtr<Uint32Array> array = constructArrayBufferView<Uint32Array, unsigned int>(exec);
if (!array.get())
// Exception has already been thrown.
return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSUint8ArrayCustom.cpp b/WebCore/bindings/js/JSUint8ArrayCustom.cpp
index adf60a9..a9ed73f 100644
--- a/WebCore/bindings/js/JSUint8ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSUint8ArrayCustom.cpp
@@ -27,9 +27,9 @@
#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-#include "JSArrayBufferViewHelper.h"
#include "JSUint8Array.h"
+#include "JSArrayBufferViewHelper.h"
#include "Uint8Array.h"
using namespace JSC;
@@ -54,7 +54,7 @@ JSC::JSValue JSUint8Array::set(JSC::ExecState* exec)
EncodedJSValue JSC_HOST_CALL JSUint8ArrayConstructor::constructJSUint8Array(ExecState* exec)
{
JSUint8ArrayConstructor* jsConstructor = static_cast<JSUint8ArrayConstructor*>(exec->callee());
- RefPtr<Uint8Array> array = static_cast<Uint8Array*>(constructArrayBufferView<Uint8Array, unsigned char>(exec).get());
+ RefPtr<Uint8Array> array = constructArrayBufferView<Uint8Array, unsigned char>(exec);
if (!array.get())
// Exception has already been thrown.
return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSWebKitCSSKeyframeRuleCustom.cpp b/WebCore/bindings/js/JSWebKitCSSKeyframeRuleCustom.cpp
new file mode 100644
index 0000000..0eaebf1
--- /dev/null
+++ b/WebCore/bindings/js/JSWebKitCSSKeyframeRuleCustom.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSWebKitCSSKeyframeRule.h"
+
+#include "WebKitCSSKeyframeRule.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSWebKitCSSKeyframeRule::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ if (CSSMutableStyleDeclaration* style = static_cast<WebKitCSSKeyframeRule*>(impl())->style())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), style);
+}
+
+}
diff --git a/WebCore/bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp b/WebCore/bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp
new file mode 100644
index 0000000..b590b6a
--- /dev/null
+++ b/WebCore/bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSWebKitCSSKeyframesRule.h"
+
+#include "WebKitCSSKeyframesRule.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSWebKitCSSKeyframesRule::markChildren(MarkStack& markStack)
+{
+ Base::markChildren(markStack);
+
+ if (CSSRuleList* rules = static_cast<WebKitCSSKeyframesRule*>(impl())->cssRules())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), rules);
+}
+
+}
diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index 58d324d..7cf8207 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -29,6 +29,7 @@
#include "config.h"
#include "JSXMLHttpRequest.h"
+#include "ArrayBuffer.h"
#include "Blob.h"
#include "DOMFormData.h"
#include "DOMWindow.h"
@@ -38,6 +39,7 @@
#include "FrameLoader.h"
#include "HTMLDocument.h"
#include "InspectorInstrumentation.h"
+#include "JSArrayBuffer.h"
#include "JSBlob.h"
#include "JSDOMFormData.h"
#include "JSDOMWindowCustom.h"
@@ -59,6 +61,19 @@ void JSXMLHttpRequest::markChildren(MarkStack& markStack)
if (XMLHttpRequestUpload* upload = m_impl->optionalUpload())
markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), upload);
+ if (Document* responseDocument = m_impl->optionalResponseXML())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), responseDocument);
+
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+ if (ArrayBuffer* responseArrayBuffer = m_impl->optionalResponseArrayBuffer())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), responseArrayBuffer);
+#endif
+
+#if ENABLE(XHR_RESPONSE_BLOB)
+ if (Blob* responseBlob = m_impl->optionalResponseBlob())
+ markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), responseBlob);
+#endif
+
m_impl->markJSEventListeners(markStack);
}
@@ -77,7 +92,7 @@ JSValue JSXMLHttpRequest::open(ExecState* exec)
if (exec->argumentCount() >= 4 && !exec->argument(3).isUndefined()) {
String user = valueToStringWithNullCheck(exec, exec->argument(3));
-
+
if (exec->argumentCount() >= 5 && !exec->argument(4).isUndefined()) {
String password = valueToStringWithNullCheck(exec, exec->argument(4));
impl()->open(method, url, async, user, password, ec);
@@ -109,6 +124,10 @@ JSValue JSXMLHttpRequest::send(ExecState* exec)
impl()->send(toBlob(val), ec);
else if (val.inherits(&JSDOMFormData::s_info))
impl()->send(toDOMFormData(val), ec);
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+ else if (val.inherits(&JSArrayBuffer::s_info))
+ impl()->send(toArrayBuffer(val), ec);
+#endif
else
impl()->send(ustringToString(val.toString(exec)), ec);
}
@@ -136,6 +155,56 @@ JSValue JSXMLHttpRequest::responseText(ExecState* exec) const
return jsOwnedStringOrNull(exec, text);
}
+JSValue JSXMLHttpRequest::response(ExecState* exec) const
+{
+ switch (impl()->responseTypeCode()) {
+ case XMLHttpRequest::ResponseTypeDefault:
+ case XMLHttpRequest::ResponseTypeText:
+ return responseText(exec);
+
+ case XMLHttpRequest::ResponseTypeDocument:
+ {
+ ExceptionCode ec = 0;
+ Document* document = impl()->responseXML(ec);
+ if (ec) {
+ setDOMException(exec, ec);
+ return jsUndefined();
+ }
+ return toJS(exec, globalObject(), document);
+ }
+
+ case XMLHttpRequest::ResponseTypeBlob:
+#if ENABLE(XHR_RESPONSE_BLOB)
+ {
+ ExceptionCode ec = 0;
+ Blob* blob = impl()->responseBlob(ec);
+ if (ec) {
+ setDOMException(exec, ec);
+ return jsUndefined();
+ }
+ return toJS(exec, globalObject(), blob);
+ }
+#else
+ return jsUndefined();
+#endif
+
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+ case XMLHttpRequest::ResponseTypeArrayBuffer:
+ {
+ ExceptionCode ec = 0;
+ ArrayBuffer* arrayBuffer = impl()->responseArrayBuffer(ec);
+ if (ec) {
+ setDOMException(exec, ec);
+ return jsUndefined();
+ }
+ return toJS(exec, globalObject(), arrayBuffer);
+ }
+#endif
+ }
+
+ return jsUndefined();
+}
+
EncodedJSValue JSC_HOST_CALL JSXMLHttpRequestConstructor::constructJSXMLHttpRequest(ExecState* exec)
{
JSXMLHttpRequestConstructor* jsConstructor = static_cast<JSXMLHttpRequestConstructor*>(exec->callee());
diff --git a/WebCore/bindings/js/OptionsObject.h b/WebCore/bindings/js/OptionsObject.h
new file mode 100644
index 0000000..34910c0
--- /dev/null
+++ b/WebCore/bindings/js/OptionsObject.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef OptionsObject_h
+#define OptionsObject_h
+
+// FIXME: Implement.
+
+#endif // OptionsObject_h
diff --git a/WebCore/bindings/js/ScriptCallStackFactory.cpp b/WebCore/bindings/js/ScriptCallStackFactory.cpp
index 25fabdd..9a64ffc 100644
--- a/WebCore/bindings/js/ScriptCallStackFactory.cpp
+++ b/WebCore/bindings/js/ScriptCallStackFactory.cpp
@@ -48,7 +48,7 @@ using namespace JSC;
namespace WebCore {
-PassOwnPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize)
+PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize)
{
Vector<ScriptCallFrame> frames;
CallFrame* callFrame = exec;
@@ -75,16 +75,16 @@ PassOwnPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t m
break;
callFrame = callFrame->callerFrame();
}
- return new ScriptCallStack(frames);
+ return ScriptCallStack::create(frames);
}
-PassOwnPtr<ScriptArguments> createScriptArguments(JSC::ExecState* exec, unsigned skipArgumentCount)
+PassRefPtr<ScriptArguments> createScriptArguments(JSC::ExecState* exec, unsigned skipArgumentCount)
{
Vector<ScriptValue> arguments;
size_t argumentCount = exec->argumentCount();
for (size_t i = skipArgumentCount; i < argumentCount; ++i)
arguments.append(ScriptValue(exec->argument(i)));
- return new ScriptArguments(exec, arguments);
+ return ScriptArguments::create(exec, arguments);
}
bool ScriptCallStack::stackTrace(int, const RefPtr<InspectorArray>&)
diff --git a/WebCore/bindings/js/ScriptCallStackFactory.h b/WebCore/bindings/js/ScriptCallStackFactory.h
index 744d88d..9fbfc78 100644
--- a/WebCore/bindings/js/ScriptCallStackFactory.h
+++ b/WebCore/bindings/js/ScriptCallStackFactory.h
@@ -31,7 +31,7 @@
#ifndef ScriptCallStackFactory_h
#define ScriptCallStackFactory_h
-#include <wtf/PassOwnPtr.h>
+#include <wtf/Forward.h>
namespace JSC {
class ExecState;
@@ -42,8 +42,8 @@ namespace WebCore {
class ScriptArguments;
class ScriptCallStack;
-PassOwnPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState*, size_t maxStackSize);
-PassOwnPtr<ScriptArguments> createScriptArguments(JSC::ExecState*, unsigned skipArgumentCount);
+PassRefPtr<ScriptCallStack> createScriptCallStack(JSC::ExecState*, size_t maxStackSize);
+PassRefPtr<ScriptArguments> createScriptArguments(JSC::ExecState*, unsigned skipArgumentCount);
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptHeapSnapshot.h b/WebCore/bindings/js/ScriptHeapSnapshot.h
index c81c782..4c3d915 100644
--- a/WebCore/bindings/js/ScriptHeapSnapshot.h
+++ b/WebCore/bindings/js/ScriptHeapSnapshot.h
@@ -38,15 +38,22 @@ namespace WebCore {
class ScriptHeapSnapshot : public RefCounted<ScriptHeapSnapshot> {
public:
- virtual ~ScriptHeapSnapshot() {}
+ class OutputStream {
+ public:
+ virtual ~OutputStream() { }
+ virtual void Write(const String& chunk) = 0;
+ virtual void Close() = 0;
+ };
+
+ virtual ~ScriptHeapSnapshot() { }
String title() const { return ""; }
unsigned int uid() const { return 0; }
- PassRefPtr<InspectorObject> buildInspectorObjectForHead() const { return InspectorObject::create(); }
+ void writeJSON(OutputStream*) { }
private:
- ScriptHeapSnapshot() {}
+ ScriptHeapSnapshot() { }
};
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptProfile.cpp b/WebCore/bindings/js/ScriptProfile.cpp
index 8731ec2..84451fb 100644
--- a/WebCore/bindings/js/ScriptProfile.cpp
+++ b/WebCore/bindings/js/ScriptProfile.cpp
@@ -66,6 +66,7 @@ ScriptProfileNode* ScriptProfile::head() const
return m_profile->head();
}
+#if ENABLE(INSPECTOR)
static PassRefPtr<InspectorObject> buildInspectorObjectFor(const JSC::ProfileNode* node)
{
RefPtr<InspectorObject> result = InspectorObject::create();
@@ -94,6 +95,7 @@ PassRefPtr<InspectorObject> ScriptProfile::buildInspectorObjectForHead() const
{
return buildInspectorObjectFor(m_profile->head());
}
+#endif
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptProfile.h b/WebCore/bindings/js/ScriptProfile.h
index b39d2c9..0b38edc 100644
--- a/WebCore/bindings/js/ScriptProfile.h
+++ b/WebCore/bindings/js/ScriptProfile.h
@@ -51,7 +51,9 @@ public:
unsigned int uid() const;
ScriptProfileNode* head() const;
+#if ENABLE(INSPECTOR)
PassRefPtr<InspectorObject> buildInspectorObjectForHead() const;
+#endif
private:
ScriptProfile(PassRefPtr<JSC::Profile> profile);
diff --git a/WebCore/bindings/js/ScriptValue.cpp b/WebCore/bindings/js/ScriptValue.cpp
index a58e0c7..a2a72b6 100644
--- a/WebCore/bindings/js/ScriptValue.cpp
+++ b/WebCore/bindings/js/ScriptValue.cpp
@@ -84,6 +84,12 @@ bool ScriptValue::isObject() const
return m_value.get().isObject();
}
+bool ScriptValue::isFunction() const
+{
+ CallData callData;
+ return getCallData(m_value, callData) != CallTypeNone;
+}
+
PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState)
{
return SerializedScriptValue::create(scriptState, jsValue());
diff --git a/WebCore/bindings/js/ScriptValue.h b/WebCore/bindings/js/ScriptValue.h
index b170fcf..5746c3f 100644
--- a/WebCore/bindings/js/ScriptValue.h
+++ b/WebCore/bindings/js/ScriptValue.h
@@ -55,8 +55,11 @@ public:
bool isNull() const;
bool isUndefined() const;
bool isObject() const;
+ bool isFunction() const;
bool hasNoValue() const { return m_value == JSC::JSValue(); }
+ bool operator==(const ScriptValue& other) const { return m_value == other.m_value; }
+
PassRefPtr<SerializedScriptValue> serialize(ScriptState*);
static ScriptValue deserialize(ScriptState*, SerializedScriptValue*);
diff --git a/WebCore/bindings/objc/DOMSVG.h b/WebCore/bindings/objc/DOMSVG.h
index 1fdab9a..4fc69fd 100644
--- a/WebCore/bindings/objc/DOMSVG.h
+++ b/WebCore/bindings/objc/DOMSVG.h
@@ -38,7 +38,6 @@
#import <WebCore/DOMSVGAnimatedLengthList.h>
#import <WebCore/DOMSVGAnimatedNumber.h>
#import <WebCore/DOMSVGAnimatedNumberList.h>
-#import <WebCore/DOMSVGAnimatedPathData.h>
#import <WebCore/DOMSVGAnimatedPreserveAspectRatio.h>
#import <WebCore/DOMSVGAnimatedRect.h>
#import <WebCore/DOMSVGAnimatedString.h>
diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm
index 1e56b0c..9a9e9d7 100644
--- a/WebCore/bindings/scripts/CodeGenerator.pm
+++ b/WebCore/bindings/scripts/CodeGenerator.pm
@@ -75,6 +75,7 @@ my %svgTypeNeedingTearOff = (
"SVGMatrix" => "SVGPropertyTearOff<SVGMatrix>",
"SVGNumber" => "SVGPropertyTearOff<float>",
"SVGNumberList" => "SVGListPropertyTearOff<SVGNumberList>",
+ "SVGPathSegList" => "SVGPathSegListPropertyTearOff",
"SVGPoint" => "SVGPropertyTearOff<FloatPoint>",
"SVGPointList" => "SVGListPropertyTearOff<SVGPointList>",
"SVGPreserveAspectRatio" => "SVGPropertyTearOff<SVGPreserveAspectRatio>",
@@ -307,8 +308,8 @@ sub AvoidInclusionOfType
my $object = shift;
my $type = shift;
- # Special case: SVGRect.h / SVGPoint.h / SVGNumber.h do not exist.
- return 1 if $type eq "SVGRect" or $type eq "SVGPoint" or $type eq "SVGNumber";
+ # Special case: SVGPoint.h / SVGNumber.h do not exist.
+ return 1 if $type eq "SVGPoint" or $type eq "SVGNumber";
return 0;
}
diff --git a/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/WebCore/bindings/scripts/CodeGeneratorCPP.pm
index f9dd5f2..9b3f21e 100644
--- a/WebCore/bindings/scripts/CodeGeneratorCPP.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorCPP.pm
@@ -25,8 +25,6 @@
package CodeGeneratorCPP;
-use File::stat;
-
# Global Variables
my $module = "";
my $outputDir = "";
diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm
index 6c450ad..e2773b8 100644
--- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm
@@ -110,6 +110,7 @@ sub FixUpDecamelizedName {
# FIXME: try to merge this somehow with the fixes in ClassNameToGobjectType
$classname =~ s/x_path/xpath/;
$classname =~ s/web_kit/webkit/;
+ $classname =~ s/htmli_frame/html_iframe/;
return $classname;
}
@@ -118,8 +119,8 @@ sub ClassNameToGObjectType {
my $className = shift;
my $CLASS_NAME = uc(decamelize($className));
# Fixup: with our prefix being 'WebKitDOM' decamelize can't get
- # WebKitDOMCSS right, so we have to fix it manually (and there
- # might be more like this in the future)
+ # WebKitDOMCSS and similar names right, so we have to fix it
+ # manually.
$CLASS_NAME =~ s/DOMCSS/DOM_CSS/;
$CLASS_NAME =~ s/DOMHTML/DOM_HTML/;
$CLASS_NAME =~ s/DOMDOM/DOM_DOM/;
@@ -127,6 +128,7 @@ sub ClassNameToGObjectType {
$CLASS_NAME =~ s/DOMX_PATH/DOM_XPATH/;
$CLASS_NAME =~ s/DOM_WEB_KIT/DOM_WEBKIT/;
$CLASS_NAME =~ s/DOMUI/DOM_UI/;
+ $CLASS_NAME =~ s/HTMLI_FRAME/HTML_IFRAME/;
return $CLASS_NAME;
}
@@ -210,8 +212,11 @@ sub SkipFunction {
# Skip functions that have ["Callback"] parameters, because this
# code generator doesn't know how to auto-generate callbacks.
+ # Skip functions that have "MediaQueryListListener" parameters, because this
+ # code generator doesn't know how to auto-generate MediaQueryListListener.
foreach my $param (@{$function->parameters}) {
- if ($param->extendedAttributes->{"Callback"}) {
+ if ($param->extendedAttributes->{"Callback"} ||
+ $param->type eq "MediaQueryListListener") {
return 1;
}
}
@@ -599,7 +604,8 @@ EOF
push(@txtSetProps, $txtSetProps);
foreach my $attribute (@readableProperties) {
- if ($attribute->signature->type ne "EventListener") {
+ if ($attribute->signature->type ne "EventListener" &&
+ $attribute->signature->type ne "MediaQueryListListener") {
GenerateProperty($attribute, $interfaceName, \@writeableProperties);
}
}
@@ -766,6 +772,7 @@ sub getIncludeHeader {
return "" if $type eq "unsigned short";
return "" if $type eq "DOMTimeStamp";
return "" if $type eq "EventListener";
+ return "" if $type eq "MediaQueryListListener";
return "" if $type eq "unsigned char";
return "" if $type eq "DOMString";
return "" if $type eq "float";
@@ -800,6 +807,10 @@ sub GenerateFunction {
my $decamelize = FixUpDecamelizedName(decamelize($interfaceName));
+ if ($object eq "MediaQueryListListener") {
+ return;
+ }
+
if (SkipFunction($function, $decamelize, $prefix)) {
return;
}
@@ -821,7 +832,7 @@ sub GenerateFunction {
foreach my $param (@{$function->parameters}) {
my $paramIDLType = $param->type;
- if ($paramIDLType eq "EventListener") {
+ if ($paramIDLType eq "EventListener" || $paramIDLType eq "MediaQueryListListener") {
push(@hBody, "\n/* TODO: event function ${functionName} */\n\n");
push(@cBody, "\n/* TODO: event function ${functionName} */\n\n");
return;
@@ -974,7 +985,7 @@ sub GenerateFunction {
bool ok = item->${functionSigName}(${callImplParams}${exceptions});
if (ok)
{
- ${returnType} res = static_cast<${returnType}>(WebKit::kit($returnParamName));
+ ${returnType} res = WebKit::kit($returnParamName);
return res;
}
EOF
@@ -1029,7 +1040,7 @@ EOF
if ($returnType ne "void" && !$functionHasCustomReturn) {
if ($functionSigType ne "DOMObject") {
if ($returnValueIsGDOMType) {
- push(@cBody, " ${returnType} res = static_cast<${returnType}>(WebKit::kit(g_res.get()));\n");
+ push(@cBody, " ${returnType} res = WebKit::kit(g_res.get());\n");
}
}
if ($functionSigType eq "DOMObject") {
@@ -1075,7 +1086,9 @@ sub GenerateFunctions {
TOP:
foreach my $attribute (@{$dataNode->attributes}) {
- if (SkipAttribute($attribute) || $attribute->signature->type eq "EventListener") {
+ if (SkipAttribute($attribute) ||
+ $attribute->signature->type eq "EventListener" ||
+ $attribute->signature->type eq "MediaQueryListListener") {
next TOP;
}
@@ -1239,7 +1252,7 @@ EOF
if ($className ne "WebKitDOMNode") {
$text = << "EOF";
- gpointer
+ ${className}*
kit(WebCore::${interfaceName}* node);
EOF
@@ -1322,6 +1335,7 @@ sub Generate {
$implIncludes{"webkitmarshal.h"} = 1;
$implIncludes{"webkitprivate.h"} = 1;
+ $implIncludes{"DOMObjectCache.h"} = 1;
$implIncludes{"WebKitDOMBinding.h"} = 1;
$implIncludes{"gobject/ConvertToUTF8String.h"} = 1;
$implIncludes{"webkit/$className.h"} = 1;
@@ -1336,14 +1350,14 @@ sub Generate {
my $converter = << "EOF";
namespace WebKit {
-gpointer kit(WebCore::$interfaceName* obj)
+${className}* kit(WebCore::$interfaceName* obj)
{
g_return_val_if_fail(obj, 0);
if (gpointer ret = DOMObjectCache::get(obj))
- return ret;
+ return static_cast<${className}*>(ret);
- return DOMObjectCache::put(obj, WebKit::wrap${interfaceName}(obj));
+ return static_cast<${className}*>(DOMObjectCache::put(obj, WebKit::wrap${interfaceName}(obj)));
}
} // namespace WebKit //
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index ea32615..1ad55e4 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -6,6 +6,7 @@
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
# Copyright (C) Research In Motion Limited 2010. All rights reserved.
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -24,8 +25,6 @@
package CodeGeneratorJS;
-use File::stat;
-
my $module = "";
my $outputDir = "";
my $writeDependencies = 0;
@@ -273,6 +272,10 @@ sub AddIncludesForType
if ($type eq "Document") {
$implIncludes{"NodeFilter.h"} = 1;
}
+
+ if ($type eq "MediaQueryListListener") {
+ $implIncludes{"MediaQueryListListener.h"} = 1;
+ }
}
# FIXME: This method will go away once all SVG animated properties are converted to the new scheme.
@@ -316,25 +319,6 @@ sub AddClassForwardIfNeeded
}
}
-# FIXME: This method will go away once all SVG animated properties are converted to the new scheme.
-sub IsSVGTypeNeedingContextParameter
-{
- # FIXME: This function will be removed, as soon the PODType concept is gone, and all SVG datatypes use the new style JS bindings.
-
- my $implClassName = shift;
-
- return 0 unless $implClassName =~ /SVG/;
- return 0 if $implClassName =~ /Element/;
- return 0 if $codeGenerator->IsSVGAnimatedType($implClassName);
- return 0 if $codeGenerator->IsSVGTypeNeedingTearOff($implClassName);
-
- my @noContextNeeded = ("SVGColor", "SVGDocument", "SVGPaint", "SVGZoomEvent");
- foreach (@noContextNeeded) {
- return 0 if $implClassName eq $_;
- }
- return 1;
-}
-
sub HashValueForClassAndName
{
my $class = shift;
@@ -937,8 +921,6 @@ sub GenerateHeader
if (!$hasParent || $dataNode->extendedAttributes->{"GenerateToJS"} || $dataNode->extendedAttributes->{"CustomToJS"}) {
if ($svgPropertyType) {
push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, $implType*);\n");
- } elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, $implType*, SVGElement* context);\n");
} else {
push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, $implType*);\n");
}
@@ -1461,8 +1443,6 @@ sub GenerateImplementation
} else {
push(@implContent, " forgetDOMObject(this, impl());\n");
}
-
- push(@implContent, " JSSVGContextCache::forgetWrapper(this);\n") if IsSVGTypeNeedingContextParameter($implClassName);
}
push(@implContent, "}\n\n");
@@ -1770,6 +1750,12 @@ sub GenerateImplementation
my $nativeValue = JSValueToNative($attribute->signature, "value");
if ($svgPropertyOrListPropertyType) {
+ if ($svgPropertyType) {
+ push(@implContent, " if (imp->role() == AnimValRole) {\n");
+ push(@implContent, " setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);\n");
+ push(@implContent, " return;\n");
+ push(@implContent, " }\n");
+ }
push(@implContent, " $svgPropertyOrListPropertyType& podImp = imp->propertyReference();\n");
if ($svgPropertyOrListPropertyType eq "float") { # Special case for JSSVGNumber
push(@implContent, " podImp = $nativeValue;\n");
@@ -1793,9 +1779,6 @@ sub GenerateImplementation
push(@implContent, ", ec") if @{$attribute->setterExceptions};
push(@implContent, ");\n");
push(@implContent, " setDOMException(exec, ec);\n") if @{$attribute->setterExceptions};
- if (IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@implContent, " JSSVGContextCache::propagateSVGDOMChange(castedThis, imp->associatedAttributeName());\n");
- }
}
}
@@ -1874,7 +1857,13 @@ sub GenerateImplementation
push(@implContent, " return JSValue::encode(castedThis->" . $functionImplementationName . "(exec));\n");
} else {
push(@implContent, " $implType* imp = static_cast<$implType*>(castedThis->impl());\n");
- push(@implContent, " $svgPropertyOrListPropertyType& podImp = imp->propertyReference();\n") if $svgPropertyType;
+ if ($svgPropertyType) {
+ push(@implContent, " if (imp->role() == AnimValRole) {\n");
+ push(@implContent, " setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);\n");
+ push(@implContent, " return JSValue::encode(jsUndefined());\n");
+ push(@implContent, " }\n");
+ push(@implContent, " $svgPropertyType& podImp = imp->propertyReference();\n");
+ }
my $numParameters = @{$function->parameters};
@@ -1917,9 +1906,9 @@ sub GenerateImplementation
my $hasOptionalArguments = 0;
if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
- push(@implContent, " OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, $numParameters));\n");
+ push(@implContent, " RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, $numParameters));\n");
push(@implContent, " size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;\n");
- push(@implContent, " OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));\n");
+ push(@implContent, " RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));\n");
$implIncludes{"ScriptArguments.h"} = 1;
$implIncludes{"ScriptCallStack.h"} = 1;
$implIncludes{"ScriptCallStackFactory.h"} = 1;
@@ -2077,7 +2066,7 @@ sub GenerateImplementation
if ($constant->type eq "DOMString") {
push(@implContent, " return jsStringOrNull(exec, String(" . $constant->value . "));\n");
} else {
- push(@implContent, " UNUSED_PARAM(exec);");
+ push(@implContent, " UNUSED_PARAM(exec);\n");
push(@implContent, " return jsNumber(static_cast<int>(" . $constant->value . "));\n");
}
push(@implContent, "}\n\n");
@@ -2115,16 +2104,12 @@ sub GenerateImplementation
if ((!$hasParent or $dataNode->extendedAttributes->{"GenerateToJS"}) and !$dataNode->extendedAttributes->{"CustomToJS"}) {
if ($svgPropertyType) {
push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object)\n");
- } elsif ($podType or IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object, SVGElement* context)\n");
} else {
push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object)\n");
}
push(@implContent, "{\n");
if ($svgPropertyType) {
push(@implContent, " return getDOMObjectWrapper<$className, $implType>(exec, globalObject, object);\n");
- } elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@implContent, " return getDOMObjectWrapper<$className>(exec, globalObject, object, context);\n");
} else {
push(@implContent, " return getDOMObjectWrapper<$className>(exec, globalObject, object);\n");
}
@@ -2315,7 +2300,7 @@ sub GenerateImplementationFunctionCall()
if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
$functionString .= ", " if $paramIndex;
$paramIndex += 2;
- $functionString .= "scriptArguments.release(), callStack.release()";
+ $functionString .= "scriptArguments, callStack";
}
if (@{$function->raisesExceptions}) {
@@ -2376,11 +2361,13 @@ my %nativeType = (
"boolean" => "bool",
"double" => "double",
"float" => "float",
+ "short" => "short",
"long" => "int",
"unsigned long" => "unsigned",
"unsigned short" => "unsigned short",
"long long" => "long long",
"unsigned long long" => "unsigned long long",
+ "MediaQueryListListener" => "RefPtr<MediaQueryListListener>"
);
sub GetNativeType
@@ -2425,6 +2412,11 @@ sub GetSVGPropertyTypes
$headerIncludes{"$svgWrappedNativeType.h"} = 1;
$headerIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1;
$headerIncludes{"SVGTransformListPropertyTearOff.h"} = 1;
+ } elsif ($svgNativeType =~ /SVGPathSegListPropertyTearOff/) {
+ $svgListPropertyType = $svgWrappedNativeType;
+ $headerIncludes{"$svgWrappedNativeType.h"} = 1;
+ $headerIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1;
+ $headerIncludes{"SVGPathSegListPropertyTearOff.h"} = 1;
}
return ($svgPropertyType, $svgListPropertyType, $svgNativeType);
@@ -2446,7 +2438,7 @@ sub JSValueToNative
return "$value.toBoolean(exec)" if $type eq "boolean";
return "$value.toNumber(exec)" if $type eq "double";
return "$value.toFloat(exec)" if $type eq "float";
- return "$value.toInt32(exec)" if $type eq "long";
+ return "$value.toInt32(exec)" if $type eq "long" or $type eq "short";
return "$value.toUInt32(exec)" if $type eq "unsigned long" or $type eq "unsigned short";
return "static_cast<$type>($value.toInteger(exec))" if $type eq "long long" or $type eq "unsigned long long";
@@ -2464,6 +2456,11 @@ sub JSValueToNative
return "$value";
}
+ if ($type eq "MediaQueryListListener") {
+ $implIncludes{"MediaQueryListListener.h"} = 1;
+ return "MediaQueryListListener::create(" . $value .")";
+ }
+
if ($type eq "SerializedScriptValue" or $type eq "any") {
$implIncludes{"SerializedScriptValue.h"} = 1;
return "SerializedScriptValue::create(exec, $value)";
@@ -2553,11 +2550,6 @@ sub NativeToJSValue
return $value if $codeGenerator->IsSVGAnimatedType($type);
- if (IsSVGTypeNeedingContextParameter($type)) {
- my $contextPtr = IsSVGTypeNeedingContextParameter($implClassName) ? "JSSVGContextCache::svgContextForDOMObject(castedThis)" : "imp";
- return "toJS(exec, $globalObject, WTF::getPtr($value), $contextPtr)";
- }
-
if ($signature->extendedAttributes->{"ReturnsNew"}) {
return "toJSNewlyCreated(exec, $globalObject, WTF::getPtr($value))";
}
@@ -2594,7 +2586,7 @@ sub NativeToJSValue
} elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
my $extraImp = "GetOwnerElementForType<$implClassName, IsDerivedFromSVGElement<$implClassName>::value>::ownerElement(imp), ";
$value = "${tearOffType}::create($extraImp$value)";
- } elsif (not $tearOffType =~ /SVGPointList/) {
+ } elsif (not $tearOffType =~ /SVG(Point|PathSeg)List/) {
$value = "${tearOffType}::create($value)";
}
}
diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
index 50334a2..6ccebf9 100644
--- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
@@ -26,8 +26,6 @@
package CodeGeneratorObjC;
-use File::stat;
-
# Global Variables
my $module = "";
my $outputDir = "";
@@ -673,6 +671,9 @@ sub GetSVGPropertyTypes
} elsif ($svgNativeType =~ /SVGTransformListPropertyTearOff/) {
$svgListPropertyType = "WebCore::$svgWrappedNativeType";
$svgListPropertyType =~ s/</\<WebCore::/;
+ } elsif ($svgNativeType =~ /SVGPathSegListPropertyTearOff/) {
+ $svgListPropertyType = "WebCore::$svgWrappedNativeType";
+ $svgListPropertyType =~ s/</\<WebCore::/;
}
return ($svgPropertyType, $svgListPropertyType, $svgNativeType);
@@ -1004,6 +1005,7 @@ sub GenerateHeader
if ($svgListPropertyType) {
push(@internalHeaderContent, "#import <WebCore/SVGAnimatedListPropertyTearOff.h>\n\n");
push(@internalHeaderContent, "#import <WebCore/SVGTransformListPropertyTearOff.h>\n\n") if $svgListPropertyType =~ /SVGTransformList/;
+ push(@internalHeaderContent, "#import <WebCore/SVGPathSegListPropertyTearOff.h>\n\n") if $svgListPropertyType =~ /SVGPathSegList/;
}
push(@internalHeaderContent, $interfaceAvailabilityVersionCheck) if length $interfaceAvailabilityVersion;
@@ -1300,6 +1302,7 @@ sub GenerateImplementation
my $type = $attribute->signature->type;
if ($codeGenerator->IsSVGTypeNeedingTearOff($type) and not $implClassName =~ /List$/) {
my $idlTypeWithNamespace = GetSVGTypeWithNamespace($type);
+ $implIncludes{"$type.h"} = 1 if not $codeGenerator->AvoidInclusionOfType($type);
if ($codeGenerator->IsSVGTypeWithWritablePropertiesNeedingTearOff($type) and not defined $attribute->signature->extendedAttributes->{"Immutable"}) {
$idlTypeWithNamespace =~ s/SVGPropertyTearOff</SVGStaticPropertyTearOff<$implClassNameWithNamespace, /;
$implIncludes{"SVGStaticPropertyTearOff.h"} = 1;
@@ -1310,13 +1313,13 @@ sub GenerateImplementation
my $updateMethod = "&${implClassNameWithNamespace}::update" . $codeGenerator->WK_ucfirst($getter);
$getterContentHead = "kit(WTF::getPtr(${idlTypeWithNamespace}::create(IMPL, $getterContentHead$getterContentTail, $updateMethod";
$getterContentTail .= "))";
+ } elsif ($idlTypeWithNamespace =~ /SVG(Point|PathSeg)List/) {
+ $getterContentHead = "kit(WTF::getPtr($getterContentHead";
+ $getterContentTail .= "))";
} elsif ($idlTypeWithNamespace =~ /SVGStaticListPropertyTearOff/) {
my $extraImp = "WebCore::GetOwnerElementForType<$implClassNameWithNamespace, WebCore::IsDerivedFromSVGElement<$implClassNameWithNamespace>::value>::ownerElement(IMPL), ";
$getterContentHead = "kit(WTF::getPtr(${idlTypeWithNamespace}::create($extraImp$getterContentHead";
$getterContentTail .= ")))";
- } elsif ($idlTypeWithNamespace =~ /SVGPointList/) {
- $getterContentHead = "kit(WTF::getPtr($getterContentHead";
- $getterContentTail .= "))";
} else {
$getterContentHead = "kit(WTF::getPtr(${idlTypeWithNamespace}::create($getterContentHead";
$getterContentTail .= ")))";
@@ -1390,6 +1393,10 @@ sub GenerateImplementation
if ($svgPropertyType) {
$getterContentHead = "$getterExpressionPrefix";
+ push(@implContent, " if (IMPL->role() == WebCore::AnimValRole) {\n");
+ push(@implContent, " WebCore::raiseOnDOMError(WebCore::NO_MODIFICATION_ALLOWED_ERR);\n");
+ push(@implContent, " return;\n");
+ push(@implContent, " }\n");
push(@implContent, " $svgPropertyType& podImpl = IMPL->propertyReference();\n");
my $ec = $hasSetterException ? ", ec" : "";
push(@implContent, " $exceptionInit\n") if $hasSetterException;
@@ -1572,6 +1579,14 @@ sub GenerateImplementation
my $content = $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")";
if ($svgPropertyType) {
+ push(@functionContent, " if (IMPL->role() == WebCore::AnimValRole) {\n");
+ push(@functionContent, " WebCore::raiseOnDOMError(WebCore::NO_MODIFICATION_ALLOWED_ERR);\n");
+ if ($returnType eq "void") {
+ push(@functionContent, " return;\n");
+ } else {
+ push(@functionContent, " return nil;\n");
+ }
+ push(@functionContent, " }\n");
push(@functionContent, " $svgPropertyType& podImpl = IMPL->propertyReference();\n");
$content = "podImpl.$content";
} else {
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 6f39582..7488d50 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -6,6 +6,7 @@
# Copyright (C) 2007, 2008, 2009 Google Inc.
# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
# Copyright (C) Research In Motion Limited 2010. All rights reserved.
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -25,7 +26,6 @@
package CodeGeneratorV8;
-use File::stat;
use Digest::MD5;
my $module = "";
@@ -681,18 +681,9 @@ sub GenerateNormalAttrGetter
my $interfaceName = shift;
my $attrExt = $attribute->signature->extendedAttributes;
-
my $attrName = $attribute->signature->name;
-
my $attrType = GetTypeFromSignature($attribute->signature);
-
my $nativeType = GetNativeTypeFromSignature($attribute->signature, -1);
- my $skipContext = 0;
-
- # Special case: SVGZoomEvent's attributes are all read-only
- if ($implClassName eq "SVGZoomEvent") {
- $skipContext = 1;
- }
my $getterStringUsesImp = $implClassName ne "SVGNumber";
my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($implClassName);
@@ -836,14 +827,6 @@ END
return;
}
- if (IsSVGTypeNeedingContextParameter($attrType) && !$skipContext) {
- push(@implContentDecls, GenerateSVGContextRetrieval($implClassName, " "));
- # The templating associated with passing withSVGContext()'s return value directly into toV8 can get compilers confused,
- # so just manually set the return value to a PassRefPtr of the expected type.
- push(@implContentDecls, " PassRefPtr<$attrType> resultAsPassRefPtr = V8Proxy::withSVGContext($result, context);\n");
- $result = "resultAsPassRefPtr";
- }
-
if ($codeGenerator->IsSVGAnimatedType($implClassName) and $codeGenerator->IsSVGTypeNeedingTearOff($attrType)) {
$implIncludes{"V8$attrType.h"} = 1;
my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($attrType);
@@ -881,7 +864,7 @@ END
} elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
my $extraImp = "GetOwnerElementForType<$implClassName, IsDerivedFromSVGElement<$implClassName>::value>::ownerElement(imp), ";
push(@implContentDecls, " return toV8(WTF::getPtr(${tearOffType}::create($extraImp$result)));\n");
- } elsif ($tearOffType =~ /SVGPointList/) {
+ } elsif ($tearOffType =~ /SVG(Point|PathSeg)List/) {
push(@implContentDecls, " return toV8(WTF::getPtr($result));\n");
} else {
push(@implContentDecls, " return toV8(WTF::getPtr(${tearOffType}::create($result)));\n");
@@ -934,11 +917,13 @@ sub GenerateNormalAttrSetter
$svgNativeType* imp = V8${implClassName}::toNative(info.Holder());
END
} else {
- push(@implContentDecls, <<END);
- $svgNativeType* wrapper = V8${implClassName}::toNative(info.Holder());
- $svgWrappedNativeType& impInstance = wrapper->propertyReference();
- $svgWrappedNativeType* imp = &impInstance;
-END
+ push(@implContentDecls, " $svgNativeType* wrapper = V8${implClassName}::toNative(info.Holder());\n");
+ push(@implContentDecls, " if (wrapper->role() == AnimValRole) {\n");
+ push(@implContentDecls, " V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);\n");
+ push(@implContentDecls, " return;\n");
+ push(@implContentDecls, " }\n");
+ push(@implContentDecls, " $svgWrappedNativeType& impInstance = wrapper->propertyReference();\n");
+ push(@implContentDecls, " $svgWrappedNativeType* imp = &impInstance;\n");
}
} elsif ($attrExt->{"v8OnProto"}) {
if ($interfaceName eq "DOMWindow") {
@@ -1038,10 +1023,6 @@ END
} else {
push(@implContentDecls, " wrapper->commitChange();\n");
}
- } elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
- $implIncludes{"SVGElement.h"} = 1;
- push(@implContentDecls, " if (SVGElement* context = V8Proxy::svgContext(imp))\n");
- push(@implContentDecls, " context->svgAttributeChanged(imp->associatedAttributeName());\n");
}
push(@implContentDecls, " return;\n");
@@ -1239,8 +1220,12 @@ END
if ($implClassName =~ /List$/) {
push(@implContentDecls, " $nativeClassName imp = V8${implClassName}::toNative(args.Holder());\n");
} else {
- my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName);
push(@implContentDecls, " $nativeClassName wrapper = V8${implClassName}::toNative(args.Holder());\n");
+ push(@implContentDecls, " if (wrapper->role() == AnimValRole) {\n");
+ push(@implContentDecls, " V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);\n");
+ push(@implContentDecls, " return v8::Handle<v8::Value>();\n");
+ push(@implContentDecls, " }\n");
+ my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName);
push(@implContentDecls, " $svgWrappedNativeType& impInstance = wrapper->propertyReference();\n");
push(@implContentDecls, " $svgWrappedNativeType* imp = &impInstance;\n");
}
@@ -1281,9 +1266,9 @@ END
if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
push(@implContentDecls, <<END);
- OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, $numParameters));
+ RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, $numParameters));
size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize));
+ RefPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize));
if (!callStack)
return v8::Undefined();
END
@@ -1538,11 +1523,6 @@ sub GenerateImplementationIndexer
if ($interfaceName eq "HTMLOptionsCollection") {
$hasGetter = 1;
}
- # FIXME: If the parent interface of $dataNode already has
- # HasIndexGetter, we don't need to handle the getter here.
- if ($interfaceName eq "WebKitCSSTransformValue") {
- $hasGetter = 0;
- }
# FIXME: Investigate and remove this nastinesss. In V8, named property handling and indexer handling are apparently decoupled,
# which means that object[X] where X is a number doesn't reach named property indexer. So we need to provide
@@ -1568,6 +1548,13 @@ sub GenerateImplementationIndexer
$indexerType = "WebKitCSSKeyframeRule";
}
+ # FIXME: The item() getter is not inherited from CSSValueList, seemingly due to the way
+ # the CodeGenerator->AddMethodsConstantsAndAttributesFromParentClasses() method works,
+ # so we need to set the indexerType manually in this case.
+ if ($interfaceName eq "WebKitCSSTransformValue") {
+ $indexerType = "CSSValue";
+ }
+
if ($indexerType && !$hasCustomSetter) {
if ($indexerType eq "DOMString") {
my $conversion = $indexer->extendedAttributes->{"ConvertNullStringTo"};
@@ -1937,7 +1924,7 @@ END
push(@implContent, <<END);
static v8::Persistent<v8::ObjectTemplate> ConfigureShadowObjectTemplate(v8::Persistent<v8::ObjectTemplate> templ)
{
- batchConfigureAttributes(templ, v8::Handle<v8::ObjectTemplate>(), shadowAttrs, sizeof(shadowAttrs) / sizeof(*shadowAttrs));
+ batchConfigureAttributes(templ, v8::Handle<v8::ObjectTemplate>(), shadowAttrs, WTF_ARRAY_LENGTH(shadowAttrs));
// Install a security handler with V8.
templ->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheck, V8DOMWindow::indexedSecurityCheck, v8::External::Wrap(&V8DOMWindow::info));
@@ -1969,7 +1956,7 @@ END
# Set up our attributes if we have them
if ($has_attributes) {
push(@implContent, <<END);
- ${interfaceName}Attrs, sizeof(${interfaceName}Attrs) / sizeof(*${interfaceName}Attrs),
+ ${interfaceName}Attrs, WTF_ARRAY_LENGTH(${interfaceName}Attrs),
END
} else {
push(@implContent, <<END);
@@ -1979,7 +1966,7 @@ END
if ($has_callbacks) {
push(@implContent, <<END);
- ${interfaceName}Callbacks, sizeof(${interfaceName}Callbacks) / sizeof(*${interfaceName}Callbacks));
+ ${interfaceName}Callbacks, WTF_ARRAY_LENGTH(${interfaceName}Callbacks));
END
} else {
push(@implContent, <<END);
@@ -2117,7 +2104,7 @@ END
if ($has_constants) {
push(@implContent, <<END);
- batchConfigureConstants(desc, proto, ${interfaceName}Consts, sizeof(${interfaceName}Consts) / sizeof(*${interfaceName}Consts));
+ batchConfigureConstants(desc, proto, ${interfaceName}Consts, WTF_ARRAY_LENGTH(${interfaceName}Consts));
END
}
@@ -2554,8 +2541,6 @@ sub GetDomMapFunction
my $type = shift;
return "getDOMSVGElementInstanceMap()" if $type eq "SVGElementInstance";
return "getDOMNodeMap()" if ($dataNode && IsNodeSubType($dataNode));
- # Only use getDOMSVGObjectWithContextMap() for non-node svg objects
- return "getDOMSVGObjectWithContextMap()" if $type =~ /SVG/ and not $codeGenerator->IsSVGTypeNeedingTearOff($type) and not $codeGenerator->IsSVGAnimatedType($type);
return "" if $type eq "DOMImplementation";
return "getActiveDOMObjectMap()" if IsActiveDomType($type);
return "getDOMObjectMap()";
@@ -2574,7 +2559,6 @@ sub IsActiveDomType
return 1 if $type eq "IDBRequest";
return 1 if $type eq "FileReader";
return 1 if $type eq "FileWriter";
- return 1 if $type eq "FileWriterSync";
return 0;
}
@@ -2668,7 +2652,7 @@ sub GenerateFunctionCallString()
if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
$functionString .= ", " if $index;
- $functionString .= "scriptArguments.release(), callStack.release()";
+ $functionString .= "scriptArguments, callStack";
$index += 2;
}
@@ -2722,23 +2706,6 @@ sub GenerateFunctionCallString()
return $result;
}
- my $generatedSVGContextRetrieval = 0;
- # If the return type needs an SVG context, output it
- if (IsSVGTypeNeedingContextParameter($returnType)) {
- $result .= GenerateSVGContextAssignment($implClassName, $return . ".get()", $indent);
- $generatedSVGContextRetrieval = 1;
- }
-
- if (IsSVGTypeNeedingContextParameter($implClassName) && $implClassName =~ /List$/ && IsSVGListMutator($name)) {
- if (!$generatedSVGContextRetrieval) {
- $result .= GenerateSVGContextRetrieval($implClassName, $indent);
- $generatedSVGContextRetrieval = 1;
- }
-
- $result .= $indent . "context->svgAttributeChanged(imp->associatedAttributeName());\n";
- $implIncludes{"SVGElement.h"} = 1;
- }
-
# If the implementing class is a POD type, commit changes
if ($codeGenerator->IsSVGTypeNeedingTearOff($implClassName) and not $implClassName =~ /List$/) {
$result .= $indent . "wrapper->commitChange();\n";
@@ -2839,6 +2806,7 @@ sub GetNativeType
return "Node*" if $type eq "EventTarget" and $isParameter;
return "double" if $type eq "Date";
return "ScriptValue" if $type eq "DOMObject";
+ return "OptionsObject" if $type eq "OptionsObject";
return "String" if $type eq "DOMUserData"; # FIXME: Temporary hack?
@@ -2854,6 +2822,8 @@ sub GetNativeType
return "RefPtr<${type}>" if IsRefPtrType($type) and not $isParameter;
+ return "RefPtr<MediaQueryListListener>" if $type eq "MediaQueryListListener";
+
# Default, assume native type is a pointer with same type name as idl type
return "${type}*";
}
@@ -2901,7 +2871,7 @@ sub JSValueToNative
return "$value->BooleanValue()" if $type eq "boolean";
return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $type eq "double";
- return "toInt32($value)" if $type eq "long";
+ return "toInt32($value)" if $type eq "long" or $type eq "short";
return "toUInt32($value)" if $type eq "unsigned long" or $type eq "unsigned short";
return "toInt64($value)" if $type eq "unsigned long long" or $type eq "long long";
return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow";
@@ -2920,6 +2890,11 @@ sub JSValueToNative
return "createIDBKeyFromValue($value)";
}
+ if ($type eq "OptionsObject") {
+ $implIncludes{"OptionsObject.h"} = 1;
+ return $value;
+ }
+
if ($type eq "DOMObject") {
$implIncludes{"ScriptValue.h"} = 1;
return "ScriptValue($value)";
@@ -2929,8 +2904,9 @@ sub JSValueToNative
return "V8DOMWrapper::wrapNativeNodeFilter($value)";
}
- if ($type eq "SVGRect") {
- $implIncludes{"FloatRect.h"} = 1;
+ if ($type eq "MediaQueryListListener") {
+ $implIncludes{"MediaQueryListListener.h"} = 1;
+ return "MediaQueryListListener::create(" . $value . ")";
}
# Default, assume autogenerated type conversion routines
@@ -3060,7 +3036,9 @@ my %non_wrapper_types = (
'NodeFilter' => 1,
'EventListener' => 1,
'IDBKey' => 1,
- 'Date' => 1
+ 'OptionsObject' => 1,
+ 'Date' => 1,
+ 'MediaQueryListListener' => 1
);
@@ -3107,7 +3085,6 @@ sub ReturnNativeToJSValue
my $indent = shift;
my $type = GetTypeFromSignature($signature);
- return "return v8::Date::New(static_cast<double>($value))" if $type eq "DOMTimeStamp";
return "return v8Boolean($value)" if $type eq "boolean";
return "return v8::Handle<v8::Value>()" if $type eq "void"; # equivalent to v8::Undefined()
@@ -3119,7 +3096,7 @@ sub ReturnNativeToJSValue
return "return v8DateOrNull($value)" if $type eq "Date";
# long long and unsigned long long are not representable in ECMAScript.
- return "return v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long";
+ return "return v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long" or $type eq "DOMTimeStamp";
return "return v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType";
return "return $value.v8Value()" if $nativeType eq "ScriptValue";
@@ -3208,64 +3185,6 @@ sub WriteData
}
}
-# FIXME: This method will go away once all SVG animated properties are converted to the new scheme.
-sub IsSVGTypeNeedingContextParameter
-{
- my $implClassName = shift;
-
- return 0 unless $implClassName =~ /SVG/;
- return 0 if $implClassName =~ /Element/;
- return 0 if $codeGenerator->IsSVGAnimatedType($implClassName);
- return 0 if $codeGenerator->IsSVGTypeNeedingTearOff($implClassName);
-
- my @noContextNeeded = ("SVGColor", "SVGDocument", "SVGPaintType", "SVGPaint", "SVGZoomEvent");
- foreach (@noContextNeeded) {
- return 0 if $implClassName eq $_;
- }
- return 1;
-}
-
-# FIXME: This method will go away once all SVG animated properties are converted to the new scheme.
-sub GenerateSVGContextAssignment
-{
- my $srcType = shift;
- my $value = shift;
- my $indent = shift;
-
- $result = GenerateSVGContextRetrieval($srcType, $indent);
- $result .= $indent . "V8Proxy::setSVGContext($value, context);\n";
-
- return $result;
-}
-
-# FIXME: This method will go away once all SVG animated properties are converted to the new scheme.
-sub GenerateSVGContextRetrieval
-{
- my $srcType = shift;
- my $indent = shift;
-
- my $contextDecl = "imp";
- if (IsSVGTypeNeedingContextParameter($srcType)) {
- $contextDecl = "V8Proxy::svgContext($contextDecl)";
- }
-
- return $indent . "SVGElement* context = $contextDecl;\n";
-}
-
-sub IsSVGListMutator
-{
- my $functionName = shift;
-
- return 1 if $functionName eq "clear";
- return 1 if $functionName eq "initialize";
- return 1 if $functionName eq "insertItemBefore";
- return 1 if $functionName eq "replaceItem";
- return 1 if $functionName eq "removeItem";
- return 1 if $functionName eq "appendItem";
-
- return 0;
-}
-
sub GetVisibleInterfaceName
{
my $interfaceName = shift;
diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
index 579295f..819c7cf 100644
--- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
+++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
@@ -24,9 +24,11 @@
#include "HTMLNames.h"
#include "IDBKey.h"
#include "KURL.h"
+#include "OptionsObject.h"
#include "SerializedScriptValue.h"
#include "TestObj.h"
#include "WebDOMIDBKey.h"
+#include "WebDOMOptionsObject.h"
#include "WebDOMString.h"
#include "WebExceptionHandler.h"
#include "WebNativeEventListener.h"
@@ -103,6 +105,38 @@ WebDOMTestObj WebDOMTestObj::readOnlyTestObjAttr() const
return toWebKit(WTF::getPtr(impl()->readOnlyTestObjAttr()));
}
+short WebDOMTestObj::shortAttr() const
+{
+ if (!impl())
+ return 0;
+
+ return impl()->shortAttr();
+}
+
+void WebDOMTestObj::setShortAttr(short newShortAttr)
+{
+ if (!impl())
+ return;
+
+ impl()->setShortAttr(newShortAttr);
+}
+
+unsigned short WebDOMTestObj::unsignedShortAttr() const
+{
+ if (!impl())
+ return 0;
+
+ return impl()->unsignedShortAttr();
+}
+
+void WebDOMTestObj::setUnsignedShortAttr(unsigned short newUnsignedShortAttr)
+{
+ if (!impl())
+ return;
+
+ impl()->setUnsignedShortAttr(newUnsignedShortAttr);
+}
+
int WebDOMTestObj::intAttr() const
{
if (!impl())
@@ -630,6 +664,14 @@ void WebDOMTestObj::idbKey(const WebDOMIDBKey& key)
impl()->idbKey(toWebCore(key));
}
+void WebDOMTestObj::optionsObject(const WebDOMOptionsObject& oo, const WebDOMOptionsObject& ooo)
+{
+ if (!impl())
+ return;
+
+ impl()->optionsObject(toWebCore(oo), toWebCore(ooo));
+}
+
void WebDOMTestObj::methodWithException()
{
if (!impl())
diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
index cd6caaa..0b3593d 100644
--- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
+++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
@@ -32,6 +32,7 @@ class TestObj;
class WebDOMEventListener;
class WebDOMIDBKey;
+class WebDOMOptionsObject;
class WebDOMString;
class WebDOMTestObj;
@@ -60,6 +61,10 @@ public:
int readOnlyIntAttr() const;
WebDOMString readOnlyStringAttr() const;
WebDOMTestObj readOnlyTestObjAttr() const;
+ short shortAttr() const;
+ void setShortAttr(short);
+ unsigned short unsignedShortAttr() const;
+ void setUnsignedShortAttr(unsigned short);
int intAttr() const;
void setIntAttr(int);
long long longLongAttr() const;
@@ -132,6 +137,7 @@ public:
WebDOMTestObj methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg);
void serializedValue(const WebDOMString& serializedArg);
void idbKey(const WebDOMIDBKey& key);
+ void optionsObject(const WebDOMOptionsObject& oo, const WebDOMOptionsObject& ooo);
void methodWithException();
void customMethod();
void customMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg);
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp
index fbe538d..554cc15 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp
@@ -25,6 +25,7 @@
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>
+#include "DOMObjectCache.h"
#include "ExceptionCode.h"
#include "JSMainThreadExecState.h"
#include "TestCallback.h"
@@ -58,8 +59,8 @@ gpointer kit(WebCore::TestCallback* obj)
gboolean
webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestCallback * item = WebKit::core(self);
g_return_val_if_fail(class1param, 0);
WebCore::Class1 * converted_class1param = NULL;
@@ -74,8 +75,8 @@ webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self,
gboolean
webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, const gchar* str_arg)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestCallback * item = WebKit::core(self);
g_return_val_if_fail(class2param, 0);
g_return_val_if_fail(str_arg, 0);
@@ -92,8 +93,8 @@ webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self,
glong
webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestCallback * item = WebKit::core(self);
g_return_val_if_fail(class3param, 0);
WebCore::Class3 * converted_class3param = NULL;
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp
index a13da45..6c906e4 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp
@@ -25,6 +25,7 @@
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>
+#include "DOMObjectCache.h"
#include "ExceptionCode.h"
#include "JSMainThreadExecState.h"
#include "TestInterface.h"
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp
index af9300d..a7d364c 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp
@@ -23,13 +23,12 @@
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>
+#include "DOMObjectCache.h"
#include "ExceptionCode.h"
#include "JSMainThreadExecState.h"
#include "TestMediaQueryListListener.h"
#include "WebKitDOMBinding.h"
#include "gobject/ConvertToUTF8String.h"
-#include "webkit/WebKitDOMMediaQueryListListener.h"
-#include "webkit/WebKitDOMMediaQueryListListenerPrivate.h"
#include "webkit/WebKitDOMTestMediaQueryListListener.h"
#include "webkit/WebKitDOMTestMediaQueryListListenerPrivate.h"
#include "webkitmarshal.h"
@@ -49,21 +48,6 @@ gpointer kit(WebCore::TestMediaQueryListListener* obj)
} // namespace WebKit //
-void
-webkit_dom_test_media_query_list_listener_method(WebKitDOMTestMediaQueryListListener* self, WebKitDOMMediaQueryListListener* listener)
-{
- WebCore::JSMainThreadNullState state;
- g_return_if_fail(self);
- WebCore::TestMediaQueryListListener * item = WebKit::core(self);
- g_return_if_fail(listener);
- WebCore::MediaQueryListListener * converted_listener = NULL;
- if (listener != NULL) {
- converted_listener = WebKit::core(listener);
- g_return_if_fail(converted_listener);
- }
- item->method(converted_listener);
-}
-
G_DEFINE_TYPE(WebKitDOMTestMediaQueryListListener, webkit_dom_test_media_query_list_listener, WEBKIT_TYPE_DOM_OBJECT)
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h
index 94e825e..612439b 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h
@@ -46,9 +46,6 @@ struct _WebKitDOMTestMediaQueryListListenerClass {
WEBKIT_API GType
webkit_dom_test_media_query_list_listener_get_type (void);
-WEBKIT_API void
-webkit_dom_test_media_query_list_listener_method(WebKitDOMTestMediaQueryListListener* self, WebKitDOMMediaQueryListListener* listener);
-
G_END_DECLS
#endif /* WebKitDOMTestMediaQueryListListener_h */
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
index c9c10d7..ec2c6dc 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
@@ -23,6 +23,7 @@
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>
+#include "DOMObjectCache.h"
#include "ExceptionCode.h"
#include "HTMLNames.h"
#include "JSMainThreadExecState.h"
@@ -31,6 +32,8 @@
#include "gobject/ConvertToUTF8String.h"
#include "webkit/WebKitDOMIDBKey.h"
#include "webkit/WebKitDOMIDBKeyPrivate.h"
+#include "webkit/WebKitDOMOptionsObject.h"
+#include "webkit/WebKitDOMOptionsObjectPrivate.h"
#include "webkit/WebKitDOMSerializedScriptValue.h"
#include "webkit/WebKitDOMSerializedScriptValuePrivate.h"
#include "webkit/WebKitDOMTestObj.h"
@@ -55,8 +58,8 @@ gpointer kit(WebCore::TestObj* obj)
void
webkit_dom_test_obj_void_method(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->voidMethod();
}
@@ -64,8 +67,8 @@ webkit_dom_test_obj_void_method(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(str_arg);
g_return_if_fail(obj_arg);
@@ -81,8 +84,8 @@ webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg,
glong
webkit_dom_test_obj_int_method(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->intMethod();
return res;
@@ -91,8 +94,8 @@ webkit_dom_test_obj_int_method(WebKitDOMTestObj* self)
glong
webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_val_if_fail(str_arg, 0);
g_return_val_if_fail(obj_arg, 0);
@@ -109,8 +112,8 @@ webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg,
WebKitDOMTestObj*
webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
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()));
@@ -120,8 +123,8 @@ webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self)
WebKitDOMTestObj*
webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_val_if_fail(str_arg, 0);
g_return_val_if_fail(obj_arg, 0);
@@ -139,8 +142,8 @@ webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg,
WebKitDOMTestObj*
webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, const gchar* str_arg, WebKitDOMTestObj* obj_arg)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_val_if_fail(str_arg, 0);
g_return_val_if_fail(obj_arg, 0);
@@ -158,8 +161,8 @@ webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, const
WebKitDOMTestObj*
webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, const gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_val_if_fail(str_arg, 0);
g_return_val_if_fail(obj_arg, 0);
@@ -183,8 +186,8 @@ webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* s
void
webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(serialized_arg);
WebCore::SerializedScriptValue * converted_serialized_arg = NULL;
@@ -198,8 +201,8 @@ webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerialized
void
webkit_dom_test_obj_idb_key(WebKitDOMTestObj* self, WebKitDOMIDBKey* key)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(key);
WebCore::IDBKey * converted_key = NULL;
@@ -211,10 +214,31 @@ webkit_dom_test_obj_idb_key(WebKitDOMTestObj* self, WebKitDOMIDBKey* key)
}
void
-webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error)
+webkit_dom_test_obj_options_object(WebKitDOMTestObj* self, WebKitDOMOptionsObject* oo, WebKitDOMOptionsObject* ooo)
{
+ g_return_if_fail(self);
WebCore::JSMainThreadNullState state;
+ WebCore::TestObj * item = WebKit::core(self);
+ g_return_if_fail(oo);
+ g_return_if_fail(ooo);
+ WebCore::OptionsObject * converted_oo = NULL;
+ if (oo != NULL) {
+ converted_oo = WebKit::core(oo);
+ g_return_if_fail(converted_oo);
+ }
+ WebCore::OptionsObject * converted_ooo = NULL;
+ if (ooo != NULL) {
+ converted_ooo = WebKit::core(ooo);
+ g_return_if_fail(converted_ooo);
+ }
+ item->optionsObject(converted_oo, converted_ooo);
+}
+
+void
+webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error)
+{
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
WebCore::ExceptionCode ec = 0;
item->methodWithException(ec);
@@ -234,8 +258,8 @@ webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error
void
webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->withDynamicFrame();
}
@@ -243,8 +267,8 @@ webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int_arg)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->withDynamicFrameAndArg(int_arg);
}
@@ -252,8 +276,8 @@ webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int
void
webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, glong int_arg, glong optional_arg)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->withDynamicFrameAndOptionalArg(int_arg, optional_arg);
}
@@ -261,8 +285,8 @@ webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self,
void
webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg, gboolean isUserGesture)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->withDynamicFrameAndUserGesture(int_arg, false);
}
@@ -270,8 +294,8 @@ webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self,
void
webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg, gboolean isUserGesture)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg, false);
}
@@ -279,8 +303,8 @@ webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* s
void
webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->withScriptStateVoid();
}
@@ -288,8 +312,8 @@ webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self)
WebKitDOMTestObj*
webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
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()));
@@ -299,8 +323,8 @@ webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GError **error)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
WebCore::ExceptionCode ec = 0;
item->withScriptStateVoidException(ec);
@@ -314,8 +338,8 @@ webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GEr
WebKitDOMTestObj*
webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GError **error)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
WebCore::ExceptionCode ec = 0;
PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObjException(ec));
@@ -331,8 +355,8 @@ webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GErr
void
webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->withScriptExecutionContext();
}
@@ -340,8 +364,8 @@ webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->methodWithOptionalArg(opt);
}
@@ -349,8 +373,8 @@ webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt)
void
webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestObj* self, glong non_opt, glong opt)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->methodWithNonOptionalArgAndOptionalArg(non_opt, opt);
}
@@ -358,8 +382,8 @@ webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestO
void
webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOMTestObj* self, glong non_opt, glong opt1, glong opt2)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->methodWithNonOptionalArgAndTwoOptionalArgs(non_opt, opt1, opt2);
}
@@ -367,8 +391,8 @@ webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOM
void
webkit_dom_test_obj_class_method(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->classMethod();
}
@@ -376,8 +400,8 @@ webkit_dom_test_obj_class_method(WebKitDOMTestObj* self)
glong
webkit_dom_test_obj_class_method_with_optional(WebKitDOMTestObj* self, glong arg)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->classMethodWithOptional(arg);
return res;
@@ -386,8 +410,8 @@ webkit_dom_test_obj_class_method_with_optional(WebKitDOMTestObj* self, glong arg
glong
webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->readOnlyIntAttr();
return res;
@@ -396,8 +420,8 @@ webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self)
gchar*
webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->readOnlyStringAttr());
return res;
@@ -406,19 +430,57 @@ webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self)
WebKitDOMTestObj*
webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
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;
}
+gshort
+webkit_dom_test_obj_get_short_attr(WebKitDOMTestObj* self)
+{
+ g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
+ WebCore::TestObj * item = WebKit::core(self);
+ gshort res = item->shortAttr();
+ return res;
+}
+
+void
+webkit_dom_test_obj_set_short_attr(WebKitDOMTestObj* self, gshort value)
+{
+ g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
+ WebCore::TestObj * item = WebKit::core(self);
+ item->setShortAttr(value);
+}
+
+gushort
+webkit_dom_test_obj_get_unsigned_short_attr(WebKitDOMTestObj* self)
+{
+ g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
+ WebCore::TestObj * item = WebKit::core(self);
+ gushort res = item->unsignedShortAttr();
+ return res;
+}
+
+void
+webkit_dom_test_obj_set_unsigned_short_attr(WebKitDOMTestObj* self, gushort value)
+{
+ g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
+ WebCore::TestObj * item = WebKit::core(self);
+ item->setUnsignedShortAttr(value);
+}
+
glong
webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->intAttr();
return res;
@@ -427,8 +489,8 @@ webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setIntAttr(value);
}
@@ -436,8 +498,8 @@ webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value)
gint64
webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gint64 res = item->longLongAttr();
return res;
@@ -446,8 +508,8 @@ webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setLongLongAttr(value);
}
@@ -455,8 +517,8 @@ webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value)
guint64
webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
guint64 res = item->unsignedLongLongAttr();
return res;
@@ -465,8 +527,8 @@ webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setUnsignedLongLongAttr(value);
}
@@ -474,8 +536,8 @@ webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64
gchar*
webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->stringAttr());
return res;
@@ -484,8 +546,8 @@ webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, const gchar* value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(value);
WTF::String converted_value = WTF::String::fromUTF8(value);
@@ -495,8 +557,8 @@ webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, const gchar* value)
WebKitDOMTestObj*
webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
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()));
@@ -506,8 +568,8 @@ webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(value);
WebCore::TestObj * converted_value = NULL;
@@ -521,8 +583,8 @@ webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj*
WebKitDOMTestObj*
webkit_dom_test_obj_get_xml_obj_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->xmlObjAttr());
WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get()));
@@ -532,8 +594,8 @@ webkit_dom_test_obj_get_xml_obj_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(value);
WebCore::TestObj * converted_value = NULL;
@@ -547,8 +609,8 @@ webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* v
gboolean
webkit_dom_test_obj_get_create(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gboolean res = item->isCreate();
return res;
@@ -557,8 +619,8 @@ webkit_dom_test_obj_get_create(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_create(WebKitDOMTestObj* self, gboolean value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setCreate(value);
}
@@ -566,8 +628,8 @@ webkit_dom_test_obj_set_create(WebKitDOMTestObj* self, gboolean value)
gchar*
webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr));
return res;
@@ -576,8 +638,8 @@ webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gchar* value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(value);
WTF::String converted_value = WTF::String::fromUTF8(value);
@@ -587,8 +649,8 @@ webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gcha
glong
webkit_dom_test_obj_get_reflected_integral_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr);
return res;
@@ -597,8 +659,8 @@ webkit_dom_test_obj_get_reflected_integral_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_reflected_integral_attr(WebKitDOMTestObj* self, glong value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, value);
}
@@ -606,8 +668,8 @@ webkit_dom_test_obj_set_reflected_integral_attr(WebKitDOMTestObj* self, glong va
gboolean
webkit_dom_test_obj_get_reflected_boolean_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gboolean res = item->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr);
return res;
@@ -616,8 +678,8 @@ webkit_dom_test_obj_get_reflected_boolean_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_reflected_boolean_attr(WebKitDOMTestObj* self, gboolean value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, value);
}
@@ -625,8 +687,8 @@ webkit_dom_test_obj_set_reflected_boolean_attr(WebKitDOMTestObj* self, gboolean
gchar*
webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr));
return res;
@@ -635,8 +697,8 @@ webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, const gchar* value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(value);
WTF::String converted_value = WTF::String::fromUTF8(value);
@@ -646,8 +708,8 @@ webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, const gchar*
gchar*
webkit_dom_test_obj_get_reflected_non_empty_url_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr));
return res;
@@ -656,8 +718,8 @@ webkit_dom_test_obj_get_reflected_non_empty_url_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(value);
WTF::String converted_value = WTF::String::fromUTF8(value);
@@ -667,8 +729,8 @@ webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, con
gchar*
webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr));
return res;
@@ -677,8 +739,8 @@ webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gchar* value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(value);
WTF::String converted_value = WTF::String::fromUTF8(value);
@@ -688,8 +750,8 @@ webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gcha
glong
webkit_dom_test_obj_get_reflected_custom_integral_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr);
return res;
@@ -698,8 +760,8 @@ webkit_dom_test_obj_get_reflected_custom_integral_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_reflected_custom_integral_attr(WebKitDOMTestObj* self, glong value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, value);
}
@@ -707,8 +769,8 @@ webkit_dom_test_obj_set_reflected_custom_integral_attr(WebKitDOMTestObj* self, g
gboolean
webkit_dom_test_obj_get_reflected_custom_boolean_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gboolean res = item->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr);
return res;
@@ -717,8 +779,8 @@ webkit_dom_test_obj_get_reflected_custom_boolean_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_reflected_custom_boolean_attr(WebKitDOMTestObj* self, gboolean value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, value);
}
@@ -726,8 +788,8 @@ webkit_dom_test_obj_set_reflected_custom_boolean_attr(WebKitDOMTestObj* self, gb
gchar*
webkit_dom_test_obj_get_reflected_custom_url_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr));
return res;
@@ -736,8 +798,8 @@ webkit_dom_test_obj_get_reflected_custom_url_attr(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, const gchar* value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(value);
WTF::String converted_value = WTF::String::fromUTF8(value);
@@ -747,8 +809,8 @@ webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, const
gchar*
webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr));
return res;
@@ -757,8 +819,8 @@ webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* se
void
webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(value);
WTF::String converted_value = WTF::String::fromUTF8(value);
@@ -768,8 +830,8 @@ webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* se
glong
webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
WebCore::ExceptionCode ec = 0;
glong res = item->attrWithGetterException(ec);
@@ -784,8 +846,8 @@ webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self, GErro
void
webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong value, GError **error)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
WebCore::ExceptionCode ec = 0;
item->setAttrWithGetterException(value, ec);
@@ -799,8 +861,8 @@ webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong
glong
webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->attrWithSetterException();
return res;
@@ -809,8 +871,8 @@ webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong value, GError **error)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
WebCore::ExceptionCode ec = 0;
item->setAttrWithSetterException(value, ec);
@@ -824,8 +886,8 @@ webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong
gchar*
webkit_dom_test_obj_get_string_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
WebCore::ExceptionCode ec = 0;
gchar* res = convertToUTF8String(item->stringAttrWithGetterException(ec));
@@ -835,8 +897,8 @@ webkit_dom_test_obj_get_string_attr_with_getter_exception(WebKitDOMTestObj* self
void
webkit_dom_test_obj_set_string_attr_with_getter_exception(WebKitDOMTestObj* self, const gchar* value, GError **error)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(value);
WTF::String converted_value = WTF::String::fromUTF8(value);
@@ -852,8 +914,8 @@ webkit_dom_test_obj_set_string_attr_with_getter_exception(WebKitDOMTestObj* self
gchar*
webkit_dom_test_obj_get_string_attr_with_setter_exception(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->stringAttrWithSetterException());
return res;
@@ -862,8 +924,8 @@ webkit_dom_test_obj_get_string_attr_with_setter_exception(WebKitDOMTestObj* self
void
webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self, const gchar* value, GError **error)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
g_return_if_fail(value);
WTF::String converted_value = WTF::String::fromUTF8(value);
@@ -879,87 +941,93 @@ webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self
gchar*
webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->scriptStringAttr());
return res;
}
-#if ENABLE(Condition1)
glong
webkit_dom_test_obj_get_conditional_attr1(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
+#if ENABLE(Condition1)
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->conditionalAttr1();
return res;
-}
+#else
+ return static_cast<glong>(0);
#endif /* ENABLE(Condition1) */
+}
-#if ENABLE(Condition1)
void
webkit_dom_test_obj_set_conditional_attr1(WebKitDOMTestObj* self, glong value)
{
- WebCore::JSMainThreadNullState state;
+#if ENABLE(Condition1)
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setConditionalAttr1(value);
-}
#endif /* ENABLE(Condition1) */
+}
-#if ENABLE(Condition1) && ENABLE(Condition2)
glong
webkit_dom_test_obj_get_conditional_attr2(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
+#if ENABLE(Condition1) && ENABLE(Condition2)
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->conditionalAttr2();
return res;
-}
+#else
+ return static_cast<glong>(0);
#endif /* ENABLE(Condition1) && ENABLE(Condition2) */
+}
-#if ENABLE(Condition1) && ENABLE(Condition2)
void
webkit_dom_test_obj_set_conditional_attr2(WebKitDOMTestObj* self, glong value)
{
- WebCore::JSMainThreadNullState state;
+#if ENABLE(Condition1) && ENABLE(Condition2)
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setConditionalAttr2(value);
-}
#endif /* ENABLE(Condition1) && ENABLE(Condition2) */
+}
-#if ENABLE(Condition1) || ENABLE(Condition2)
glong
webkit_dom_test_obj_get_conditional_attr3(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
+#if ENABLE(Condition1) || ENABLE(Condition2)
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->conditionalAttr3();
return res;
-}
+#else
+ return static_cast<glong>(0);
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
+}
-#if ENABLE(Condition1) || ENABLE(Condition2)
void
webkit_dom_test_obj_set_conditional_attr3(WebKitDOMTestObj* self, glong value)
{
- WebCore::JSMainThreadNullState state;
+#if ENABLE(Condition1) || ENABLE(Condition2)
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setConditionalAttr3(value);
-}
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
+}
glong
webkit_dom_test_obj_get_description(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->description();
return res;
@@ -968,8 +1036,8 @@ webkit_dom_test_obj_get_description(WebKitDOMTestObj* self)
glong
webkit_dom_test_obj_get_id(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
glong res = item->id();
return res;
@@ -978,8 +1046,8 @@ webkit_dom_test_obj_get_id(WebKitDOMTestObj* self)
void
webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value)
{
- WebCore::JSMainThreadNullState state;
g_return_if_fail(self);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
item->setId(value);
}
@@ -987,8 +1055,8 @@ webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value)
gchar*
webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self)
{
- WebCore::JSMainThreadNullState state;
g_return_val_if_fail(self, 0);
+ WebCore::JSMainThreadNullState state;
WebCore::TestObj * item = WebKit::core(self);
gchar* res = convertToUTF8String(item->hash());
return res;
@@ -1015,6 +1083,8 @@ enum {
PROP_READ_ONLY_INT_ATTR,
PROP_READ_ONLY_STRING_ATTR,
PROP_READ_ONLY_TEST_OBJ_ATTR,
+ PROP_SHORT_ATTR,
+ PROP_UNSIGNED_SHORT_ATTR,
PROP_INT_ATTR,
PROP_LONG_LONG_ATTR,
PROP_UNSIGNED_LONG_LONG_ATTR,
@@ -1075,6 +1145,11 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con
WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object);
WebCore::TestObj* coreSelf = WebKit::core(self);
switch (prop_id) {
+ case PROP_UNSIGNED_SHORT_ATTR:
+ {
+ coreSelf->setUnsignedShortAttr((g_value_get_ushort(value)));
+ break;
+ }
case PROP_INT_ATTR:
{
coreSelf->setIntAttr((g_value_get_long(value)));
@@ -1224,6 +1299,16 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa
g_value_set_object(value, WebKit::kit(ptr.get()));
break;
}
+ case PROP_SHORT_ATTR:
+ {
+ g_value_set_int(value, coreSelf->shortAttr());
+ break;
+ }
+ case PROP_UNSIGNED_SHORT_ATTR:
+ {
+ g_value_set_uint(value, coreSelf->unsignedShortAttr());
+ break;
+ }
case PROP_INT_ATTR:
{
g_value_set_long(value, coreSelf->intAttr());
@@ -1420,6 +1505,24 @@ G_MAXLONG, /* max */
WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */
WEBKIT_PARAM_READABLE));
g_object_class_install_property(gobjectClass,
+ PROP_SHORT_ATTR,
+ g_param_spec_int("short-attr", /* name */
+ "test_obj_short-attr", /* short description */
+ "read-write gshort TestObj.short-attr", /* longer - could do with some extra doc stuff here */
+ G_MININT, /* min */
+G_MAXINT, /* max */
+0, /* default */
+ WEBKIT_PARAM_READWRITE));
+ g_object_class_install_property(gobjectClass,
+ PROP_UNSIGNED_SHORT_ATTR,
+ g_param_spec_uint("unsigned-short-attr", /* name */
+ "test_obj_unsigned-short-attr", /* short description */
+ "read-write gushort TestObj.unsigned-short-attr", /* longer - could do with some extra doc stuff here */
+ 0, /* min */
+G_MAXUINT16, /* max */
+0, /* default */
+ WEBKIT_PARAM_READWRITE));
+ g_object_class_install_property(gobjectClass,
PROP_INT_ATTR,
g_param_spec_long("int-attr", /* name */
"test_obj_int-attr", /* short description */
diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
index 8ee8f04..42d1fcd 100644
--- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
+++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
@@ -77,6 +77,9 @@ WEBKIT_API void
webkit_dom_test_obj_idb_key(WebKitDOMTestObj* self, WebKitDOMIDBKey* key);
WEBKIT_API void
+webkit_dom_test_obj_options_object(WebKitDOMTestObj* self, WebKitDOMOptionsObject* oo, WebKitDOMOptionsObject* ooo);
+
+WEBKIT_API void
webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error);
@@ -139,6 +142,18 @@ 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_API gshort
+webkit_dom_test_obj_get_short_attr(WebKitDOMTestObj* self);
+
+WEBKIT_API void
+webkit_dom_test_obj_set_short_attr(WebKitDOMTestObj* self, gshort value);
+
+WEBKIT_API gushort
+webkit_dom_test_obj_get_unsigned_short_attr(WebKitDOMTestObj* self);
+
+WEBKIT_API void
+webkit_dom_test_obj_set_unsigned_short_attr(WebKitDOMTestObj* self, gushort value);
+
WEBKIT_API glong
webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self);
@@ -268,35 +283,23 @@ webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self
WEBKIT_API gchar*
webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self);
-#if ENABLE(Condition1)
WEBKIT_API glong
webkit_dom_test_obj_get_conditional_attr1(WebKitDOMTestObj* self);
-#endif /* ENABLE(Condition1) */
-#if ENABLE(Condition1)
WEBKIT_API void
webkit_dom_test_obj_set_conditional_attr1(WebKitDOMTestObj* self, glong value);
-#endif /* ENABLE(Condition1) */
-#if ENABLE(Condition1) && ENABLE(Condition2)
WEBKIT_API glong
webkit_dom_test_obj_get_conditional_attr2(WebKitDOMTestObj* self);
-#endif /* ENABLE(Condition1) && ENABLE(Condition2) */
-#if ENABLE(Condition1) && ENABLE(Condition2)
WEBKIT_API void
webkit_dom_test_obj_set_conditional_attr2(WebKitDOMTestObj* self, glong value);
-#endif /* ENABLE(Condition1) && ENABLE(Condition2) */
-#if ENABLE(Condition1) || ENABLE(Condition2)
WEBKIT_API glong
webkit_dom_test_obj_get_conditional_attr3(WebKitDOMTestObj* self);
-#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
-#if ENABLE(Condition1) || ENABLE(Condition2)
WEBKIT_API void
webkit_dom_test_obj_set_conditional_attr3(WebKitDOMTestObj* self, glong value);
-#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
WEBKIT_API glong
webkit_dom_test_obj_get_description(WebKitDOMTestObj* self);
diff --git a/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp b/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
index cde9672..e505ed2 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
+++ b/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
@@ -23,7 +23,7 @@
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
-#include "JSMediaQueryListListener.h"
+#include "MediaQueryListListener.h"
#include "TestMediaQueryListListener.h"
#include <runtime/Error.h>
#include <wtf/GetPtr.h>
@@ -174,7 +174,7 @@ EncodedJSValue JSC_HOST_CALL jsTestMediaQueryListListenerPrototypeFunctionMethod
return throwVMTypeError(exec);
JSTestMediaQueryListListener* castedThis = static_cast<JSTestMediaQueryListListener*>(asObject(thisValue));
TestMediaQueryListListener* imp = static_cast<TestMediaQueryListListener*>(castedThis->impl());
- MediaQueryListListener* listener = toMediaQueryListListener(exec->argument(0));
+ RefPtr<MediaQueryListListener> listener = MediaQueryListListener::create(exec->argument(0));
if (exec->hadException())
return JSValue::encode(jsUndefined());
diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
index 7e06068..44efde1 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
+++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
@@ -27,6 +27,7 @@
#include "IDBKey.h"
#include "JSDOMBinding.h"
#include "JSEventListener.h"
+#include "JSOptionsObject.h"
#include "JSTestCallback.h"
#include "JSTestObj.h"
#include "JSlog.h"
@@ -54,11 +55,13 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj);
#define THUNK_GENERATOR(generator)
#endif
-static const HashTableValue JSTestObjTableValues[34] =
+static const HashTableValue JSTestObjTableValues[36] =
{
{ "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) },
{ "readOnlyTestObjAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyTestObjAttr), (intptr_t)0 THUNK_GENERATOR(0) },
+ { "shortAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjShortAttr), (intptr_t)setJSTestObjShortAttr THUNK_GENERATOR(0) },
+ { "unsignedShortAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedShortAttr), (intptr_t)setJSTestObjUnsignedShortAttr THUNK_GENERATOR(0) },
{ "intAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjIntAttr), (intptr_t)setJSTestObjIntAttr THUNK_GENERATOR(0) },
{ "longLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjLongLongAttr), (intptr_t)setJSTestObjLongLongAttr THUNK_GENERATOR(0) },
{ "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedLongLongAttr), (intptr_t)setJSTestObjUnsignedLongLongAttr THUNK_GENERATOR(0) },
@@ -99,7 +102,7 @@ static const HashTableValue JSTestObjTableValues[34] =
};
#undef THUNK_GENERATOR
-static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 132, 127, JSTestObjTableValues, 0 };
+static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 133, 127, JSTestObjTableValues, 0 };
/* Hash table for constructor */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
@@ -179,7 +182,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident
#define THUNK_GENERATOR(generator)
#endif
-static const HashTableValue JSTestObjPrototypeTableValues[47] =
+static const HashTableValue JSTestObjPrototypeTableValues[48] =
{
{ "CONST_VALUE_0", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_0), (intptr_t)0 THUNK_GENERATOR(0) },
{ "CONST_VALUE_1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_1), (intptr_t)0 THUNK_GENERATOR(0) },
@@ -202,6 +205,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[47] =
{ "methodThatRequiresAllArgsAndThrows", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows), (intptr_t)2 THUNK_GENERATOR(0) },
{ "serializedValue", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionSerializedValue), (intptr_t)1 THUNK_GENERATOR(0) },
{ "idbKey", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionIdbKey), (intptr_t)1 THUNK_GENERATOR(0) },
+ { "optionsObject", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOptionsObject), (intptr_t)2 THUNK_GENERATOR(0) },
{ "methodWithException", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithException), (intptr_t)0 THUNK_GENERATOR(0) },
{ "customMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethod), (intptr_t)0 THUNK_GENERATOR(0) },
{ "customMethodWithArgs", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) },
@@ -231,7 +235,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[47] =
};
#undef THUNK_GENERATOR
-static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 135, 127, JSTestObjPrototypeTableValues, 0 };
+static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 136, 127, JSTestObjPrototypeTableValues, 0 };
const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", 0, &JSTestObjPrototypeTable, 0 };
JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
@@ -282,7 +286,7 @@ JSValue jsTestObjReadOnlyIntAttr(ExecState* exec, JSValue slotBase, const Identi
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- JSValue result = jsNumber(exec, imp->readOnlyIntAttr());
+ JSValue result = jsNumber(imp->readOnlyIntAttr());
return result;
}
@@ -304,12 +308,30 @@ JSValue jsTestObjReadOnlyTestObjAttr(ExecState* exec, JSValue slotBase, const Id
return result;
}
+JSValue jsTestObjShortAttr(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(imp->shortAttr());
+ return result;
+}
+
+JSValue jsTestObjUnsignedShortAttr(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(imp->unsignedShortAttr());
+ return result;
+}
+
JSValue jsTestObjIntAttr(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->intAttr());
+ JSValue result = jsNumber(imp->intAttr());
return result;
}
@@ -318,7 +340,7 @@ JSValue jsTestObjLongLongAttr(ExecState* exec, JSValue slotBase, const Identifie
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- JSValue result = jsNumber(exec, imp->longLongAttr());
+ JSValue result = jsNumber(imp->longLongAttr());
return result;
}
@@ -327,7 +349,7 @@ JSValue jsTestObjUnsignedLongLongAttr(ExecState* exec, JSValue slotBase, const I
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- JSValue result = jsNumber(exec, imp->unsignedLongLongAttr());
+ JSValue result = jsNumber(imp->unsignedLongLongAttr());
return result;
}
@@ -381,7 +403,7 @@ JSValue jsTestObjReflectedIntegralAttr(ExecState* exec, JSValue slotBase, const
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- JSValue result = jsNumber(exec, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr));
+ JSValue result = jsNumber(imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr));
return result;
}
@@ -426,7 +448,7 @@ JSValue jsTestObjReflectedCustomIntegralAttr(ExecState* exec, JSValue slotBase,
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- JSValue result = jsNumber(exec, imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr));
+ JSValue result = jsNumber(imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr));
return result;
}
@@ -462,7 +484,7 @@ JSValue jsTestObjAttrWithGetterException(ExecState* exec, JSValue slotBase, cons
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
ExceptionCode ec = 0;
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- JSC::JSValue result = jsNumber(exec, imp->attrWithGetterException(ec));
+ JSC::JSValue result = jsNumber(imp->attrWithGetterException(ec));
setDOMException(exec, ec);
return result;
}
@@ -472,7 +494,7 @@ JSValue jsTestObjAttrWithSetterException(ExecState* exec, JSValue slotBase, cons
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- JSValue result = jsNumber(exec, imp->attrWithSetterException());
+ JSValue result = jsNumber(imp->attrWithSetterException());
return result;
}
@@ -516,7 +538,7 @@ JSValue jsTestObjConditionalAttr1(ExecState* exec, JSValue slotBase, const Ident
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- JSValue result = jsNumber(exec, imp->conditionalAttr1());
+ JSValue result = jsNumber(imp->conditionalAttr1());
return result;
}
#endif
@@ -527,7 +549,7 @@ JSValue jsTestObjConditionalAttr2(ExecState* exec, JSValue slotBase, const Ident
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- JSValue result = jsNumber(exec, imp->conditionalAttr2());
+ JSValue result = jsNumber(imp->conditionalAttr2());
return result;
}
#endif
@@ -538,7 +560,7 @@ JSValue jsTestObjConditionalAttr3(ExecState* exec, JSValue slotBase, const Ident
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- JSValue result = jsNumber(exec, imp->conditionalAttr3());
+ JSValue result = jsNumber(imp->conditionalAttr3());
return result;
}
#endif
@@ -548,7 +570,7 @@ 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());
+ JSValue result = jsNumber(imp->description());
return result;
}
@@ -557,7 +579,7 @@ 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());
+ JSValue result = jsNumber(imp->id());
return result;
}
@@ -580,6 +602,20 @@ void JSTestObj::put(ExecState* exec, const Identifier& propertyName, JSValue val
lookupPut<JSTestObj, Base>(exec, propertyName, value, &JSTestObjTable, this, slot);
}
+void setJSTestObjShortAttr(ExecState* exec, JSObject* thisObject, JSValue value)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
+ TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+ imp->setShortAttr(value.toInt32(exec));
+}
+
+void setJSTestObjUnsignedShortAttr(ExecState* exec, JSObject* thisObject, JSValue value)
+{
+ JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
+ TestObj* imp = static_cast<TestObj*>(castedThis->impl());
+ imp->setUnsignedShortAttr(value.toUInt32(exec));
+}
+
void setJSTestObjIntAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
@@ -821,7 +857,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- JSC::JSValue result = jsNumber(exec, imp->intMethod());
+ JSC::JSValue result = jsNumber(imp->intMethod());
return JSValue::encode(result);
}
@@ -843,7 +879,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecSta
return JSValue::encode(jsUndefined());
- JSC::JSValue result = jsNumber(exec, imp->intMethodWithArgs(intArg, strArg, objArg));
+ JSC::JSValue result = jsNumber(imp->intMethodWithArgs(intArg, strArg, objArg));
return JSValue::encode(result);
}
@@ -956,6 +992,31 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIdbKey(ExecState* exec)
return JSValue::encode(jsUndefined());
}
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOptionsObject(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());
+ OptionsObject* oo = toOptionsObject(exec->argument(0));
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ int argsCount = exec->argumentCount();
+ if (argsCount <= 1) {
+ imp->optionsObject(oo);
+ return JSValue::encode(jsUndefined());
+ }
+
+ OptionsObject* ooo = toOptionsObject(exec->argument(1));
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+
+ imp->optionsObject(oo, ooo);
+ return JSValue::encode(jsUndefined());
+}
+
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
@@ -996,14 +1057,14 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(Ex
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
- OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1));
+ RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1));
size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));
+ RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));
log* intArg = tolog(exec->argument(0));
if (exec->hadException())
return JSValue::encode(jsUndefined());
- imp->customArgsAndException(intArg, scriptArguments.release(), callStack.release(), ec);
+ imp->customArgsAndException(intArg, scriptArguments, callStack, ec);
setDOMException(exec, ec);
return JSValue::encode(jsUndefined());
}
@@ -1476,7 +1537,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptional(E
int argsCount = exec->argumentCount();
if (argsCount <= 0) {
- JSC::JSValue result = jsNumber(exec, imp->classMethodWithOptional());
+ JSC::JSValue result = jsNumber(imp->classMethodWithOptional());
return JSValue::encode(result);
}
@@ -1485,7 +1546,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptional(E
return JSValue::encode(jsUndefined());
- JSC::JSValue result = jsNumber(exec, imp->classMethodWithOptional(arg));
+ JSC::JSValue result = jsNumber(imp->classMethodWithOptional(arg));
return JSValue::encode(result);
}
@@ -1493,32 +1554,38 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptional(E
JSValue jsTestObjCONST_VALUE_0(ExecState* exec, JSValue, const Identifier&)
{
- return jsNumber(exec, static_cast<int>(0));
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(0));
}
JSValue jsTestObjCONST_VALUE_1(ExecState* exec, JSValue, const Identifier&)
{
- return jsNumber(exec, static_cast<int>(1));
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(1));
}
JSValue jsTestObjCONST_VALUE_2(ExecState* exec, JSValue, const Identifier&)
{
- return jsNumber(exec, static_cast<int>(2));
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(2));
}
JSValue jsTestObjCONST_VALUE_4(ExecState* exec, JSValue, const Identifier&)
{
- return jsNumber(exec, static_cast<int>(4));
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(4));
}
JSValue jsTestObjCONST_VALUE_8(ExecState* exec, JSValue, const Identifier&)
{
- return jsNumber(exec, static_cast<int>(8));
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(8));
}
JSValue jsTestObjCONST_VALUE_9(ExecState* exec, JSValue, const Identifier&)
{
- return jsNumber(exec, static_cast<int>(-1));
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(-1));
}
JSValue jsTestObjCONST_VALUE_10(ExecState* exec, JSValue, const Identifier&)
@@ -1528,22 +1595,26 @@ JSValue jsTestObjCONST_VALUE_10(ExecState* exec, JSValue, const Identifier&)
JSValue jsTestObjCONST_VALUE_11(ExecState* exec, JSValue, const Identifier&)
{
- return jsNumber(exec, static_cast<int>(0xffffffff));
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(0xffffffff));
}
JSValue jsTestObjCONST_VALUE_12(ExecState* exec, JSValue, const Identifier&)
{
- return jsNumber(exec, static_cast<int>(0x01));
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(0x01));
}
JSValue jsTestObjCONST_VALUE_13(ExecState* exec, JSValue, const Identifier&)
{
- return jsNumber(exec, static_cast<int>(0X20));
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(0X20));
}
JSValue jsTestObjCONST_VALUE_14(ExecState* exec, JSValue, const Identifier&)
{
- return jsNumber(exec, static_cast<int>(0x1abc));
+ UNUSED_PARAM(exec);
+ return jsNumber(static_cast<int>(0x1abc));
}
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 2168b3f..c27444a 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestObj.h
+++ b/WebCore/bindings/scripts/test/JS/JSTestObj.h
@@ -96,6 +96,7 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAl
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIdbKey(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOptionsObject(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*);
@@ -126,6 +127,10 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptio
JSC::JSValue jsTestObjReadOnlyIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
JSC::JSValue jsTestObjReadOnlyStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
JSC::JSValue jsTestObjReadOnlyTestObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+JSC::JSValue jsTestObjShortAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+void setJSTestObjShortAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
+JSC::JSValue jsTestObjUnsignedShortAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+void setJSTestObjUnsignedShortAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjIntAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjLongLongAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
index 1ad29cb..766d31f 100644
--- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
+++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
@@ -29,6 +29,7 @@
#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST
@class DOMIDBKey;
+@class DOMOptionsObject;
@class DOMTestObj;
@class DOMlog;
@class NSString;
@@ -52,6 +53,10 @@ enum {
- (int)readOnlyIntAttr;
- (NSString *)readOnlyStringAttr;
- (DOMTestObj *)readOnlyTestObjAttr;
+- (short)shortAttr;
+- (void)setShortAttr:(short)newShortAttr;
+- (unsigned short)unsignedShortAttr;
+- (void)setUnsignedShortAttr:(unsigned short)newUnsignedShortAttr;
- (int)intAttr;
- (void)setIntAttr:(int)newIntAttr;
- (long long)longLongAttr;
@@ -123,6 +128,7 @@ enum {
- (DOMTestObj *)methodThatRequiresAllArgsAndThrows:(NSString *)strArg objArg:(DOMTestObj *)objArg;
- (void)serializedValue:(NSString *)serializedArg;
- (void)idbKey:(DOMIDBKey *)key;
+- (void)optionsObject:(DOMOptionsObject *)oo ooo:(DOMOptionsObject *)ooo;
- (void)methodWithException;
- (void)customMethod;
- (void)customMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg;
diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
index 6788075..ac04235 100644
--- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
+++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
@@ -35,6 +35,7 @@
#import "DOMEventInternal.h"
#import "DOMIDBKeyInternal.h"
#import "DOMNodeInternal.h"
+#import "DOMOptionsObjectInternal.h"
#import "DOMStyleSheetInternal.h"
#import "DOMTestObjInternal.h"
#import "DOMlogInternal.h"
@@ -45,6 +46,7 @@
#import "JSMainThreadExecState.h"
#import "KURL.h"
#import "ObjCEventListener.h"
+#import "OptionsObject.h"
#import "SerializedScriptValue.h"
#import "TestObj.h"
#import "ThreadCheck.h"
@@ -92,6 +94,30 @@
return kit(WTF::getPtr(IMPL->readOnlyTestObjAttr()));
}
+- (short)shortAttr
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->shortAttr();
+}
+
+- (void)setShortAttr:(short)newShortAttr
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->setShortAttr(newShortAttr);
+}
+
+- (unsigned short)unsignedShortAttr
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->unsignedShortAttr();
+}
+
+- (void)setUnsignedShortAttr:(unsigned short)newUnsignedShortAttr
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->setUnsignedShortAttr(newUnsignedShortAttr);
+}
+
- (int)intAttr
{
WebCore::JSMainThreadNullState state;
@@ -509,6 +535,12 @@
IMPL->idbKey(core(key));
}
+- (void)optionsObject:(DOMOptionsObject *)oo ooo:(DOMOptionsObject *)ooo
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->optionsObject(core(oo), core(ooo));
+}
+
- (void)methodWithException
{
WebCore::JSMainThreadNullState state;
diff --git a/WebCore/bindings/scripts/test/TestObj.idl b/WebCore/bindings/scripts/test/TestObj.idl
index 22ed680..c0d0e88 100644
--- a/WebCore/bindings/scripts/test/TestObj.idl
+++ b/WebCore/bindings/scripts/test/TestObj.idl
@@ -35,6 +35,8 @@ module test {
readonly attribute long readOnlyIntAttr;
readonly attribute DOMString readOnlyStringAttr;
readonly attribute TestObj readOnlyTestObjAttr;
+ attribute short shortAttr;
+ attribute unsigned short unsignedShortAttr;
attribute long intAttr;
attribute long long longLongAttr;
attribute unsigned long long unsignedLongLongAttr;
@@ -72,6 +74,7 @@ module test {
void serializedValue(in SerializedScriptValue serializedArg);
void idbKey(in IDBKey key);
+ void optionsObject(in OptionsObject oo, in [Optional] OptionsObject ooo);
// Exceptions
void methodWithException() raises(DOMException);
diff --git a/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp b/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
index 1f78f39..ab9e6db 100644
--- a/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
+++ b/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
@@ -22,13 +22,13 @@
#include "V8TestMediaQueryListListener.h"
#include "ExceptionCode.h"
+#include "MediaQueryListListener.h"
#include "RuntimeEnabledFeatures.h"
#include "V8Binding.h"
#include "V8BindingMacros.h"
#include "V8BindingState.h"
#include "V8DOMWrapper.h"
#include "V8IsolatedContext.h"
-#include "V8MediaQueryListListener.h"
#include "V8Proxy.h"
namespace WebCore {
@@ -43,28 +43,25 @@ static v8::Handle<v8::Value> methodCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TestMediaQueryListListener.method");
TestMediaQueryListListener* imp = V8TestMediaQueryListListener::toNative(args.Holder());
- EXCEPTION_BLOCK(MediaQueryListListener*, listener, V8MediaQueryListListener::HasInstance(args[0]) ? V8MediaQueryListListener::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
+ EXCEPTION_BLOCK(RefPtr<MediaQueryListListener>, listener, MediaQueryListListener::create(args[0]));
imp->method(listener);
return v8::Handle<v8::Value>();
}
} // namespace TestMediaQueryListListenerInternal
+static const BatchedCallback TestMediaQueryListListenerCallbacks[] = {
+ {"method", TestMediaQueryListListenerInternal::methodCallback},
+};
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestMediaQueryListListenerTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestMediaQueryListListener", v8::Persistent<v8::FunctionTemplate>(), V8TestMediaQueryListListener::internalFieldCount,
0, 0,
- 0, 0);
+ TestMediaQueryListListenerCallbacks, WTF_ARRAY_LENGTH(TestMediaQueryListListenerCallbacks));
v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
- // Custom Signature 'method'
- const int methodArgc = 1;
- v8::Handle<v8::FunctionTemplate> methodArgv[methodArgc] = { V8MediaQueryListListener::GetRawTemplate() };
- v8::Handle<v8::Signature> methodSignature = v8::Signature::New(desc, methodArgc, methodArgv);
- proto->Set(v8::String::New("method"), v8::FunctionTemplate::New(TestMediaQueryListListenerInternal::methodCallback, v8::Handle<v8::Value>(), methodSignature));
-
// Custom toString template
desc->Set(getToStringName(), getToStringTemplate());
return desc;
diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
index 4c921bb..d4fdff5 100644
--- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
+++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
@@ -25,6 +25,7 @@
#include "HTMLNames.h"
#include "IDBBindingUtilities.h"
#include "IDBKey.h"
+#include "OptionsObject.h"
#include "RuntimeEnabledFeatures.h"
#include "ScriptArguments.h"
#include "ScriptCallStack.h"
@@ -79,6 +80,38 @@ static v8::Handle<v8::Value> readOnlyTestObjAttrAttrGetter(v8::Local<v8::String>
return wrapper;
}
+static v8::Handle<v8::Value> shortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.shortAttr._get");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ return v8::Integer::New(imp->shortAttr());
+}
+
+static void shortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.shortAttr._set");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ int v = toInt32(value);
+ imp->setShortAttr(v);
+ return;
+}
+
+static v8::Handle<v8::Value> unsignedShortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.unsignedShortAttr._get");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ return v8::Integer::New(imp->unsignedShortAttr());
+}
+
+static void unsignedShortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.TestObj.unsignedShortAttr._set");
+ TestObj* imp = V8TestObj::toNative(info.Holder());
+ int v = toUInt32(value);
+ imp->setUnsignedShortAttr(v);
+ return;
+}
+
static v8::Handle<v8::Value> intAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.intAttr._get");
@@ -695,6 +728,20 @@ static v8::Handle<v8::Value> idbKeyCallback(const v8::Arguments& args)
return v8::Handle<v8::Value>();
}
+static v8::Handle<v8::Value> optionsObjectCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.TestObj.optionsObject");
+ TestObj* imp = V8TestObj::toNative(args.Holder());
+ EXCEPTION_BLOCK(OptionsObject, oo, args[0]);
+ if (args.Length() <= 1) {
+ imp->optionsObject(oo);
+ return v8::Handle<v8::Value>();
+ }
+ EXCEPTION_BLOCK(OptionsObject, ooo, args[1]);
+ imp->optionsObject(oo, ooo);
+ return v8::Handle<v8::Value>();
+}
+
static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TestObj.methodWithException");
@@ -717,13 +764,13 @@ static v8::Handle<v8::Value> customArgsAndExceptionCallback(const v8::Arguments&
TestObj* imp = V8TestObj::toNative(args.Holder());
ExceptionCode ec = 0;
{
- OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
+ RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize));
+ RefPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize));
if (!callStack)
return v8::Undefined();
EXCEPTION_BLOCK(log*, intArg, V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
- imp->customArgsAndException(intArg, scriptArguments.release(), callStack.release(), ec);
+ imp->customArgsAndException(intArg, scriptArguments, callStack, ec);
if (UNLIKELY(ec))
goto fail;
return v8::Handle<v8::Value>();
@@ -1094,6 +1141,10 @@ static const BatchedAttribute TestObjAttrs[] = {
{"readOnlyStringAttr", TestObjInternal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '')
{"readOnlyTestObjAttr", TestObjInternal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '')
+ {"shortAttr", TestObjInternal::shortAttrAttrGetter, TestObjInternal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ // Attribute 'unsignedShortAttr' (Type: 'attribute' ExtAttr: '')
+ {"unsignedShortAttr", TestObjInternal::unsignedShortAttrAttrGetter, TestObjInternal::unsignedShortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'intAttr' (Type: 'attribute' ExtAttr: '')
{"intAttr", TestObjInternal::intAttrAttrGetter, TestObjInternal::intAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'longLongAttr' (Type: 'attribute' ExtAttr: '')
@@ -1165,6 +1216,7 @@ static const BatchedCallback TestObjCallbacks[] = {
{"objMethod", TestObjInternal::objMethodCallback},
{"serializedValue", TestObjInternal::serializedValueCallback},
{"idbKey", TestObjInternal::idbKeyCallback},
+ {"optionsObject", TestObjInternal::optionsObjectCallback},
{"methodWithException", TestObjInternal::methodWithExceptionCallback},
{"customMethod", V8TestObj::customMethodCallback},
{"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback},
@@ -1217,8 +1269,8 @@ COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWro
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestObj", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
- TestObjAttrs, sizeof(TestObjAttrs) / sizeof(*TestObjAttrs),
- TestObjCallbacks, sizeof(TestObjCallbacks) / sizeof(*TestObjCallbacks));
+ TestObjAttrs, WTF_ARRAY_LENGTH(TestObjAttrs),
+ TestObjCallbacks, WTF_ARRAY_LENGTH(TestObjCallbacks));
v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
@@ -1276,7 +1328,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi
proto->Set(v8::String::New("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod1Callback, v8::Handle<v8::Value>(), defaultSignature));
if (RuntimeEnabledFeatures::featureNameEnabled())
proto->Set(v8::String::New("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod2Callback, v8::Handle<v8::Value>(), defaultSignature));
- batchConfigureConstants(desc, proto, TestObjConsts, sizeof(TestObjConsts) / sizeof(*TestObjConsts));
+ batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts));
// Custom toString template
desc->Set(getToStringName(), getToStringTemplate());
diff --git a/WebCore/bindings/v8/DOMDataStore.cpp b/WebCore/bindings/v8/DOMDataStore.cpp
index 0b06a69..0d37dc0 100644
--- a/WebCore/bindings/v8/DOMDataStore.cpp
+++ b/WebCore/bindings/v8/DOMDataStore.cpp
@@ -88,7 +88,6 @@ DOMDataStore::DOMDataStore(DOMData* domData)
, m_activeDomObjectMap(0)
#if ENABLE(SVG)
, m_domSvgElementInstanceMap(0)
- , m_domSvgObjectWithContextMap(0)
#endif
, m_domData(domData)
{
@@ -126,8 +125,6 @@ void* DOMDataStore::getDOMWrapperMap(DOMWrapperMapType type)
#if ENABLE(SVG)
case DOMSVGElementInstanceMap:
return m_domSvgElementInstanceMap;
- case DOMSVGObjectWithContextMap:
- return m_domSvgObjectWithContextMap;
#endif
}
@@ -197,13 +194,6 @@ void DOMDataStore::weakSVGElementInstanceCallback(v8::Persistent<v8::Value> v8Ob
DOMData::handleWeakObject(DOMDataStore::DOMSVGElementInstanceMap, v8::Persistent<v8::Object>::Cast(v8Object), static_cast<SVGElementInstance*>(domObject));
}
-void DOMDataStore::weakSVGObjectWithContextCallback(v8::Persistent<v8::Value> v8Object, void* domObject)
-{
- v8::HandleScope scope;
- ASSERT(v8Object->IsObject());
- DOMData::handleWeakObject(DOMDataStore::DOMSVGObjectWithContextMap, v8::Persistent<v8::Object>::Cast(v8Object), domObject);
-}
-
#endif // ENABLE(SVG)
} // namespace WebCore
diff --git a/WebCore/bindings/v8/DOMDataStore.h b/WebCore/bindings/v8/DOMDataStore.h
index c39a0ed..3758e23 100644
--- a/WebCore/bindings/v8/DOMDataStore.h
+++ b/WebCore/bindings/v8/DOMDataStore.h
@@ -156,8 +156,7 @@ namespace WebCore {
DOMObjectMap,
ActiveDOMObjectMap,
#if ENABLE(SVG)
- DOMSVGElementInstanceMap,
- DOMSVGObjectWithContextMap
+ DOMSVGElementInstanceMap
#endif
};
@@ -251,7 +250,6 @@ namespace WebCore {
DOMWrapperMap<void>& activeDomObjectMap() { return *m_activeDomObjectMap; }
#if ENABLE(SVG)
DOMWrapperMap<SVGElementInstance>& domSvgElementInstanceMap() { return *m_domSvgElementInstanceMap; }
- DOMWrapperMap<void>& domSvgObjectWithContextMap() { return *m_domSvgObjectWithContextMap; }
#endif
// Need by V8GCController.
@@ -262,8 +260,6 @@ namespace WebCore {
static void weakDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject);
#if ENABLE(SVG)
static void weakSVGElementInstanceCallback(v8::Persistent<v8::Value> v8Object, void* domObject);
- // SVG non-node elements may have a reference to a context node which should be notified when the element is change.
- static void weakSVGObjectWithContextCallback(v8::Persistent<v8::Value> v8Object, void* domObject);
#endif
DOMNodeMapping* m_domNodeMap;
@@ -271,7 +267,6 @@ namespace WebCore {
DOMWrapperMap<void>* m_activeDomObjectMap;
#if ENABLE(SVG)
DOMWrapperMap<SVGElementInstance>* m_domSvgElementInstanceMap;
- DOMWrapperMap<void>* m_domSvgObjectWithContextMap;
#endif
private:
diff --git a/WebCore/bindings/v8/IDBBindingUtilities.cpp b/WebCore/bindings/v8/IDBBindingUtilities.cpp
index 123b15c..644e2d2 100644
--- a/WebCore/bindings/v8/IDBBindingUtilities.cpp
+++ b/WebCore/bindings/v8/IDBBindingUtilities.cpp
@@ -45,7 +45,8 @@ PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value)
return IDBKey::create(value->Int32Value());
if (value->IsString())
return IDBKey::create(v8ValueToWebCoreString(value));
- // FIXME: Implement dates.
+ if (value->IsDate())
+ return 0; // Signals type error. FIXME: Implement dates.
return 0; // Signals type error.
}
diff --git a/WebCore/bindings/v8/OptionsObject.cpp b/WebCore/bindings/v8/OptionsObject.cpp
new file mode 100644
index 0000000..ce9189a
--- /dev/null
+++ b/WebCore/bindings/v8/OptionsObject.cpp
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "OptionsObject.h"
+
+#include "DOMStringList.h"
+#include "V8Binding.h"
+#include <limits>
+
+#if ENABLE(INDEXED_DATABASE)
+#include "IDBKeyRange.h"
+#include "V8IDBKeyRange.h"
+#endif
+
+namespace WebCore {
+
+OptionsObject::OptionsObject()
+{
+}
+
+OptionsObject::OptionsObject(const v8::Local<v8::Value>& options)
+ : m_options(options)
+{
+}
+
+OptionsObject::~OptionsObject()
+{
+}
+
+OptionsObject& OptionsObject::operator=(const OptionsObject& optionsObject)
+{
+ m_options = optionsObject.m_options;
+ return *this;
+}
+
+bool OptionsObject::isUndefinedOrNull() const
+{
+ if (m_options.IsEmpty())
+ return true;
+ return WebCore::isUndefinedOrNull(m_options);
+}
+
+bool OptionsObject::getKeyBool(const String& key, bool& value) const
+{
+ v8::Local<v8::Value> v8Value;
+ if (!getKey(key, v8Value))
+ return false;
+
+ v8::Local<v8::Boolean> v8Bool = v8Value->ToBoolean();
+ if (v8Bool.IsEmpty())
+ return false;
+ value = v8Bool->Value();
+ return true;
+}
+
+bool OptionsObject::getKeyInt32(const String& key, int32_t& value) const
+{
+ v8::Local<v8::Value> v8Value;
+ if (!getKey(key, v8Value))
+ return false;
+
+ v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32();
+ if (v8Int32.IsEmpty())
+ return false;
+ value = v8Int32->Value();
+ return true;
+}
+
+bool OptionsObject::getKeyString(const String& key, String& value) const
+{
+ v8::Local<v8::Value> v8Value;
+ if (!getKey(key, v8Value))
+ return false;
+
+ // FIXME: It is possible for this to throw in which case we'd be getting back
+ // an empty string and returning true when we should be returning false.
+ // See fast/dom/Geolocation/script-tests/argument-types.js for a similar
+ // example.
+ value = v8ValueToWebCoreString(v8Value);
+ return true;
+}
+
+PassRefPtr<DOMStringList> OptionsObject::getKeyDOMStringList(const String& key) const
+{
+ v8::Local<v8::Value> v8Value;
+ if (!getKey(key, v8Value))
+ return 0;
+
+ if (!v8Value->IsArray())
+ return 0;
+
+ RefPtr<DOMStringList> ret = DOMStringList::create();
+ v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value);
+ for (size_t i = 0; i < v8Array->Length(); ++i) {
+ v8::Local<v8::Value> indexedValue = v8Array->Get(v8::Integer::New(i));
+ ret->append(v8ValueToWebCoreString(indexedValue));
+ }
+ return ret.release();
+}
+
+#if ENABLE(INDEXED_DATABASE)
+
+PassRefPtr<IDBKeyRange> OptionsObject::getKeyKeyRange(const String& key) const
+{
+ v8::Local<v8::Value> v8Value;
+ if (!getKey(key, v8Value))
+ return 0;
+
+ if (!V8IDBKeyRange::HasInstance(v8Value))
+ return 0;
+
+ return V8IDBKeyRange::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+}
+
+#endif
+
+bool OptionsObject::getKey(const String& key, v8::Local<v8::Value>& value) const
+{
+ if (isUndefinedOrNull())
+ return false;
+ v8::Local<v8::Object> options = m_options->ToObject();
+ ASSERT(!options.IsEmpty());
+
+ v8::Handle<v8::String> v8Key = v8String(key);
+ if (!options->Has(v8Key))
+ return false;
+ value = options->Get(v8Key);
+ if (value.IsEmpty())
+ return false;
+ return !value->IsUndefined(); // FIXME: Is the undefined check necessary?
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/v8/OptionsObject.h b/WebCore/bindings/v8/OptionsObject.h
new file mode 100644
index 0000000..b006927
--- /dev/null
+++ b/WebCore/bindings/v8/OptionsObject.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef OptionsObject_h
+#define OptionsObject_h
+
+#include "PlatformString.h"
+#include <v8.h>
+
+namespace WebCore {
+
+class DOMStringList;
+class IDBKeyRange;
+
+class OptionsObject {
+public:
+ OptionsObject();
+ OptionsObject(const v8::Local<v8::Value>& options);
+ ~OptionsObject();
+
+ OptionsObject& operator=(const OptionsObject&);
+
+ bool isUndefinedOrNull() const;
+ bool getKeyBool(const String& key, bool& value) const;
+ bool getKeyInt32(const String& key, int32_t& value) const;
+ bool getKeyString(const String& key, String& value) const;
+ PassRefPtr<DOMStringList> getKeyDOMStringList(const String& key) const;
+ PassRefPtr<IDBKeyRange> getKeyKeyRange(const String& key) const;
+
+private:
+ bool getKey(const String& key, v8::Local<v8::Value>&) const;
+
+ // This object can only be used safely when stack allocated because of v8::Local.
+ static void* operator new(size_t);
+ static void* operator new[](size_t);
+ static void operator delete(void *);
+
+ v8::Local<v8::Value> m_options;
+};
+
+}
+
+#endif // OptionsObject_h
diff --git a/WebCore/bindings/v8/ScopedDOMDataStore.cpp b/WebCore/bindings/v8/ScopedDOMDataStore.cpp
index df4a63a..60a6c67 100644
--- a/WebCore/bindings/v8/ScopedDOMDataStore.cpp
+++ b/WebCore/bindings/v8/ScopedDOMDataStore.cpp
@@ -41,7 +41,6 @@ ScopedDOMDataStore::ScopedDOMDataStore(DOMData* domData)
m_activeDomObjectMap = new DOMWrapperMap<void>(&DOMDataStore::weakActiveDOMObjectCallback);
#if ENABLE(SVG)
m_domSvgElementInstanceMap = new DOMWrapperMap<SVGElementInstance>(&DOMDataStore::weakSVGElementInstanceCallback);
- m_domSvgObjectWithContextMap = new DOMWrapperMap<void>(&DOMDataStore::weakSVGObjectWithContextCallback);
#endif
}
@@ -52,7 +51,6 @@ ScopedDOMDataStore::~ScopedDOMDataStore()
delete m_activeDomObjectMap;
#if ENABLE(SVG)
delete m_domSvgElementInstanceMap;
- delete m_domSvgObjectWithContextMap;
#endif
}
diff --git a/WebCore/bindings/v8/ScriptCallStackFactory.cpp b/WebCore/bindings/v8/ScriptCallStackFactory.cpp
index 62fbeef..5d4e146 100644
--- a/WebCore/bindings/v8/ScriptCallStackFactory.cpp
+++ b/WebCore/bindings/v8/ScriptCallStackFactory.cpp
@@ -78,17 +78,17 @@ static void toScriptCallFramesVector(v8::Local<v8::Context> context, v8::Handle<
}
}
-PassOwnPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize)
+PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context> context, v8::Handle<v8::StackTrace> stackTrace, size_t maxStackSize)
{
v8::HandleScope scope;
v8::Context::Scope contextScope(context);
Vector<ScriptCallFrame> scriptCallFrames;
toScriptCallFramesVector(context, stackTrace, scriptCallFrames, maxStackSize);
- return new ScriptCallStack(scriptCallFrames);
+ return ScriptCallStack::create(scriptCallFrames);
}
-PassOwnPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize)
+PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize)
{
v8::HandleScope scope;
v8::Local<v8::Context> context = v8::Context::GetCurrent();
@@ -98,7 +98,7 @@ PassOwnPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize)
return createScriptCallStack(context, stackTrace, maxStackSize);
}
-PassOwnPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount)
+PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount)
{
v8::HandleScope scope;
v8::Local<v8::Context> context = v8::Context::GetCurrent();
@@ -108,7 +108,7 @@ PassOwnPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8argumen
for (int i = skipArgumentCount; i < v8arguments.Length(); ++i)
arguments.append(ScriptValue(v8arguments[i]));
- return new ScriptArguments(state, arguments);
+ return ScriptArguments::create(state, arguments);
}
bool ScriptCallStack::stackTrace(int frameLimit, const RefPtr<InspectorArray>& stackTrace)
diff --git a/WebCore/bindings/v8/ScriptCallStackFactory.h b/WebCore/bindings/v8/ScriptCallStackFactory.h
index 613af7b..66e44f5 100644
--- a/WebCore/bindings/v8/ScriptCallStackFactory.h
+++ b/WebCore/bindings/v8/ScriptCallStackFactory.h
@@ -32,10 +32,12 @@
#define ScriptCallStackFactory_h
#include <v8.h>
-#include <wtf/PassOwnPtr.h>
+#include <wtf/Forward.h>
namespace WebCore {
+class ScriptArguments;
+class ScriptCallStack;
class ScriptState;
const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v8::StackTrace::StackTraceOptions>(
@@ -44,12 +46,9 @@ const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v8::Stac
| v8::StackTrace::kScriptNameOrSourceURL
| v8::StackTrace::kFunctionName);
-class ScriptArguments;
-class ScriptCallStack;
-
-PassOwnPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context>, v8::Handle<v8::StackTrace>, size_t maxStackSize);
-PassOwnPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize);
-PassOwnPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount);
+PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Local<v8::Context>, v8::Handle<v8::StackTrace>, size_t maxStackSize);
+PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize);
+PassRefPtr<ScriptArguments> createScriptArguments(const v8::Arguments& v8arguments, unsigned skipArgumentCount);
} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptHeapSnapshot.cpp b/WebCore/bindings/v8/ScriptHeapSnapshot.cpp
index 885d039..c35d508 100644
--- a/WebCore/bindings/v8/ScriptHeapSnapshot.cpp
+++ b/WebCore/bindings/v8/ScriptHeapSnapshot.cpp
@@ -33,6 +33,7 @@
#include "InspectorValues.h"
#include "V8Binding.h"
+#include <v8.h>
#include <v8-profiler.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -50,50 +51,29 @@ unsigned int ScriptHeapSnapshot::uid() const
return m_snapshot->GetUid();
}
-static PassRefPtr<InspectorObject> buildInspectorObjectFor(const v8::HeapGraphNode* root)
-{
- v8::HandleScope scope;
- RefPtr<InspectorObject> result = InspectorObject::create();
- RefPtr<InspectorObject> lowLevels = InspectorObject::create();
- RefPtr<InspectorObject> entries = InspectorObject::create();
- RefPtr<InspectorObject> children = InspectorObject::create();
- for (int i = 0, count = root->GetChildrenCount(); i < count; ++i) {
- const v8::HeapGraphNode* node = root->GetChild(i)->GetToNode();
- if (node->GetType() == v8::HeapGraphNode::kInternal) {
- RefPtr<InspectorObject> lowLevel = InspectorObject::create();
- lowLevel->setNumber("count", node->GetInstancesCount());
- lowLevel->setNumber("size", node->GetSelfSize());
- lowLevel->setString("type", toWebCoreString(node->GetName()));
- lowLevels->setObject(toWebCoreString(node->GetName()), lowLevel);
- } else if (node->GetInstancesCount()) {
- RefPtr<InspectorObject> entry = InspectorObject::create();
- entry->setString("constructorName", toWebCoreString(node->GetName()));
- entry->setNumber("count", node->GetInstancesCount());
- entry->setNumber("size", node->GetSelfSize());
- entries->setObject(toWebCoreString(node->GetName()), entry);
- } else {
- RefPtr<InspectorObject> entry = InspectorObject::create();
- entry->setString("constructorName", toWebCoreString(node->GetName()));
- for (int j = 0, count = node->GetChildrenCount(); j < count; ++j) {
- const v8::HeapGraphEdge* v8Edge = node->GetChild(j);
- const v8::HeapGraphNode* v8Child = v8Edge->GetToNode();
- RefPtr<InspectorObject> child = InspectorObject::create();
- child->setString("constructorName", toWebCoreString(v8Child->GetName()));
- child->setNumber("count", v8Edge->GetName()->ToInteger()->Value());
- entry->setObject(String::number(reinterpret_cast<unsigned long long>(v8Child)), child);
- }
- children->setObject(String::number(reinterpret_cast<unsigned long long>(node)), entry);
- }
+namespace {
+
+class OutputStreamAdapter : public v8::OutputStream {
+public:
+ OutputStreamAdapter(ScriptHeapSnapshot::OutputStream* output)
+ : m_output(output) { }
+ void EndOfStream() { m_output->Close(); }
+ int GetChunkSize() { return 10240; }
+ WriteResult WriteAsciiChunk(char* data, int size)
+ {
+ m_output->Write(String(data, size));
+ return kContinue;
}
- result->setObject("lowlevels", lowLevels);
- result->setObject("entries", entries);
- result->setObject("children", children);
- return result.release();
-}
+private:
+ ScriptHeapSnapshot::OutputStream* m_output;
+};
+
+} // namespace
-PassRefPtr<InspectorObject> ScriptHeapSnapshot::buildInspectorObjectForHead() const
+void ScriptHeapSnapshot::writeJSON(ScriptHeapSnapshot::OutputStream* stream)
{
- return buildInspectorObjectFor(m_snapshot->GetRoot());
+ OutputStreamAdapter outputStream(stream);
+ m_snapshot->Serialize(&outputStream, v8::HeapSnapshot::kJSON);
}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptHeapSnapshot.h b/WebCore/bindings/v8/ScriptHeapSnapshot.h
index 794a5a9..d3ae022 100644
--- a/WebCore/bindings/v8/ScriptHeapSnapshot.h
+++ b/WebCore/bindings/v8/ScriptHeapSnapshot.h
@@ -43,6 +43,13 @@ class InspectorObject;
class ScriptHeapSnapshot : public RefCounted<ScriptHeapSnapshot> {
public:
+ class OutputStream {
+ public:
+ virtual ~OutputStream() { }
+ virtual void Write(const String& chunk) = 0;
+ virtual void Close() = 0;
+ };
+
static PassRefPtr<ScriptHeapSnapshot> create(const v8::HeapSnapshot* snapshot)
{
return adoptRef(new ScriptHeapSnapshot(snapshot));
@@ -51,8 +58,7 @@ public:
String title() const;
unsigned int uid() const;
-
- PassRefPtr<InspectorObject> buildInspectorObjectForHead() const;
+ void writeJSON(OutputStream* stream);
private:
ScriptHeapSnapshot(const v8::HeapSnapshot* snapshot)
diff --git a/WebCore/bindings/v8/ScriptValue.h b/WebCore/bindings/v8/ScriptValue.h
index 1743da0..d412901 100644
--- a/WebCore/bindings/v8/ScriptValue.h
+++ b/WebCore/bindings/v8/ScriptValue.h
@@ -100,6 +100,11 @@ public:
return m_value == value.m_value;
}
+ bool isFunction() const
+ {
+ return m_value->IsFunction();
+ }
+
bool operator!=(const ScriptValue value) const
{
return !operator==(value);
diff --git a/WebCore/bindings/v8/StaticDOMDataStore.cpp b/WebCore/bindings/v8/StaticDOMDataStore.cpp
index 0b0d531..b4c36b9 100644
--- a/WebCore/bindings/v8/StaticDOMDataStore.cpp
+++ b/WebCore/bindings/v8/StaticDOMDataStore.cpp
@@ -40,7 +40,6 @@ StaticDOMDataStore::StaticDOMDataStore(DOMData* domData)
, m_staticActiveDomObjectMap(&DOMDataStore::weakActiveDOMObjectCallback)
#if ENABLE(SVG)
, m_staticDomSvgElementInstanceMap(&DOMDataStore::weakSVGElementInstanceCallback)
- , m_staticDomSvgObjectWithContextMap(&DOMDataStore::weakSVGObjectWithContextCallback)
#endif
{
m_domNodeMap = &m_staticDomNodeMap;
@@ -48,7 +47,6 @@ StaticDOMDataStore::StaticDOMDataStore(DOMData* domData)
m_activeDomObjectMap = &m_staticActiveDomObjectMap;
#if ENABLE(SVG)
m_domSvgElementInstanceMap = &m_staticDomSvgElementInstanceMap;
- m_domSvgObjectWithContextMap = &m_staticDomSvgObjectWithContextMap;
#endif
}
diff --git a/WebCore/bindings/v8/StaticDOMDataStore.h b/WebCore/bindings/v8/StaticDOMDataStore.h
index d1e5a30..fb6aa42 100644
--- a/WebCore/bindings/v8/StaticDOMDataStore.h
+++ b/WebCore/bindings/v8/StaticDOMDataStore.h
@@ -53,7 +53,6 @@ private:
DOMWrapperMap<void> m_staticActiveDomObjectMap;
#if ENABLE(SVG)
DOMWrapperMap<SVGElementInstance> m_staticDomSvgElementInstanceMap;
- DOMWrapperMap<void> m_staticDomSvgObjectWithContextMap;
#endif
};
diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp
index d0bf0ca..52b23bd 100644
--- a/WebCore/bindings/v8/V8Binding.cpp
+++ b/WebCore/bindings/v8/V8Binding.cpp
@@ -368,7 +368,8 @@ StringType v8StringToWebCoreString(v8::Handle<v8::String> v8String, ExternalMode
template String v8StringToWebCoreString<String>(v8::Handle<v8::String>, ExternalMode);
template AtomicString v8StringToWebCoreString<AtomicString>(v8::Handle<v8::String>, ExternalMode);
-String int32ToWebCoreString(int value)
+// Fast but non thread-safe version.
+String int32ToWebCoreStringFast(int value)
{
// Caching of small strings below is not thread safe: newly constructed AtomicString
// are not safely published.
@@ -390,6 +391,14 @@ String int32ToWebCoreString(int value)
return webCoreString;
}
+String int32ToWebCoreString(int value)
+{
+ // If we are on the main thread (this should always true for non-workers), call the faster one.
+ if (WTF::isMainThread())
+ return int32ToWebCoreStringFast(value);
+ return String::number(value);
+}
+
String v8NonStringValueToWebCoreString(v8::Handle<v8::Value> object)
{
ASSERT(!object->IsString());
diff --git a/WebCore/bindings/v8/V8ConsoleMessage.cpp b/WebCore/bindings/v8/V8ConsoleMessage.cpp
index 40f9a7a..9e6e267 100644
--- a/WebCore/bindings/v8/V8ConsoleMessage.cpp
+++ b/WebCore/bindings/v8/V8ConsoleMessage.cpp
@@ -114,7 +114,7 @@ void V8ConsoleMessage::handler(v8::Handle<v8::Message> message, v8::Handle<v8::V
String errorMessage = toWebCoreString(errorMessageString);
v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
- OwnPtr<ScriptCallStack> callStack;
+ RefPtr<ScriptCallStack> callStack;
// Currently stack trace is only collected when inspector is open.
if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) {
v8::Local<v8::Context> context = v8::Context::GetEntered();
@@ -125,10 +125,10 @@ void V8ConsoleMessage::handler(v8::Handle<v8::Message> message, v8::Handle<v8::V
bool useURL = resourceName.IsEmpty() || !resourceName->IsString();
String resourceNameString = useURL ? frame->document()->url() : toWebCoreString(resourceName);
V8ConsoleMessage consoleMessage(errorMessage, resourceNameString, message->GetLineNumber());
- consoleMessage.dispatchNow(page, callStack.release());
+ consoleMessage.dispatchNow(page, callStack);
}
-void V8ConsoleMessage::dispatchNow(Page* page, PassOwnPtr<ScriptCallStack> callStack)
+void V8ConsoleMessage::dispatchNow(Page* page, PassRefPtr<ScriptCallStack> callStack)
{
ASSERT(page);
diff --git a/WebCore/bindings/v8/V8ConsoleMessage.h b/WebCore/bindings/v8/V8ConsoleMessage.h
index 6b892dd..97de24f 100644
--- a/WebCore/bindings/v8/V8ConsoleMessage.h
+++ b/WebCore/bindings/v8/V8ConsoleMessage.h
@@ -82,7 +82,7 @@ namespace WebCore {
const String m_sourceID;
const unsigned m_lineNumber;
- void dispatchNow(Page*, PassOwnPtr<ScriptCallStack>);
+ void dispatchNow(Page*, PassRefPtr<ScriptCallStack>);
// All delayed messages are stored in this vector. If the vector
// is 0, there are no delayed messages.
diff --git a/WebCore/bindings/v8/V8DOMMap.cpp b/WebCore/bindings/v8/V8DOMMap.cpp
index b478d06..e1ac2c6 100644
--- a/WebCore/bindings/v8/V8DOMMap.cpp
+++ b/WebCore/bindings/v8/V8DOMMap.cpp
@@ -86,12 +86,6 @@ DOMWrapperMap<SVGElementInstance>& getDOMSVGElementInstanceMap()
return getDOMDataStore().domSvgElementInstanceMap();
}
-// Map of SVG objects with contexts to V8 objects
-DOMWrapperMap<void>& getDOMSVGObjectWithContextMap()
-{
- return getDOMDataStore().domSvgObjectWithContextMap();
-}
-
#endif // ENABLE(SVG)
void removeAllDOMObjectsInCurrentThread()
@@ -106,9 +100,6 @@ void removeAllDOMObjectsInCurrentThread()
#if ENABLE(SVG)
// Remove all SVG element instances in the wrapper map.
DOMData::removeObjectsFromWrapperMap<SVGElementInstance>(getDOMSVGElementInstanceMap());
-
- // Remove all SVG objects with context in the wrapper map.
- DOMData::removeObjectsFromWrapperMap<void>(getDOMSVGObjectWithContextMap());
#endif
}
@@ -181,21 +172,6 @@ void visitDOMSVGElementInstancesInCurrentThread(DOMWrapperMap<SVGElementInstance
}
}
-void visitSVGObjectsInCurrentThread(DOMWrapperMap<void>::Visitor* visitor)
-{
- v8::HandleScope scope;
-
- WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
- DOMDataList& list = DOMDataStore::allStores();
- for (size_t i = 0; i < list.size(); ++i) {
- DOMDataStore* store = list[i];
- if (!store->domData()->owningThread() == WTF::currentThread())
- continue;
-
- store->domSvgObjectWithContextMap().visit(visitor);
- }
-}
-
#endif
} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8DOMMap.h b/WebCore/bindings/v8/V8DOMMap.h
index d8d5c04..b50bc99 100644
--- a/WebCore/bindings/v8/V8DOMMap.h
+++ b/WebCore/bindings/v8/V8DOMMap.h
@@ -170,10 +170,6 @@ namespace WebCore {
// A map for SVGElementInstances to its JS wrapper.
DOMWrapperMap<SVGElementInstance>& getDOMSVGElementInstanceMap();
void visitSVGElementInstancesInCurrentThread(DOMWrapperMap<SVGElementInstance>::Visitor*);
-
- // Map of SVG objects with contexts to V8 objects.
- DOMWrapperMap<void>& getDOMSVGObjectWithContextMap();
- void visitDOMSVGObjectsInCurrentThread(DOMWrapperMap<void>::Visitor*);
#endif
void enableFasterDOMStoreAccess();
diff --git a/WebCore/bindings/v8/V8NPUtils.cpp b/WebCore/bindings/v8/V8NPUtils.cpp
index 8fa19d7..65c30a0 100644
--- a/WebCore/bindings/v8/V8NPUtils.cpp
+++ b/WebCore/bindings/v8/V8NPUtils.cpp
@@ -53,9 +53,7 @@ void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NP
if (object.IsEmpty())
return;
- if (object->IsInt32())
- INT32_TO_NPVARIANT(object->NumberValue(), *result);
- else if (object->IsNumber())
+ if (object->IsNumber())
DOUBLE_TO_NPVARIANT(object->NumberValue(), *result);
else if (object->IsBoolean())
BOOLEAN_TO_NPVARIANT(object->BooleanValue(), *result);
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index 8dc1487..df3670d 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -43,7 +43,6 @@
#include "Page.h"
#include "PageGroup.h"
#include "PlatformBridge.h"
-#include "SVGElement.h"
#include "ScriptController.h"
#include "Settings.h"
#include "StorageNamespace.h"
@@ -131,42 +130,6 @@ void batchConfigureConstants(v8::Handle<v8::FunctionTemplate> functionDescriptor
typedef HashMap<Node*, v8::Object*> DOMNodeMap;
typedef HashMap<void*, v8::Object*> DOMObjectMap;
-
-#if ENABLE(SVG)
-// Map of SVG objects with contexts to their contexts
-static HashMap<void*, SVGElement*>& svgObjectToContextMap()
-{
- typedef HashMap<void*, SVGElement*> SvgObjectToContextMap;
- DEFINE_STATIC_LOCAL(SvgObjectToContextMap, staticSvgObjectToContextMap, ());
- return staticSvgObjectToContextMap;
-}
-
-void V8Proxy::setSVGContext(void* object, SVGElement* context)
-{
- if (!object)
- return;
-
- SVGElement* oldContext = svgObjectToContextMap().get(object);
-
- if (oldContext == context)
- return;
-
- if (oldContext)
- oldContext->deref();
-
- if (context)
- context->ref();
-
- svgObjectToContextMap().set(object, context);
-}
-
-SVGElement* V8Proxy::svgContext(void* object)
-{
- return svgObjectToContextMap().get(object);
-}
-
-#endif
-
typedef HashMap<int, v8::FunctionTemplate*> FunctionTemplateMap;
bool AllowAllocation::m_current = false;
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
index 6f09dae..34e80e1 100644
--- a/WebCore/bindings/v8/V8Proxy.h
+++ b/WebCore/bindings/v8/V8Proxy.h
@@ -58,7 +58,6 @@ namespace WebCore {
class DOMWindow;
class Frame;
class Node;
- class SVGElement;
class ScriptExecutionContext;
class V8EventListener;
class V8IsolatedContext;
@@ -159,40 +158,6 @@ namespace WebCore {
// and clears all timeouts on the DOM window.
void disconnectFrame();
-#if ENABLE(SVG)
- static void setSVGContext(void*, SVGElement*);
- static SVGElement* svgContext(void*);
-
- // These helper functions are required in case we are given a PassRefPtr
- // to a (possibly) newly created object and must prevent its reference
- // count from dropping to zero as would happen in code like
- //
- // V8Proxy::setSVGContext(imp->getNewlyCreatedObject().get(), context);
- // foo(imp->getNewlyCreatedObject().get());
- //
- // In the above two lines each time getNewlyCreatedObject() is called it
- // creates a new object because we don't ref() it. (So our attemts to
- // associate a context with it fail.) Such code should be rewritten to
- //
- // foo(V8Proxy::withSVGContext(imp->getNewlyCreatedObject(), context).get());
- //
- // where PassRefPtr::~PassRefPtr() is invoked only after foo() is
- // called.
- template <typename T>
- static PassRefPtr<T> withSVGContext(PassRefPtr<T> object, SVGElement* context)
- {
- setSVGContext(object.get(), context);
- return object;
- }
-
- template <typename T>
- static T* withSVGContext(T* object, SVGElement* context)
- {
- setSVGContext(object, context);
- return object;
- }
-#endif
-
void finishedWithEvent(Event*) { }
// Evaluate JavaScript in a new isolated world. The script gets its own
diff --git a/WebCore/bindings/v8/V8SVGPODTypeWrapper.h b/WebCore/bindings/v8/V8SVGPODTypeWrapper.h
deleted file mode 100644
index c044a06..0000000
--- a/WebCore/bindings/v8/V8SVGPODTypeWrapper.h
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2008, 2009 Google. 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.
- */
-
-#ifndef V8SVGPODTypeWrapper_h
-#define V8SVGPODTypeWrapper_h
-
-#if ENABLE(SVG)
-
-#include <utility>
-
-#include "SVGElement.h"
-#include "SVGList.h"
-#include "V8Proxy.h"
-
-#include <wtf/Assertions.h>
-#include <wtf/HashFunctions.h>
-#include <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
-#include <wtf/StdLibExtras.h>
-
-namespace WebCore {
-
-template<typename PODType>
-class V8SVGPODTypeWrapper : public RefCounted<V8SVGPODTypeWrapper<PODType> > {
-public:
- V8SVGPODTypeWrapper() { }
- virtual ~V8SVGPODTypeWrapper() { }
- virtual operator PODType() = 0;
- virtual void commitChange(PODType, SVGElement*) = 0;
-
- static V8SVGPODTypeWrapper<PODType>* toNative(v8::Handle<v8::Object> object)
- {
- return reinterpret_cast<V8SVGPODTypeWrapper<PODType>*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
- }
-};
-
-template<typename PODType>
-class V8SVGPODTypeWrapperCreatorForList : public V8SVGPODTypeWrapper<PODType> {
-public:
- typedef SVGPODListItem<PODType> PODListItemPtrType;
-
- typedef PODType (SVGPODListItem<PODType>::*GetterMethod)() const;
- typedef void (SVGPODListItem<PODType>::*SetterMethod)(const PODType&);
-
- static PassRefPtr<V8SVGPODTypeWrapperCreatorForList> create(PassRefPtr<PODListItemPtrType> creator, const QualifiedName& attributeName)
- {
- return adoptRef(new V8SVGPODTypeWrapperCreatorForList(creator, attributeName));
- }
-
- virtual ~V8SVGPODTypeWrapperCreatorForList() { }
-
- // Getter wrapper
- virtual operator PODType() { return (m_creator.get()->*m_getter)(); }
-
- // Setter wrapper
- virtual void commitChange(PODType type, SVGElement* context)
- {
- if (!m_setter)
- return;
-
- (m_creator.get()->*m_setter)(type);
-
- if (context)
- context->svgAttributeChanged(m_associatedAttributeName);
- }
-
-private:
- V8SVGPODTypeWrapperCreatorForList(PassRefPtr<PODListItemPtrType> creator, const QualifiedName& attributeName)
- : m_creator(creator)
- , m_getter(&SVGPODListItem<PODType>::value)
- , m_setter(&SVGPODListItem<PODType>::setValue)
- , m_associatedAttributeName(attributeName)
- {
- ASSERT(m_creator);
- ASSERT(m_getter);
- ASSERT(m_setter);
- }
-
- // Update callbacks
- RefPtr<SVGPODListItem<PODType> > m_creator;
- GetterMethod m_getter;
- SetterMethod m_setter;
- const QualifiedName& m_associatedAttributeName;
-};
-
-template<typename PODType>
-class V8SVGStaticPODTypeWrapper : public V8SVGPODTypeWrapper<PODType> {
-public:
- static PassRefPtr<V8SVGStaticPODTypeWrapper> create(PODType type)
- {
- return adoptRef(new V8SVGStaticPODTypeWrapper(type));
- }
-
- virtual ~V8SVGStaticPODTypeWrapper() { }
-
- // Getter wrapper
- virtual operator PODType() { return m_podType; }
-
- // Setter wrapper
- virtual void commitChange(PODType type, SVGElement*)
- {
- m_podType = type;
- }
-
-protected:
- V8SVGStaticPODTypeWrapper(PODType type)
- : m_podType(type)
- {
- }
-
- PODType m_podType;
-};
-
-template<typename PODType, typename ParentTypeArg>
-class V8SVGStaticPODTypeWrapperWithPODTypeParent : public V8SVGStaticPODTypeWrapper<PODType> {
-public:
- typedef V8SVGPODTypeWrapper<ParentTypeArg> ParentType;
-
- static PassRefPtr<V8SVGStaticPODTypeWrapperWithPODTypeParent> create(PODType type, PassRefPtr<ParentType> parent)
- {
- return adoptRef(new V8SVGStaticPODTypeWrapperWithPODTypeParent(type, parent));
- }
-
- virtual void commitChange(PODType type, SVGElement* context)
- {
- V8SVGStaticPODTypeWrapper<PODType>::commitChange(type, context);
- m_parentType->commitChange(ParentTypeArg(type), context);
- }
-
-private:
- V8SVGStaticPODTypeWrapperWithPODTypeParent(PODType type, PassRefPtr<ParentType> parent)
- : V8SVGStaticPODTypeWrapper<PODType>(type)
- , m_parentType(parent)
- {
- }
-
- RefPtr<ParentType> m_parentType;
-};
-
-template<typename PODType, typename ParentType>
-class V8SVGStaticPODTypeWrapperWithParent : public V8SVGPODTypeWrapper<PODType> {
-public:
- typedef PODType (ParentType::*GetterMethod)() const;
- typedef void (ParentType::*SetterMethod)(const PODType&);
-
- static PassRefPtr<V8SVGStaticPODTypeWrapperWithParent> create(PassRefPtr<ParentType> parent, GetterMethod getter, SetterMethod setter)
- {
- return adoptRef(new V8SVGStaticPODTypeWrapperWithParent(parent, getter, setter));
- }
-
- virtual operator PODType()
- {
- return (m_parent.get()->*m_getter)();
- }
-
- virtual void commitChange(PODType type, SVGElement* context)
- {
- (m_parent.get()->*m_setter)(type);
- }
-
-private:
- V8SVGStaticPODTypeWrapperWithParent(PassRefPtr<ParentType> parent, GetterMethod getter, SetterMethod setter)
- : m_parent(parent)
- , m_getter(getter)
- , m_setter(setter)
- {
- ASSERT(m_parent);
- ASSERT(m_getter);
- ASSERT(m_setter);
- }
-
- RefPtr<ParentType> m_parent;
- GetterMethod m_getter;
- SetterMethod m_setter;
-};
-
-template<typename PODType, typename PODTypeCreator>
-class V8SVGDynamicPODTypeWrapper : public V8SVGPODTypeWrapper<PODType> {
-public:
- typedef PODType (PODTypeCreator::*GetterMethod)() const;
- typedef void (PODTypeCreator::*SetterMethod)(const PODType&);
- typedef void (*CacheRemovalCallback)(V8SVGPODTypeWrapper<PODType>*);
-
- static PassRefPtr<V8SVGDynamicPODTypeWrapper> create(PassRefPtr<PODTypeCreator> creator, GetterMethod getter, SetterMethod setter, CacheRemovalCallback cacheRemovalCallback)
- {
- return adoptRef(new V8SVGDynamicPODTypeWrapper(creator, getter, setter, cacheRemovalCallback));
- }
-
- virtual ~V8SVGDynamicPODTypeWrapper() {
- ASSERT(m_cacheRemovalCallback);
-
- (*m_cacheRemovalCallback)(this);
- }
-
- // Getter wrapper
- virtual operator PODType() { return (m_creator.get()->*m_getter)(); }
-
- // Setter wrapper
- virtual void commitChange(PODType type, SVGElement* context)
- {
- (m_creator.get()->*m_setter)(type);
-
- if (context)
- context->svgAttributeChanged(m_creator->associatedAttributeName());
- }
-
-private:
- V8SVGDynamicPODTypeWrapper(PassRefPtr<PODTypeCreator> creator, GetterMethod getter, SetterMethod setter, CacheRemovalCallback cacheRemovalCallback)
- : m_creator(creator)
- , m_getter(getter)
- , m_setter(setter)
- , m_cacheRemovalCallback(cacheRemovalCallback)
- {
- ASSERT(m_creator); // |creator|'s pointer was taken by m_creator.
- ASSERT(getter);
- ASSERT(setter);
- ASSERT(cacheRemovalCallback);
- }
-
- // Update callbacks
- RefPtr<PODTypeCreator> m_creator;
- GetterMethod m_getter;
- SetterMethod m_setter;
- CacheRemovalCallback m_cacheRemovalCallback;
-};
-
-// Caching facilities
-template<typename PODType, typename PODTypeCreator>
-struct PODTypeWrapperCacheInfo {
- typedef PODType (PODTypeCreator::*GetterMethod)() const;
- typedef void (PODTypeCreator::*SetterMethod)(const PODType&);
-
- // Empty value
- PODTypeWrapperCacheInfo()
- : creator(0)
- , getter(0)
- , setter(0)
- , fieldHash(0)
- { }
-
- // Deleted value
- explicit PODTypeWrapperCacheInfo(WTF::HashTableDeletedValueType)
- : creator(reinterpret_cast<PODTypeCreator*>(-1))
- , getter(0)
- , setter(0)
- , fieldHash(0)
- {
- }
-
- bool isHashTableDeletedValue() const
- {
- return creator == reinterpret_cast<PODTypeCreator*>(-1);
- }
-
- PODTypeWrapperCacheInfo(PODTypeCreator* _creator, GetterMethod _getter, SetterMethod _setter, unsigned _fieldHash)
- : creator(_creator)
- , getter(_getter)
- , setter(_setter)
- , fieldHash(_fieldHash)
- {
- ASSERT(creator);
- ASSERT(getter);
- }
-
- bool operator==(const PODTypeWrapperCacheInfo& other) const
- {
- return creator == other.creator && fieldHash == other.fieldHash && getter == other.getter && setter == other.setter;
- }
-
- PODTypeCreator* creator;
- GetterMethod getter;
- SetterMethod setter;
- unsigned fieldHash;
-};
-
-template<typename PODType, typename PODTypeCreator>
-struct PODTypeWrapperCacheInfoHash {
- static unsigned hash(const PODTypeWrapperCacheInfo<PODType, PODTypeCreator>& info)
- {
- // We can't hash member function pointers, but we have enough material
- // to hash the pointer and field identifier, and on a collision
- // operator== will still differentiate the member function pointers.
- return WTF::PairHash<void*, unsigned>::hash(std::pair<void*, unsigned>(info.creator, info.fieldHash));
- }
-
- static bool equal(const PODTypeWrapperCacheInfo<PODType, PODTypeCreator>& a, const PODTypeWrapperCacheInfo<PODType, PODTypeCreator>& b)
- {
- return a == b;
- }
-
- static const bool safeToCompareToEmptyOrDeleted = true;
-};
-
-template<typename PODType, typename PODTypeCreator>
-struct PODTypeWrapperCacheInfoTraits : WTF::GenericHashTraits<PODTypeWrapperCacheInfo<PODType, PODTypeCreator> > {
- typedef PODTypeWrapperCacheInfo<PODType, PODTypeCreator> CacheInfo;
-
- static const bool emptyValueIsZero = true;
- static const bool needsDestruction = false;
-
- static const CacheInfo& emptyValue()
- {
- DEFINE_STATIC_LOCAL(CacheInfo, key, ());
- return key;
- }
-
- static void constructDeletedValue(CacheInfo& slot)
- {
- new (&slot) CacheInfo(WTF::HashTableDeletedValue);
- }
-
- static bool isDeletedValue(const CacheInfo& value)
- {
- return value.isHashTableDeletedValue();
- }
-};
-
-template<typename PODType, typename PODTypeCreator>
-class V8SVGDynamicPODTypeWrapperCache {
-public:
- typedef PODType (PODTypeCreator::*GetterMethod)() const;
- typedef void (PODTypeCreator::*SetterMethod)(const PODType&);
-
- typedef PODTypeWrapperCacheInfo<PODType, PODTypeCreator> CacheInfo;
- typedef PODTypeWrapperCacheInfoHash<PODType, PODTypeCreator> CacheInfoHash;
- typedef PODTypeWrapperCacheInfoTraits<PODType, PODTypeCreator> CacheInfoTraits;
-
- typedef V8SVGPODTypeWrapper<PODType> WrapperBase;
- typedef V8SVGDynamicPODTypeWrapper<PODType, PODTypeCreator> DynamicWrapper;
-
- typedef HashMap<CacheInfo, DynamicWrapper*, CacheInfoHash, CacheInfoTraits> DynamicWrapperHashMap;
- typedef typename DynamicWrapperHashMap::const_iterator DynamicWrapperHashMapIterator;
-
- static DynamicWrapperHashMap& dynamicWrapperHashMap()
- {
- DEFINE_STATIC_LOCAL(DynamicWrapperHashMap, dynamicWrapperHashMap, ());
- return dynamicWrapperHashMap;
- }
-
- // Used for readwrite attributes only
- static PassRefPtr<WrapperBase> lookupOrCreateWrapper(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter, unsigned fieldHash)
- {
- DynamicWrapperHashMap& map(dynamicWrapperHashMap());
- CacheInfo info(creator, getter, setter, fieldHash);
-
- if (map.contains(info))
- return map.get(info);
-
- RefPtr<DynamicWrapper> wrapper = V8SVGDynamicPODTypeWrapper<PODType, PODTypeCreator>::create(creator, getter, setter, forgetWrapper);
- map.set(info, wrapper.get());
- return wrapper.release();
- }
-
- static void forgetWrapper(V8SVGPODTypeWrapper<PODType>* wrapper)
- {
- DynamicWrapperHashMap& map(dynamicWrapperHashMap());
-
- DynamicWrapperHashMapIterator it = map.begin();
- DynamicWrapperHashMapIterator end = map.end();
-
- for (; it != end; ++it) {
- if (it->second != wrapper)
- continue;
-
- // It's guaranteed that there's just one object we need to take care of.
- map.remove(it->first);
- break;
- }
- }
-};
-
-class V8SVGPODTypeUtil {
-public:
- template <class P>
- static P toSVGPODType(WrapperTypeInfo* info, v8::Handle<v8::Value> object, bool& ok);
-};
-
-template <class P>
-P V8SVGPODTypeUtil::toSVGPODType(WrapperTypeInfo* info, v8::Handle<v8::Value> object, bool& ok)
-{
- if (!V8DOMWrapper::isWrapperOfType(object, info)) {
- ok = false;
- return P();
- }
- ok = true;
- return *V8SVGPODTypeWrapper<P>::toNative(v8::Handle<v8::Object>::Cast(object));
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SVG)
-#endif // V8SVGPODTypeWrapper_h
diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
deleted file mode 100644
index 4671c61..0000000
--- a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-#include "V8ArrayBufferView.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-#include "V8Int8Array.h"
-#include "V8Float32Array.h"
-#include "V8Int32Array.h"
-#include "V8Int16Array.h"
-#include "V8Uint8Array.h"
-#include "V8Uint32Array.h"
-#include "V8Uint16Array.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(ArrayBufferView* impl)
-{
- if (!impl)
- return v8::Null();
- if (impl->isByteArray())
- return toV8(static_cast<Int8Array*>(impl));
- if (impl->isFloatArray())
- return toV8(static_cast<Float32Array*>(impl));
- if (impl->isIntArray())
- return toV8(static_cast<Int32Array*>(impl));
- if (impl->isShortArray())
- return toV8(static_cast<Int16Array*>(impl));
- if (impl->isUnsignedByteArray())
- return toV8(static_cast<Uint8Array*>(impl));
- if (impl->isUnsignedIntArray())
- return toV8(static_cast<Uint32Array*>(impl));
- if (impl->isUnsignedShortArray())
- return toV8(static_cast<Uint16Array*>(impl));
- return v8::Handle<v8::Value>();
-}
-
-v8::Handle<v8::Value> V8ArrayBufferView::sliceCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.ArrayBufferView.slice");
- // Forms:
- // * slice(long start, long end);
-
- ArrayBufferView* imp = V8ArrayBufferView::toNative(args.Holder());
- int start, end;
- switch (args.Length()) {
- case 0:
- start = 0;
- end = imp->length();
- break;
- case 1:
- start = toInt32(args[0]);
- end = imp->length();
- break;
- default:
- start = toInt32(args[0]);
- end = toInt32(args[1]);
- }
- return toV8(imp->slice(start, end));
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
index 2566b67..6881a01 100644
--- a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
+++ b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
@@ -28,27 +28,64 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
+#ifndef V8ArrayBufferViewCustom_h
+#define V8ArrayBufferViewCustom_h
#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
#include "ArrayBuffer.h"
-#include "V8Binding.h"
#include "V8ArrayBuffer.h"
+#include "V8Binding.h"
#include "V8Proxy.h"
namespace WebCore {
// Template function used by the ArrayBufferView*Constructor callbacks.
template<class ArrayClass, class ElementType>
+v8::Handle<v8::Value> constructWebGLArrayWithArrayBufferArgument(const v8::Arguments& args, WrapperTypeInfo* type, v8::ExternalArrayType arrayType, bool hasIndexer)
+{
+ ArrayBuffer* buf = V8ArrayBuffer::toNative(args[0]->ToObject());
+ if (!buf)
+ return throwError("Could not convert argument 0 to a ArrayBuffer");
+ bool ok;
+ uint32_t offset = 0;
+ int argLen = args.Length();
+ if (argLen > 1) {
+ offset = toUInt32(args[1], ok);
+ if (!ok)
+ return throwError("Could not convert argument 1 to a number");
+ }
+ if ((buf->byteLength() - offset) % sizeof(ElementType))
+ return throwError("ArrayBuffer length minus the byteOffset is not a multiple of the element size.", V8Proxy::RangeError);
+ uint32_t length = (buf->byteLength() - offset) / sizeof(ElementType);
+ if (argLen > 2) {
+ length = toUInt32(args[2], ok);
+ if (!ok)
+ return throwError("Could not convert argument 2 to a number");
+ }
+
+ RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length);
+ if (!array) {
+ V8Proxy::setDOMException(INDEX_SIZE_ERR);
+ return notHandledByInterceptor();
+ }
+ // Transform the holder into a wrapper object for the array.
+ V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
+ if (hasIndexer)
+ args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length());
+ return toV8(array.release(), args.Holder());
+}
+
+// Template function used by the ArrayBufferView*Constructor callbacks.
+template<class ArrayClass, class ElementType>
v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperTypeInfo* type, v8::ExternalArrayType arrayType)
{
if (!args.IsConstructCall())
return throwError("DOM object constructor cannot be called as a function.");
int argLen = args.Length();
- if (argLen == 0) {
+ if (!argLen) {
// This happens when we return a previously constructed
// ArrayBufferView, e.g. from the call to <Type>Array.slice().
// The V8DOMWrapper will set the internal pointer in the
@@ -83,36 +120,8 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType
}
// See whether the first argument is a ArrayBuffer.
- if (V8ArrayBuffer::HasInstance(args[0])) {
- ArrayBuffer* buf = V8ArrayBuffer::toNative(args[0]->ToObject());
- if (!buf)
- return throwError("Could not convert argument 0 to a ArrayBuffer");
- bool ok;
- uint32_t offset = 0;
- if (argLen > 1) {
- offset = toUInt32(args[1], ok);
- if (!ok)
- return throwError("Could not convert argument 1 to a number");
- }
- if ((buf->byteLength() - offset) % sizeof(ElementType))
- return throwError("ArrayBuffer length minus the byteOffset is not a multiple of the element size.", V8Proxy::RangeError);
- uint32_t length = (buf->byteLength() - offset) / sizeof(ElementType);
- if (argLen > 2) {
- length = toUInt32(args[2], ok);
- if (!ok)
- return throwError("Could not convert argument 2 to a number");
- }
-
- RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length);
- if (!array) {
- V8Proxy::setDOMException(INDEX_SIZE_ERR);
- return notHandledByInterceptor();
- }
- // Transform the holder into a wrapper object for the array.
- V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
- args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length());
- return toV8(array.release(), args.Holder());
- }
+ if (V8ArrayBuffer::HasInstance(args[0]))
+ return constructWebGLArrayWithArrayBufferArgument<ArrayClass, ElementType>(args, type, arrayType, true);
uint32_t len = 0;
v8::Handle<v8::Object> srcArray;
@@ -201,3 +210,5 @@ v8::Handle<v8::Value> setWebGLArrayHelper(const v8::Arguments& args)
}
#endif // ENABLE(3D_CANVAS)
+
+#endif // V8ArrayBufferViewCustom_h
diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
index 9142ad7..e21354e 100644
--- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
@@ -65,9 +65,9 @@ v8::Handle<v8::Value> V8Console::traceCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Console.traceCallback");
Console* imp = V8Console::toNative(args.Holder());
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture));
- OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 0));
- imp->trace(scriptArguments.release(), callStack.release());
+ RefPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture));
+ RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 0));
+ imp->trace(scriptArguments.release(), callStack);
return v8::Handle<v8::Value>();
}
@@ -75,10 +75,10 @@ v8::Handle<v8::Value> V8Console::assertCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Console.assertCallback");
Console* imp = V8Console::toNative(args.Holder());
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture));
+ RefPtr<ScriptCallStack> callStack(createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture));
bool condition = args[0]->BooleanValue();
- OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
- imp->assertCondition(condition, scriptArguments.release(), callStack.release());
+ RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1));
+ imp->assertCondition(condition, scriptArguments.release(), callStack);
return v8::Handle<v8::Value>();
}
@@ -87,11 +87,11 @@ v8::Handle<v8::Value> V8Console::profileCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Console.profile");
Console* imp = V8Console::toNative(args.Holder());
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(1));
+ RefPtr<ScriptCallStack> callStack(createScriptCallStack(1));
if (!callStack)
return v8::Undefined();
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<WithUndefinedOrNullCheck>, title, args[0]);
- imp->profile(title, ScriptState::current(), callStack.release());
+ imp->profile(title, ScriptState::current(), callStack);
return v8::Handle<v8::Value>();
}
@@ -99,11 +99,11 @@ v8::Handle<v8::Value> V8Console::profileEndCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Console.profileEnd");
Console* imp = V8Console::toNative(args.Holder());
- OwnPtr<ScriptCallStack> callStack(createScriptCallStack(1));
+ RefPtr<ScriptCallStack> callStack(createScriptCallStack(1));
if (!callStack)
return v8::Undefined();
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<WithUndefinedOrNullCheck>, title, args[0]);
- imp->profileEnd(title, ScriptState::current(), callStack.release());
+ imp->profileEnd(title, ScriptState::current(), callStack);
return v8::Handle<v8::Value>();
}
#endif
diff --git a/WebCore/bindings/v8/custom/V8DataViewCustom.cpp b/WebCore/bindings/v8/custom/V8DataViewCustom.cpp
new file mode 100755
index 0000000..16bd4a5
--- /dev/null
+++ b/WebCore/bindings/v8/custom/V8DataViewCustom.cpp
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+
+#include "DataView.h"
+
+#include "V8ArrayBufferViewCustom.h"
+#include "V8Binding.h"
+#include "V8BindingMacros.h"
+#include "V8DataView.h"
+#include "V8Proxy.h"
+
+namespace WebCore {
+
+v8::Handle<v8::Value> V8DataView::constructorCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.ArrayBuffer.Constructor");
+
+ if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0]))
+ return V8Proxy::throwTypeError();
+ return constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &info, v8::kExternalByteArray, false);
+}
+
+v8::Handle<v8::Value> toV8(DataView* impl)
+{
+ if (!impl)
+ return v8::Null();
+ return V8DataView::wrap(impl);
+}
+
+v8::Handle<v8::Value> V8DataView::getInt8Callback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DataView.getInt8");
+ if (args.Length() < 1)
+ return throwError("Not enough arguments", V8Proxy::SyntaxError);
+
+ DataView* imp = V8DataView::toNative(args.Holder());
+ ExceptionCode ec = 0;
+ EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
+ char result = imp->getInt8(byteOffset, ec);
+ if (UNLIKELY(ec)) {
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+ }
+ return v8::Integer::New(result);
+}
+
+v8::Handle<v8::Value> V8DataView::getUint8Callback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DataView.getUint8");
+ if (args.Length() < 1)
+ return throwError("Not enough arguments", V8Proxy::SyntaxError);
+
+ DataView* imp = V8DataView::toNative(args.Holder());
+ ExceptionCode ec = 0;
+ EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
+ unsigned char result = imp->getUint8(byteOffset, ec);
+ if (UNLIKELY(ec)) {
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+ }
+ return v8::Integer::New(result);
+}
+
+v8::Handle<v8::Value> V8DataView::setInt8Callback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DataView.setInt8");
+ if (args.Length() < 2)
+ return throwError("Not enough arguments", V8Proxy::SyntaxError);
+
+ DataView* imp = V8DataView::toNative(args.Holder());
+ ExceptionCode ec = 0;
+ EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
+ EXCEPTION_BLOCK(int, value, toInt32(args[1]));
+ imp->setInt8(byteOffset, static_cast<char>(value), ec);
+ if (UNLIKELY(ec))
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+}
+
+v8::Handle<v8::Value> V8DataView::setUint8Callback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DataView.setUint8");
+ if (args.Length() < 2)
+ return throwError("Not enough arguments", V8Proxy::SyntaxError);
+
+ DataView* imp = V8DataView::toNative(args.Holder());
+ ExceptionCode ec = 0;
+ EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
+ EXCEPTION_BLOCK(int, value, toInt32(args[1]));
+ imp->setUint8(byteOffset, static_cast<unsigned char>(value), ec);
+ if (UNLIKELY(ec))
+ V8Proxy::setDOMException(ec);
+ return v8::Handle<v8::Value>();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/v8/custom/V8EventCustom.cpp b/WebCore/bindings/v8/custom/V8EventCustom.cpp
index bb885b9..ff9b98b 100644
--- a/WebCore/bindings/v8/custom/V8EventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8EventCustom.cpp
@@ -55,6 +55,7 @@
#include "V8PopStateEvent.h"
#include "V8ProgressEvent.h"
#include "V8Proxy.h"
+#include "V8SpeechInputEvent.h"
#include "V8StorageEvent.h"
#include "V8TextEvent.h"
#include "V8TouchEvent.h"
@@ -172,6 +173,10 @@ v8::Handle<v8::Value> toV8(Event* impl)
if (impl->isAudioProcessingEvent())
return toV8(static_cast<AudioProcessingEvent*>(impl));
#endif
+#if ENABLE(INPUT_SPEECH)
+ if (impl->isSpeechInputEvent())
+ return toV8(static_cast<SpeechInputEvent*>(impl));
+#endif
if (impl->isCustomEvent())
return toV8(static_cast<CustomEvent*>(impl));
return V8Event::wrap(impl);
diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index b3007a4..81ad955 100644
--- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -114,9 +114,8 @@ ScriptObject InjectedScriptHost::createInjectedScript(const String& scriptSource
scriptHostWrapper,
windowGlobal,
v8::Number::New(id),
- v8::String::New("v8")
};
- v8::Local<v8::Value> injectedScriptValue = v8::Function::Cast(*v)->Call(windowGlobal, 4, args);
+ v8::Local<v8::Value> injectedScriptValue = v8::Function::Cast(*v)->Call(windowGlobal, 3, args);
v8::Local<v8::Object> injectedScript(v8::Object::Cast(*injectedScriptValue));
return ScriptObject(inspectedScriptState, injectedScript);
}
@@ -155,6 +154,18 @@ v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Argument
return toV8(node);
}
+v8::Handle<v8::Value> V8InjectedScriptHost::internalConstructorNameCallback(const v8::Arguments& args)
+{
+ INC_STATS("InjectedScriptHost.internalConstructorName()");
+ if (args.Length() < 1)
+ return v8::Undefined();
+
+ if (!args[0]->IsObject())
+ return v8::Undefined();
+
+ return args[0]->ToObject()->GetConstructorName();
+}
+
v8::Handle<v8::Value> V8InjectedScriptHost::pushNodePathToFrontendCallback(const v8::Arguments& args)
{
INC_STATS("InjectedScriptHost.pushNodePathToFrontend()");
diff --git a/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp b/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
index ec6324d..58f26fd 100644
--- a/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
@@ -56,12 +56,17 @@ v8::Handle<v8::Value> V8SVGLength::valueAccessorGetter(v8::Local<v8::String> nam
void V8SVGLength::valueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.SVGLength.value._set");
+ SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder());
+ if (wrapper->role() == AnimValRole) {
+ V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);
+ return;
+ }
+
if (!isUndefinedOrNull(value) && !value->IsNumber() && !value->IsBoolean()) {
V8Proxy::throwTypeError();
return;
}
- SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder());
SVGLength& imp = wrapper->propertyReference();
ExceptionCode ec = 0;
imp.setValue(static_cast<float>(value->NumberValue()), wrapper->contextElement(), ec);
@@ -74,10 +79,15 @@ void V8SVGLength::valueAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::
v8::Handle<v8::Value> V8SVGLength::convertToSpecifiedUnitsCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGLength.convertToSpecifiedUnits");
+ SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(args.Holder());
+ if (wrapper->role() == AnimValRole) {
+ V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);
+ return v8::Handle<v8::Value>();
+ }
+
if (args.Length() < 1)
return throwError("Not enough arguments", V8Proxy::SyntaxError);
- SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(args.Holder());
SVGLength& imp = wrapper->propertyReference();
ExceptionCode ec = 0;
EXCEPTION_BLOCK(int, unitType, toUInt32(args[0]));
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index 393e544..6a571ae 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -31,8 +31,10 @@
#include "config.h"
#include "V8XMLHttpRequest.h"
+#include "ArrayBuffer.h"
#include "Frame.h"
#include "InspectorInstrumentation.h"
+#include "V8ArrayBuffer.h"
#include "V8Binding.h"
#include "V8Blob.h"
#include "V8DOMFormData.h"
@@ -57,6 +59,59 @@ v8::Handle<v8::Value> V8XMLHttpRequest::responseTextAccessorGetter(v8::Local<v8:
return v8String(text);
}
+v8::Handle<v8::Value> V8XMLHttpRequest::responseAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.XMLHttpRequest.response._get");
+ XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
+
+ switch (xmlHttpRequest->responseTypeCode()) {
+ case XMLHttpRequest::ResponseTypeDefault:
+ case XMLHttpRequest::ResponseTypeText:
+ return responseTextAccessorGetter(name, info);
+
+ case XMLHttpRequest::ResponseTypeDocument:
+ {
+ ExceptionCode ec = 0;
+ Document* document = xmlHttpRequest->responseXML(ec);
+ if (ec) {
+ V8Proxy::setDOMException(ec);
+ return v8::Undefined();
+ }
+ return toV8(document);
+ }
+
+ case XMLHttpRequest::ResponseTypeBlob:
+#if ENABLE(XHR_RESPONSE_BLOB)
+ {
+ ExceptionCode ec = 0;
+ Blob* blob = xmlHttpRequest->responseBlob(ec);
+ if (ec) {
+ V8Proxy::setDOMException(ec);
+ return v8::Undefined();
+ }
+ return toV8(blob);
+ }
+#else
+ return v8::Undefined();
+#endif
+
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+ case XMLHttpRequest::ResponseTypeArrayBuffer:
+ {
+ ExceptionCode ec = 0;
+ ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(ec);
+ if (ec) {
+ V8Proxy::setDOMException(ec);
+ return v8::Undefined();
+ }
+ return toV8(arrayBuffer);
+ }
+#endif
+ }
+
+ return v8::Undefined();
+}
+
v8::Handle<v8::Value> V8XMLHttpRequest::openCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequest.open()");
@@ -138,6 +193,13 @@ v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args)
DOMFormData* domFormData = V8DOMFormData::toNative(object);
ASSERT(domFormData);
xmlHttpRequest->send(domFormData, ec);
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+ } else if (V8ArrayBuffer::HasInstance(arg)) {
+ v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
+ ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object);
+ ASSERT(arrayBuffer);
+ xmlHttpRequest->send(arrayBuffer, ec);
+#endif
} else
xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec);
}