diff options
author | Leon Clarke <leonclarke@google.com> | 2010-06-03 14:33:32 +0100 |
---|---|---|
committer | Leon Clarke <leonclarke@google.com> | 2010-06-08 12:24:51 +0100 |
commit | 5af96e2c7b73ebc627c6894727826a7576d31758 (patch) | |
tree | f9d5e6f6175ccd7e3d14de9b290f08937a0d17ba /WebCore/bindings | |
parent | 8cc4fcf4f6adcbc0e0aebfc24fbad9a4cddf2cfb (diff) | |
download | external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.zip external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.tar.gz external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.tar.bz2 |
Merge webkit.org at r60469 : Initial merge by git.
Change-Id: I66a0047aa2af802f66bb0c7f2a8b02247a596234
Diffstat (limited to 'WebCore/bindings')
105 files changed, 1658 insertions, 1370 deletions
diff --git a/WebCore/bindings/gobject/GObjectEventListener.cpp b/WebCore/bindings/gobject/GObjectEventListener.cpp new file mode 100644 index 0000000..1a4f680 --- /dev/null +++ b/WebCore/bindings/gobject/GObjectEventListener.cpp @@ -0,0 +1,45 @@ +/* + * 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 "GObjectEventListener.h" + +#include "Event.h" +#include "EventListener.h" +#include "webkit/WebKitDOMEventPrivate.h" +#include <wtf/HashMap.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +void GObjectEventListener::handleEvent(ScriptExecutionContext*, Event* event) +{ + gboolean handled = FALSE; + WebKitDOMEvent* gobjectEvent = WebKit::wrapEvent(event); + g_signal_emit_by_name(m_object, m_signalName.utf8().data(), gobjectEvent, &handled); +} + +bool GObjectEventListener::operator==(const EventListener& listener) +{ + if (const GObjectEventListener* gobjectEventListener = GObjectEventListener::cast(&listener)) + return m_signalName == gobjectEventListener->m_signalName && m_object == gobjectEventListener->m_object; + + return false; +} + +} diff --git a/WebCore/bindings/gobject/GObjectEventListener.h b/WebCore/bindings/gobject/GObjectEventListener.h new file mode 100644 index 0000000..c65b91e --- /dev/null +++ b/WebCore/bindings/gobject/GObjectEventListener.h @@ -0,0 +1,56 @@ +/* + * 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 GObjectEventListener_h +#define GObjectEventListener_h + +#include "EventListener.h" + +#include <glib-object.h> +#include <glib.h> +#include <wtf/PassRefPtr.h> + +namespace WebCore { +class GObjectEventListener : public EventListener { +public: + static PassRefPtr<GObjectEventListener> create(GObject* object, const char* signalName) { return adoptRef(new GObjectEventListener(object, signalName)); } + static const GObjectEventListener* cast(const EventListener* listener) + { + return listener->type() == GObjectEventListenerType + ? static_cast<const GObjectEventListener*>(listener) + : 0; + } + + virtual bool operator==(const EventListener& other); + +private: + GObjectEventListener(GObject* object, const char* signalName) + : EventListener(GObjectEventListenerType) + , m_object(object) + , m_signalName(signalName) + { + } + + virtual void handleEvent(ScriptExecutionContext*, Event*); + + GObject* m_object; + String m_signalName; +}; +} // namespace WebCore + +#endif diff --git a/WebCore/bindings/gobject/WebKitDOMBinding.cpp b/WebCore/bindings/gobject/WebKitDOMBinding.cpp index b8fbdda..aa4610b 100644 --- a/WebCore/bindings/gobject/WebKitDOMBinding.cpp +++ b/WebCore/bindings/gobject/WebKitDOMBinding.cpp @@ -27,6 +27,7 @@ #include "Event.h" #include "EventException.h" #include "HTMLNames.h" +#include "WebKitDOMDOMWindowPrivate.h" #include "WebKitDOMElementPrivate.h" #include "WebKitDOMNode.h" #include "WebKitDOMNodePrivate.h" @@ -118,4 +119,31 @@ gpointer kit(Element* element) return DOMObjectCache::put(element, wrappedElement); } +static gpointer wrapEventTarget(EventTarget* target) +{ + ASSERT(target); + + gpointer wrappedTarget = 0; + + if (target->toNode()) { + Node* node = target->toNode(); + wrappedTarget = wrapNode(node); + } else if (target->toDOMWindow()) { + DOMWindow* window = target->toDOMWindow(); + wrappedTarget = wrapDOMWindow(window); + } + + return DOMObjectCache::put(target, wrappedTarget); +} + +gpointer kit(WebCore::EventTarget* obj) +{ + g_return_val_if_fail(obj, 0); + + if (gpointer ret = DOMObjectCache::get(obj)) + return ret; + + return DOMObjectCache::put(obj, WebKit::wrapEventTarget(obj)); +} + } // namespace WebKit diff --git a/WebCore/bindings/gobject/WebKitDOMBinding.h b/WebCore/bindings/gobject/WebKitDOMBinding.h index d27bdda..236c450 100644 --- a/WebCore/bindings/gobject/WebKitDOMBinding.h +++ b/WebCore/bindings/gobject/WebKitDOMBinding.h @@ -29,11 +29,13 @@ namespace WebCore { class Node; class Element; +class EventTarget; } // namespace WebCore namespace WebKit { gpointer kit(WebCore::Node* node); gpointer kit(WebCore::Element* element); +gpointer kit(WebCore::EventTarget* target); class DOMObjectCache { public: diff --git a/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp b/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp new file mode 100644 index 0000000..2d2a31a --- /dev/null +++ b/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This file is derived by hand from an automatically generated file. + * Keeping it up-to-date could potentially be done by adding + * a make_names.pl generator, or by writing a separate + * generater which takes JSHTMLElementWrapperFactory.h as input. + * + * 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" +#include "WebKitDOMEventTarget.h" + +#include "WebKitDOMEvent.h" + +typedef WebKitDOMEventTargetIface WebKitDOMEventTargetInterface; +#if GLIB_CHECK_VERSION(2, 24, 0) +G_DEFINE_INTERFACE(WebKitDOMEventTarget, webkit_dom_event_target, G_TYPE_OBJECT) +#else +static void webkit_dom_event_target_default_init(WebKitDOMEventTargetIface*); + +GType webkit_dom_event_target_get_type(void) +{ + static volatile gsize typeIdVolatile = 0; + + if (g_once_init_enter(&typeIdVolatile)) { + GType typeId = g_type_register_static_simple(G_TYPE_INTERFACE, + g_intern_static_string("WebKitDOMEventTarget"), + sizeof(WebKitDOMEventTargetInterface), + (GClassInitFunc)webkit_dom_event_target_default_init, + 0, + static_cast<GInstanceInitFunc>(0), + static_cast<GTypeFlags>(0)); + g_type_interface_add_prerequisite(typeId, G_TYPE_OBJECT); + g_once_init_leave(&typeIdVolatile, typeId); + } + + return typeIdVolatile; +} +#endif + +static void webkit_dom_event_target_default_init(WebKitDOMEventTargetIface*) +{ +} + +void webkit_dom_event_target_dispatch_event(WebKitDOMEventTarget* target, WebKitDOMEvent* event, GError** error) +{ + WebKitDOMEventTargetIface* iface; + + g_return_if_fail(WEBKIT_DOM_IS_EVENT_TARGET(target)); + g_return_if_fail(WEBKIT_DOM_IS_EVENT(event)); + + iface = WEBKIT_DOM_EVENT_TARGET_GET_IFACE(target); + + if (iface->dispatch_event) + iface->dispatch_event(target, event, error); +} diff --git a/WebCore/bindings/gobject/WebKitDOMEventTarget.h b/WebCore/bindings/gobject/WebKitDOMEventTarget.h new file mode 100644 index 0000000..206abc7 --- /dev/null +++ b/WebCore/bindings/gobject/WebKitDOMEventTarget.h @@ -0,0 +1,54 @@ +/* + * 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 WebKitDOMEventTarget_h +#define WebKitDOMEventTarget_h + +#include "webkit/webkitdomdefines.h" +#include <glib-object.h> +#include <webkit/webkitdefines.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_DOM_EVENT_TARGET (webkit_dom_event_target_get_type ()) +#define WEBKIT_DOM_EVENT_TARGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WEBKIT_TYPE_DOM_EVENT_TARGET, WebKitDOMEventTarget)) +#define WEBKIT_DOM_EVENT_TARGET_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), WEBKIT_TYPE_DOM_EVENT_TARGET, WebKitDOMEventTargetIface)) +#define WEBKIT_DOM_IS_EVENT_TARGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WEBKIT_TYPE_DOM_EVENT_TARGET)) +#define WEBKIT_DOM_EVENT_TARGET_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), WEBKIT_TYPE_DOM_EVENT_TARGET, WebKitDOMEventTargetIface)) + +typedef struct _WebKitDOMEventTargetIface WebKitDOMEventTargetIface; + +struct _WebKitDOMEventTargetIface { + GTypeInterface gIface; + + /* virtual table */ + void (* dispatch_event)(WebKitDOMEventTarget* target, + WebKitDOMEvent* event, + GError** error); +}; + + +WEBKIT_API GType webkit_dom_event_target_get_type(void) G_GNUC_CONST; + +WEBKIT_API void webkit_dom_event_target_dispatch_event(WebKitDOMEventTarget *target, + WebKitDOMEvent *event, + GError **error); + +G_END_DECLS + +#endif /* WebKitDOMEventTarget_h */ diff --git a/WebCore/bindings/js/CachedScriptSourceProvider.h b/WebCore/bindings/js/CachedScriptSourceProvider.h index 8e69b6b..809a488 100644 --- a/WebCore/bindings/js/CachedScriptSourceProvider.h +++ b/WebCore/bindings/js/CachedScriptSourceProvider.h @@ -29,6 +29,7 @@ #include "CachedResourceClient.h" #include "CachedResourceHandle.h" #include "CachedScript.h" +#include "JSDOMBinding.h" // for stringToUString #include "ScriptSourceProvider.h" #include <parser/SourceCode.h> diff --git a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp b/WebCore/bindings/js/JSArrayBufferViewCustom.cpp index 271d096..a865a30 100644 --- a/WebCore/bindings/js/JSArrayBufferViewCustom.cpp +++ b/WebCore/bindings/js/JSArrayBufferViewCustom.cpp @@ -67,23 +67,23 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, ArrayBu return jsUndefined(); } -JSValue JSArrayBufferView::slice(ExecState* exec, const ArgList& args) +JSValue JSArrayBufferView::slice(ExecState* exec) { ArrayBufferView* array = reinterpret_cast<ArrayBufferView*>(impl()); int start, end; - switch (args.size()) { + switch (exec->argumentCount()) { case 0: start = 0; end = array->length(); break; case 1: - start = args.at(0).toInt32(exec); + start = exec->argument(0).toInt32(exec); end = array->length(); break; default: - start = args.at(0).toInt32(exec); - end = args.at(1).toInt32(exec); + start = exec->argument(0).toInt32(exec); + end = exec->argument(1).toInt32(exec); } return toJS(exec, globalObject(), array->slice(start, end)); } diff --git a/WebCore/bindings/js/JSArrayBufferViewHelper.h b/WebCore/bindings/js/JSArrayBufferViewHelper.h index 7243db6..6b77c0c 100644 --- a/WebCore/bindings/js/JSArrayBufferViewHelper.h +++ b/WebCore/bindings/js/JSArrayBufferViewHelper.h @@ -38,29 +38,29 @@ namespace WebCore { template <class T> -JSC::JSValue setWebGLArrayHelper(JSC::ExecState* exec, T* impl, JSC::ArgList const& args, T* (*conversionFunc)(JSC::JSValue)) +JSC::JSValue setWebGLArrayHelper(JSC::ExecState* exec, T* impl, T* (*conversionFunc)(JSC::JSValue)) { - if (args.size() < 1) + if (exec->argumentCount() < 1) return throwError(exec, JSC::SyntaxError); - T* array = (*conversionFunc)(args.at(0)); + T* array = (*conversionFunc)(exec->argument(0)); if (array) { // void set(in WebGL<T>Array array, [Optional] in unsigned long offset); unsigned offset = 0; - if (args.size() == 2) - offset = args.at(1).toInt32(exec); + if (exec->argumentCount() == 2) + offset = exec->argument(1).toInt32(exec); ExceptionCode ec = 0; impl->set(array, offset, ec); setDOMException(exec, ec); return JSC::jsUndefined(); } - if (args.at(0).isObject()) { + if (exec->argument(0).isObject()) { // void set(in sequence<long> array, [Optional] in unsigned long offset); - JSC::JSObject* array = JSC::asObject(args.at(0)); + JSC::JSObject* array = JSC::asObject(exec->argument(0)); uint32_t offset = 0; - if (args.size() == 2) - offset = args.at(1).toInt32(exec); + if (exec->argumentCount() == 2) + offset = exec->argument(1).toInt32(exec); uint32_t length = array->get(exec, JSC::Identifier(exec, "length")).toInt32(exec); if (offset > impl->length() || offset + length > impl->length() diff --git a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp index f8aa5a7..416f976 100644 --- a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp +++ b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp @@ -89,7 +89,7 @@ void JSCanvasRenderingContext2D::setFillStyle(ExecState* exec, JSValue value) context->setFillStyle(toHTMLCanvasStyle(exec, value)); } -JSValue JSCanvasRenderingContext2D::setFillColor(ExecState* exec, const ArgList& args) +JSValue JSCanvasRenderingContext2D::setFillColor(ExecState* exec) { CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); @@ -99,26 +99,26 @@ JSValue JSCanvasRenderingContext2D::setFillColor(ExecState* exec, const ArgList& // number arg, number arg = gray color, alpha // 4 args = r, g, b, a // 5 args = c, m, y, k, a - switch (args.size()) { + switch (exec->argumentCount()) { case 1: - if (args.at(0).isString()) - context->setFillColor(ustringToString(asString(args.at(0))->value(exec))); + if (exec->argument(0).isString()) + context->setFillColor(ustringToString(asString(exec->argument(0))->value(exec))); else - context->setFillColor(args.at(0).toFloat(exec)); + context->setFillColor(exec->argument(0).toFloat(exec)); break; case 2: - if (args.at(0).isString()) - context->setFillColor(ustringToString(asString(args.at(0))->value(exec)), args.at(1).toFloat(exec)); + if (exec->argument(0).isString()) + context->setFillColor(ustringToString(asString(exec->argument(0))->value(exec)), exec->argument(1).toFloat(exec)); else - context->setFillColor(args.at(0).toFloat(exec), args.at(1).toFloat(exec)); + context->setFillColor(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec)); break; case 4: - context->setFillColor(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), args.at(3).toFloat(exec)); + context->setFillColor(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec)); break; case 5: - context->setFillColor(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), args.at(3).toFloat(exec), args.at(4).toFloat(exec)); + context->setFillColor(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec)); break; default: return throwError(exec, SyntaxError); @@ -126,7 +126,7 @@ JSValue JSCanvasRenderingContext2D::setFillColor(ExecState* exec, const ArgList& return jsUndefined(); } -JSValue JSCanvasRenderingContext2D::setStrokeColor(ExecState* exec, const ArgList& args) +JSValue JSCanvasRenderingContext2D::setStrokeColor(ExecState* exec) { CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); @@ -136,26 +136,26 @@ JSValue JSCanvasRenderingContext2D::setStrokeColor(ExecState* exec, const ArgLis // number arg, number arg = gray color, alpha // 4 args = r, g, b, a // 5 args = c, m, y, k, a - switch (args.size()) { + switch (exec->argumentCount()) { case 1: - if (args.at(0).isString()) - context->setStrokeColor(ustringToString(asString(args.at(0))->value(exec))); + if (exec->argument(0).isString()) + context->setStrokeColor(ustringToString(asString(exec->argument(0))->value(exec))); else - context->setStrokeColor(args.at(0).toFloat(exec)); + context->setStrokeColor(exec->argument(0).toFloat(exec)); break; case 2: - if (args.at(0).isString()) - context->setStrokeColor(ustringToString(asString(args.at(0))->value(exec)), args.at(1).toFloat(exec)); + if (exec->argument(0).isString()) + context->setStrokeColor(ustringToString(asString(exec->argument(0))->value(exec)), exec->argument(1).toFloat(exec)); else - context->setStrokeColor(args.at(0).toFloat(exec), args.at(1).toFloat(exec)); + context->setStrokeColor(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec)); break; case 4: - context->setStrokeColor(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), args.at(3).toFloat(exec)); + context->setStrokeColor(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec)); break; case 5: - context->setStrokeColor(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), args.at(3).toFloat(exec), args.at(4).toFloat(exec)); + context->setStrokeColor(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec)); break; default: return throwError(exec, SyntaxError); @@ -164,21 +164,21 @@ JSValue JSCanvasRenderingContext2D::setStrokeColor(ExecState* exec, const ArgLis return jsUndefined(); } -JSValue JSCanvasRenderingContext2D::strokeRect(ExecState* exec, const ArgList& args) +JSValue JSCanvasRenderingContext2D::strokeRect(ExecState* exec) { CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); - if (args.size() <= 4) - context->strokeRect(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), args.at(3).toFloat(exec)); + if (exec->argumentCount() <= 4) + context->strokeRect(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec)); else - context->strokeRect(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), args.at(3).toFloat(exec), args.at(4).toFloat(exec)); + context->strokeRect(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec)); return jsUndefined(); } -JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec, const ArgList& args) +JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec) { CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); @@ -188,7 +188,7 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec, const ArgList& ar // drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh) // Composite operation is specified with globalCompositeOperation. // The img parameter can be a <img> or <canvas> element. - JSValue value = args.at(0); + JSValue value = exec->argument(0); if (!value.isObject()) return throwError(exec, TypeError); JSObject* o = asObject(value); @@ -196,20 +196,20 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec, const ArgList& ar ExceptionCode ec = 0; if (o->inherits(&JSHTMLImageElement::s_info)) { HTMLImageElement* imgElt = static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(o)->impl()); - switch (args.size()) { + switch (exec->argumentCount()) { case 3: - context->drawImage(imgElt, args.at(1).toFloat(exec), args.at(2).toFloat(exec), ec); + context->drawImage(imgElt, exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), ec); break; case 5: - context->drawImage(imgElt, args.at(1).toFloat(exec), args.at(2).toFloat(exec), - args.at(3).toFloat(exec), args.at(4).toFloat(exec), ec); + context->drawImage(imgElt, exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), + exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec), ec); setDOMException(exec, ec); break; case 9: - context->drawImage(imgElt, FloatRect(args.at(1).toFloat(exec), args.at(2).toFloat(exec), - args.at(3).toFloat(exec), args.at(4).toFloat(exec)), - FloatRect(args.at(5).toFloat(exec), args.at(6).toFloat(exec), - args.at(7).toFloat(exec), args.at(8).toFloat(exec)), ec); + context->drawImage(imgElt, FloatRect(exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), + exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec)), + FloatRect(exec->argument(5).toFloat(exec), exec->argument(6).toFloat(exec), + exec->argument(7).toFloat(exec), exec->argument(8).toFloat(exec)), ec); setDOMException(exec, ec); break; default: @@ -217,20 +217,20 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec, const ArgList& ar } } else if (o->inherits(&JSHTMLCanvasElement::s_info)) { HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLElement*>(o)->impl()); - switch (args.size()) { + switch (exec->argumentCount()) { case 3: - context->drawImage(canvas, args.at(1).toFloat(exec), args.at(2).toFloat(exec), ec); + context->drawImage(canvas, exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), ec); break; case 5: - context->drawImage(canvas, args.at(1).toFloat(exec), args.at(2).toFloat(exec), - args.at(3).toFloat(exec), args.at(4).toFloat(exec), ec); + context->drawImage(canvas, exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), + exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec), ec); setDOMException(exec, ec); break; case 9: - context->drawImage(canvas, FloatRect(args.at(1).toFloat(exec), args.at(2).toFloat(exec), - args.at(3).toFloat(exec), args.at(4).toFloat(exec)), - FloatRect(args.at(5).toFloat(exec), args.at(6).toFloat(exec), - args.at(7).toFloat(exec), args.at(8).toFloat(exec)), ec); + context->drawImage(canvas, FloatRect(exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), + exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec)), + FloatRect(exec->argument(5).toFloat(exec), exec->argument(6).toFloat(exec), + exec->argument(7).toFloat(exec), exec->argument(8).toFloat(exec)), ec); setDOMException(exec, ec); break; default: @@ -239,20 +239,20 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec, const ArgList& ar #if ENABLE(VIDEO) } else if (o->inherits(&JSHTMLVideoElement::s_info)) { HTMLVideoElement* video = static_cast<HTMLVideoElement*>(static_cast<JSHTMLElement*>(o)->impl()); - switch (args.size()) { + switch (exec->argumentCount()) { case 3: - context->drawImage(video, args.at(1).toFloat(exec), args.at(2).toFloat(exec), ec); + context->drawImage(video, exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), ec); break; case 5: - context->drawImage(video, args.at(1).toFloat(exec), args.at(2).toFloat(exec), - args.at(3).toFloat(exec), args.at(4).toFloat(exec), ec); + context->drawImage(video, exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), + exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec), ec); setDOMException(exec, ec); break; case 9: - context->drawImage(video, FloatRect(args.at(1).toFloat(exec), args.at(2).toFloat(exec), - args.at(3).toFloat(exec), args.at(4).toFloat(exec)), - FloatRect(args.at(5).toFloat(exec), args.at(6).toFloat(exec), - args.at(7).toFloat(exec), args.at(8).toFloat(exec)), ec); + context->drawImage(video, FloatRect(exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), + exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec)), + FloatRect(exec->argument(5).toFloat(exec), exec->argument(6).toFloat(exec), + exec->argument(7).toFloat(exec), exec->argument(8).toFloat(exec)), ec); setDOMException(exec, ec); break; default: @@ -266,11 +266,11 @@ JSValue JSCanvasRenderingContext2D::drawImage(ExecState* exec, const ArgList& ar return jsUndefined(); } -JSValue JSCanvasRenderingContext2D::drawImageFromRect(ExecState* exec, const ArgList& args) +JSValue JSCanvasRenderingContext2D::drawImageFromRect(ExecState* exec) { CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); - JSValue value = args.at(0); + JSValue value = exec->argument(0); if (!value.isObject()) return throwError(exec, TypeError); JSObject* o = asObject(value); @@ -278,52 +278,52 @@ JSValue JSCanvasRenderingContext2D::drawImageFromRect(ExecState* exec, const Arg if (!o->inherits(&JSHTMLImageElement::s_info)) return throwError(exec, TypeError); context->drawImageFromRect(static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(o)->impl()), - args.at(1).toFloat(exec), args.at(2).toFloat(exec), - args.at(3).toFloat(exec), args.at(4).toFloat(exec), - args.at(5).toFloat(exec), args.at(6).toFloat(exec), - args.at(7).toFloat(exec), args.at(8).toFloat(exec), - ustringToString(args.at(9).toString(exec))); + exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), + exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec), + exec->argument(5).toFloat(exec), exec->argument(6).toFloat(exec), + exec->argument(7).toFloat(exec), exec->argument(8).toFloat(exec), + ustringToString(exec->argument(9).toString(exec))); return jsUndefined(); } -JSValue JSCanvasRenderingContext2D::setShadow(ExecState* exec, const ArgList& args) +JSValue JSCanvasRenderingContext2D::setShadow(ExecState* exec) { CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); - switch (args.size()) { + switch (exec->argumentCount()) { case 3: - context->setShadow(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec)); + context->setShadow(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec)); break; case 4: - if (args.at(3).isString()) - context->setShadow(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), ustringToString(asString(args.at(3))->value(exec))); + if (exec->argument(3).isString()) + context->setShadow(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), ustringToString(asString(exec->argument(3))->value(exec))); else - context->setShadow(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), args.at(3).toFloat(exec)); + context->setShadow(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec)); break; case 5: - if (args.at(3).isString()) - context->setShadow(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), ustringToString(asString(args.at(3))->value(exec)), - args.at(4).toFloat(exec)); + if (exec->argument(3).isString()) + context->setShadow(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), ustringToString(asString(exec->argument(3))->value(exec)), + exec->argument(4).toFloat(exec)); else - context->setShadow(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), args.at(3).toFloat(exec), - args.at(4).toFloat(exec)); + context->setShadow(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), + exec->argument(4).toFloat(exec)); break; case 7: - context->setShadow(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), args.at(3).toFloat(exec), - args.at(4).toFloat(exec), args.at(5).toFloat(exec), - args.at(6).toFloat(exec)); + context->setShadow(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), + exec->argument(4).toFloat(exec), exec->argument(5).toFloat(exec), + exec->argument(6).toFloat(exec)); break; case 8: - context->setShadow(args.at(0).toFloat(exec), args.at(1).toFloat(exec), - args.at(2).toFloat(exec), args.at(3).toFloat(exec), - args.at(4).toFloat(exec), args.at(5).toFloat(exec), - args.at(6).toFloat(exec), args.at(7).toFloat(exec)); + context->setShadow(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), + exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec), + exec->argument(4).toFloat(exec), exec->argument(5).toFloat(exec), + exec->argument(6).toFloat(exec), exec->argument(7).toFloat(exec)); break; default: return throwError(exec, SyntaxError); @@ -332,11 +332,11 @@ JSValue JSCanvasRenderingContext2D::setShadow(ExecState* exec, const ArgList& ar return jsUndefined(); } -JSValue JSCanvasRenderingContext2D::createPattern(ExecState* exec, const ArgList& args) +JSValue JSCanvasRenderingContext2D::createPattern(ExecState* exec) { CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); - JSValue value = args.at(0); + JSValue value = exec->argument(0); if (!value.isObject()) return throwError(exec, TypeError); JSObject* o = asObject(value); @@ -345,7 +345,7 @@ JSValue JSCanvasRenderingContext2D::createPattern(ExecState* exec, const ArgList ExceptionCode ec; JSValue pattern = toJS(exec, context->createPattern(static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(o)->impl()), - valueToStringWithNullCheck(exec, args.at(1)), ec).get()); + valueToStringWithNullCheck(exec, exec->argument(1)), ec).get()); setDOMException(exec, ec); return pattern; } @@ -353,7 +353,7 @@ JSValue JSCanvasRenderingContext2D::createPattern(ExecState* exec, const ArgList ExceptionCode ec; JSValue pattern = toJS(exec, context->createPattern(static_cast<HTMLCanvasElement*>(static_cast<JSHTMLElement*>(o)->impl()), - valueToStringWithNullCheck(exec, args.at(1)), ec).get()); + valueToStringWithNullCheck(exec, exec->argument(1)), ec).get()); setDOMException(exec, ec); return pattern; } @@ -361,7 +361,7 @@ JSValue JSCanvasRenderingContext2D::createPattern(ExecState* exec, const ArgList return jsUndefined(); } -JSValue JSCanvasRenderingContext2D::createImageData(ExecState* exec, const ArgList& args) +JSValue JSCanvasRenderingContext2D::createImageData(ExecState* exec) { // createImageData has two variants // createImageData(ImageData) @@ -370,16 +370,16 @@ JSValue JSCanvasRenderingContext2D::createImageData(ExecState* exec, const ArgLi RefPtr<ImageData> imageData = 0; ExceptionCode ec = 0; - if (args.size() == 1) - imageData = context->createImageData(toImageData(args.at(0)), ec); - else if (args.size() == 2) - imageData = context->createImageData(args.at(0).toFloat(exec), args.at(1).toFloat(exec), ec); + if (exec->argumentCount() == 1) + imageData = context->createImageData(toImageData(exec->argument(0)), ec); + else if (exec->argumentCount() == 2) + imageData = context->createImageData(exec->argument(0).toFloat(exec), exec->argument(1).toFloat(exec), ec); setDOMException(exec, ec); return toJS(exec, globalObject(), WTF::getPtr(imageData)); } -JSValue JSCanvasRenderingContext2D::putImageData(ExecState* exec, const ArgList& args) +JSValue JSCanvasRenderingContext2D::putImageData(ExecState* exec) { // putImageData has two variants // putImageData(ImageData, x, y) @@ -387,17 +387,17 @@ JSValue JSCanvasRenderingContext2D::putImageData(ExecState* exec, const ArgList& CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); ExceptionCode ec = 0; - if (args.size() >= 7) - context->putImageData(toImageData(args.at(0)), args.at(1).toFloat(exec), args.at(2).toFloat(exec), - args.at(3).toFloat(exec), args.at(4).toFloat(exec), args.at(5).toFloat(exec), args.at(6).toFloat(exec), ec); + if (exec->argumentCount() >= 7) + context->putImageData(toImageData(exec->argument(0)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), + exec->argument(3).toFloat(exec), exec->argument(4).toFloat(exec), exec->argument(5).toFloat(exec), exec->argument(6).toFloat(exec), ec); else - context->putImageData(toImageData(args.at(0)), args.at(1).toFloat(exec), args.at(2).toFloat(exec), ec); + context->putImageData(toImageData(exec->argument(0)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), ec); setDOMException(exec, ec); return jsUndefined(); } -JSValue JSCanvasRenderingContext2D::fillText(ExecState* exec, const ArgList& args) +JSValue JSCanvasRenderingContext2D::fillText(ExecState* exec) { CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); @@ -405,17 +405,17 @@ JSValue JSCanvasRenderingContext2D::fillText(ExecState* exec, const ArgList& arg // number arg = x // number arg = y // optional number arg = maxWidth - if (args.size() < 3 || args.size() > 4) + if (exec->argumentCount() < 3 || exec->argumentCount() > 4) return throwError(exec, SyntaxError); - if (args.size() == 4) - context->fillText(ustringToString(args.at(0).toString(exec)), args.at(1).toFloat(exec), args.at(2).toFloat(exec), args.at(3).toFloat(exec)); + if (exec->argumentCount() == 4) + context->fillText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec)); else - context->fillText(ustringToString(args.at(0).toString(exec)), args.at(1).toFloat(exec), args.at(2).toFloat(exec)); + context->fillText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec)); return jsUndefined(); } -JSValue JSCanvasRenderingContext2D::strokeText(ExecState* exec, const ArgList& args) +JSValue JSCanvasRenderingContext2D::strokeText(ExecState* exec) { CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); @@ -423,13 +423,13 @@ JSValue JSCanvasRenderingContext2D::strokeText(ExecState* exec, const ArgList& a // number arg = x // number arg = y // optional number arg = maxWidth - if (args.size() < 3 || args.size() > 4) + if (exec->argumentCount() < 3 || exec->argumentCount() > 4) return throwError(exec, SyntaxError); - if (args.size() == 4) - context->strokeText(ustringToString(args.at(0).toString(exec)), args.at(1).toFloat(exec), args.at(2).toFloat(exec), args.at(3).toFloat(exec)); + if (exec->argumentCount() == 4) + context->strokeText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec), exec->argument(3).toFloat(exec)); else - context->strokeText(ustringToString(args.at(0).toString(exec)), args.at(1).toFloat(exec), args.at(2).toFloat(exec)); + context->strokeText(ustringToString(exec->argument(0).toString(exec)), exec->argument(1).toFloat(exec), exec->argument(2).toFloat(exec)); return jsUndefined(); } diff --git a/WebCore/bindings/js/JSClipboardCustom.cpp b/WebCore/bindings/js/JSClipboardCustom.cpp index ca06d92..ad5e055 100644 --- a/WebCore/bindings/js/JSClipboardCustom.cpp +++ b/WebCore/bindings/js/JSClipboardCustom.cpp @@ -63,17 +63,17 @@ JSValue JSClipboard::types(ExecState* exec) const return constructArray(exec, list); } -JSValue JSClipboard::clearData(ExecState* exec, const ArgList& args) +JSValue JSClipboard::clearData(ExecState* exec) { Clipboard* clipboard = impl(); - if (args.size() == 0) { + if (!exec->argumentCount()) { clipboard->clearAllData(); return jsUndefined(); } - if (args.size() == 1) { - clipboard->clearData(ustringToString(args.at(0).toString(exec))); + if (exec->argumentCount() == 1) { + clipboard->clearData(ustringToString(exec->argument(0).toString(exec))); return jsUndefined(); } @@ -81,23 +81,23 @@ JSValue JSClipboard::clearData(ExecState* exec, const ArgList& args) return throwError(exec, SyntaxError, "clearData: Invalid number of arguments"); } -JSValue JSClipboard::getData(ExecState* exec, const ArgList& args) +JSValue JSClipboard::getData(ExecState* exec) { // FIXME: It does not match the rest of the JS bindings to throw on invalid number of arguments. - if (args.size() != 1) + if (exec->argumentCount() != 1) return throwError(exec, SyntaxError, "getData: Invalid number of arguments"); Clipboard* clipboard = impl(); bool success; - String result = clipboard->getData(ustringToString(args.at(0).toString(exec)), success); + String result = clipboard->getData(ustringToString(exec->argument(0).toString(exec)), success); if (!success) return jsUndefined(); return jsString(exec, result); } -JSValue JSClipboard::setDragImage(ExecState* exec, const ArgList& args) +JSValue JSClipboard::setDragImage(ExecState* exec) { Clipboard* clipboard = impl(); @@ -105,14 +105,14 @@ JSValue JSClipboard::setDragImage(ExecState* exec, const ArgList& args) return jsUndefined(); // FIXME: It does not match the rest of the JS bindings to throw on invalid number of arguments. - if (args.size() != 3) + if (exec->argumentCount() != 3) return throwError(exec, SyntaxError, "setDragImage: Invalid number of arguments"); - int x = args.at(1).toInt32(exec); - int y = args.at(2).toInt32(exec); + int x = exec->argument(1).toInt32(exec); + int y = exec->argument(2).toInt32(exec); // See if they passed us a node - Node* node = toNode(args.at(0)); + Node* node = toNode(exec->argument(0)); if (!node) return throwError(exec, TypeError); diff --git a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp index b1f82a8..4d7b6e1 100644 --- a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp +++ b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp @@ -44,12 +44,12 @@ namespace WebCore { #if ENABLE(APPLICATION_CACHE_DYNAMIC_ENTRIES) -JSValue JSDOMApplicationCache::hasItem(ExecState* exec, const ArgList& args) +JSValue JSDOMApplicationCache::hasItem(ExecState* exec) { Frame* frame = asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame(); if (!frame) return jsUndefined(); - const KURL& url = frame->loader()->completeURL(args.at(0).toString(exec)); + const KURL& url = frame->loader()->completeURL(exec->argument(0).toString(exec)); ExceptionCode ec = 0; bool result = impl()->hasItem(url, ec); @@ -57,12 +57,12 @@ JSValue JSDOMApplicationCache::hasItem(ExecState* exec, const ArgList& args) return jsBoolean(result); } -JSValue JSDOMApplicationCache::add(ExecState* exec, const ArgList& args) +JSValue JSDOMApplicationCache::add(ExecState* exec) { Frame* frame = asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame(); if (!frame) return jsUndefined(); - const KURL& url = frame->loader()->completeURL(args.at(0).toString(exec)); + const KURL& url = frame->loader()->completeURL(exec->argument(0).toString(exec)); ExceptionCode ec = 0; impl()->add(url, ec); @@ -70,12 +70,12 @@ JSValue JSDOMApplicationCache::add(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSDOMApplicationCache::remove(ExecState* exec, const ArgList& args) +JSValue JSDOMApplicationCache::remove(ExecState* exec) { Frame* frame = asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame(); if (!frame) return jsUndefined(); - const KURL& url = frame->loader()->completeURL(args.at(0).toString(exec)); + const KURL& url = frame->loader()->completeURL(exec->argument(0).toString(exec)); ExceptionCode ec = 0; impl()->remove(url, ec); diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h index 215e09a..3f2502d 100644 --- a/WebCore/bindings/js/JSDOMBinding.h +++ b/WebCore/bindings/js/JSDOMBinding.h @@ -222,7 +222,7 @@ namespace WebCore { { if (!node) return JSC::jsNull(); - if (JSNode* wrapper = getCachedDOMNodeWrapper(exec, node->document(), node)) + if (JSC::JSCell* wrapper = getCachedDOMNodeWrapper(exec, node->document(), node)) return wrapper; return createDOMNodeWrapper<WrapperClass>(exec, globalObject, node); } diff --git a/WebCore/bindings/js/JSDOMFormDataCustom.cpp b/WebCore/bindings/js/JSDOMFormDataCustom.cpp index 830db6b..f207578 100644 --- a/WebCore/bindings/js/JSDOMFormDataCustom.cpp +++ b/WebCore/bindings/js/JSDOMFormDataCustom.cpp @@ -39,11 +39,11 @@ using namespace JSC; namespace WebCore { -JSValue JSDOMFormData::append(ExecState* exec, const ArgList& args) +JSValue JSDOMFormData::append(ExecState* exec) { - if (args.size() >= 2) { - String name = ustringToString(args.at(0).toString(exec)); - JSValue value = args.at(1); + if (exec->argumentCount() >= 2) { + String name = ustringToString(exec->argument(0).toString(exec)); + JSValue value = exec->argument(1); if (value.inherits(&JSBlob::s_info)) impl()->append(name, toBlob(value)); else diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp index 343c8f9..eabf962 100644 --- a/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -766,11 +766,11 @@ static bool domWindowAllowPopUp(Frame* activeFrame, ExecState* exec) return DOMWindow::allowPopUp(activeFrame); } -JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args) +JSValue JSDOMWindow::open(ExecState* exec) { - String urlString = valueToStringWithUndefinedOrNullCheck(exec, args.at(0)); - AtomicString frameName = args.at(1).isUndefinedOrNull() ? "_blank" : ustringToAtomicString(args.at(1).toString(exec)); - WindowFeatures windowFeatures(valueToStringWithUndefinedOrNullCheck(exec, args.at(2))); + String urlString = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)); + AtomicString frameName = exec->argument(1).isUndefinedOrNull() ? "_blank" : ustringToAtomicString(exec->argument(1).toString(exec)); + WindowFeatures windowFeatures(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(2))); Frame* frame = impl()->frame(); if (!frame) @@ -840,11 +840,11 @@ JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args) return toJS(exec, frame->domWindow()); } -JSValue JSDOMWindow::showModalDialog(ExecState* exec, const ArgList& args) +JSValue JSDOMWindow::showModalDialog(ExecState* exec) { - String url = valueToStringWithUndefinedOrNullCheck(exec, args.at(0)); - JSValue dialogArgs = args.at(1); - String featureArgs = valueToStringWithUndefinedOrNullCheck(exec, args.at(2)); + String url = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)); + JSValue dialogArgs = exec->argument(1); + String featureArgs = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(2)); Frame* frame = impl()->frame(); if (!frame) @@ -923,23 +923,23 @@ JSValue JSDOMWindow::showModalDialog(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSDOMWindow::postMessage(ExecState* exec, const ArgList& args) +JSValue JSDOMWindow::postMessage(ExecState* exec) { DOMWindow* window = impl(); DOMWindow* source = asJSDOMWindow(exec->lexicalGlobalObject())->impl(); - PassRefPtr<SerializedScriptValue> message = SerializedScriptValue::create(exec, args.at(0)); + PassRefPtr<SerializedScriptValue> message = SerializedScriptValue::create(exec, exec->argument(0)); if (exec->hadException()) return jsUndefined(); MessagePortArray messagePorts; - if (args.size() > 2) - fillMessagePortArray(exec, args.at(1), messagePorts); + if (exec->argumentCount() > 2) + fillMessagePortArray(exec, exec->argument(1), messagePorts); if (exec->hadException()) return jsUndefined(); - String targetOrigin = valueToStringWithUndefinedOrNullCheck(exec, args.at((args.size() == 2) ? 1 : 2)); + String targetOrigin = valueToStringWithUndefinedOrNullCheck(exec, exec->argument((exec->argumentCount() == 2) ? 1 : 2)); if (exec->hadException()) return jsUndefined(); @@ -950,12 +950,12 @@ JSValue JSDOMWindow::postMessage(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSDOMWindow::setTimeout(ExecState* exec, const ArgList& args) +JSValue JSDOMWindow::setTimeout(ExecState* exec) { - OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, args, currentWorld(exec)); + OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, currentWorld(exec)); if (exec->hadException()) return jsUndefined(); - int delay = args.at(1).toInt32(exec); + int delay = exec->argument(1).toInt32(exec); ExceptionCode ec = 0; int result = impl()->setTimeout(action.release(), delay, ec); @@ -964,12 +964,12 @@ JSValue JSDOMWindow::setTimeout(ExecState* exec, const ArgList& args) return jsNumber(exec, result); } -JSValue JSDOMWindow::setInterval(ExecState* exec, const ArgList& args) +JSValue JSDOMWindow::setInterval(ExecState* exec) { - OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, args, currentWorld(exec)); + OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, currentWorld(exec)); if (exec->hadException()) return jsUndefined(); - int delay = args.at(1).toInt32(exec); + int delay = exec->argument(1).toInt32(exec); ExceptionCode ec = 0; int result = impl()->setInterval(action.release(), delay, ec); @@ -978,67 +978,67 @@ JSValue JSDOMWindow::setInterval(ExecState* exec, const ArgList& args) return jsNumber(exec, result); } -JSValue JSDOMWindow::addEventListener(ExecState* exec, const ArgList& args) +JSValue JSDOMWindow::addEventListener(ExecState* exec) { Frame* frame = impl()->frame(); if (!frame) return jsUndefined(); - JSValue listener = args.at(1); + JSValue listener = exec->argument(1); if (!listener.isObject()) return jsUndefined(); - impl()->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec)); + impl()->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); return jsUndefined(); } -JSValue JSDOMWindow::removeEventListener(ExecState* exec, const ArgList& args) +JSValue JSDOMWindow::removeEventListener(ExecState* exec) { Frame* frame = impl()->frame(); if (!frame) return jsUndefined(); - JSValue listener = args.at(1); + JSValue listener = exec->argument(1); if (!listener.isObject()) return jsUndefined(); - impl()->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); + impl()->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return jsUndefined(); } #if ENABLE(DATABASE) -JSValue JSDOMWindow::openDatabase(ExecState* exec, const ArgList& args) +JSValue JSDOMWindow::openDatabase(ExecState* exec) { - if (!allowsAccessFrom(exec) || (args.size() < 4)) { + if (!allowsAccessFrom(exec) || (exec->argumentCount() < 4)) { setDOMException(exec, SYNTAX_ERR); return jsUndefined(); } - String name = ustringToString(args.at(0).toString(exec)); + String name = ustringToString(exec->argument(0).toString(exec)); if (exec->hadException()) return jsUndefined(); - String version = ustringToString(args.at(1).toString(exec)); + String version = ustringToString(exec->argument(1).toString(exec)); if (exec->hadException()) return jsUndefined(); - String displayName = ustringToString(args.at(2).toString(exec)); + String displayName = ustringToString(exec->argument(2).toString(exec)); if (exec->hadException()) return jsUndefined(); - // args.at(3) = estimated size - unsigned long estimatedSize = args.at(3).toUInt32(exec); + // exec->argument(3) = estimated size + unsigned long estimatedSize = exec->argument(3).toUInt32(exec); if (exec->hadException()) return jsUndefined(); RefPtr<DatabaseCallback> creationCallback; - if (args.size() >= 5) { - if (!args.at(4).isObject()) { + if (exec->argumentCount() >= 5) { + if (!exec->argument(4).isObject()) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } - creationCallback = JSDatabaseCallback::create(asObject(args.at(4)), globalObject()); + creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject()); } ExceptionCode ec = 0; diff --git a/WebCore/bindings/js/JSDatabaseCustom.cpp b/WebCore/bindings/js/JSDatabaseCustom.cpp index a86cc18..26f9db7 100644 --- a/WebCore/bindings/js/JSDatabaseCustom.cpp +++ b/WebCore/bindings/js/JSDatabaseCustom.cpp @@ -47,17 +47,17 @@ namespace WebCore { using namespace JSC; -JSValue JSDatabase::changeVersion(ExecState* exec, const ArgList& args) +JSValue JSDatabase::changeVersion(ExecState* exec) { - String oldVersion = ustringToString(args.at(0).toString(exec)); + String oldVersion = ustringToString(exec->argument(0).toString(exec)); if (exec->hadException()) return jsUndefined(); - String newVersion = ustringToString(args.at(1).toString(exec)); + String newVersion = ustringToString(exec->argument(1).toString(exec)); if (exec->hadException()) return jsUndefined(); - JSObject* object = args.at(2).getObject(); + JSObject* object = exec->argument(2).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -66,8 +66,8 @@ JSValue JSDatabase::changeVersion(ExecState* exec, const ArgList& args) RefPtr<SQLTransactionCallback> callback(JSSQLTransactionCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()))); RefPtr<SQLTransactionErrorCallback> errorCallback; - if (!args.at(3).isNull()) { - object = args.at(3).getObject(); + if (!exec->argument(3).isNull()) { + object = exec->argument(3).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -77,8 +77,8 @@ JSValue JSDatabase::changeVersion(ExecState* exec, const ArgList& args) } RefPtr<VoidCallback> successCallback; - if (!args.at(4).isNull()) { - object = args.at(4).getObject(); + if (!exec->argument(4).isNull()) { + object = exec->argument(4).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -92,9 +92,9 @@ JSValue JSDatabase::changeVersion(ExecState* exec, const ArgList& args) return jsUndefined(); } -static JSValue createTransaction(ExecState* exec, const ArgList& args, Database* database, JSDOMGlobalObject* globalObject, bool readOnly) +static JSValue createTransaction(ExecState* exec, Database* database, JSDOMGlobalObject* globalObject, bool readOnly) { - JSObject* object = args.at(0).getObject(); + JSObject* object = exec->argument(0).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); @@ -103,8 +103,8 @@ static JSValue createTransaction(ExecState* exec, const ArgList& args, Database* RefPtr<SQLTransactionCallback> callback(JSSQLTransactionCallback::create(object, globalObject)); RefPtr<SQLTransactionErrorCallback> errorCallback; - if (args.size() > 1 && !args.at(1).isNull()) { - object = args.at(1).getObject(); + if (exec->argumentCount() > 1 && !exec->argument(1).isNull()) { + object = exec->argument(1).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -114,8 +114,8 @@ static JSValue createTransaction(ExecState* exec, const ArgList& args, Database* } RefPtr<VoidCallback> successCallback; - if (args.size() > 2 && !args.at(2).isNull()) { - object = args.at(2).getObject(); + if (exec->argumentCount() > 2 && !exec->argument(2).isNull()) { + object = exec->argument(2).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -128,14 +128,14 @@ static JSValue createTransaction(ExecState* exec, const ArgList& args, Database* return jsUndefined(); } -JSValue JSDatabase::transaction(ExecState* exec, const ArgList& args) +JSValue JSDatabase::transaction(ExecState* exec) { - return createTransaction(exec, args, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), false); + return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), false); } -JSValue JSDatabase::readTransaction(ExecState* exec, const ArgList& args) +JSValue JSDatabase::readTransaction(ExecState* exec) { - return createTransaction(exec, args, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), true); + return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), true); } } diff --git a/WebCore/bindings/js/JSDatabaseSyncCustom.cpp b/WebCore/bindings/js/JSDatabaseSyncCustom.cpp index 272cb83..79eb376 100644 --- a/WebCore/bindings/js/JSDatabaseSyncCustom.cpp +++ b/WebCore/bindings/js/JSDatabaseSyncCustom.cpp @@ -42,17 +42,17 @@ namespace WebCore { using namespace JSC; -JSValue JSDatabaseSync::changeVersion(ExecState* exec, const ArgList& args) +JSValue JSDatabaseSync::changeVersion(ExecState* exec) { - String oldVersion = ustringToString(args.at(0).toString(exec)); + String oldVersion = ustringToString(exec->argument(0).toString(exec)); if (exec->hadException()) return jsUndefined(); - String newVersion = ustringToString(args.at(1).toString(exec)); + String newVersion = ustringToString(exec->argument(1).toString(exec)); if (exec->hadException()) return jsUndefined(); - JSObject* object = args.at(2).getObject(); + JSObject* object = exec->argument(2).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -67,9 +67,9 @@ JSValue JSDatabaseSync::changeVersion(ExecState* exec, const ArgList& args) return jsUndefined(); } -static JSValue createTransaction(ExecState* exec, const ArgList& args, DatabaseSync* database, JSDOMGlobalObject* globalObject, bool readOnly) +static JSValue createTransaction(ExecState* exec, DatabaseSync* database, JSDOMGlobalObject* globalObject, bool readOnly) { - JSObject* object = args.at(0).getObject(); + JSObject* object = exec->argument(0).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -84,14 +84,14 @@ static JSValue createTransaction(ExecState* exec, const ArgList& args, DatabaseS return jsUndefined(); } -JSValue JSDatabaseSync::transaction(ExecState* exec, const ArgList& args) +JSValue JSDatabaseSync::transaction(ExecState* exec) { - return createTransaction(exec, args, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), false); + return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), false); } -JSValue JSDatabaseSync::readTransaction(ExecState* exec, const ArgList& args) +JSValue JSDatabaseSync::readTransaction(ExecState* exec) { - return createTransaction(exec, args, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), true); + return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), true); } } diff --git a/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp b/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp index fbee5ef..2222353 100644 --- a/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp +++ b/WebCore/bindings/js/JSDedicatedWorkerContextCustom.cpp @@ -42,9 +42,9 @@ using namespace JSC; namespace WebCore { -JSC::JSValue JSDedicatedWorkerContext::postMessage(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSDedicatedWorkerContext::postMessage(JSC::ExecState* exec) { - return handlePostMessage(exec, args, impl()); + return handlePostMessage(exec, impl()); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp index 387f5f5..3098752 100644 --- a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp +++ b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp @@ -45,17 +45,17 @@ using namespace JSC; namespace WebCore { -JSValue JSNotificationCenter::requestPermission(ExecState* exec, const ArgList& args) +JSValue JSNotificationCenter::requestPermission(ExecState* exec) { // Permission request is only valid from page context. ScriptExecutionContext* context = impl()->context(); if (context->isWorkerContext()) return throwError(exec, SyntaxError); - if (!args.at(0).isObject()) + if (!exec->argument(0).isObject()) return throwError(exec, TypeError); - PassRefPtr<JSCustomVoidCallback> callback = JSCustomVoidCallback::create(args.at(0).getObject(), toJSDOMGlobalObject(static_cast<Document*>(context), exec)); + PassRefPtr<JSCustomVoidCallback> callback = JSCustomVoidCallback::create(exec->argument(0).getObject(), toJSDOMGlobalObject(static_cast<Document*>(context), exec)); impl()->requestPermission(callback); return jsUndefined(); diff --git a/WebCore/bindings/js/JSElementCustom.cpp b/WebCore/bindings/js/JSElementCustom.cpp index 7e294bd..23eda7e 100644 --- a/WebCore/bindings/js/JSElementCustom.cpp +++ b/WebCore/bindings/js/JSElementCustom.cpp @@ -64,73 +64,6 @@ void JSElement::markChildren(MarkStack& markStack) markDOMObjectWrapper(markStack, globalData, static_cast<StyledElement*>(element)->inlineStyleDecl()); } -JSValue JSElement::setAttribute(ExecState* exec, const ArgList& args) -{ - ExceptionCode ec = 0; - AtomicString name = ustringToAtomicString(args.at(0).toString(exec)); - AtomicString value = ustringToAtomicString(args.at(1).toString(exec)); - - Element* imp = impl(); - if (!allowSettingSrcToJavascriptURL(exec, imp, name, value)) - return jsUndefined(); - - imp->setAttribute(name, value, ec); - setDOMException(exec, ec); - return jsUndefined(); -} - -JSValue JSElement::setAttributeNode(ExecState* exec, const ArgList& args) -{ - ExceptionCode ec = 0; - Attr* newAttr = toAttr(args.at(0)); - if (!newAttr) { - setDOMException(exec, TYPE_MISMATCH_ERR); - return jsUndefined(); - } - - Element* imp = impl(); - if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value())) - return jsUndefined(); - - JSValue result = toJS(exec, globalObject(), WTF::getPtr(imp->setAttributeNode(newAttr, ec))); - setDOMException(exec, ec); - return result; -} - -JSValue JSElement::setAttributeNS(ExecState* exec, const ArgList& args) -{ - ExceptionCode ec = 0; - AtomicString namespaceURI = valueToStringWithNullCheck(exec, args.at(0)); - AtomicString qualifiedName = ustringToAtomicString(args.at(1).toString(exec)); - AtomicString value = ustringToAtomicString(args.at(2).toString(exec)); - - Element* imp = impl(); - if (!allowSettingSrcToJavascriptURL(exec, imp, qualifiedName, value)) - return jsUndefined(); - - imp->setAttributeNS(namespaceURI, qualifiedName, value, ec); - setDOMException(exec, ec); - return jsUndefined(); -} - -JSValue JSElement::setAttributeNodeNS(ExecState* exec, const ArgList& args) -{ - ExceptionCode ec = 0; - Attr* newAttr = toAttr(args.at(0)); - if (!newAttr) { - setDOMException(exec, TYPE_MISMATCH_ERR); - return jsUndefined(); - } - - Element* imp = impl(); - if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value())) - return jsUndefined(); - - JSValue result = toJS(exec, globalObject(), WTF::getPtr(imp->setAttributeNodeNS(newAttr, ec))); - setDOMException(exec, ec); - return result; -} - JSValue toJSNewlyCreated(ExecState* exec, JSDOMGlobalObject* globalObject, Element* element) { if (!element) diff --git a/WebCore/bindings/js/JSEventCustom.cpp b/WebCore/bindings/js/JSEventCustom.cpp index bc69323..b6190ff 100644 --- a/WebCore/bindings/js/JSEventCustom.cpp +++ b/WebCore/bindings/js/JSEventCustom.cpp @@ -40,10 +40,6 @@ #include "JSCompositionEvent.h" #include "JSDeviceOrientationEvent.h" #include "JSErrorEvent.h" -#if ENABLE(INDEXED_DATABASE) -#include "JSIDBErrorEvent.h" -#include "JSIDBSuccessEvent.h" -#endif #include "JSKeyboardEvent.h" #include "JSMessageEvent.h" #include "JSMouseEvent.h" @@ -60,10 +56,6 @@ #include "JSXMLHttpRequestProgressEvent.h" #include "BeforeLoadEvent.h" #include "ErrorEvent.h" -#if ENABLE(INDEXED_DATABASE) -#include "IDBErrorEvent.h" -#include "IDBSuccessEvent.h" -#endif #include "KeyboardEvent.h" #include "MessageEvent.h" #include "MouseEvent.h" @@ -95,6 +87,13 @@ #include "TouchEvent.h" #endif +#if ENABLE(INDEXED_DATABASE) +#include "IDBErrorEvent.h" +#include "IDBSuccessEvent.h" +#include "JSIDBErrorEvent.h" +#include "JSIDBSuccessEvent.h" +#endif + using namespace JSC; namespace WebCore { diff --git a/WebCore/bindings/js/JSFloatArrayCustom.cpp b/WebCore/bindings/js/JSFloatArrayCustom.cpp index 9e52762..8a82f98 100644 --- a/WebCore/bindings/js/JSFloatArrayCustom.cpp +++ b/WebCore/bindings/js/JSFloatArrayCustom.cpp @@ -46,9 +46,9 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, FloatAr return getDOMObjectWrapper<JSFloatArray>(exec, globalObject, object); } -JSC::JSValue JSFloatArray::set(JSC::ExecState* exec, JSC::ArgList const& args) +JSC::JSValue JSFloatArray::set(JSC::ExecState* exec) { - return setWebGLArrayHelper(exec, impl(), args, toFloatArray); + return setWebGLArrayHelper(exec, impl(), toFloatArray); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSGeolocationCustom.cpp b/WebCore/bindings/js/JSGeolocationCustom.cpp index 8bc348c..16849ec 100644 --- a/WebCore/bindings/js/JSGeolocationCustom.cpp +++ b/WebCore/bindings/js/JSGeolocationCustom.cpp @@ -135,20 +135,20 @@ static PassRefPtr<PositionOptions> createPositionOptions(ExecState* exec, JSValu return options.release(); } -JSValue JSGeolocation::getCurrentPosition(ExecState* exec, const ArgList& args) +JSValue JSGeolocation::getCurrentPosition(ExecState* exec) { // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions - RefPtr<PositionCallback> positionCallback = createPositionCallback(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), args.at(0)); + RefPtr<PositionCallback> positionCallback = createPositionCallback(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(0)); if (exec->hadException()) return jsUndefined(); ASSERT(positionCallback); - RefPtr<PositionErrorCallback> positionErrorCallback = createPositionErrorCallback(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), args.at(1)); + RefPtr<PositionErrorCallback> positionErrorCallback = createPositionErrorCallback(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(1)); if (exec->hadException()) return jsUndefined(); - RefPtr<PositionOptions> positionOptions = createPositionOptions(exec, args.at(2)); + RefPtr<PositionOptions> positionOptions = createPositionOptions(exec, exec->argument(2)); if (exec->hadException()) return jsUndefined(); ASSERT(positionOptions); @@ -157,20 +157,20 @@ JSValue JSGeolocation::getCurrentPosition(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSGeolocation::watchPosition(ExecState* exec, const ArgList& args) +JSValue JSGeolocation::watchPosition(ExecState* exec) { // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions - RefPtr<PositionCallback> positionCallback = createPositionCallback(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), args.at(0)); + RefPtr<PositionCallback> positionCallback = createPositionCallback(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(0)); if (exec->hadException()) return jsUndefined(); ASSERT(positionCallback); - RefPtr<PositionErrorCallback> positionErrorCallback = createPositionErrorCallback(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), args.at(1)); + RefPtr<PositionErrorCallback> positionErrorCallback = createPositionErrorCallback(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(1)); if (exec->hadException()) return jsUndefined(); - RefPtr<PositionOptions> positionOptions = createPositionOptions(exec, args.at(2)); + RefPtr<PositionOptions> positionOptions = createPositionOptions(exec, exec->argument(2)); if (exec->hadException()) return jsUndefined(); ASSERT(positionOptions); diff --git a/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp b/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp index 86d6fa2..3d819ef 100644 --- a/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp +++ b/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp @@ -58,21 +58,21 @@ static JSValue getNamedItems(ExecState* exec, JSHTMLAllCollection* collection, c // HTMLCollections are strange objects, they support both get and call, // so that document.forms.item(0) and document.forms(0) both work. -static JSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec, JSObject* function, JSValue, const ArgList& args) +static JSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec) { - if (args.size() < 1) + if (exec->argumentCount() < 1) return jsUndefined(); // Do not use thisObj here. It can be the JSHTMLDocument, in the document.forms(i) case. - JSHTMLAllCollection* jsCollection = static_cast<JSHTMLAllCollection*>(function); + JSHTMLAllCollection* jsCollection = static_cast<JSHTMLAllCollection*>(exec->callee()); HTMLAllCollection* collection = static_cast<HTMLAllCollection*>(jsCollection->impl()); // Also, do we need the TypeError test here ? - if (args.size() == 1) { + if (exec->argumentCount() == 1) { // Support for document.all(<index>) etc. bool ok; - UString string = args.at(0).toString(exec); + UString string = exec->argument(0).toString(exec); unsigned index = string.toUInt32(&ok, false); if (ok) return toJS(exec, jsCollection->globalObject(), collection->item(index)); @@ -83,8 +83,8 @@ static JSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec, JSObject* fu // The second arg, if set, is the index of the item we want bool ok; - UString string = args.at(0).toString(exec); - unsigned index = args.at(1).toString(exec).toUInt32(&ok, false); + UString string = exec->argument(0).toString(exec); + unsigned index = exec->argument(1).toString(exec).toUInt32(&ok, false); if (ok) { String pstr = ustringToString(string); Node* node = collection->namedItem(pstr); @@ -118,18 +118,18 @@ JSValue JSHTMLAllCollection::nameGetter(ExecState* exec, JSValue slotBase, const return getNamedItems(exec, thisObj, propertyName); } -JSValue JSHTMLAllCollection::item(ExecState* exec, const ArgList& args) +JSValue JSHTMLAllCollection::item(ExecState* exec) { bool ok; - uint32_t index = args.at(0).toString(exec).toUInt32(&ok, false); + uint32_t index = exec->argument(0).toString(exec).toUInt32(&ok, false); if (ok) return toJS(exec, globalObject(), impl()->item(index)); - return getNamedItems(exec, this, Identifier(exec, args.at(0).toString(exec))); + return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec))); } -JSValue JSHTMLAllCollection::namedItem(ExecState* exec, const ArgList& args) +JSValue JSHTMLAllCollection::namedItem(ExecState* exec) { - return getNamedItems(exec, this, Identifier(exec, args.at(0).toString(exec))); + return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec))); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp index 419f9e9..a69696a 100644 --- a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp +++ b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,17 +50,17 @@ void JSHTMLCanvasElement::markChildren(MarkStack& markStack) markDOMObjectWrapper(markStack, globalData, canvas->renderingContext()); } -JSValue JSHTMLCanvasElement::getContext(ExecState* exec, const ArgList& args) +JSValue JSHTMLCanvasElement::getContext(ExecState* exec) { HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl()); - const UString& contextId = args.at(0).toString(exec); + const UString& contextId = exec->argument(0).toString(exec); RefPtr<CanvasContextAttributes> attrs; #if ENABLE(3D_CANVAS) if (contextId == "experimental-webgl" || contextId == "webkit-3d") { attrs = WebGLContextAttributes::create(); WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get()); - if (args.size() > 1 && args.at(1).isObject()) { - JSObject* jsAttrs = args.at(1).getObject(); + if (exec->argumentCount() > 1 && exec->argument(1).isObject()) { + JSObject* jsAttrs = exec->argument(1).getObject(); Identifier alpha(exec, "alpha"); if (jsAttrs->hasProperty(exec, alpha)) webGLAttrs->setAlpha(jsAttrs->get(exec, alpha).toBoolean(exec)); @@ -84,4 +85,22 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec, const ArgList& args) return toJS(exec, globalObject(), WTF::getPtr(context)); } +JSValue JSHTMLCanvasElement::toDataURL(ExecState* exec) +{ + const String& type = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)); + double quality = 1.0; + if (exec->argumentCount() > 1) { + JSValue v = exec->argument(1); + if (v.isNumber()) + quality = v.toNumber(exec); + if (!(0.0 <= quality && quality <= 1.0)) + quality = 1.0; + } + HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl()); + ExceptionCode ec = 0; + JSC::JSValue result = jsString(exec, canvas->toDataURL(type, quality, ec)); + setDOMException(exec, ec); + return result; +} + } // namespace WebCore diff --git a/WebCore/bindings/js/JSHTMLCollectionCustom.cpp b/WebCore/bindings/js/JSHTMLCollectionCustom.cpp index c5eb41a..24059b7 100644 --- a/WebCore/bindings/js/JSHTMLCollectionCustom.cpp +++ b/WebCore/bindings/js/JSHTMLCollectionCustom.cpp @@ -55,21 +55,21 @@ static JSValue getNamedItems(ExecState* exec, JSHTMLCollection* collection, cons // HTMLCollections are strange objects, they support both get and call, // so that document.forms.item(0) and document.forms(0) both work. -static JSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec, JSObject* function, JSValue, const ArgList& args) +static JSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec) { - if (args.size() < 1) + if (exec->argumentCount() < 1) return jsUndefined(); // Do not use thisObj here. It can be the JSHTMLDocument, in the document.forms(i) case. - JSHTMLCollection* jsCollection = static_cast<JSHTMLCollection*>(function); + JSHTMLCollection* jsCollection = static_cast<JSHTMLCollection*>(exec->callee()); HTMLCollection* collection = jsCollection->impl(); // Also, do we need the TypeError test here ? - if (args.size() == 1) { + if (exec->argumentCount() == 1) { // Support for document.all(<index>) etc. bool ok; - UString string = args.at(0).toString(exec); + UString string = exec->argument(0).toString(exec); unsigned index = string.toUInt32(&ok, false); if (ok) return toJS(exec, jsCollection->globalObject(), collection->item(index)); @@ -80,8 +80,8 @@ static JSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec, JSObject* funct // The second arg, if set, is the index of the item we want bool ok; - UString string = args.at(0).toString(exec); - unsigned index = args.at(1).toString(exec).toUInt32(&ok, false); + UString string = exec->argument(0).toString(exec); + unsigned index = exec->argument(1).toString(exec).toUInt32(&ok, false); if (ok) { String pstr = ustringToString(string); Node* node = collection->namedItem(pstr); @@ -115,18 +115,18 @@ JSValue JSHTMLCollection::nameGetter(ExecState* exec, JSValue slotBase, const Id return getNamedItems(exec, thisObj, propertyName); } -JSValue JSHTMLCollection::item(ExecState* exec, const ArgList& args) +JSValue JSHTMLCollection::item(ExecState* exec) { bool ok; - uint32_t index = args.at(0).toString(exec).toUInt32(&ok, false); + uint32_t index = exec->argument(0).toString(exec).toUInt32(&ok, false); if (ok) return toJS(exec, globalObject(), impl()->item(index)); - return getNamedItems(exec, this, Identifier(exec, args.at(0).toString(exec))); + return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec))); } -JSValue JSHTMLCollection::namedItem(ExecState* exec, const ArgList& args) +JSValue JSHTMLCollection::namedItem(ExecState* exec) { - return getNamedItems(exec, this, Identifier(exec, args.at(0).toString(exec))); + return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec))); } JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, HTMLCollection* collection) diff --git a/WebCore/bindings/js/JSHTMLDocumentCustom.cpp b/WebCore/bindings/js/JSHTMLDocumentCustom.cpp index de0e96f..30cb3a2 100644 --- a/WebCore/bindings/js/JSHTMLDocumentCustom.cpp +++ b/WebCore/bindings/js/JSHTMLDocumentCustom.cpp @@ -100,10 +100,10 @@ void JSHTMLDocument::setAll(ExecState* exec, JSValue value) // Custom functions -JSValue JSHTMLDocument::open(ExecState* exec, const ArgList& args) +JSValue JSHTMLDocument::open(ExecState* exec) { // For compatibility with other browsers, pass open calls with more than 2 parameters to the window. - if (args.size() > 2) { + if (exec->argumentCount() > 2) { Frame* frame = static_cast<HTMLDocument*>(impl())->frame(); if (frame) { JSDOMWindowShell* wrapper = toJSDOMWindowShell(frame, currentWorld(exec)); @@ -113,7 +113,7 @@ JSValue JSHTMLDocument::open(ExecState* exec, const ArgList& args) CallType callType = function.getCallData(callData); if (callType == CallTypeNone) return throwError(exec, TypeError); - return JSC::call(exec, function, callType, callData, wrapper, args); + return JSC::call(exec, function, callType, callData, wrapper, ArgList(exec)); } } return jsUndefined(); @@ -130,20 +130,20 @@ JSValue JSHTMLDocument::open(ExecState* exec, const ArgList& args) enum NewlineRequirement { DoNotAddNewline, DoAddNewline }; -static inline void documentWrite(ExecState* exec, const ArgList& args, HTMLDocument* document, NewlineRequirement addNewline) +static inline void documentWrite(ExecState* exec, HTMLDocument* document, NewlineRequirement addNewline) { // DOM only specifies single string argument, but browsers allow multiple or no arguments. - size_t size = args.size(); + size_t size = exec->argumentCount(); - UString firstString = args.at(0).toString(exec); + UString firstString = exec->argument(0).toString(exec); SegmentedString segmentedString = ustringToString(firstString); if (size != 1) { if (!size) segmentedString.clear(); else { for (size_t i = 1; i < size; ++i) { - UString subsequentString = args.at(i).toString(exec); + UString subsequentString = exec->argument(i).toString(exec); segmentedString.append(SegmentedString(ustringToString(subsequentString))); } } @@ -155,15 +155,15 @@ static inline void documentWrite(ExecState* exec, const ArgList& args, HTMLDocum document->write(segmentedString, activeDocument); } -JSValue JSHTMLDocument::write(ExecState* exec, const ArgList& args) +JSValue JSHTMLDocument::write(ExecState* exec) { - documentWrite(exec, args, static_cast<HTMLDocument*>(impl()), DoNotAddNewline); + documentWrite(exec, static_cast<HTMLDocument*>(impl()), DoNotAddNewline); return jsUndefined(); } -JSValue JSHTMLDocument::writeln(ExecState* exec, const ArgList& args) +JSValue JSHTMLDocument::writeln(ExecState* exec) { - documentWrite(exec, args, static_cast<HTMLDocument*>(impl()), DoAddNewline); + documentWrite(exec, static_cast<HTMLDocument*>(impl()), DoAddNewline); return jsUndefined(); } diff --git a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp index e5166ee..d4be8dc 100644 --- a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp +++ b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp @@ -103,14 +103,14 @@ void JSHTMLInputElement::setSelectionEnd(ExecState* exec, JSValue value) input->setSelectionEnd(value.toInt32(exec)); } -JSValue JSHTMLInputElement::setSelectionRange(ExecState* exec, const ArgList& args) +JSValue JSHTMLInputElement::setSelectionRange(ExecState* exec) { HTMLInputElement* input = static_cast<HTMLInputElement*>(impl()); if (!input->canHaveSelection()) return throwError(exec, TypeError); - int start = args.at(0).toInt32(exec); - int end = args.at(1).toInt32(exec); + int start = exec->argument(0).toInt32(exec); + int end = exec->argument(1).toInt32(exec); input->setSelectionRange(start, end); return jsUndefined(); diff --git a/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp b/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp index 7bca2db..dc2f7cb 100644 --- a/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp +++ b/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp @@ -67,16 +67,16 @@ void JSHTMLOptionsCollection::indexSetter(ExecState* exec, unsigned index, JSVal selectIndexSetter(base, exec, index, value); } -JSValue JSHTMLOptionsCollection::add(ExecState* exec, const ArgList& args) +JSValue JSHTMLOptionsCollection::add(ExecState* exec) { HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl()); - HTMLOptionElement* option = toHTMLOptionElement(args.at(0)); + HTMLOptionElement* option = toHTMLOptionElement(exec->argument(0)); ExceptionCode ec = 0; - if (args.size() < 2) + if (exec->argumentCount() < 2) imp->add(option, ec); else { bool ok; - int index = args.at(1).toInt32(exec, ok); + int index = exec->argument(1).toInt32(exec, ok); if (exec->hadException()) return jsUndefined(); if (!ok) @@ -88,11 +88,11 @@ JSValue JSHTMLOptionsCollection::add(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSHTMLOptionsCollection::remove(ExecState* exec, const ArgList& args) +JSValue JSHTMLOptionsCollection::remove(ExecState* exec) { HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl()); JSHTMLSelectElement* base = static_cast<JSHTMLSelectElement*>(asObject(toJS(exec, globalObject(), imp->base()))); - return base->remove(exec, args); + return base->remove(exec); } } diff --git a/WebCore/bindings/js/JSHTMLSelectElementCustom.cpp b/WebCore/bindings/js/JSHTMLSelectElementCustom.cpp index 9bb6b75..5c462c1 100644 --- a/WebCore/bindings/js/JSHTMLSelectElementCustom.cpp +++ b/WebCore/bindings/js/JSHTMLSelectElementCustom.cpp @@ -32,16 +32,16 @@ namespace WebCore { using namespace JSC; using namespace HTMLNames; -JSValue JSHTMLSelectElement::remove(ExecState* exec, const ArgList& args) +JSValue JSHTMLSelectElement::remove(ExecState* exec) { HTMLSelectElement& select = *static_cast<HTMLSelectElement*>(impl()); // we support both options index and options objects - HTMLElement* element = toHTMLElement(args.at(0)); + HTMLElement* element = toHTMLElement(exec->argument(0)); if (element && element->hasTagName(optionTag)) select.remove(static_cast<HTMLOptionElement*>(element)->index()); else - select.remove(args.at(0).toInt32(exec)); + select.remove(exec->argument(0).toInt32(exec)); return jsUndefined(); } diff --git a/WebCore/bindings/js/JSHistoryCustom.cpp b/WebCore/bindings/js/JSHistoryCustom.cpp index 53b554f..6a2f614 100644 --- a/WebCore/bindings/js/JSHistoryCustom.cpp +++ b/WebCore/bindings/js/JSHistoryCustom.cpp @@ -162,19 +162,19 @@ void JSHistory::getOwnPropertyNames(ExecState* exec, PropertyNameArray& property Base::getOwnPropertyNames(exec, propertyNames, mode); } -JSValue JSHistory::pushState(ExecState* exec, const ArgList& args) +JSValue JSHistory::pushState(ExecState* exec) { - RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(exec, args.at(0)); + RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(exec, exec->argument(0)); if (exec->hadException()) return jsUndefined(); - String title = valueToStringWithUndefinedOrNullCheck(exec, args.at(1)); + String title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(1)); if (exec->hadException()) return jsUndefined(); String url; - if (args.size() > 2) { - url = valueToStringWithUndefinedOrNullCheck(exec, args.at(2)); + if (exec->argumentCount() > 2) { + url = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(2)); if (exec->hadException()) return jsUndefined(); } @@ -186,19 +186,19 @@ JSValue JSHistory::pushState(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSHistory::replaceState(ExecState* exec, const ArgList& args) +JSValue JSHistory::replaceState(ExecState* exec) { - RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(exec, args.at(0)); + RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(exec, exec->argument(0)); if (exec->hadException()) return jsUndefined(); - String title = valueToStringWithUndefinedOrNullCheck(exec, args.at(1)); + String title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(1)); if (exec->hadException()) return jsUndefined(); String url; - if (args.size() > 2) { - url = valueToStringWithUndefinedOrNullCheck(exec, args.at(2)); + if (exec->argumentCount() > 2) { + url = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(2)); if (exec->hadException()) return jsUndefined(); } diff --git a/WebCore/bindings/js/JSIDBAnyCustom.cpp b/WebCore/bindings/js/JSIDBAnyCustom.cpp index f7674b8..43a79a2 100644 --- a/WebCore/bindings/js/JSIDBAnyCustom.cpp +++ b/WebCore/bindings/js/JSIDBAnyCustom.cpp @@ -36,8 +36,12 @@ #include "IDBAny.h" #include "IDBDatabaseRequest.h" +#include "IDBIndexRequest.h" +#include "IDBObjectStoreRequest.h" #include "IndexedDatabaseRequest.h" #include "JSIDBDatabaseRequest.h" +#include "JSIDBIndexRequest.h" +#include "JSIDBObjectStoreRequest.h" #include "JSIndexedDatabaseRequest.h" #include "SerializedScriptValue.h" @@ -53,8 +57,14 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, IDBAny* idbAny) switch (idbAny->type()) { case IDBAny::UndefinedType: return jsUndefined(); + case IDBAny::NullType: + return jsNull(); case IDBAny::IDBDatabaseRequestType: return toJS(exec, globalObject, idbAny->idbDatabaseRequest()); + case IDBAny::IDBIndexRequestType: + return toJS(exec, globalObject, idbAny->idbIndexRequest()); + case IDBAny::IDBObjectStoreRequestType: + return toJS(exec, globalObject, idbAny->idbObjectStoreRequest()); case IDBAny::IndexedDatabaseRequestType: return toJS(exec, globalObject, idbAny->indexedDatabaseRequest()); case IDBAny::SerializedScriptValueType: diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp index df191b7..c13ea0c 100644 --- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp +++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp @@ -104,16 +104,16 @@ ScriptObject InjectedScriptHost::createInjectedScript(const String& source, Scri } #if ENABLE(DATABASE) -JSValue JSInjectedScriptHost::databaseForId(ExecState* exec, const ArgList& args) +JSValue JSInjectedScriptHost::databaseForId(ExecState* exec) { - if (args.size() < 1) + if (exec->argumentCount() < 1) return jsUndefined(); InspectorController* ic = impl()->inspectorController(); if (!ic) return jsUndefined(); - Database* database = impl()->databaseForId(args.at(0).toInt32(exec)); + Database* database = impl()->databaseForId(exec->argument(0).toInt32(exec)); if (!database) return jsUndefined(); return toJS(exec, database); @@ -121,7 +121,7 @@ JSValue JSInjectedScriptHost::databaseForId(ExecState* exec, const ArgList& args #endif #if ENABLE(JAVASCRIPT_DEBUGGER) -JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec, const ArgList&) +JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec) { JavaScriptCallFrame* callFrame = ScriptDebugServer::shared().currentCallFrame(); if (!callFrame || !callFrame->isValid()) @@ -132,12 +132,12 @@ JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec, const ArgList&) } #endif -JSValue JSInjectedScriptHost::nodeForId(ExecState* exec, const ArgList& args) +JSValue JSInjectedScriptHost::nodeForId(ExecState* exec) { - if (args.size() < 1) + if (exec->argumentCount() < 1) return jsUndefined(); - Node* node = impl()->nodeForId(args.at(0).toInt32(exec)); + Node* node = impl()->nodeForId(exec->argument(0).toInt32(exec)); if (!node) return jsUndefined(); @@ -149,27 +149,27 @@ JSValue JSInjectedScriptHost::nodeForId(ExecState* exec, const ArgList& args) return toJS(exec, node); } -JSValue JSInjectedScriptHost::pushNodePathToFrontend(ExecState* exec, const ArgList& args) +JSValue JSInjectedScriptHost::pushNodePathToFrontend(ExecState* exec) { - if (args.size() < 3) + if (exec->argumentCount() < 3) return jsUndefined(); - Node* node = toNode(args.at(0)); + Node* node = toNode(exec->argument(0)); if (!node) return jsUndefined(); - bool withChildren = args.at(1).toBoolean(exec); - bool selectInUI = args.at(2).toBoolean(exec); + bool withChildren = exec->argument(1).toBoolean(exec); + bool selectInUI = exec->argument(2).toBoolean(exec); return jsNumber(exec, impl()->pushNodePathToFrontend(node, withChildren, selectInUI)); } #if ENABLE(DATABASE) -JSValue JSInjectedScriptHost::selectDatabase(ExecState*, const ArgList& args) +JSValue JSInjectedScriptHost::selectDatabase(ExecState* exec) { - if (args.size() < 1) + if (exec->argumentCount() < 1) return jsUndefined(); - Database* database = toDatabase(args.at(0)); + Database* database = toDatabase(exec->argument(0)); if (database) impl()->selectDatabase(database); return jsUndefined(); @@ -177,34 +177,34 @@ JSValue JSInjectedScriptHost::selectDatabase(ExecState*, const ArgList& args) #endif #if ENABLE(DOM_STORAGE) -JSValue JSInjectedScriptHost::selectDOMStorage(ExecState*, const ArgList& args) +JSValue JSInjectedScriptHost::selectDOMStorage(ExecState* exec) { - if (args.size() < 1) + if (exec->argumentCount() < 1) return jsUndefined(); InspectorController* ic = impl()->inspectorController(); if (!ic) return jsUndefined(); - Storage* storage = toStorage(args.at(0)); + Storage* storage = toStorage(exec->argument(0)); if (storage) impl()->selectDOMStorage(storage); return jsUndefined(); } #endif -JSValue JSInjectedScriptHost::reportDidDispatchOnInjectedScript(ExecState* exec, const ArgList& args) +JSValue JSInjectedScriptHost::reportDidDispatchOnInjectedScript(ExecState* exec) { - if (args.size() < 3) + if (exec->argumentCount() < 3) return jsUndefined(); - if (!args.at(0).isInt32()) + if (!exec->argument(0).isInt32()) return jsUndefined(); - int callId = args.at(0).asInt32(); + int callId = exec->argument(0).asInt32(); - RefPtr<SerializedScriptValue> result(SerializedScriptValue::create(exec, args.at(1))); + RefPtr<SerializedScriptValue> result(SerializedScriptValue::create(exec, exec->argument(1))); bool isException; - if (!args.at(2).getBoolean(isException)) + if (!exec->argument(2).getBoolean(isException)) return jsUndefined(); impl()->reportDidDispatchOnInjectedScript(callId, result.get(), isException); return jsUndefined(); diff --git a/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp b/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp index d18260b..c119adf 100644 --- a/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp +++ b/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp @@ -49,7 +49,7 @@ using namespace JSC; namespace WebCore { -JSValue JSInspectorFrontendHost::platform(ExecState* execState, const ArgList&) +JSValue JSInspectorFrontendHost::platform(ExecState* execState) { #if PLATFORM(MAC) DEFINE_STATIC_LOCAL(const String, platform, ("mac")); @@ -63,7 +63,7 @@ JSValue JSInspectorFrontendHost::platform(ExecState* execState, const ArgList&) return jsString(execState, platform); } -JSValue JSInspectorFrontendHost::port(ExecState* execState, const ArgList&) +JSValue JSInspectorFrontendHost::port(ExecState* execState) { #if PLATFORM(QT) DEFINE_STATIC_LOCAL(const String, port, ("qt")); @@ -77,31 +77,29 @@ JSValue JSInspectorFrontendHost::port(ExecState* execState, const ArgList&) return jsString(execState, port); } -JSValue JSInspectorFrontendHost::showContextMenu(ExecState* execState, const ArgList& args) +JSValue JSInspectorFrontendHost::showContextMenu(ExecState* exec) { - if (args.size() < 2) + if (exec->argumentCount() < 2) return jsUndefined(); #if ENABLE(CONTEXT_MENUS) - Event* event = toEvent(args.at(0)); + Event* event = toEvent(exec->argument(0)); - JSArray* array = asArray(args.at(1)); + JSArray* array = asArray(exec->argument(1)); Vector<ContextMenuItem*> items; for (size_t i = 0; i < array->length(); ++i) { JSObject* item = asObject(array->getIndex(i)); - JSValue label = item->get(execState, Identifier(execState, "label")); - JSValue id = item->get(execState, Identifier(execState, "id")); + JSValue label = item->get(exec, Identifier(exec, "label")); + JSValue id = item->get(exec, Identifier(exec, "id")); if (label.isUndefined() || id.isUndefined()) items.append(new ContextMenuItem(SeparatorType, ContextMenuItemTagNoAction, String())); else { - ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(execState)); - items.append(new ContextMenuItem(ActionType, typedId, ustringToString(label.toString(execState)))); + ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(exec)); + items.append(new ContextMenuItem(ActionType, typedId, ustringToString(label.toString(exec)))); } } impl()->showContextMenu(event, items); -#else - UNUSED_PARAM(execState); #endif return jsUndefined(); } diff --git a/WebCore/bindings/js/JSInt16ArrayCustom.cpp b/WebCore/bindings/js/JSInt16ArrayCustom.cpp index d557c3d..2888a1b 100644 --- a/WebCore/bindings/js/JSInt16ArrayCustom.cpp +++ b/WebCore/bindings/js/JSInt16ArrayCustom.cpp @@ -46,9 +46,9 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Int16Ar return getDOMObjectWrapper<JSInt16Array>(exec, globalObject, object); } -JSC::JSValue JSInt16Array::set(JSC::ExecState* exec, JSC::ArgList const& args) +JSC::JSValue JSInt16Array::set(JSC::ExecState* exec) { - return setWebGLArrayHelper(exec, impl(), args, toInt16Array); + return setWebGLArrayHelper(exec, impl(), toInt16Array); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSInt32ArrayCustom.cpp b/WebCore/bindings/js/JSInt32ArrayCustom.cpp index 3d0ca79..cfdab63 100644 --- a/WebCore/bindings/js/JSInt32ArrayCustom.cpp +++ b/WebCore/bindings/js/JSInt32ArrayCustom.cpp @@ -46,9 +46,9 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Int32Ar return getDOMObjectWrapper<JSInt32Array>(exec, globalObject, object); } -JSC::JSValue JSInt32Array::set(JSC::ExecState* exec, JSC::ArgList const& args) +JSC::JSValue JSInt32Array::set(JSC::ExecState* exec) { - return setWebGLArrayHelper(exec, impl(), args, toInt32Array); + return setWebGLArrayHelper(exec, impl(), toInt32Array); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSInt8ArrayCustom.cpp b/WebCore/bindings/js/JSInt8ArrayCustom.cpp index 3c94002..9d41694 100644 --- a/WebCore/bindings/js/JSInt8ArrayCustom.cpp +++ b/WebCore/bindings/js/JSInt8ArrayCustom.cpp @@ -48,9 +48,9 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Int8Arr return getDOMObjectWrapper<JSInt8Array>(exec, globalObject, object); } -JSC::JSValue JSInt8Array::set(JSC::ExecState* exec, JSC::ArgList const& args) +JSC::JSValue JSInt8Array::set(JSC::ExecState* exec) { - return setWebGLArrayHelper(exec, impl(), args, toInt8Array); + return setWebGLArrayHelper(exec, impl(), toInt8Array); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp b/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp index f45abf6..6c04930 100644 --- a/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp +++ b/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp @@ -35,10 +35,10 @@ using namespace JSC; namespace WebCore { -JSValue JSJavaScriptCallFrame::evaluate(ExecState* exec, const ArgList& args) +JSValue JSJavaScriptCallFrame::evaluate(ExecState* exec) { JSValue exception; - JSValue result = impl()->evaluate(args.at(0).toString(exec), exception); + JSValue result = impl()->evaluate(exec->argument(0).toString(exec), exception); if (exception) exec->setException(exception); @@ -85,14 +85,14 @@ JSValue JSJavaScriptCallFrame::scopeChain(ExecState* exec) const return constructArray(exec, list); } -JSValue JSJavaScriptCallFrame::scopeType(ExecState* exec, const ArgList& args) +JSValue JSJavaScriptCallFrame::scopeType(ExecState* exec) { if (!impl()->scopeChain()) return jsUndefined(); - if (!args.at(0).isInt32()) + if (!exec->argument(0).isInt32()) return jsUndefined(); - int index = args.at(0).asInt32(); + int index = exec->argument(0).asInt32(); const ScopeChainNode* scopeChain = impl()->scopeChain(); ScopeChainIterator end = scopeChain->end(); diff --git a/WebCore/bindings/js/JSLocationCustom.cpp b/WebCore/bindings/js/JSLocationCustom.cpp index da35c23..76005fa 100644 --- a/WebCore/bindings/js/JSLocationCustom.cpp +++ b/WebCore/bindings/js/JSLocationCustom.cpp @@ -301,13 +301,13 @@ void JSLocation::setHash(ExecState* exec, JSValue value) navigateIfAllowed(exec, frame, url, !frame->script()->anyPageIsProcessingUserGesture(), false); } -JSValue JSLocation::replace(ExecState* exec, const ArgList& args) +JSValue JSLocation::replace(ExecState* exec) { Frame* frame = impl()->frame(); if (!frame) return jsUndefined(); - KURL url = completeURL(exec, ustringToString(args.at(0).toString(exec))); + KURL url = completeURL(exec, ustringToString(exec->argument(0).toString(exec))); if (url.isNull()) return jsUndefined(); @@ -318,7 +318,7 @@ JSValue JSLocation::replace(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSLocation::reload(ExecState* exec, const ArgList&) +JSValue JSLocation::reload(ExecState* exec) { Frame* frame = impl()->frame(); if (!frame || !allowsAccessFromFrame(exec, frame)) @@ -329,13 +329,13 @@ JSValue JSLocation::reload(ExecState* exec, const ArgList&) return jsUndefined(); } -JSValue JSLocation::assign(ExecState* exec, const ArgList& args) +JSValue JSLocation::assign(ExecState* exec) { Frame* frame = impl()->frame(); if (!frame) return jsUndefined(); - KURL url = completeURL(exec, ustringToString(args.at(0).toString(exec))); + KURL url = completeURL(exec, ustringToString(exec->argument(0).toString(exec))); if (url.isNull()) return jsUndefined(); @@ -347,7 +347,7 @@ JSValue JSLocation::assign(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSLocation::toString(ExecState* exec, const ArgList&) +JSValue JSLocation::toString(ExecState* exec) { Frame* frame = impl()->frame(); if (!frame || !allowsAccessFromFrame(exec, frame)) diff --git a/WebCore/bindings/js/JSMessageEventCustom.cpp b/WebCore/bindings/js/JSMessageEventCustom.cpp index fc1f542..b3dabae 100644 --- a/WebCore/bindings/js/JSMessageEventCustom.cpp +++ b/WebCore/bindings/js/JSMessageEventCustom.cpp @@ -54,19 +54,19 @@ JSValue JSMessageEvent::ports(ExecState* exec) const return constructArray(exec, list); } -JSC::JSValue JSMessageEvent::initMessageEvent(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSMessageEvent::initMessageEvent(JSC::ExecState* exec) { - const UString& typeArg = args.at(0).toString(exec); - bool canBubbleArg = args.at(1).toBoolean(exec); - bool cancelableArg = args.at(2).toBoolean(exec); - PassRefPtr<SerializedScriptValue> dataArg = SerializedScriptValue::create(exec, args.at(3)); - const UString& originArg = args.at(4).toString(exec); - const UString& lastEventIdArg = args.at(5).toString(exec); - DOMWindow* sourceArg = toDOMWindow(args.at(6)); + const UString& typeArg = exec->argument(0).toString(exec); + bool canBubbleArg = exec->argument(1).toBoolean(exec); + bool cancelableArg = exec->argument(2).toBoolean(exec); + PassRefPtr<SerializedScriptValue> dataArg = SerializedScriptValue::create(exec, exec->argument(3)); + const UString& originArg = exec->argument(4).toString(exec); + const UString& lastEventIdArg = exec->argument(5).toString(exec); + DOMWindow* sourceArg = toDOMWindow(exec->argument(6)); OwnPtr<MessagePortArray> messagePorts; - if (!args.at(7).isUndefinedOrNull()) { + if (!exec->argument(7).isUndefinedOrNull()) { messagePorts = new MessagePortArray(); - fillMessagePortArray(exec, args.at(7), *messagePorts); + fillMessagePortArray(exec, exec->argument(7), *messagePorts); if (exec->hadException()) return jsUndefined(); } diff --git a/WebCore/bindings/js/JSMessagePortCustom.cpp b/WebCore/bindings/js/JSMessagePortCustom.cpp index 4c1491d..79c1811 100644 --- a/WebCore/bindings/js/JSMessagePortCustom.cpp +++ b/WebCore/bindings/js/JSMessagePortCustom.cpp @@ -52,9 +52,9 @@ void JSMessagePort::markChildren(MarkStack& markStack) m_impl->markJSEventListeners(markStack); } -JSC::JSValue JSMessagePort::postMessage(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSMessagePort::postMessage(JSC::ExecState* exec) { - return handlePostMessage(exec, args, impl()); + return handlePostMessage(exec, impl()); } void fillMessagePortArray(JSC::ExecState* exec, JSC::JSValue value, MessagePortArray& portArray) diff --git a/WebCore/bindings/js/JSMessagePortCustom.h b/WebCore/bindings/js/JSMessagePortCustom.h index 17b1eae..62ebef1 100644 --- a/WebCore/bindings/js/JSMessagePortCustom.h +++ b/WebCore/bindings/js/JSMessagePortCustom.h @@ -47,11 +47,11 @@ namespace WebCore { // Helper function to convert from JS postMessage arguments to WebCore postMessage arguments. template <typename T> - inline JSC::JSValue handlePostMessage(JSC::ExecState* exec, const JSC::ArgList& args, T* impl) + inline JSC::JSValue handlePostMessage(JSC::ExecState* exec, T* impl) { - PassRefPtr<SerializedScriptValue> message = SerializedScriptValue::create(exec, args.at(0)); + PassRefPtr<SerializedScriptValue> message = SerializedScriptValue::create(exec, exec->argument(0)); MessagePortArray portArray; - fillMessagePortArray(exec, args.at(1), portArray); + fillMessagePortArray(exec, exec->argument(1), portArray); if (exec->hadException()) return JSC::jsUndefined(); diff --git a/WebCore/bindings/js/JSNodeCustom.cpp b/WebCore/bindings/js/JSNodeCustom.cpp index 747f238..b7c50f2 100644 --- a/WebCore/bindings/js/JSNodeCustom.cpp +++ b/WebCore/bindings/js/JSNodeCustom.cpp @@ -68,47 +68,47 @@ using namespace JSC; namespace WebCore { -JSValue JSNode::insertBefore(ExecState* exec, const ArgList& args) +JSValue JSNode::insertBefore(ExecState* exec) { Node* imp = static_cast<Node*>(impl()); ExceptionCode ec = 0; - bool ok = imp->insertBefore(toNode(args.at(0)), toNode(args.at(1)), ec, true); + bool ok = imp->insertBefore(toNode(exec->argument(0)), toNode(exec->argument(1)), ec, true); setDOMException(exec, ec); if (ok) - return args.at(0); + return exec->argument(0); return jsNull(); } -JSValue JSNode::replaceChild(ExecState* exec, const ArgList& args) +JSValue JSNode::replaceChild(ExecState* exec) { Node* imp = static_cast<Node*>(impl()); ExceptionCode ec = 0; - bool ok = imp->replaceChild(toNode(args.at(0)), toNode(args.at(1)), ec, true); + bool ok = imp->replaceChild(toNode(exec->argument(0)), toNode(exec->argument(1)), ec, true); setDOMException(exec, ec); if (ok) - return args.at(1); + return exec->argument(1); return jsNull(); } -JSValue JSNode::removeChild(ExecState* exec, const ArgList& args) +JSValue JSNode::removeChild(ExecState* exec) { Node* imp = static_cast<Node*>(impl()); ExceptionCode ec = 0; - bool ok = imp->removeChild(toNode(args.at(0)), ec); + bool ok = imp->removeChild(toNode(exec->argument(0)), ec); setDOMException(exec, ec); if (ok) - return args.at(0); + return exec->argument(0); return jsNull(); } -JSValue JSNode::appendChild(ExecState* exec, const ArgList& args) +JSValue JSNode::appendChild(ExecState* exec) { Node* imp = static_cast<Node*>(impl()); ExceptionCode ec = 0; - bool ok = imp->appendChild(toNode(args.at(0)), ec, true); + bool ok = imp->appendChild(toNode(exec->argument(0)), ec, true); setDOMException(exec, ec); if (ok) - return args.at(0); + return exec->argument(0); return jsNull(); } diff --git a/WebCore/bindings/js/JSNodeListCustom.cpp b/WebCore/bindings/js/JSNodeListCustom.cpp index d013e4f..6d51943 100644 --- a/WebCore/bindings/js/JSNodeListCustom.cpp +++ b/WebCore/bindings/js/JSNodeListCustom.cpp @@ -36,13 +36,13 @@ using namespace JSC; namespace WebCore { // Need to support call so that list(0) works. -static JSValue JSC_HOST_CALL callNodeList(ExecState* exec, JSObject* function, JSValue, const ArgList& args) +static JSValue JSC_HOST_CALL callNodeList(ExecState* exec) { bool ok; - unsigned index = args.at(0).toString(exec).toUInt32(&ok); + unsigned index = exec->argument(0).toString(exec).toUInt32(&ok); if (!ok) return jsUndefined(); - return toJS(exec, static_cast<JSNodeList*>(function)->impl()->item(index)); + return toJS(exec, static_cast<JSNodeList*>(exec->callee())->impl()->item(index)); } CallType JSNodeList::getCallData(CallData& callData) diff --git a/WebCore/bindings/js/JSPluginElementFunctions.cpp b/WebCore/bindings/js/JSPluginElementFunctions.cpp index b20b9a7..a260782 100644 --- a/WebCore/bindings/js/JSPluginElementFunctions.cpp +++ b/WebCore/bindings/js/JSPluginElementFunctions.cpp @@ -105,11 +105,11 @@ bool runtimeObjectCustomPut(ExecState* exec, const Identifier& propertyName, JSV return true; } -static JSValue JSC_HOST_CALL callPlugin(ExecState* exec, JSObject* function, JSValue, const ArgList& args) +static JSValue JSC_HOST_CALL callPlugin(ExecState* exec) { - Instance* instance = pluginInstance(static_cast<JSHTMLElement*>(function)->impl()); + Instance* instance = pluginInstance(static_cast<JSHTMLElement*>(exec->callee())->impl()); instance->begin(); - JSValue result = instance->invokeDefaultMethod(exec, args); + JSValue result = instance->invokeDefaultMethod(exec); instance->end(); return result; } diff --git a/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp b/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp index 0039a05..2a504d3 100644 --- a/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp +++ b/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp @@ -39,10 +39,10 @@ using namespace JSC; namespace WebCore { -JSValue JSSQLResultSetRowList::item(ExecState* exec, const ArgList& args) +JSValue JSSQLResultSetRowList::item(ExecState* exec) { bool indexOk; - int index = args.at(0).toInt32(exec, indexOk); + int index = exec->argument(0).toInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); diff --git a/WebCore/bindings/js/JSSQLTransactionCustom.cpp b/WebCore/bindings/js/JSSQLTransactionCustom.cpp index 13cc0bc..44ebb02 100644 --- a/WebCore/bindings/js/JSSQLTransactionCustom.cpp +++ b/WebCore/bindings/js/JSSQLTransactionCustom.cpp @@ -42,21 +42,21 @@ using namespace JSC; namespace WebCore { -JSValue JSSQLTransaction::executeSql(ExecState* exec, const ArgList& args) +JSValue JSSQLTransaction::executeSql(ExecState* exec) { - if (args.isEmpty()) { + if (!exec->argumentCount()) { setDOMException(exec, SYNTAX_ERR); return jsUndefined(); } - String sqlStatement = ustringToString(args.at(0).toString(exec)); + String sqlStatement = ustringToString(exec->argument(0).toString(exec)); if (exec->hadException()) return jsUndefined(); // Now assemble the list of SQL arguments Vector<SQLValue> sqlValues; - if (!args.at(1).isUndefinedOrNull()) { - JSObject* object = args.at(1).getObject(); + if (!exec->argument(1).isUndefinedOrNull()) { + JSObject* object = exec->argument(1).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -88,8 +88,8 @@ JSValue JSSQLTransaction::executeSql(ExecState* exec, const ArgList& args) } RefPtr<SQLStatementCallback> callback; - if (!args.at(2).isUndefinedOrNull()) { - JSObject* object = args.at(2).getObject(); + if (!exec->argument(2).isUndefinedOrNull()) { + JSObject* object = exec->argument(2).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -99,8 +99,8 @@ JSValue JSSQLTransaction::executeSql(ExecState* exec, const ArgList& args) } RefPtr<SQLStatementErrorCallback> errorCallback; - if (!args.at(3).isUndefinedOrNull()) { - JSObject* object = args.at(3).getObject(); + if (!exec->argument(3).isUndefinedOrNull()) { + JSObject* object = exec->argument(3).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); diff --git a/WebCore/bindings/js/JSSQLTransactionSyncCustom.cpp b/WebCore/bindings/js/JSSQLTransactionSyncCustom.cpp index 69fc6cf..08f42e8 100644 --- a/WebCore/bindings/js/JSSQLTransactionSyncCustom.cpp +++ b/WebCore/bindings/js/JSSQLTransactionSyncCustom.cpp @@ -41,21 +41,21 @@ using namespace JSC; namespace WebCore { -JSValue JSSQLTransactionSync::executeSql(ExecState* exec, const ArgList& args) +JSValue JSSQLTransactionSync::executeSql(ExecState* exec) { - if (args.isEmpty()) { + if (!exec->argumentCount()) { setDOMException(exec, SYNTAX_ERR); return jsUndefined(); } - String sqlStatement = ustringToString(args.at(0).toString(exec)); + String sqlStatement = ustringToString(exec->argument(0).toString(exec)); if (exec->hadException()) return jsUndefined(); // Now assemble the list of SQL arguments Vector<SQLValue> sqlValues; - if (!args.at(1).isUndefinedOrNull()) { - JSObject* object = args.at(1).getObject(); + if (!exec->argument(1).isUndefinedOrNull()) { + JSObject* object = exec->argument(1).getObject(); if (!object) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); diff --git a/WebCore/bindings/js/JSSVGLengthCustom.cpp b/WebCore/bindings/js/JSSVGLengthCustom.cpp index 33bbf30..c7cfdb0 100644 --- a/WebCore/bindings/js/JSSVGLengthCustom.cpp +++ b/WebCore/bindings/js/JSSVGLengthCustom.cpp @@ -35,13 +35,13 @@ JSValue JSSVGLength::value(ExecState* exec) const return jsNumber(exec, podImp.value(context)); } -JSValue JSSVGLength::convertToSpecifiedUnits(ExecState* exec, const ArgList& args) +JSValue JSSVGLength::convertToSpecifiedUnits(ExecState* exec) { JSSVGPODTypeWrapper<SVGLength>* imp = impl(); SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this); SVGLength podImp(*imp); - podImp.convertToSpecifiedUnits(args.at(0).toInt32(exec), context); + podImp.convertToSpecifiedUnits(exec->argument(0).toInt32(exec), context); imp->commitChange(podImp, this); return jsUndefined(); diff --git a/WebCore/bindings/js/JSSVGMatrixCustom.cpp b/WebCore/bindings/js/JSSVGMatrixCustom.cpp index 59e3f03..149da8a 100644 --- a/WebCore/bindings/js/JSSVGMatrixCustom.cpp +++ b/WebCore/bindings/js/JSSVGMatrixCustom.cpp @@ -31,15 +31,15 @@ using namespace JSC; namespace WebCore { -JSValue JSSVGMatrix::multiply(ExecState* exec, const ArgList& args) +JSValue JSSVGMatrix::multiply(ExecState* exec) { - if (args.size() < 1) + if (exec->argumentCount() < 1) return throwError(exec, SyntaxError, "Not enough arguments"); - if (!args.at(0).inherits(&JSSVGMatrix::s_info)) + if (!exec->argument(0).inherits(&JSSVGMatrix::s_info)) return throwError(exec, TypeError, "secondMatrix argument was not a SVGMatrix"); - JSSVGMatrix* matrixObj = static_cast<JSSVGMatrix*>(asObject(args.at(0))); + JSSVGMatrix* matrixObj = static_cast<JSSVGMatrix*>(asObject(exec->argument(0))); AffineTransform m1(*impl()); AffineTransform m2(*(matrixObj->impl())); @@ -48,7 +48,7 @@ JSValue JSSVGMatrix::multiply(ExecState* exec, const ArgList& args) return toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<AffineTransform>::create(m1.multLeft(m2)).get(), context); } -JSValue JSSVGMatrix::inverse(ExecState* exec, const ArgList&) +JSValue JSSVGMatrix::inverse(ExecState* exec) { AffineTransform imp(*impl()); @@ -61,12 +61,12 @@ JSValue JSSVGMatrix::inverse(ExecState* exec, const ArgList&) return result; } -JSValue JSSVGMatrix::rotateFromVector(ExecState* exec, const ArgList& args) +JSValue JSSVGMatrix::rotateFromVector(ExecState* exec) { AffineTransform imp(*impl()); - float x = args.at(0).toFloat(exec); - float y = args.at(1).toFloat(exec); + float x = exec->argument(0).toFloat(exec); + float y = exec->argument(1).toFloat(exec); SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this); JSValue result = toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<AffineTransform>::create(imp.rotateFromVector(x, y)).get(), context); diff --git a/WebCore/bindings/js/JSSVGPODListCustom.h b/WebCore/bindings/js/JSSVGPODListCustom.h index 8a0654c..9db5618 100644 --- a/WebCore/bindings/js/JSSVGPODListCustom.h +++ b/WebCore/bindings/js/JSSVGPODListCustom.h @@ -89,7 +89,7 @@ static JSC::JSValue finishSetterReadOnlyResult(JSC::ExecState* exec, ExceptionCo } template<typename JSPODListType, typename PODType> -static JSC::JSValue clear(JSPODListType* wrapper, JSC::ExecState* exec, const JSC::ArgList&, +static JSC::JSValue clear(JSPODListType* wrapper, JSC::ExecState* exec, typename JSSVGPODListTraits<PODType>::ConversionCallback) { ExceptionCode ec = 0; @@ -105,21 +105,21 @@ static JSC::JSValue clear(JSPODListType* wrapper, JSC::ExecState* exec, const JS } template<typename JSPODListType, typename PODType> -static JSC::JSValue initialize(JSPODListType* wrapper, JSC::ExecState* exec, const JSC::ArgList& args, +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(args.at(0))), ec)); + 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, const JSC::ArgList& args, +static JSC::JSValue getItem(JSPODListType* wrapper, JSC::ExecState* exec, typename JSSVGPODListTraits<PODType>::ConversionCallback) { bool indexOk = false; - unsigned index = args.at(0).toUInt32(exec, indexOk); + unsigned index = exec->argument(0).toUInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return JSC::jsUndefined(); @@ -132,11 +132,11 @@ static JSC::JSValue getItem(JSPODListType* wrapper, JSC::ExecState* exec, const } template<typename JSPODListType, typename PODType> -static JSC::JSValue insertItemBefore(JSPODListType* wrapper, JSC::ExecState* exec, const JSC::ArgList& args, +static JSC::JSValue insertItemBefore(JSPODListType* wrapper, JSC::ExecState* exec, typename JSSVGPODListTraits<PODType>::ConversionCallback conversion) { bool indexOk = false; - unsigned index = args.at(1).toUInt32(exec, indexOk); + unsigned index = exec->argument(1).toUInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return JSC::jsUndefined(); @@ -145,15 +145,15 @@ static JSC::JSValue insertItemBefore(JSPODListType* wrapper, JSC::ExecState* exe ExceptionCode ec = 0; typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl(); return finishSetter<JSPODListType, PODType>(exec, ec, wrapper, - listImp->insertItemBefore(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(args.at(0))), index, ec)); + 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, const JSC::ArgList& args, +static JSC::JSValue replaceItem(JSPODListType* wrapper, JSC::ExecState* exec, typename JSSVGPODListTraits<PODType>::ConversionCallback conversion) { bool indexOk = false; - unsigned index = args.at(1).toUInt32(exec, indexOk); + unsigned index = exec->argument(1).toUInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return JSC::jsUndefined(); @@ -162,15 +162,15 @@ static JSC::JSValue replaceItem(JSPODListType* wrapper, JSC::ExecState* exec, co ExceptionCode ec = 0; typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl(); return finishSetter<JSPODListType, PODType>(exec, ec, wrapper, - listImp->replaceItem(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(args.at(0))), index, ec)); + 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, const JSC::ArgList& args, +static JSC::JSValue removeItem(JSPODListType* wrapper, JSC::ExecState* exec, typename JSSVGPODListTraits<PODType>::ConversionCallback) { bool indexOk = false; - unsigned index = args.at(0).toUInt32(exec, indexOk); + unsigned index = exec->argument(0).toUInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return JSC::jsUndefined(); @@ -183,13 +183,13 @@ static JSC::JSValue removeItem(JSPODListType* wrapper, JSC::ExecState* exec, con } template<typename JSPODListType, typename PODType> -static JSC::JSValue appendItem(JSPODListType* wrapper, JSC::ExecState* exec, const JSC::ArgList& args, +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(args.at(0))), ec)); + listImp->appendItem(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(exec->argument(0))), ec)); } } diff --git a/WebCore/bindings/js/JSSVGPathSegListCustom.cpp b/WebCore/bindings/js/JSSVGPathSegListCustom.cpp index 4831727..850e533 100644 --- a/WebCore/bindings/js/JSSVGPathSegListCustom.cpp +++ b/WebCore/bindings/js/JSSVGPathSegListCustom.cpp @@ -36,7 +36,7 @@ using namespace JSC; namespace WebCore { -JSValue JSSVGPathSegList::clear(ExecState* exec, const ArgList&) +JSValue JSSVGPathSegList::clear(ExecState* exec) { ExceptionCode ec = 0; @@ -49,10 +49,10 @@ JSValue JSSVGPathSegList::clear(ExecState* exec, const ArgList&) return jsUndefined(); } -JSValue JSSVGPathSegList::initialize(ExecState* exec, const ArgList& args) +JSValue JSSVGPathSegList::initialize(ExecState* exec) { ExceptionCode ec = 0; - SVGPathSeg* newItem = toSVGPathSeg(args.at(0)); + SVGPathSeg* newItem = toSVGPathSeg(exec->argument(0)); SVGPathSegList* list = impl(); @@ -66,12 +66,12 @@ JSValue JSSVGPathSegList::initialize(ExecState* exec, const ArgList& args) return result; } -JSValue JSSVGPathSegList::getItem(ExecState* exec, const ArgList& args) +JSValue JSSVGPathSegList::getItem(ExecState* exec) { ExceptionCode ec = 0; bool indexOk; - unsigned index = args.at(0).toInt32(exec, indexOk); + unsigned index = exec->argument(0).toInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -86,13 +86,13 @@ JSValue JSSVGPathSegList::getItem(ExecState* exec, const ArgList& args) return result; } -JSValue JSSVGPathSegList::insertItemBefore(ExecState* exec, const ArgList& args) +JSValue JSSVGPathSegList::insertItemBefore(ExecState* exec) { ExceptionCode ec = 0; - SVGPathSeg* newItem = toSVGPathSeg(args.at(0)); + SVGPathSeg* newItem = toSVGPathSeg(exec->argument(0)); bool indexOk; - unsigned index = args.at(1).toInt32(exec, indexOk); + unsigned index = exec->argument(1).toInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -108,13 +108,13 @@ JSValue JSSVGPathSegList::insertItemBefore(ExecState* exec, const ArgList& args) return result; } -JSValue JSSVGPathSegList::replaceItem(ExecState* exec, const ArgList& args) +JSValue JSSVGPathSegList::replaceItem(ExecState* exec) { ExceptionCode ec = 0; - SVGPathSeg* newItem = toSVGPathSeg(args.at(0)); + SVGPathSeg* newItem = toSVGPathSeg(exec->argument(0)); bool indexOk; - unsigned index = args.at(1).toInt32(exec, indexOk); + unsigned index = exec->argument(1).toInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -130,12 +130,12 @@ JSValue JSSVGPathSegList::replaceItem(ExecState* exec, const ArgList& args) return result; } -JSValue JSSVGPathSegList::removeItem(ExecState* exec, const ArgList& args) +JSValue JSSVGPathSegList::removeItem(ExecState* exec) { ExceptionCode ec = 0; bool indexOk; - unsigned index = args.at(0).toInt32(exec, indexOk); + unsigned index = exec->argument(0).toInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); @@ -153,10 +153,10 @@ JSValue JSSVGPathSegList::removeItem(ExecState* exec, const ArgList& args) return result; } -JSValue JSSVGPathSegList::appendItem(ExecState* exec, const ArgList& args) +JSValue JSSVGPathSegList::appendItem(ExecState* exec) { ExceptionCode ec = 0; - SVGPathSeg* newItem = toSVGPathSeg(args.at(0)); + SVGPathSeg* newItem = toSVGPathSeg(exec->argument(0)); SVGPathSegList* list = impl(); SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this); diff --git a/WebCore/bindings/js/JSUint16ArrayCustom.cpp b/WebCore/bindings/js/JSUint16ArrayCustom.cpp index bac5220..4eb254f 100644 --- a/WebCore/bindings/js/JSUint16ArrayCustom.cpp +++ b/WebCore/bindings/js/JSUint16ArrayCustom.cpp @@ -46,9 +46,9 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Uint16A return getDOMObjectWrapper<JSUint16Array>(exec, globalObject, object); } -JSC::JSValue JSUint16Array::set(JSC::ExecState* exec, JSC::ArgList const& args) +JSC::JSValue JSUint16Array::set(JSC::ExecState* exec) { - return setWebGLArrayHelper(exec, impl(), args, toUint16Array); + return setWebGLArrayHelper(exec, impl(), toUint16Array); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSUint32ArrayCustom.cpp b/WebCore/bindings/js/JSUint32ArrayCustom.cpp index 926079d..2826b6a 100644 --- a/WebCore/bindings/js/JSUint32ArrayCustom.cpp +++ b/WebCore/bindings/js/JSUint32ArrayCustom.cpp @@ -46,9 +46,9 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Uint32A return getDOMObjectWrapper<JSUint32Array>(exec, globalObject, object); } -JSC::JSValue JSUint32Array::set(JSC::ExecState* exec, JSC::ArgList const& args) +JSC::JSValue JSUint32Array::set(JSC::ExecState* exec) { - return setWebGLArrayHelper(exec, impl(), args, toUint32Array); + return setWebGLArrayHelper(exec, impl(), toUint32Array); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSUint8ArrayCustom.cpp b/WebCore/bindings/js/JSUint8ArrayCustom.cpp index 40bfda3..45c80c0 100644 --- a/WebCore/bindings/js/JSUint8ArrayCustom.cpp +++ b/WebCore/bindings/js/JSUint8ArrayCustom.cpp @@ -46,9 +46,9 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Uint8Ar return getDOMObjectWrapper<JSUint8Array>(exec, globalObject, object); } -JSC::JSValue JSUint8Array::set(JSC::ExecState* exec, JSC::ArgList const& args) +JSC::JSValue JSUint8Array::set(JSC::ExecState* exec) { - return setWebGLArrayHelper(exec, impl(), args, toUint8Array); + return setWebGLArrayHelper(exec, impl(), toUint8Array); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp index c938aec..02dae08 100644 --- a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp +++ b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp @@ -67,21 +67,21 @@ using namespace JSC; namespace WebCore { -JSValue JSWebGLRenderingContext::bufferData(JSC::ExecState* exec, JSC::ArgList const& args) +JSValue JSWebGLRenderingContext::bufferData(JSC::ExecState* exec) { - if (args.size() != 3) + if (exec->argumentCount() != 3) return throwError(exec, SyntaxError); - unsigned target = args.at(0).toInt32(exec); - unsigned usage = args.at(2).toInt32(exec); + unsigned target = exec->argument(0).toInt32(exec); + unsigned usage = exec->argument(2).toInt32(exec); ExceptionCode ec = 0; // If argument 1 is a number, we are initializing this buffer to that size - if (!args.at(1).isObject()) { - unsigned int count = args.at(1).toInt32(exec); + if (!exec->argument(1).isObject()) { + unsigned int count = exec->argument(1).toInt32(exec); static_cast<WebGLRenderingContext*>(impl())->bufferData(target, count, usage, ec); } else { - ArrayBufferView* array = toArrayBufferView(args.at(1)); + ArrayBufferView* array = toArrayBufferView(exec->argument(1)); static_cast<WebGLRenderingContext*>(impl())->bufferData(target, array, usage, ec); } @@ -89,16 +89,16 @@ JSValue JSWebGLRenderingContext::bufferData(JSC::ExecState* exec, JSC::ArgList c return jsUndefined(); } -JSValue JSWebGLRenderingContext::bufferSubData(JSC::ExecState* exec, JSC::ArgList const& args) +JSValue JSWebGLRenderingContext::bufferSubData(JSC::ExecState* exec) { - if (args.size() != 3) + if (exec->argumentCount() != 3) return throwError(exec, SyntaxError); - unsigned target = args.at(0).toInt32(exec); - unsigned offset = args.at(1).toInt32(exec); + unsigned target = exec->argument(0).toInt32(exec); + unsigned offset = exec->argument(1).toInt32(exec); ExceptionCode ec = 0; - ArrayBufferView* array = toArrayBufferView(args.at(2)); + ArrayBufferView* array = toArrayBufferView(exec->argument(2)); static_cast<WebGLRenderingContext*>(impl())->bufferSubData(target, offset, array, ec); @@ -149,17 +149,17 @@ enum ObjectType { kBuffer, kRenderbuffer, kTexture, kVertexAttrib }; -static JSValue getObjectParameter(JSWebGLRenderingContext* obj, ExecState* exec, const ArgList& args, ObjectType objectType) +static JSValue getObjectParameter(JSWebGLRenderingContext* obj, ExecState* exec, ObjectType objectType) { - if (args.size() != 2) + if (exec->argumentCount() != 2) return throwError(exec, SyntaxError); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(obj->impl()); - unsigned target = args.at(0).toInt32(exec); + unsigned target = exec->argument(0).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned pname = args.at(1).toInt32(exec); + unsigned pname = exec->argument(1).toInt32(exec); if (exec->hadException()) return jsUndefined(); WebGLGetInfo info; @@ -192,25 +192,25 @@ enum WhichProgramCall { kProgramParameter, kUniform }; -JSValue JSWebGLRenderingContext::getBufferParameter(ExecState* exec, const ArgList& args) +JSValue JSWebGLRenderingContext::getBufferParameter(ExecState* exec) { - return getObjectParameter(this, exec, args, kBuffer); + return getObjectParameter(this, exec, kBuffer); } -JSValue JSWebGLRenderingContext::getFramebufferAttachmentParameter(ExecState* exec, const ArgList& args) +JSValue JSWebGLRenderingContext::getFramebufferAttachmentParameter(ExecState* exec) { - if (args.size() != 3) + if (exec->argumentCount() != 3) return throwError(exec, SyntaxError); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); - unsigned target = args.at(0).toInt32(exec); + unsigned target = exec->argument(0).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned attachment = args.at(1).toInt32(exec); + unsigned attachment = exec->argument(1).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned pname = args.at(2).toInt32(exec); + unsigned pname = exec->argument(2).toInt32(exec); if (exec->hadException()) return jsUndefined(); WebGLGetInfo info = context->getFramebufferAttachmentParameter(target, attachment, pname, ec); @@ -221,14 +221,14 @@ JSValue JSWebGLRenderingContext::getFramebufferAttachmentParameter(ExecState* ex return toJS(exec, globalObject(), info); } -JSValue JSWebGLRenderingContext::getParameter(ExecState* exec, const ArgList& args) +JSValue JSWebGLRenderingContext::getParameter(ExecState* exec) { - if (args.size() != 1) + if (exec->argumentCount() != 1) return throwError(exec, SyntaxError); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); - unsigned pname = args.at(0).toInt32(exec); + unsigned pname = exec->argument(0).toInt32(exec); if (exec->hadException()) return jsUndefined(); WebGLGetInfo info = context->getParameter(pname, ec); @@ -239,15 +239,15 @@ JSValue JSWebGLRenderingContext::getParameter(ExecState* exec, const ArgList& ar return toJS(exec, globalObject(), info); } -JSValue JSWebGLRenderingContext::getProgramParameter(ExecState* exec, const ArgList& args) +JSValue JSWebGLRenderingContext::getProgramParameter(ExecState* exec) { - if (args.size() != 2) + if (exec->argumentCount() != 2) return throwError(exec, SyntaxError); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); - WebGLProgram* program = toWebGLProgram(args.at(0)); - unsigned pname = args.at(1).toInt32(exec); + WebGLProgram* program = toWebGLProgram(exec->argument(0)); + unsigned pname = exec->argument(1).toInt32(exec); if (exec->hadException()) return jsUndefined(); WebGLGetInfo info = context->getProgramParameter(program, pname, ec); @@ -258,20 +258,20 @@ JSValue JSWebGLRenderingContext::getProgramParameter(ExecState* exec, const ArgL return toJS(exec, globalObject(), info); } -JSValue JSWebGLRenderingContext::getRenderbufferParameter(ExecState* exec, const ArgList& args) +JSValue JSWebGLRenderingContext::getRenderbufferParameter(ExecState* exec) { - return getObjectParameter(this, exec, args, kRenderbuffer); + return getObjectParameter(this, exec, kRenderbuffer); } -JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec, const ArgList& args) +JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec) { - if (args.size() != 2) + if (exec->argumentCount() != 2) return throwError(exec, SyntaxError); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); - WebGLShader* shader = toWebGLShader(args.at(0)); - unsigned pname = args.at(1).toInt32(exec); + WebGLShader* shader = toWebGLShader(exec->argument(0)); + unsigned pname = exec->argument(1).toInt32(exec); if (exec->hadException()) return jsUndefined(); WebGLGetInfo info = context->getShaderParameter(shader, pname, ec); @@ -282,20 +282,20 @@ JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec, const ArgLi return toJS(exec, globalObject(), info); } -JSValue JSWebGLRenderingContext::getTexParameter(ExecState* exec, const ArgList& args) +JSValue JSWebGLRenderingContext::getTexParameter(ExecState* exec) { - return getObjectParameter(this, exec, args, kTexture); + return getObjectParameter(this, exec, kTexture); } -JSValue JSWebGLRenderingContext::getUniform(ExecState* exec, const ArgList& args) +JSValue JSWebGLRenderingContext::getUniform(ExecState* exec) { - if (args.size() != 2) + if (exec->argumentCount() != 2) return throwError(exec, SyntaxError); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); - WebGLProgram* program = toWebGLProgram(args.at(0)); - WebGLUniformLocation* loc = toWebGLUniformLocation(args.at(1)); + WebGLProgram* program = toWebGLProgram(exec->argument(0)); + WebGLUniformLocation* loc = toWebGLUniformLocation(exec->argument(1)); if (exec->hadException()) return jsUndefined(); WebGLGetInfo info = context->getUniform(program, loc, ec); @@ -306,9 +306,9 @@ JSValue JSWebGLRenderingContext::getUniform(ExecState* exec, const ArgList& args return toJS(exec, globalObject(), info); } -JSValue JSWebGLRenderingContext::getVertexAttrib(ExecState* exec, const ArgList& args) +JSValue JSWebGLRenderingContext::getVertexAttrib(ExecState* exec) { - return getObjectParameter(this, exec, args, kVertexAttrib); + return getObjectParameter(this, exec, kVertexAttrib); } // void texImage2D(in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, in GLint border, in GLenum format, in GLenum type, in ArrayBufferView pixels); @@ -316,35 +316,35 @@ JSValue JSWebGLRenderingContext::getVertexAttrib(ExecState* exec, const ArgList& // void texImage2D(in GLenum target, in GLint level, in HTMLImageElement image, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); // void texImage2D(in GLenum target, in GLint level, in HTMLCanvasElement canvas, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); // void texImage2D(in GLenum target, in GLint level, in HTMLVideoElement video, [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); -JSValue JSWebGLRenderingContext::texImage2D(ExecState* exec, const ArgList& args) +JSValue JSWebGLRenderingContext::texImage2D(ExecState* exec) { - if (args.size() < 3 || args.size() > 9) + if (exec->argumentCount() < 3 || exec->argumentCount() > 9) return throwError(exec, SyntaxError); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); - unsigned target = args.at(0).toInt32(exec); + unsigned target = exec->argument(0).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned level = args.at(1).toInt32(exec); + unsigned level = exec->argument(1).toInt32(exec); if (exec->hadException()) return jsUndefined(); JSObject* o = 0; - if (args.size() <= 5) { + if (exec->argumentCount() <= 5) { // This is one of the last 4 forms. Param 2 can be ImageData or <img>, <canvas> or <video> element. - JSValue value = args.at(2); + JSValue value = exec->argument(2); if (!value.isObject()) return throwError(exec, TypeError); o = asObject(value); - bool flipY = args.at(3).toBoolean(exec); - bool premultiplyAlpha = args.at(4).toBoolean(exec); + bool flipY = exec->argument(3).toBoolean(exec); + bool premultiplyAlpha = exec->argument(4).toBoolean(exec); if (o->inherits(&JSImageData::s_info)) { ImageData* data = static_cast<ImageData*>(static_cast<JSImageData*>(o)->impl()); @@ -363,35 +363,35 @@ JSValue JSWebGLRenderingContext::texImage2D(ExecState* exec, const ArgList& args } else ec = TYPE_MISMATCH_ERR; } else { - if (args.size() != 9) + if (exec->argumentCount() != 9) return throwError(exec, SyntaxError); // This must be the ArrayBufferView case - unsigned internalformat = args.at(2).toInt32(exec); + unsigned internalformat = exec->argument(2).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned width = args.at(3).toInt32(exec); + unsigned width = exec->argument(3).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned height = args.at(4).toInt32(exec); + unsigned height = exec->argument(4).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned border = args.at(5).toInt32(exec); + unsigned border = exec->argument(5).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned format = args.at(6).toInt32(exec); + unsigned format = exec->argument(6).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned type = args.at(7).toInt32(exec); + unsigned type = exec->argument(7).toInt32(exec); if (exec->hadException()) return jsUndefined(); - JSValue value = args.at(8); + JSValue value = exec->argument(8); // For this case passing 0 (for a null array) is allowed if (value.isNull()) @@ -419,43 +419,43 @@ JSValue JSWebGLRenderingContext::texImage2D(ExecState* exec, const ArgList& args // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in HTMLImageElement image, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in HTMLCanvasElement canvas, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, in HTMLVideoElement video, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); -JSValue JSWebGLRenderingContext::texSubImage2D(ExecState* exec, const ArgList& args) +JSValue JSWebGLRenderingContext::texSubImage2D(ExecState* exec) { - if (args.size() < 5 || args.size() > 9) + if (exec->argumentCount() < 5 || exec->argumentCount() > 9) return throwError(exec, SyntaxError); ExceptionCode ec = 0; WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); - unsigned target = args.at(0).toInt32(exec); + unsigned target = exec->argument(0).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned level = args.at(1).toInt32(exec); + unsigned level = exec->argument(1).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned xoff = args.at(2).toInt32(exec); + unsigned xoff = exec->argument(2).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned yoff = args.at(3).toInt32(exec); + unsigned yoff = exec->argument(3).toInt32(exec); if (exec->hadException()) return jsUndefined(); JSObject* o = 0; - if (args.size() <= 7) { + if (exec->argumentCount() <= 7) { // This is one of the last 4 forms. Param 4 can be <img>, <canvas> or <video> element, of the format param. - JSValue value = args.at(4); + JSValue value = exec->argument(4); if (!value.isObject()) return throwError(exec, SyntaxError); o = asObject(value); - bool flipY = args.at(5).toBoolean(exec); - bool premultiplyAlpha = args.at(6).toBoolean(exec); + bool flipY = exec->argument(5).toBoolean(exec); + bool premultiplyAlpha = exec->argument(6).toBoolean(exec); if (o->inherits(&JSImageData::s_info)) { ImageData* data = static_cast<ImageData*>(static_cast<JSImageData*>(o)->impl()); @@ -475,26 +475,26 @@ JSValue JSWebGLRenderingContext::texSubImage2D(ExecState* exec, const ArgList& a ec = TYPE_MISMATCH_ERR; } else { // This must be the ArrayBufferView form - if (args.size() != 9) + if (exec->argumentCount() != 9) return throwError(exec, SyntaxError); - unsigned width = args.at(4).toInt32(exec); + unsigned width = exec->argument(4).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned height = args.at(5).toInt32(exec); + unsigned height = exec->argument(5).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned format = args.at(6).toInt32(exec); + unsigned format = exec->argument(6).toInt32(exec); if (exec->hadException()) return jsUndefined(); - unsigned type = args.at(7).toInt32(exec); + unsigned type = exec->argument(7).toInt32(exec); if (exec->hadException()) return jsUndefined(); - JSValue value = args.at(8); + JSValue value = exec->argument(8); if (!value.isObject()) context->texSubImage2D(target, level, xoff, yoff, width, height, format, type, 0, ec); else { @@ -555,23 +555,23 @@ static bool functionForUniform(DataFunctionToCall f) return false; } -static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, const JSC::ArgList& args, WebGLRenderingContext* context) +static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, WebGLRenderingContext* context) { - if (args.size() != 2) + if (exec->argumentCount() != 2) return throwError(exec, SyntaxError); WebGLUniformLocation* location = 0; long index = -1; if (functionForUniform(f)) - location = toWebGLUniformLocation(args.at(0)); + location = toWebGLUniformLocation(exec->argument(0)); else - index = args.at(0).toInt32(exec); + index = exec->argument(0).toInt32(exec); if (exec->hadException()) return jsUndefined(); - RefPtr<FloatArray> webGLArray = toFloatArray(args.at(1)); + RefPtr<FloatArray> webGLArray = toFloatArray(exec->argument(1)); if (exec->hadException()) return jsUndefined(); @@ -609,7 +609,7 @@ static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, co } Vector<float, 64> array; - if (!toVector(exec, args.at(1), array)) + if (!toVector(exec, exec->argument(1), array)) return throwError(exec, TypeError); switch (f) { @@ -643,17 +643,17 @@ static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, co return jsUndefined(); } -static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, const JSC::ArgList& args, WebGLRenderingContext* context) +static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, WebGLRenderingContext* context) { - if (args.size() != 2) + if (exec->argumentCount() != 2) return throwError(exec, SyntaxError); - WebGLUniformLocation* location = toWebGLUniformLocation(args.at(0)); + WebGLUniformLocation* location = toWebGLUniformLocation(exec->argument(0)); if (exec->hadException()) return jsUndefined(); - RefPtr<Int32Array> webGLArray = toInt32Array(args.at(1)); + RefPtr<Int32Array> webGLArray = toInt32Array(exec->argument(1)); if (exec->hadException()) return jsUndefined(); @@ -682,7 +682,7 @@ static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, co Vector<int, 64> array; - if (!toVector(exec, args.at(1), array)) + if (!toVector(exec, exec->argument(1), array)) return throwError(exec, TypeError); switch (f) { @@ -706,21 +706,21 @@ static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, co return jsUndefined(); } -static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecState* exec, const JSC::ArgList& args, WebGLRenderingContext* context) +static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecState* exec, WebGLRenderingContext* context) { - if (args.size() != 3) + if (exec->argumentCount() != 3) return throwError(exec, SyntaxError); - WebGLUniformLocation* location = toWebGLUniformLocation(args.at(0)); + WebGLUniformLocation* location = toWebGLUniformLocation(exec->argument(0)); if (exec->hadException()) return jsUndefined(); - bool transpose = args.at(1).toBoolean(exec); + bool transpose = exec->argument(1).toBoolean(exec); if (exec->hadException()) return jsUndefined(); - RefPtr<FloatArray> webGLArray = toFloatArray(args.at(2)); + RefPtr<FloatArray> webGLArray = toFloatArray(exec->argument(2)); if (exec->hadException()) return jsUndefined(); @@ -743,7 +743,7 @@ static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecStat } Vector<float, 64> array; - if (!toVector(exec, args.at(2), array)) + if (!toVector(exec, exec->argument(2), array)) return throwError(exec, TypeError); switch (f) { @@ -762,79 +762,79 @@ static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecStat return jsUndefined(); } -JSC::JSValue JSWebGLRenderingContext::uniform1fv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::uniform1fv(JSC::ExecState* exec) { - return dataFunctionf(f_uniform1v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctionf(f_uniform1v, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::uniform1iv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::uniform1iv(JSC::ExecState* exec) { - return dataFunctioni(f_uniform1v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctioni(f_uniform1v, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::uniform2fv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::uniform2fv(JSC::ExecState* exec) { - return dataFunctionf(f_uniform2v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctionf(f_uniform2v, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::uniform2iv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::uniform2iv(JSC::ExecState* exec) { - return dataFunctioni(f_uniform2v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctioni(f_uniform2v, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::uniform3fv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::uniform3fv(JSC::ExecState* exec) { - return dataFunctionf(f_uniform3v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctionf(f_uniform3v, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::uniform3iv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::uniform3iv(JSC::ExecState* exec) { - return dataFunctioni(f_uniform3v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctioni(f_uniform3v, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::uniform4fv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::uniform4fv(JSC::ExecState* exec) { - return dataFunctionf(f_uniform4v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctionf(f_uniform4v, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::uniform4iv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::uniform4iv(JSC::ExecState* exec) { - return dataFunctioni(f_uniform4v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctioni(f_uniform4v, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::uniformMatrix2fv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::uniformMatrix2fv(JSC::ExecState* exec) { - return dataFunctionMatrix(f_uniformMatrix2fv, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctionMatrix(f_uniformMatrix2fv, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::uniformMatrix3fv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::uniformMatrix3fv(JSC::ExecState* exec) { - return dataFunctionMatrix(f_uniformMatrix3fv, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctionMatrix(f_uniformMatrix3fv, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::uniformMatrix4fv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::uniformMatrix4fv(JSC::ExecState* exec) { - return dataFunctionMatrix(f_uniformMatrix4fv, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctionMatrix(f_uniformMatrix4fv, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::vertexAttrib1fv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::vertexAttrib1fv(JSC::ExecState* exec) { - return dataFunctionf(f_vertexAttrib1v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctionf(f_vertexAttrib1v, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::vertexAttrib2fv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::vertexAttrib2fv(JSC::ExecState* exec) { - return dataFunctionf(f_vertexAttrib2v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctionf(f_vertexAttrib2v, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::vertexAttrib3fv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::vertexAttrib3fv(JSC::ExecState* exec) { - return dataFunctionf(f_vertexAttrib3v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctionf(f_vertexAttrib3v, exec, static_cast<WebGLRenderingContext*>(impl())); } -JSC::JSValue JSWebGLRenderingContext::vertexAttrib4fv(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWebGLRenderingContext::vertexAttrib4fv(JSC::ExecState* exec) { - return dataFunctionf(f_vertexAttrib4v, exec, args, static_cast<WebGLRenderingContext*>(impl())); + return dataFunctionf(f_vertexAttrib4v, exec, static_cast<WebGLRenderingContext*>(impl())); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp index 149ac5d..81b5b9e 100644 --- a/WebCore/bindings/js/JSWebSocketCustom.cpp +++ b/WebCore/bindings/js/JSWebSocketCustom.cpp @@ -45,12 +45,12 @@ using namespace JSC; namespace WebCore { // Custom functions -JSValue JSWebSocket::send(ExecState* exec, const ArgList& args) +JSValue JSWebSocket::send(ExecState* exec) { - if (args.size() < 1) + if (exec->argumentCount() < 1) return throwError(exec, SyntaxError, "Not enough arguments"); - const String& msg = ustringToString(args.at(0).toString(exec)); + const String& msg = ustringToString(exec->argument(0).toString(exec)); if (exec->hadException()) return throwError(exec, SyntaxError, "bad message data."); ExceptionCode ec = 0; diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp index 925a5c3..47a867e 100644 --- a/WebCore/bindings/js/JSWorkerContextCustom.cpp +++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp @@ -105,14 +105,14 @@ JSValue JSWorkerContext::webSocket(ExecState* exec) const } #endif -JSValue JSWorkerContext::importScripts(ExecState* exec, const ArgList& args) +JSValue JSWorkerContext::importScripts(ExecState* exec) { - if (!args.size()) + if (!exec->argumentCount()) return jsUndefined(); Vector<String> urls; - for (unsigned i = 0; i < args.size(); i++) { - urls.append(ustringToString(args.at(i).toString(exec))); + for (unsigned i = 0; i < exec->argumentCount(); i++) { + urls.append(ustringToString(exec->argument(i).toString(exec))); if (exec->hadException()) return jsUndefined(); } @@ -123,21 +123,21 @@ JSValue JSWorkerContext::importScripts(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSWorkerContext::setTimeout(ExecState* exec, const ArgList& args) +JSValue JSWorkerContext::setTimeout(ExecState* exec) { - OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, args, currentWorld(exec)); + OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, currentWorld(exec)); if (exec->hadException()) return jsUndefined(); - int delay = args.at(1).toInt32(exec); + int delay = exec->argument(1).toInt32(exec); return jsNumber(exec, impl()->setTimeout(action.release(), delay)); } -JSValue JSWorkerContext::setInterval(ExecState* exec, const ArgList& args) +JSValue JSWorkerContext::setInterval(ExecState* exec) { - OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, args, currentWorld(exec)); + OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, currentWorld(exec)); if (exec->hadException()) return jsUndefined(); - int delay = args.at(1).toInt32(exec); + int delay = exec->argument(1).toInt32(exec); return jsNumber(exec, impl()->setInterval(action.release(), delay)); } @@ -150,38 +150,38 @@ JSValue JSWorkerContext::messageChannel(ExecState* exec) const #endif #if ENABLE(DATABASE) -JSValue JSWorkerContext::openDatabase(ExecState* exec, const ArgList& args) +JSValue JSWorkerContext::openDatabase(ExecState* exec) { - if (args.size() < 4) { + if (exec->argumentCount() < 4) { setDOMException(exec, SYNTAX_ERR); return jsUndefined(); } - String name = ustringToString(args.at(0).toString(exec)); + String name = ustringToString(exec->argument(0).toString(exec)); if (exec->hadException()) return jsUndefined(); - String version = ustringToString(args.at(1).toString(exec)); + String version = ustringToString(exec->argument(1).toString(exec)); if (exec->hadException()) return jsUndefined(); - String displayName = ustringToString(args.at(2).toString(exec)); + String displayName = ustringToString(exec->argument(2).toString(exec)); if (exec->hadException()) return jsUndefined(); - // args.at(3) = estimated size - unsigned long estimatedSize = args.at(3).toUInt32(exec); + // exec->argument(3) = estimated size + unsigned long estimatedSize = exec->argument(3).toUInt32(exec); if (exec->hadException()) return jsUndefined(); RefPtr<DatabaseCallback> creationCallback; - if (args.size() >= 5) { - if (!args.at(4).isObject()) { + if (exec->argumentCount() >= 5) { + if (!exec->argument(4).isObject()) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } - creationCallback = JSDatabaseCallback::create(asObject(args.at(4)), globalObject()); + creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject()); } ExceptionCode ec = 0; @@ -190,38 +190,38 @@ JSValue JSWorkerContext::openDatabase(ExecState* exec, const ArgList& args) return result; } -JSValue JSWorkerContext::openDatabaseSync(ExecState* exec, const ArgList& args) +JSValue JSWorkerContext::openDatabaseSync(ExecState* exec) { - if (args.size() < 4) { + if (exec->argumentCount() < 4) { setDOMException(exec, SYNTAX_ERR); return jsUndefined(); } - String name = ustringToString(args.at(0).toString(exec)); + String name = ustringToString(exec->argument(0).toString(exec)); if (exec->hadException()) return jsUndefined(); - String version = ustringToString(args.at(1).toString(exec)); + String version = ustringToString(exec->argument(1).toString(exec)); if (exec->hadException()) return jsUndefined(); - String displayName = ustringToString(args.at(2).toString(exec)); + String displayName = ustringToString(exec->argument(2).toString(exec)); if (exec->hadException()) return jsUndefined(); - // args.at(3) = estimated size - unsigned long estimatedSize = args.at(3).toUInt32(exec); + // exec->argument(3) = estimated size + unsigned long estimatedSize = exec->argument(3).toUInt32(exec); if (exec->hadException()) return jsUndefined(); RefPtr<DatabaseCallback> creationCallback; - if (args.size() >= 5) { - if (!args.at(4).isObject()) { + if (exec->argumentCount() >= 5) { + if (!exec->argument(4).isObject()) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } - creationCallback = JSDatabaseCallback::create(asObject(args.at(4)), globalObject()); + creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject()); } ExceptionCode ec = 0; diff --git a/WebCore/bindings/js/JSWorkerCustom.cpp b/WebCore/bindings/js/JSWorkerCustom.cpp index 09b881a..64d9d41 100644 --- a/WebCore/bindings/js/JSWorkerCustom.cpp +++ b/WebCore/bindings/js/JSWorkerCustom.cpp @@ -37,9 +37,9 @@ using namespace JSC; namespace WebCore { -JSC::JSValue JSWorker::postMessage(JSC::ExecState* exec, const JSC::ArgList& args) +JSC::JSValue JSWorker::postMessage(JSC::ExecState* exec) { - return handlePostMessage(exec, args, impl()); + return handlePostMessage(exec, impl()); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp index 086b89d..420bf37 100644 --- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp +++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp @@ -62,23 +62,23 @@ void JSXMLHttpRequest::markChildren(MarkStack& markStack) } // Custom functions -JSValue JSXMLHttpRequest::open(ExecState* exec, const ArgList& args) +JSValue JSXMLHttpRequest::open(ExecState* exec) { - if (args.size() < 2) + if (exec->argumentCount() < 2) return throwError(exec, SyntaxError, "Not enough arguments"); - const KURL& url = impl()->scriptExecutionContext()->completeURL(ustringToString(args.at(1).toString(exec))); - String method = ustringToString(args.at(0).toString(exec)); + const KURL& url = impl()->scriptExecutionContext()->completeURL(ustringToString(exec->argument(1).toString(exec))); + String method = ustringToString(exec->argument(0).toString(exec)); ExceptionCode ec = 0; - if (args.size() >= 3) { - bool async = args.at(2).toBoolean(exec); + if (exec->argumentCount() >= 3) { + bool async = exec->argument(2).toBoolean(exec); - if (args.size() >= 4 && !args.at(3).isUndefined()) { - String user = valueToStringWithNullCheck(exec, args.at(3)); + if (exec->argumentCount() >= 4 && !exec->argument(3).isUndefined()) { + String user = valueToStringWithNullCheck(exec, exec->argument(3)); - if (args.size() >= 5 && !args.at(4).isUndefined()) { - String password = valueToStringWithNullCheck(exec, args.at(4)); + if (exec->argumentCount() >= 5 && !exec->argument(4).isUndefined()) { + String password = valueToStringWithNullCheck(exec, exec->argument(4)); impl()->open(method, url, async, user, password, ec); } else impl()->open(method, url, async, user, ec); @@ -91,13 +91,13 @@ JSValue JSXMLHttpRequest::open(ExecState* exec, const ArgList& args) return jsUndefined(); } -JSValue JSXMLHttpRequest::send(ExecState* exec, const ArgList& args) +JSValue JSXMLHttpRequest::send(ExecState* exec) { ExceptionCode ec = 0; - if (args.isEmpty()) + if (!exec->argumentCount()) impl()->send(ec); else { - JSValue val = args.at(0); + JSValue val = exec->argument(0); if (val.isUndefinedOrNull()) impl()->send(ec); else if (val.inherits(&JSDocument::s_info)) diff --git a/WebCore/bindings/js/JSXSLTProcessorCustom.cpp b/WebCore/bindings/js/JSXSLTProcessorCustom.cpp index 49ac234..63aa2b5 100644 --- a/WebCore/bindings/js/JSXSLTProcessorCustom.cpp +++ b/WebCore/bindings/js/JSXSLTProcessorCustom.cpp @@ -46,9 +46,9 @@ using namespace JSC; namespace WebCore { -JSValue JSXSLTProcessor::importStylesheet(ExecState*, const ArgList& args) +JSValue JSXSLTProcessor::importStylesheet(ExecState* exec) { - JSValue nodeVal = args.at(0); + JSValue nodeVal = exec->argument(0); if (nodeVal.inherits(&JSNode::s_info)) { JSNode* node = static_cast<JSNode*>(asObject(nodeVal)); impl()->importStylesheet(node->impl()); @@ -58,10 +58,10 @@ JSValue JSXSLTProcessor::importStylesheet(ExecState*, const ArgList& args) return jsUndefined(); } -JSValue JSXSLTProcessor::transformToFragment(ExecState* exec, const ArgList& args) +JSValue JSXSLTProcessor::transformToFragment(ExecState* exec) { - JSValue nodeVal = args.at(0); - JSValue docVal = args.at(1); + JSValue nodeVal = exec->argument(0); + JSValue docVal = exec->argument(1); if (nodeVal.inherits(&JSNode::s_info) && docVal.inherits(&JSDocument::s_info)) { WebCore::Node* node = static_cast<JSNode*>(asObject(nodeVal))->impl(); Document* doc = static_cast<Document*>(static_cast<JSDocument*>(asObject(docVal))->impl()); @@ -71,9 +71,9 @@ JSValue JSXSLTProcessor::transformToFragment(ExecState* exec, const ArgList& arg return jsUndefined(); } -JSValue JSXSLTProcessor::transformToDocument(ExecState* exec, const ArgList& args) +JSValue JSXSLTProcessor::transformToDocument(ExecState* exec) { - JSValue nodeVal = args.at(0); + JSValue nodeVal = exec->argument(0); if (nodeVal.inherits(&JSNode::s_info)) { JSNode* node = static_cast<JSNode*>(asObject(nodeVal)); RefPtr<Document> resultDocument = impl()->transformToDocument(node->impl()); @@ -85,33 +85,33 @@ JSValue JSXSLTProcessor::transformToDocument(ExecState* exec, const ArgList& arg return jsUndefined(); } -JSValue JSXSLTProcessor::setParameter(ExecState* exec, const ArgList& args) +JSValue JSXSLTProcessor::setParameter(ExecState* exec) { - if (args.at(1).isUndefinedOrNull() || args.at(2).isUndefinedOrNull()) + if (exec->argument(1).isUndefinedOrNull() || exec->argument(2).isUndefinedOrNull()) return jsUndefined(); // Throw exception? - String namespaceURI = ustringToString(args.at(0).toString(exec)); - String localName = ustringToString(args.at(1).toString(exec)); - String value = ustringToString(args.at(2).toString(exec)); + String namespaceURI = ustringToString(exec->argument(0).toString(exec)); + String localName = ustringToString(exec->argument(1).toString(exec)); + String value = ustringToString(exec->argument(2).toString(exec)); impl()->setParameter(namespaceURI, localName, value); return jsUndefined(); } -JSValue JSXSLTProcessor::getParameter(ExecState* exec, const ArgList& args) +JSValue JSXSLTProcessor::getParameter(ExecState* exec) { - if (args.at(1).isUndefinedOrNull()) + if (exec->argument(1).isUndefinedOrNull()) return jsUndefined(); - String namespaceURI = ustringToString(args.at(0).toString(exec)); - String localName = ustringToString(args.at(1).toString(exec)); + String namespaceURI = ustringToString(exec->argument(0).toString(exec)); + String localName = ustringToString(exec->argument(1).toString(exec)); String value = impl()->getParameter(namespaceURI, localName); return jsStringOrUndefined(exec, value); } -JSValue JSXSLTProcessor::removeParameter(ExecState* exec, const ArgList& args) +JSValue JSXSLTProcessor::removeParameter(ExecState* exec) { - if (args.at(1).isUndefinedOrNull()) + if (exec->argument(1).isUndefinedOrNull()) return jsUndefined(); - String namespaceURI = ustringToString(args.at(0).toString(exec)); - String localName = ustringToString(args.at(1).toString(exec)); + String namespaceURI = ustringToString(exec->argument(0).toString(exec)); + String localName = ustringToString(exec->argument(1).toString(exec)); impl()->removeParameter(namespaceURI, localName); return jsUndefined(); } diff --git a/WebCore/bindings/js/ScheduledAction.cpp b/WebCore/bindings/js/ScheduledAction.cpp index 8cafefe..5a45e87 100644 --- a/WebCore/bindings/js/ScheduledAction.cpp +++ b/WebCore/bindings/js/ScheduledAction.cpp @@ -47,9 +47,9 @@ using namespace JSC; namespace WebCore { -PassOwnPtr<ScheduledAction> ScheduledAction::create(ExecState* exec, const ArgList& args, DOMWrapperWorld* isolatedWorld) +PassOwnPtr<ScheduledAction> ScheduledAction::create(ExecState* exec, DOMWrapperWorld* isolatedWorld) { - JSValue v = args.at(0); + JSValue v = exec->argument(0); CallData callData; if (v.getCallData(callData) == CallTypeNone) { UString string = v.toString(exec); @@ -57,18 +57,18 @@ PassOwnPtr<ScheduledAction> ScheduledAction::create(ExecState* exec, const ArgLi return 0; return new ScheduledAction(ustringToString(string), isolatedWorld); } - ArgList argsTail; - args.getSlice(2, argsTail); - return new ScheduledAction(v, argsTail, isolatedWorld); + + return new ScheduledAction(exec, v, isolatedWorld); } -ScheduledAction::ScheduledAction(JSValue function, const ArgList& args, DOMWrapperWorld* isolatedWorld) +ScheduledAction::ScheduledAction(ExecState* exec, JSValue function, DOMWrapperWorld* isolatedWorld) : m_function(function) , m_isolatedWorld(isolatedWorld) { - ArgList::const_iterator end = args.end(); - for (ArgList::const_iterator it = args.begin(); it != end; ++it) - m_args.append(*it); + // setTimeout(function, interval, arg0, arg1...). + // Start at 2 to skip function and interval. + for (size_t i = 2; i < exec->argumentCount(); ++i) + m_args.append(exec->argument(i)); } void ScheduledAction::execute(ScriptExecutionContext* context) diff --git a/WebCore/bindings/js/ScheduledAction.h b/WebCore/bindings/js/ScheduledAction.h index 313451a..6c9d0ba 100644 --- a/WebCore/bindings/js/ScheduledAction.h +++ b/WebCore/bindings/js/ScheduledAction.h @@ -43,12 +43,12 @@ namespace WebCore { */ class ScheduledAction : public Noncopyable { public: - static PassOwnPtr<ScheduledAction> create(JSC::ExecState*, const JSC::ArgList&, DOMWrapperWorld* isolatedWorld); + static PassOwnPtr<ScheduledAction> create(JSC::ExecState*, DOMWrapperWorld* isolatedWorld); void execute(ScriptExecutionContext*); private: - ScheduledAction(JSC::JSValue function, const JSC::ArgList&, DOMWrapperWorld* isolatedWorld); + ScheduledAction(JSC::ExecState*, JSC::JSValue function, DOMWrapperWorld* isolatedWorld); ScheduledAction(const String& code, DOMWrapperWorld* isolatedWorld) : m_code(code) , m_isolatedWorld(isolatedWorld) diff --git a/WebCore/bindings/js/ScriptCallFrame.cpp b/WebCore/bindings/js/ScriptCallFrame.cpp index 19ed1ea..8381a4e 100644 --- a/WebCore/bindings/js/ScriptCallFrame.cpp +++ b/WebCore/bindings/js/ScriptCallFrame.cpp @@ -38,14 +38,16 @@ using namespace JSC; namespace WebCore { -ScriptCallFrame::ScriptCallFrame(const UString& functionName, const UString& urlString, int lineNumber, const ArgList& args, unsigned skipArgumentCount) +ScriptCallFrame::ScriptCallFrame(const UString& functionName, const UString& urlString, int lineNumber, ExecState* exec, unsigned skipArgumentCount) : m_functionName(functionName) , m_sourceURL(ParsedURLString, ustringToString(urlString)) , m_lineNumber(lineNumber) { - size_t argumentCount = args.size(); + if (!exec) + return; + size_t argumentCount = exec->argumentCount(); for (size_t i = skipArgumentCount; i < argumentCount; ++i) - m_arguments.append(ScriptValue(args.at(i))); + m_arguments.append(ScriptValue(exec->argument(i))); } ScriptCallFrame::~ScriptCallFrame() diff --git a/WebCore/bindings/js/ScriptCallFrame.h b/WebCore/bindings/js/ScriptCallFrame.h index b8c0aba..202f4b6 100644 --- a/WebCore/bindings/js/ScriptCallFrame.h +++ b/WebCore/bindings/js/ScriptCallFrame.h @@ -50,7 +50,7 @@ namespace WebCore { // <https://bugs.webkit.org/show_bug.cgi?id=21180> class ScriptCallFrame { public: - ScriptCallFrame(const JSC::UString& functionName, const JSC::UString& urlString, int lineNumber, const JSC::ArgList&, unsigned skipArgumentCount); + ScriptCallFrame(const JSC::UString& functionName, const JSC::UString& urlString, int lineNumber, JSC::ExecState*, unsigned skipArgumentCount); ~ScriptCallFrame(); const ScriptString& functionName() const { return m_functionName; } diff --git a/WebCore/bindings/js/ScriptCallStack.cpp b/WebCore/bindings/js/ScriptCallStack.cpp index 64600cf..86ddcd1 100644 --- a/WebCore/bindings/js/ScriptCallStack.cpp +++ b/WebCore/bindings/js/ScriptCallStack.cpp @@ -42,7 +42,7 @@ using namespace JSC; namespace WebCore { -ScriptCallStack::ScriptCallStack(ExecState* exec, const ArgList& args, unsigned skipArgumentCount) +ScriptCallStack::ScriptCallStack(ExecState* exec, unsigned skipArgumentCount) : m_initialized(false) , m_exec(exec) , m_caller(0) @@ -58,11 +58,11 @@ ScriptCallStack::ScriptCallStack(ExecState* exec, const ArgList& args, unsigned if (function) { m_caller = asFunction(function); - m_frames.append(ScriptCallFrame(m_caller->name(m_exec), urlString, lineNumber, args, skipArgumentCount)); + m_frames.append(ScriptCallFrame(m_caller->name(m_exec), urlString, lineNumber, m_exec, skipArgumentCount)); } else { // Caller is unknown, but we should still add the frame, because // something called us, and gave us arguments. - m_frames.append(ScriptCallFrame(UString(), urlString, lineNumber, args, skipArgumentCount)); + m_frames.append(ScriptCallFrame(UString(), urlString, lineNumber, m_exec, skipArgumentCount)); } } @@ -94,14 +94,13 @@ void ScriptCallStack::initialize() JSValue func = m_exec->interpreter()->retrieveCaller(m_exec, m_caller); while (!func.isNull()) { JSFunction* jsFunction = asFunction(func); - ArgList emptyArgList; - m_frames.append(ScriptCallFrame(jsFunction->name(m_exec), UString(), 0, emptyArgList, 0)); + m_frames.append(ScriptCallFrame(jsFunction->name(m_exec), UString(), 0, 0, 0)); func = m_exec->interpreter()->retrieveCaller(m_exec, jsFunction); } m_initialized = true; } -bool ScriptCallStack::callLocation(String*, int*, String*) +bool ScriptCallStack::stackTrace(int, ScriptState*, ScriptArray&) { return false; } diff --git a/WebCore/bindings/js/ScriptCallStack.h b/WebCore/bindings/js/ScriptCallStack.h index 7b66a97..6cf7679 100644 --- a/WebCore/bindings/js/ScriptCallStack.h +++ b/WebCore/bindings/js/ScriptCallStack.h @@ -31,6 +31,7 @@ #ifndef ScriptCallStack_h #define ScriptCallStack_h +#include "ScriptArray.h" #include "ScriptCallFrame.h" #include "ScriptState.h" #include "ScriptString.h" @@ -45,7 +46,7 @@ namespace WebCore { class ScriptCallStack : public Noncopyable { public: - ScriptCallStack(JSC::ExecState*, const JSC::ArgList&, unsigned skipArgumentCount = 0); + ScriptCallStack(JSC::ExecState*, unsigned skipArgumentCount = 0); ~ScriptCallStack(); ScriptState* state() const { return m_exec; } @@ -53,7 +54,7 @@ namespace WebCore { // frame retrieval methods const ScriptCallFrame &at(unsigned); unsigned size(); - static bool callLocation(String*, int*, String*); + static bool stackTrace(int, ScriptState*, ScriptArray&); private: void initialize(); diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h index 877eb9f..16fe4f2 100644 --- a/WebCore/bindings/js/ScriptController.h +++ b/WebCore/bindings/js/ScriptController.h @@ -142,6 +142,9 @@ public: void clearWindowShell(bool goingIntoPageCache = false); void updateDocument(); + void namedItemAdded(HTMLDocument*, const AtomicString&) { } + void namedItemRemoved(HTMLDocument*, const AtomicString&) { } + // Notifies the ScriptController that the securityOrigin of the current // document was modified. For example, this method is called when // document.domain is set. This method is *not* called when a new document diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp index 8f476b4..94d7e73 100644 --- a/WebCore/bindings/js/ScriptDebugServer.cpp +++ b/WebCore/bindings/js/ScriptDebugServer.cpp @@ -245,11 +245,16 @@ JavaScriptCallFrame* ScriptDebugServer::currentCallFrame() return m_currentCallFrame.get(); } -ScriptState* ScriptDebugServer::currentCallFrameState() +void ScriptDebugServer::dispatchDidPause(ScriptDebugListener* listener) { - if (!m_paused) - return 0; - return m_currentCallFrame->scopeChain()->globalObject->globalExec(); + ASSERT(m_paused); + ScriptState* state = m_currentCallFrame->scopeChain()->globalObject->globalExec(); + listener->didPause(state); +} + +void ScriptDebugServer::dispatchDidContinue(ScriptDebugListener* listener) +{ + listener->didContinue(); } void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source) @@ -335,7 +340,7 @@ void ScriptDebugServer::dispatchFunctionToListeners(const ListenerSet& listeners Vector<ScriptDebugListener*> copy; copyToVector(listeners, copy); for (size_t i = 0; i < copy.size(); ++i) - (copy[i]->*callback)(); + (this->*callback)(copy[i]); } void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback callback, Page* page) @@ -431,7 +436,7 @@ void ScriptDebugServer::pauseIfNeeded(Page* page) m_pauseOnNextStatement = false; m_paused = true; - dispatchFunctionToListeners(&ScriptDebugListener::didPause, page); + dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, page); setJavaScriptPaused(page->group(), true); @@ -446,7 +451,7 @@ void ScriptDebugServer::pauseIfNeeded(Page* page) m_paused = false; - dispatchFunctionToListeners(&ScriptDebugListener::didContinue, page); + dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, page); } void ScriptDebugServer::callEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) diff --git a/WebCore/bindings/js/ScriptDebugServer.h b/WebCore/bindings/js/ScriptDebugServer.h index 4740585..cfada27 100644 --- a/WebCore/bindings/js/ScriptDebugServer.h +++ b/WebCore/bindings/js/ScriptDebugServer.h @@ -34,7 +34,6 @@ #include "PlatformString.h" #include "ScriptBreakpoint.h" -#include "ScriptState.h" #include "Timer.h" #include <debugger/Debugger.h> @@ -86,13 +85,12 @@ public: void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0); JavaScriptCallFrame* currentCallFrame(); - ScriptState* currentCallFrameState(); void pageCreated(Page*); private: typedef HashSet<ScriptDebugListener*> ListenerSet; - typedef void (ScriptDebugListener::*JavaScriptExecutionCallback)(); + typedef void (ScriptDebugServer::*JavaScriptExecutionCallback)(ScriptDebugListener*); ScriptDebugServer(); ~ScriptDebugServer(); @@ -109,6 +107,8 @@ private: void dispatchFunctionToListeners(JavaScriptExecutionCallback, Page*); void dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback callback); + void dispatchDidPause(ScriptDebugListener*); + void dispatchDidContinue(ScriptDebugListener*); void dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source); void dispatchFailedToParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, int errorLine, const String& errorMessage); diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm index 1d03f08..b331f97 100644 --- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -26,6 +26,11 @@ package CodeGeneratorGObject; my %implIncludes = (); my %hdrIncludes = (); +my $defineTypeMacro = "G_DEFINE_TYPE"; +my $defineTypeInterfaceImplementation = ")"; +my @txtEventListeners = (); +my @txtInstallEventListeners = (); +my @txtInstallSignals = (); my @txtInstallProps = (); my @txtSetProps = (); my @txtGetProps = (); @@ -153,10 +158,6 @@ sub SkipAttribute { } my $propType = $attribute->signature->type; - if ($propType eq "EventListener") { - return 1; - } - if ($propType =~ /Constructor$/) { return 1; } @@ -198,10 +199,6 @@ sub SkipFunction { return 1; } - if ($function->signature->type eq "Event") { - return 1; - } - if ($function->signature->name eq "getSVGDocument") { return 1; } @@ -218,6 +215,7 @@ sub GetGValueTypeName { my $type = shift; my %types = ("DOMString", "string", + "DOMTimeStamp", "uint", "float", "float", "double", "double", "boolean", "boolean", @@ -242,6 +240,7 @@ sub GetGlibTypeName { my $name = GetClassName($type); my %types = ("DOMString", "gchar* ", + "DOMTimeStamp", "guint32", "CompareHow", "gushort", "float", "gfloat", "double", "gdouble", @@ -319,9 +318,6 @@ sub GenerateProperty { my $propType = $attribute->signature->type; my ${propGType} = decamelize($propType); - if ($propGType eq "event_target") { - $propGType = "event_target_node"; - } my ${ucPropGType} = uc($propGType); my $gtype = GetGValueTypeName($propType); @@ -446,6 +442,64 @@ EOF push(@txtInstallProps, $txtInstallProp); } +my %breakWords = ("before" => 1, "can" => 1, "context" => 1, "dbl" => 1, "drag" => 1, + "drag" => 1, "duration" => 1, "has" => 1, "key" => 1, "loaded" => 1, + "mouse" => 1, "page" => 1, "pop" => 1, "rate" => 1, "select" => 1, + "time" => 1, "touch" => 1, "volume" => 1); + +sub SplitEventListenerAttrName { + my $attrName = shift; + + my @matches = grep { $attrName =~ /^$_/ } keys (%breakWords); + + if (@matches && (length $matches[0] < length $attrName)) { + $attrName = $matches[0] . "-" . substr($attrName, length $matches[0]); + } + + return $attrName; +} + +sub EventSignalName { + my $attrName = shift; + my $name = SplitEventListenerAttrName($attrName) . "-event"; + + return $name; +} + +sub GenerateEventListener { + my $attribute = shift; + my $object = shift; + my $interfaceName = shift; + + my $name = $attribute->signature->name; + my $domSignalName = substr($name, 2); + my $gobjectSignalName = EventSignalName($domSignalName); + + my $txtInstallSignal = << "EOF"; + g_signal_new("${gobjectSignalName}", + G_TYPE_FROM_CLASS(gobjectClass), + G_SIGNAL_RUN_LAST, + 0, + g_signal_accumulator_true_handled, 0, + webkit_marshal_BOOLEAN__OBJECT, + G_TYPE_BOOLEAN, 1, + WEBKIT_TYPE_DOM_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); + +EOF + push(@txtInstallSignals, $txtInstallSignal); + + my ${listenerName} = $domSignalName . "Listener"; + + my $txtInstallEventListener = << "EOF"; + RefPtr<WebCore::GObjectEventListener> ${listenerName} = WebCore::GObjectEventListener::create(reinterpret_cast<GObject*>(wrapper), "${gobjectSignalName}"); + coreObject->addEventListener("${domSignalName}", ${listenerName}, false); +EOF + push(@txtInstallEventListeners, $txtInstallEventListener); + + $implIncludes{"webkit/WebKitDOMEvent.h"} = 1; + $implIncludes{"GObjectEventListener.h"} = 1; +} + sub GenerateProperties { my ($object, $interfaceName, $dataNode) = @_; @@ -506,7 +560,11 @@ EOF push(@txtSetProps, $txtSetProps); foreach my $attribute (@readableProperties) { - GenerateProperty($attribute, $interfaceName, \@writeableProperties); + if ($attribute->signature->type eq "EventListener") { + GenerateEventListener($attribute, $object, $interfaceName); + } else { + GenerateProperty($attribute, $interfaceName, \@writeableProperties); + } } push(@cBodyPriv, "};\n\n"); @@ -529,17 +587,13 @@ EOF EOF push(@txtSetProps, $txtSetProps); - # TODO: work out if it's appropriate to split this into many different - # signals e.g. "click" etc. - my $txtInstallSignals = ""; - $implContent = << "EOF"; static void ${lowerCaseIfaceName}_finalize(GObject* object) { WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); - if (dom_object->coreObject != NULL) { + if (dom_object->coreObject) { WebCore::${interfaceName}* coreObject = static_cast<WebCore::${interfaceName} *>(dom_object->coreObject); WebKit::DOMObjectCache::forget(coreObject); @@ -563,8 +617,7 @@ static void ${lowerCaseIfaceName}_class_init(${className}Class* requestClass) gobjectClass->get_property = ${lowerCaseIfaceName}_get_property; @txtInstallProps - -$txtInstallSignals +@txtInstallSignals } static void ${lowerCaseIfaceName}_init(${className}* request) @@ -674,6 +727,11 @@ sub addIncludeInBody { } } +# Some methods' body (only the body, since the public API can't be +# conditional) should be guarded by #ifdefs depending on whether +# certain features in WebKit are enabled. +my %conditionalMethods = ("webkit_dom_geolocation_clear_watch" => "GEOLOCATION"); + sub GenerateFunction { my ($object, $interfaceName, $function, $prefix) = @_; @@ -699,7 +757,7 @@ sub GenerateFunction { foreach my $param (@{$function->parameters}) { my $paramIDLType = $param->type; - if ($paramIDLType eq "Event" || $paramIDLType eq "EventListener") { + if ($paramIDLType eq "EventListener") { push(@hBody, "\n/* TODO: event function ${functionName} */\n\n"); push(@cBody, "\n/* TODO: event function ${functionName} */\n\n"); return; @@ -730,6 +788,8 @@ sub GenerateFunction { if ($functionSigType ne "EventTarget") { $implIncludes{"webkit/WebKitDOM${functionSigType}Private.h"} = 1; $implIncludes{"webkit/WebKitDOM${functionSigType}.h"} = 1; + } else { + $implIncludes{"WebKitDOM${functionSigType}.h"} = 1; } $implIncludes{"${functionSigType}.h"} = 1; @@ -742,6 +802,10 @@ sub GenerateFunction { push(@hBody, "WEBKIT_API $returnType\n$functionName ($functionSig);\n\n"); push(@cBody, "$returnType\n$functionName ($functionSig)\n{\n"); + if ($conditionalMethods{$functionName}) { + push(@cBody, "#if ENABLE($conditionalMethods{$functionName})\n"); + } + if ($returnType ne "void") { # TODO: return proper default result push(@cBody, " g_return_val_if_fail (self, 0);\n"); @@ -900,6 +964,11 @@ EOF push(@cBody, " return res;\n"); } } + + if ($conditionalMethods{$functionName}) { + push(@cBody, "#endif\n"); + } + push(@cBody, "\n}\n\n"); } @@ -924,7 +993,7 @@ sub GenerateFunctions { TOP: foreach my $attribute (@{$dataNode->attributes}) { - if (SkipAttribute($attribute)) { + if (SkipAttribute($attribute) || $attribute->signature->type eq "EventListener") { next TOP; } @@ -982,22 +1051,46 @@ sub GenerateFunctions { sub GenerateCFile { my ($object, $interfaceName, $parentClassName, $parentGObjType, $dataNode) = @_; + + if ($dataNode->extendedAttributes->{"EventTarget"}) { + $object->GenerateEventTargetIface($dataNode); + } + my $implContent = ""; my $clsCaps = uc(FixUpDecamelizedName(decamelize($interfaceName))); my $lowerCaseIfaceName = "webkit_dom_" . FixUpDecamelizedName(decamelize($interfaceName)); $implContent = << "EOF"; -G_DEFINE_TYPE(${className}, ${lowerCaseIfaceName}, ${parentGObjType}) +${defineTypeMacro}(${className}, ${lowerCaseIfaceName}, ${parentGObjType}${defineTypeInterfaceImplementation} namespace WebKit { +WebCore::${interfaceName}* core(${className}* request) +{ + g_return_val_if_fail(request, 0); + + WebCore::${interfaceName}* coreObject = static_cast<WebCore::${interfaceName}*>(WEBKIT_DOM_OBJECT(request)->coreObject); + g_return_val_if_fail(coreObject, 0); + + return coreObject; +} + +} // namespace WebKit +EOF + + push(@cBodyPriv, $implContent); + $object->GenerateProperties($interfaceName, $dataNode); + $object->GenerateFunctions($interfaceName, $dataNode); + + my $wrapMethod = << "EOF"; +namespace WebKit { ${className}* wrap${interfaceName}(WebCore::${interfaceName}* coreObject) { - g_return_val_if_fail(coreObject != 0, 0); + g_return_val_if_fail(coreObject, 0); ${className}* wrapper = WEBKIT_DOM_${clsCaps}(g_object_new(WEBKIT_TYPE_DOM_${clsCaps}, NULL)); - g_return_val_if_fail(wrapper != 0, 0); + g_return_val_if_fail(wrapper, 0); /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object * in a C-allocated GObject structure. See the finalize() code for the @@ -1006,26 +1099,13 @@ ${className}* wrap${interfaceName}(WebCore::${interfaceName}* coreObject) coreObject->ref(); WEBKIT_DOM_OBJECT(wrapper)->coreObject = coreObject; +@txtInstallEventListeners return wrapper; } - -WebCore::${interfaceName}* core(${className}* request) -{ - g_return_val_if_fail(request != 0, 0); - - WebCore::${interfaceName}* coreObject = static_cast<WebCore::${interfaceName}*>(WEBKIT_DOM_OBJECT(request)->coreObject); - g_return_val_if_fail(coreObject != 0, 0); - - return coreObject; -} - } // namespace WebKit EOF - - push(@cBodyPriv, $implContent); - $object->GenerateProperties($interfaceName, $dataNode); - $object->GenerateFunctions($interfaceName, $dataNode); + push(@cBodyPriv, $wrapMethod); } sub GenerateEndHeader { @@ -1107,6 +1187,44 @@ sub UsesManualKitImplementation { return 0; } +sub GenerateEventTargetIface { + my $object = shift; + my $dataNode = shift; + + my $interfaceName = $dataNode->name; + my $decamelize = FixUpDecamelizedName(decamelize($interfaceName)); + + $implIncludes{"WebKitDOMEventTarget.h"} = 1; + $implIncludes{"WebKitDOMEventPrivate.h"} = 1; + + my $impl = << "EOF"; +static void webkit_dom_${decamelize}_dispatch_event(WebKitDOMEventTarget* target, WebKitDOMEvent* event, GError** error) +{ + WebCore::Event* coreEvent = WebKit::core(event); + WebCore::${interfaceName}* coreTarget = static_cast<WebCore::${interfaceName}*>(WEBKIT_DOM_OBJECT(target)->coreObject); + + WebCore::ExceptionCode ec = 0; + coreTarget->dispatchEvent(coreEvent, ec); + if (ec) { + WebCore::ExceptionCodeDescription description; + WebCore::getExceptionCodeDescription(ec, description); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.code, description.name); + } +} + +static void webkit_dom_event_target_init(WebKitDOMEventTargetIface* iface) +{ + iface->dispatch_event = webkit_dom_${decamelize}_dispatch_event; +} + +EOF + + push(@cBody, $impl); + + $defineTypeMacro = "G_DEFINE_TYPE_WITH_CODE"; + $defineTypeInterfaceImplementation = ", G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_DOM_EVENT_TARGET, webkit_dom_event_target_init))"; +} + sub Generate { my ($object, $dataNode) = @_; @@ -1138,7 +1256,7 @@ namespace WebKit { gpointer kit(WebCore::$interfaceName* obj) { - g_return_val_if_fail(obj != 0, 0); + g_return_val_if_fail(obj, 0); if (gpointer ret = DOMObjectCache::get(obj)) return ret; @@ -1156,6 +1274,7 @@ EOF $object->GenerateCFile($interfaceName, $parentClassName, $parentGObjType, $dataNode); $object->GenerateEndHeader(); $object->GeneratePrivateHeader($dataNode); + } # Internal helper diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index 3be997f..bffd046 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -177,10 +177,10 @@ END } push(@GenerateEventListenerImpl, <<END); - JSValue listener = args.at(1); + JSValue listener = exec->argument(1); if (!listener.isObject()) return jsUndefined(); - imp->${functionName}EventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, args.at(2).toBoolean(exec)); + imp->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean(exec)); return jsUndefined(); END return @GenerateEventListenerImpl; @@ -846,7 +846,7 @@ sub GenerateHeader foreach my $function (@{$dataNode->functions}) { if ($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}) { my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name); - push(@headerContent, " JSC::JSValue " . $functionImplementationName . "(JSC::ExecState*, const JSC::ArgList&);\n"); + push(@headerContent, " JSC::JSValue " . $functionImplementationName . "(JSC::ExecState*);\n"); } } } @@ -989,7 +989,7 @@ sub GenerateHeader foreach my $function (@{$dataNode->functions}) { next if $function->{overloadIndex} && $function->{overloadIndex} > 1; my $functionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name); - push(@headerContent, "JSC::JSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);\n"); + push(@headerContent, "JSC::JSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*);\n"); } } @@ -1103,11 +1103,11 @@ sub GenerateParametersCheckExpression my $function = shift; my @andExpression = (); - push(@andExpression, "args.size() == $numParameters"); + push(@andExpression, "exec->argumentCount() == $numParameters"); my $parameterIndex = 0; foreach $parameter (@{$function->parameters}) { last if $parameterIndex >= $numParameters; - my $value = "args.at($parameterIndex)"; + my $value = "exec->argument($parameterIndex)"; my $type = $codeGenerator->StripModule($parameter->type); # Only DOMString or wrapper types are checked. @@ -1154,14 +1154,14 @@ sub GenerateOverloadedPrototypeFunction my $functionName = "js${implClassName}PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name); - push(@implContent, "JSValue JSC_HOST_CALL ${functionName}(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)\n"); + push(@implContent, "JSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); push(@implContent, <<END); { END foreach my $overload (@{$function->{overloads}}) { my $parametersCheck = GenerateFunctionParametersCheck($overload); push(@implContent, " if ($parametersCheck)\n"); - push(@implContent, " return ${functionName}$overload->{overloadIndex}(exec, thisValue, args);\n"); + push(@implContent, " return ${functionName}$overload->{overloadIndex}(exec);\n"); } push(@implContent, <<END); return throwError(exec, TypeError); @@ -1790,21 +1790,21 @@ sub GenerateImplementation my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name); - push(@implContent, "JSValue JSC_HOST_CALL ${functionName}(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)\n"); + push(@implContent, "JSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); push(@implContent, "{\n"); - push(@implContent, " UNUSED_PARAM(args);\n"); $implIncludes{"<runtime/Error.h>"} = 1; if ($interfaceName eq "DOMWindow") { - push(@implContent, " $className* castedThis = toJSDOMWindow(thisValue.toThisObject(exec));\n"); + push(@implContent, " $className* castedThis = toJSDOMWindow(exec->hostThisValue().toThisObject(exec));\n"); push(@implContent, " if (!castedThis)\n"); push(@implContent, " return throwError(exec, TypeError);\n"); } elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) { - push(@implContent, " $className* castedThis = to${className}(thisValue.toThisObject(exec));\n"); + push(@implContent, " $className* castedThis = to${className}(exec->hostThisValue().toThisObject(exec));\n"); push(@implContent, " if (!castedThis)\n"); push(@implContent, " return throwError(exec, TypeError);\n"); } else { + push(@implContent, " JSValue thisValue = exec->hostThisValue();\n"); push(@implContent, " if (!thisValue.inherits(&${className}::s_info))\n"); push(@implContent, " return throwError(exec, TypeError);\n"); push(@implContent, " $className* castedThis = static_cast<$className*>(asObject(thisValue));\n"); @@ -1832,12 +1832,12 @@ sub GenerateImplementation } if ($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}) { - push(@implContent, " return castedThis->" . $functionImplementationName . "(exec, args);\n"); + push(@implContent, " return castedThis->" . $functionImplementationName . "(exec);\n"); } elsif ($svgPODListType) { $implIncludes{"JS${svgPODListType}.h"} = 1; $implIncludes{"JSSVGPODListCustom.h"} = 1; push(@implContent, " return JSSVGPODListCustom::$functionImplementationName<$className, " . GetNativeType($svgPODListType) - . ">(castedThis, exec, args, to" . $svgPODListType . ");\n"); + . ">(castedThis, exec, to" . $svgPODListType . ");\n"); } else { push(@implContent, " $implType* imp = static_cast<$implType*>(castedThis->impl());\n"); push(@implContent, " $podType podImp(*imp);\n") if $podType; @@ -1846,7 +1846,7 @@ sub GenerateImplementation my $requiresAllArguments = $function->signature->extendedAttributes->{"RequiresAllArguments"}; if ($requiresAllArguments) { - push(@implContent, " if (args.size() < $numParameters)\n"); + push(@implContent, " if (exec->argumentCount() < $numParameters)\n"); if ($requiresAllArguments eq "Raise") { push(@implContent, " return throwError(exec, SyntaxError, \"Not enough arguments\");\n"); } else { @@ -1875,7 +1875,7 @@ sub GenerateImplementation my $hasOptionalArguments = 0; if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { - push(@implContent, " ScriptCallStack callStack(exec, args, $numParameters);\n"); + push(@implContent, " ScriptCallStack callStack(exec, $numParameters);\n"); $implIncludes{"ScriptCallStack.h"} = 1; } @@ -1899,7 +1899,7 @@ sub GenerateImplementation if ($parameter->extendedAttributes->{"Optional"}) { # Generate early call if there are enough parameters. if (!$hasOptionalArguments) { - push(@implContent, "\n int argsCount = args.size();\n"); + push(@implContent, "\n int argsCount = exec->argumentCount();\n"); $hasOptionalArguments = 1; } push(@implContent, " if (argsCount < " . ($paramIndex + 1) . ") {\n"); @@ -1911,15 +1911,15 @@ sub GenerateImplementation if ($parameter->type eq "XPathNSResolver") { push(@implContent, " RefPtr<XPathNSResolver> customResolver;\n"); - push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(args.at($paramIndex));\n"); + push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(exec->argument($paramIndex));\n"); push(@implContent, " if (!resolver) {\n"); - push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, args.at($paramIndex));\n"); + push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, exec->argument($paramIndex));\n"); push(@implContent, " if (exec->hadException())\n"); push(@implContent, " return jsUndefined();\n"); push(@implContent, " resolver = customResolver.get();\n"); push(@implContent, " }\n"); } else { - push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "args.at($paramIndex)") . ";\n"); + push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($paramIndex)") . ";\n"); # If a parameter is "an index" and it's negative it should throw an INDEX_SIZE_ERR exception. # But this needs to be done in the bindings, because the type is unsigned and the fact that it @@ -2719,7 +2719,7 @@ public: ${constructorClassName}(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), None); + putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), DontDelete | ReadOnly); } virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm index e06b274..89da48d 100644 --- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -224,7 +224,9 @@ sub ReadPublicInterfaces my $fileName = "WebCore/bindings/objc/PublicDOMInterfaces.h"; my $gccLocation = ""; - if (($Config::Config{'osname'}) =~ /solaris/i) { + if ($ENV{CC}) { + $gccLocation = $ENV{CC}; + } elsif (($Config::Config{'osname'}) =~ /solaris/i) { $gccLocation = "/usr/sfw/bin/gcc"; } else { $gccLocation = "/usr/bin/gcc"; diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index 0167a4f..c93c25a 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -2154,15 +2154,14 @@ sub GenerateCallbackHeader push(@headerContent, "#include <wtf/Forward.h>\n"); push(@headerContent, "\nnamespace WebCore {\n\n"); - push(@headerContent, "class Frame;\n\n"); push(@headerContent, "class $className : public $interfaceName {\n"); push(@headerContent, <<END); public: - static PassRefPtr<${className}> create(v8::Local<v8::Value> value, Frame* frame) + static PassRefPtr<${className}> create(v8::Local<v8::Value> value) { ASSERT(value->IsObject()); - return adoptRef(new ${className}(value->ToObject(), frame)); + return adoptRef(new ${className}(value->ToObject())); } virtual ~${className}(); @@ -2192,10 +2191,9 @@ END push(@headerContent, <<END); private: - ${className}(v8::Local<v8::Object>, Frame*); + ${className}(v8::Local<v8::Object>); v8::Persistent<v8::Object> m_callback; - RefPtr<Frame> m_frame; WorldContextHandle m_worldContext; }; @@ -2218,15 +2216,13 @@ sub GenerateCallbackImplementation # - Add default header template push(@implFixedHeader, GenerateImplementationContentHeader($dataNode)); - $implIncludes{"Frame.h"} = 1; $implIncludes{"ScriptExecutionContext.h"} = 1; $implIncludes{"V8CustomVoidCallback.h"} = 1; push(@implContent, "namespace WebCore {\n\n"); push(@implContent, <<END); -${className}::${className}(v8::Local<v8::Object> callback, Frame* frame) +${className}::${className}(v8::Local<v8::Object> callback) : m_callback(v8::Persistent<v8::Object>::New(callback)) - , m_frame(frame) , m_worldContext(UseCurrentWorld) { } @@ -2274,9 +2270,8 @@ END push(@implContent, join(",\n", @argvs)); push(@implContent, "\n };\n\n"); - push(@implContent, " RefPtr<Frame> protect(m_frame);\n\n"); push(@implContent, " bool callbackReturnValue = false;\n"); - push(@implContent, " return !invokeCallback(m_callback, " . scalar(@params). ", argv, callbackReturnValue);\n"); + push(@implContent, " return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, context);\n"); push(@implContent, "}\n"); } } diff --git a/WebCore/bindings/scripts/IDLParser.pm b/WebCore/bindings/scripts/IDLParser.pm index c6742dc..5b7beb3 100644 --- a/WebCore/bindings/scripts/IDLParser.pm +++ b/WebCore/bindings/scripts/IDLParser.pm @@ -66,7 +66,9 @@ sub Parse if (!$preprocessor) { require Config; my $gccLocation = ""; - if (($Config::Config{'osname'}) =~ /solaris/i) { + if ($ENV{CC}) { + $gccLocation = $ENV{CC}; + } elsif (($Config::Config{'osname'}) =~ /solaris/i) { $gccLocation = "/usr/sfw/bin/gcc"; } else { $gccLocation = "/usr/bin/gcc"; diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp index 6cfec74..505b59b 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp @@ -42,7 +42,7 @@ namespace WebKit { gpointer kit(WebCore::TestCallback* obj) { - g_return_val_if_fail(obj != 0, 0); + g_return_val_if_fail(obj, 0); if (gpointer ret = DOMObjectCache::get(obj)) return ret; @@ -98,31 +98,13 @@ G_DEFINE_TYPE(WebKitDOMTestCallback, webkit_dom_test_callback, WEBKIT_TYPE_DOM_O namespace WebKit { -WebKitDOMTestCallback* wrapTestCallback(WebCore::TestCallback* coreObject) -{ - g_return_val_if_fail(coreObject != 0, 0); - - WebKitDOMTestCallback* wrapper = WEBKIT_DOM_TEST_CALLBACK(g_object_new(WEBKIT_TYPE_DOM_TEST_CALLBACK, NULL)); - g_return_val_if_fail(wrapper != 0, 0); - - /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object - * in a C-allocated GObject structure. See the finalize() code for the - * matching deref(). - */ - - coreObject->ref(); - WEBKIT_DOM_OBJECT(wrapper)->coreObject = coreObject; - - return wrapper; -} - WebCore::TestCallback* core(WebKitDOMTestCallback* request) { - g_return_val_if_fail(request != 0, 0); - + g_return_val_if_fail(request, 0); + WebCore::TestCallback* coreObject = static_cast<WebCore::TestCallback*>(WEBKIT_DOM_OBJECT(request)->coreObject); - g_return_val_if_fail(coreObject != 0, 0); - + g_return_val_if_fail(coreObject, 0); + return coreObject; } @@ -136,7 +118,7 @@ static void webkit_dom_test_callback_finalize(GObject* object) { WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); - if (dom_object->coreObject != NULL) { + if (dom_object->coreObject) { WebCore::TestCallback* coreObject = static_cast<WebCore::TestCallback *>(dom_object->coreObject); WebKit::DOMObjectCache::forget(coreObject); @@ -177,10 +159,29 @@ static void webkit_dom_test_callback_class_init(WebKitDOMTestCallbackClass* requ - } static void webkit_dom_test_callback_init(WebKitDOMTestCallback* request) { } +namespace WebKit { +WebKitDOMTestCallback* wrapTestCallback(WebCore::TestCallback* coreObject) +{ + g_return_val_if_fail(coreObject, 0); + + WebKitDOMTestCallback* wrapper = WEBKIT_DOM_TEST_CALLBACK(g_object_new(WEBKIT_TYPE_DOM_TEST_CALLBACK, NULL)); + g_return_val_if_fail(wrapper, 0); + + /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object + * in a C-allocated GObject structure. See the finalize() code for the + * matching deref(). + */ + + coreObject->ref(); + WEBKIT_DOM_OBJECT(wrapper)->coreObject = coreObject; + + + return wrapper; +} +} // namespace WebKit diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp index 2be0277..17548d9 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp @@ -36,7 +36,7 @@ namespace WebKit { gpointer kit(WebCore::TestInterface* obj) { - g_return_val_if_fail(obj != 0, 0); + g_return_val_if_fail(obj, 0); if (gpointer ret = DOMObjectCache::get(obj)) return ret; @@ -51,31 +51,13 @@ G_DEFINE_TYPE(WebKitDOMTestInterface, webkit_dom_test_interface, WEBKIT_TYPE_DOM namespace WebKit { -WebKitDOMTestInterface* wrapTestInterface(WebCore::TestInterface* coreObject) -{ - g_return_val_if_fail(coreObject != 0, 0); - - WebKitDOMTestInterface* wrapper = WEBKIT_DOM_TEST_INTERFACE(g_object_new(WEBKIT_TYPE_DOM_TEST_INTERFACE, NULL)); - g_return_val_if_fail(wrapper != 0, 0); - - /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object - * in a C-allocated GObject structure. See the finalize() code for the - * matching deref(). - */ - - coreObject->ref(); - WEBKIT_DOM_OBJECT(wrapper)->coreObject = coreObject; - - return wrapper; -} - WebCore::TestInterface* core(WebKitDOMTestInterface* request) { - g_return_val_if_fail(request != 0, 0); - + g_return_val_if_fail(request, 0); + WebCore::TestInterface* coreObject = static_cast<WebCore::TestInterface*>(WEBKIT_DOM_OBJECT(request)->coreObject); - g_return_val_if_fail(coreObject != 0, 0); - + g_return_val_if_fail(coreObject, 0); + return coreObject; } @@ -89,7 +71,7 @@ static void webkit_dom_test_interface_finalize(GObject* object) { WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); - if (dom_object->coreObject != NULL) { + if (dom_object->coreObject) { WebCore::TestInterface* coreObject = static_cast<WebCore::TestInterface *>(dom_object->coreObject); WebKit::DOMObjectCache::forget(coreObject); @@ -130,10 +112,29 @@ static void webkit_dom_test_interface_class_init(WebKitDOMTestInterfaceClass* re - } static void webkit_dom_test_interface_init(WebKitDOMTestInterface* request) { } +namespace WebKit { +WebKitDOMTestInterface* wrapTestInterface(WebCore::TestInterface* coreObject) +{ + g_return_val_if_fail(coreObject, 0); + + WebKitDOMTestInterface* wrapper = WEBKIT_DOM_TEST_INTERFACE(g_object_new(WEBKIT_TYPE_DOM_TEST_INTERFACE, NULL)); + g_return_val_if_fail(wrapper, 0); + + /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object + * in a C-allocated GObject structure. See the finalize() code for the + * matching deref(). + */ + + coreObject->ref(); + WEBKIT_DOM_OBJECT(wrapper)->coreObject = coreObject; + + + return wrapper; +} +} // namespace WebKit diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 996bd01..2fa8c00 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -38,7 +38,7 @@ namespace WebKit { gpointer kit(WebCore::TestObj* obj) { - g_return_val_if_fail(obj != 0, 0); + g_return_val_if_fail(obj, 0); if (gpointer ret = DOMObjectCache::get(obj)) return ret; @@ -540,31 +540,13 @@ G_DEFINE_TYPE(WebKitDOMTestObj, webkit_dom_test_obj, WEBKIT_TYPE_DOM_OBJECT) namespace WebKit { -WebKitDOMTestObj* wrapTestObj(WebCore::TestObj* coreObject) -{ - g_return_val_if_fail(coreObject != 0, 0); - - WebKitDOMTestObj* wrapper = WEBKIT_DOM_TEST_OBJ(g_object_new(WEBKIT_TYPE_DOM_TEST_OBJ, NULL)); - g_return_val_if_fail(wrapper != 0, 0); - - /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object - * in a C-allocated GObject structure. See the finalize() code for the - * matching deref(). - */ - - coreObject->ref(); - WEBKIT_DOM_OBJECT(wrapper)->coreObject = coreObject; - - return wrapper; -} - WebCore::TestObj* core(WebKitDOMTestObj* request) { - g_return_val_if_fail(request != 0, 0); - + g_return_val_if_fail(request, 0); + WebCore::TestObj* coreObject = static_cast<WebCore::TestObj*>(WEBKIT_DOM_OBJECT(request)->coreObject); - g_return_val_if_fail(coreObject != 0, 0); - + g_return_val_if_fail(coreObject, 0); + return coreObject; } @@ -591,7 +573,7 @@ static void webkit_dom_test_obj_finalize(GObject* object) { WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); - if (dom_object->coreObject != NULL) { + if (dom_object->coreObject) { WebCore::TestObj* coreObject = static_cast<WebCore::TestObj *>(dom_object->coreObject); WebKit::DOMObjectCache::forget(coreObject); @@ -829,10 +811,29 @@ G_MAXLONG, /* max */ WEBKIT_PARAM_READABLE)); - } static void webkit_dom_test_obj_init(WebKitDOMTestObj* request) { } +namespace WebKit { +WebKitDOMTestObj* wrapTestObj(WebCore::TestObj* coreObject) +{ + g_return_val_if_fail(coreObject, 0); + + WebKitDOMTestObj* wrapper = WEBKIT_DOM_TEST_OBJ(g_object_new(WEBKIT_TYPE_DOM_TEST_OBJ, NULL)); + g_return_val_if_fail(wrapper, 0); + + /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object + * in a C-allocated GObject structure. See the finalize() code for the + * matching deref(). + */ + + coreObject->ref(); + WEBKIT_DOM_OBJECT(wrapper)->coreObject = coreObject; + + + return wrapper; +} +} // namespace WebKit diff --git a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index 51eb4ec..a230aef 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -64,7 +64,7 @@ public: JSTestInterfaceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSTestInterfaceConstructor::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, JSTestInterfacePrototype::self(exec, globalObject), None); + putDirect(exec->propertyNames().prototype, JSTestInterfacePrototype::self(exec, globalObject), DontDelete | ReadOnly); } virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); @@ -140,7 +140,7 @@ JSTestInterface::~JSTestInterface() JSObject* JSTestInterface::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { - return new (exec) JSTestInterfacePrototype(JSTestInterfacePrototype::createStructure(globalObject->objectPrototype())); + return new (exec) JSTestInterfacePrototype(globalObject, JSTestInterfacePrototype::createStructure(globalObject->objectPrototype())); } bool JSTestInterface::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) diff --git a/WebCore/bindings/scripts/test/JS/JSTestInterface.h b/WebCore/bindings/scripts/test/JS/JSTestInterface.h index c076dbd..23b183b 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestInterface.h +++ b/WebCore/bindings/scripts/test/JS/JSTestInterface.h @@ -23,6 +23,7 @@ #include "JSDOMBinding.h" #include <runtime/JSGlobalObject.h> +#include <runtime/JSObjectWithGlobalObject.h> #include <runtime/ObjectPrototype.h> namespace WebCore { @@ -57,8 +58,8 @@ protected: JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestInterface*); TestInterface* toTestInterface(JSC::JSValue); -class JSTestInterfacePrototype : public JSC::JSObject { - typedef JSC::JSObject Base; +class JSTestInterfacePrototype : public JSC::JSObjectWithGlobalObject { + typedef JSC::JSObjectWithGlobalObject Base; public: static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); virtual const JSC::ClassInfo* classInfo() const { return &s_info; } @@ -67,7 +68,7 @@ public: { return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); } - JSTestInterfacePrototype(NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { } + JSTestInterfacePrototype(JSC::JSGlobalObject* globalObject, NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObjectWithGlobalObject(globalObject, structure) { } protected: static const unsigned StructureFlags = Base::StructureFlags; }; diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 926d137..1e563c6 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -86,7 +86,7 @@ public: JSTestObjConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSTestObjConstructor::createStructure(globalObject->objectPrototype()), globalObject) { - putDirect(exec->propertyNames().prototype, JSTestObjPrototype::self(exec, globalObject), None); + putDirect(exec->propertyNames().prototype, JSTestObjPrototype::self(exec, globalObject), DontDelete | ReadOnly); } virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); @@ -188,7 +188,7 @@ JSTestObj::~JSTestObj() JSObject* JSTestObj::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { - return new (exec) JSTestObjPrototype(JSTestObjPrototype::createStructure(globalObject->objectPrototype())); + return new (exec) JSTestObjPrototype(globalObject, JSTestObjPrototype::createStructure(globalObject->objectPrototype())); } bool JSTestObj::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) @@ -396,9 +396,9 @@ JSValue JSTestObj::getConstructor(ExecState* exec, JSGlobalObject* globalObject) return getDOMConstructor<JSTestObjConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -408,24 +408,24 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec, JSOb return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int intArg = args.at(0).toInt32(exec); - const String& strArg = ustringToString(args.at(1).toString(exec)); - TestObj* objArg = toTestObj(args.at(2)); + int intArg = exec->argument(0).toInt32(exec); + const String& strArg = ustringToString(exec->argument(1).toString(exec)); + TestObj* objArg = toTestObj(exec->argument(2)); imp->voidMethodWithArgs(intArg, strArg, objArg); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -436,25 +436,25 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec, JSObj return result; } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int intArg = args.at(0).toInt32(exec); - const String& strArg = ustringToString(args.at(1).toString(exec)); - TestObj* objArg = toTestObj(args.at(2)); + int intArg = exec->argument(0).toInt32(exec); + const String& strArg = ustringToString(exec->argument(1).toString(exec)); + TestObj* objArg = toTestObj(exec->argument(2)); JSC::JSValue result = jsNumber(exec, imp->intMethodWithArgs(intArg, strArg, objArg)); return result; } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -465,51 +465,51 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec, JSObj return result; } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int intArg = args.at(0).toInt32(exec); - const String& strArg = ustringToString(args.at(1).toString(exec)); - TestObj* objArg = toTestObj(args.at(2)); + int intArg = exec->argument(0).toInt32(exec); + const String& strArg = ustringToString(exec->argument(1).toString(exec)); + TestObj* objArg = toTestObj(exec->argument(2)); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethodWithArgs(intArg, strArg, objArg))); return result; } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - if (args.size() < 2) + if (exec->argumentCount() < 2) return jsUndefined(); - const String& strArg = ustringToString(args.at(0).toString(exec)); - TestObj* objArg = toTestObj(args.at(1)); + const String& strArg = ustringToString(exec->argument(0).toString(exec)); + TestObj* objArg = toTestObj(exec->argument(1)); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgs(strArg, objArg))); return result; } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - if (args.size() < 2) + if (exec->argumentCount() < 2) return throwError(exec, SyntaxError, "Not enough arguments"); ExceptionCode ec = 0; - const String& strArg = ustringToString(args.at(0).toString(exec)); - TestObj* objArg = toTestObj(args.at(1)); + const String& strArg = ustringToString(exec->argument(0).toString(exec)); + TestObj* objArg = toTestObj(exec->argument(1)); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec))); @@ -517,22 +517,22 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThro return result; } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, args.at(0)); + RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, exec->argument(0)); imp->serializedValue(serializedArg); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -544,71 +544,71 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* e return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - return castedThis->customMethod(exec, args); + return castedThis->customMethod(exec); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - return castedThis->customMethodWithArgs(exec, args); + return castedThis->customMethodWithArgs(exec); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; - ScriptCallStack callStack(exec, args, 1); - log* intArg = tolog(args.at(0)); + ScriptCallStack callStack(exec, 1); + log* intArg = tolog(exec->argument(0)); imp->customArgsAndException(intArg, &callStack, ec); setDOMException(exec, ec); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue listener = args.at(1); + JSValue listener = exec->argument(1); if (!listener.isObject()) return jsUndefined(); - imp->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), args.at(2).toBoolean(exec)); + imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue listener = args.at(1); + JSValue listener = exec->argument(1); if (!listener.isObject()) return jsUndefined(); - imp->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec)); + imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -621,9 +621,9 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -631,15 +631,15 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) return jsUndefined(); - int intArg = args.at(1).toInt32(exec); + int intArg = exec->argument(1).toInt32(exec); imp->withDynamicFrameAndArg(dynamicFrame, intArg); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -647,23 +647,23 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(E Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) return jsUndefined(); - int intArg = args.at(1).toInt32(exec); + int intArg = exec->argument(1).toInt32(exec); - int argsCount = args.size(); + int argsCount = exec->argumentCount(); if (argsCount < 3) { imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg); return jsUndefined(); } - int optionalArg = args.at(2).toInt32(exec); + int optionalArg = exec->argument(2).toInt32(exec); imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -671,15 +671,15 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(E Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) return jsUndefined(); - int intArg = args.at(1).toInt32(exec); + int intArg = exec->argument(1).toInt32(exec); imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec)); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -687,23 +687,23 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureAS Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) return jsUndefined(); - int intArg = args.at(1).toInt32(exec); + int intArg = exec->argument(1).toInt32(exec); - int argsCount = args.size(); + int argsCount = exec->argumentCount(); if (argsCount < 3) { imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg); return jsUndefined(); } - int optionalArg = args.at(2).toInt32(exec); + int optionalArg = exec->argument(2).toInt32(exec); imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec)); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -713,9 +713,9 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* e return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -728,9 +728,9 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* ex return result; } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -742,9 +742,9 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(Exe return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); @@ -759,140 +759,140 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(Exec return result; } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int argsCount = args.size(); + int argsCount = exec->argumentCount(); if (argsCount < 1) { imp->methodWithOptionalArg(); return jsUndefined(); } - int opt = args.at(0).toInt32(exec); + int opt = exec->argument(0).toInt32(exec); imp->methodWithOptionalArg(opt); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int nonOpt = args.at(0).toInt32(exec); + int nonOpt = exec->argument(0).toInt32(exec); - int argsCount = args.size(); + int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->methodWithNonOptionalArgAndOptionalArg(nonOpt); return jsUndefined(); } - int opt = args.at(1).toInt32(exec); + int opt = exec->argument(1).toInt32(exec); imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int nonOpt = args.at(0).toInt32(exec); + int nonOpt = exec->argument(0).toInt32(exec); - int argsCount = args.size(); + int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt); return jsUndefined(); } - int opt1 = args.at(1).toInt32(exec); - int opt2 = args.at(2).toInt32(exec); + int opt1 = exec->argument(1).toInt32(exec); + int opt2 = exec->argument(2).toInt32(exec); imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - TestObj* objArg = toTestObj(args.at(0)); - const String& strArg = ustringToString(args.at(1).toString(exec)); + TestObj* objArg = toTestObj(exec->argument(0)); + const String& strArg = ustringToString(exec->argument(1).toString(exec)); imp->overloadedMethod(objArg, strArg); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - TestObj* objArg = toTestObj(args.at(0)); + TestObj* objArg = toTestObj(exec->argument(0)); - int argsCount = args.size(); + int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->overloadedMethod(objArg); return jsUndefined(); } - int intArg = args.at(1).toInt32(exec); + int intArg = exec->argument(1).toInt32(exec); imp->overloadedMethod(objArg, intArg); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - const String& strArg = ustringToString(args.at(0).toString(exec)); + const String& strArg = ustringToString(exec->argument(0).toString(exec)); imp->overloadedMethod(strArg); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec) { - UNUSED_PARAM(args); + JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwError(exec, TypeError); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - int intArg = args.at(0).toInt32(exec); + int intArg = exec->argument(0).toInt32(exec); imp->overloadedMethod(intArg); return jsUndefined(); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) +JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) { - if ((args.size() == 2 && (args.at(0).isNull() || asObject(args.at(0))->inherits(JSTestObj::s_info) && (args.at(1).isNull() || args.at(1).isUndefined() || args.at(1).isString() || args.at(1).isObject()))) - return jsTestObjPrototypeFunctionOverloadedMethod1(exec, thisValue, args); - if ((args.size() == 1 && (args.at(0).isNull() || asObject(args.at(0))->inherits(JSTestObj::s_info)) || (args.size() == 2 && (args.at(0).isNull() || asObject(args.at(0))->inherits(JSTestObj::s_info))) - return jsTestObjPrototypeFunctionOverloadedMethod2(exec, thisValue, args); - if ((args.size() == 1 && (args.at(0).isNull() || args.at(0).isUndefined() || args.at(0).isString() || args.at(0).isObject()))) - return jsTestObjPrototypeFunctionOverloadedMethod3(exec, thisValue, args); - if (args.size() == 1) - return jsTestObjPrototypeFunctionOverloadedMethod4(exec, thisValue, args); + if ((exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info) && (exec->argument(1).isNull() || exec->argument(1).isUndefined() || exec->argument(1).isString() || exec->argument(1).isObject()))) + return jsTestObjPrototypeFunctionOverloadedMethod1(exec); + if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info)) || (exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info))) + return jsTestObjPrototypeFunctionOverloadedMethod2(exec); + if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || exec->argument(0).isUndefined() || exec->argument(0).isString() || exec->argument(0).isObject()))) + return jsTestObjPrototypeFunctionOverloadedMethod3(exec); + if (exec->argumentCount() == 1) + return jsTestObjPrototypeFunctionOverloadedMethod4(exec); return throwError(exec, TypeError); } diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.h b/WebCore/bindings/scripts/test/JS/JSTestObj.h index a1f208d..38cf8c2 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -23,6 +23,7 @@ #include "JSDOMBinding.h" #include <runtime/JSGlobalObject.h> +#include <runtime/JSObjectWithGlobalObject.h> #include <runtime/ObjectPrototype.h> namespace WebCore { @@ -53,8 +54,8 @@ public: void setCustomAttr(JSC::ExecState*, JSC::JSValue); // Custom functions - JSC::JSValue customMethod(JSC::ExecState*, const JSC::ArgList&); - JSC::JSValue customMethodWithArgs(JSC::ExecState*, const JSC::ArgList&); + JSC::JSValue customMethod(JSC::ExecState*); + JSC::JSValue customMethodWithArgs(JSC::ExecState*); TestObj* impl() const { return m_impl.get(); } private: @@ -66,8 +67,8 @@ protected: JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestObj*); TestObj* toTestObj(JSC::JSValue); -class JSTestObjPrototype : public JSC::JSObject { - typedef JSC::JSObject Base; +class JSTestObjPrototype : public JSC::JSObjectWithGlobalObject { + typedef JSC::JSObjectWithGlobalObject Base; public: static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); virtual const JSC::ClassInfo* classInfo() const { return &s_info; } @@ -78,41 +79,41 @@ public: { return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); } - JSTestObjPrototype(NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { } + JSTestObjPrototype(JSC::JSGlobalObject* globalObject, NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObjectWithGlobalObject(globalObject, structure) { } protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; }; // Functions -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*); +JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*); // Attributes JSC::JSValue jsTestObjReadOnlyIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); diff --git a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp index e72330d..e8be71d 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp @@ -23,7 +23,6 @@ #if ENABLE(DATABASE) -#include "Frame.h" #include "ScriptExecutionContext.h" #include "V8Class1.h" #include "V8Class2.h" @@ -32,9 +31,8 @@ namespace WebCore { -V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback, Frame* frame) +V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback) : m_callback(v8::Persistent<v8::Object>::New(callback)) - , m_frame(frame) , m_worldContext(UseCurrentWorld) { } @@ -60,10 +58,8 @@ bool V8TestCallback::callbackWithClass1Param(ScriptExecutionContext* context, Cl toV8(class1Param) }; - RefPtr<Frame> protect(m_frame); - bool callbackReturnValue = false; - return !invokeCallback(m_callback, 1, argv, callbackReturnValue); + return !invokeCallback(m_callback, 1, argv, callbackReturnValue, context); } bool V8TestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Class2* class2Param, const String& strArg) @@ -81,10 +77,8 @@ bool V8TestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Cl toV8(strArg) }; - RefPtr<Frame> protect(m_frame); - bool callbackReturnValue = false; - return !invokeCallback(m_callback, 2, argv, callbackReturnValue); + return !invokeCallback(m_callback, 2, argv, callbackReturnValue, context); } } // namespace WebCore diff --git a/WebCore/bindings/scripts/test/V8/V8TestCallback.h b/WebCore/bindings/scripts/test/V8/V8TestCallback.h index f58f3f0..aed6b22 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestCallback.h +++ b/WebCore/bindings/scripts/test/V8/V8TestCallback.h @@ -30,14 +30,12 @@ namespace WebCore { -class Frame; - class V8TestCallback : public TestCallback { public: - static PassRefPtr<V8TestCallback> create(v8::Local<v8::Value> value, Frame* frame) + static PassRefPtr<V8TestCallback> create(v8::Local<v8::Value> value) { ASSERT(value->IsObject()); - return adoptRef(new V8TestCallback(value->ToObject(), frame)); + return adoptRef(new V8TestCallback(value->ToObject())); } virtual ~V8TestCallback(); @@ -49,10 +47,9 @@ public: virtual int customCallback(ScriptExecutionContext*, Class5* class5Param, Class6* class6Param); private: - V8TestCallback(v8::Local<v8::Object>, Frame*); + V8TestCallback(v8::Local<v8::Object>); v8::Persistent<v8::Object> m_callback; - RefPtr<Frame> m_frame; WorldContextHandle m_worldContext; }; diff --git a/WebCore/bindings/v8/ScriptArray.h b/WebCore/bindings/v8/ScriptArray.h index 6e8f852..9f40fbf 100644 --- a/WebCore/bindings/v8/ScriptArray.h +++ b/WebCore/bindings/v8/ScriptArray.h @@ -41,6 +41,7 @@ namespace WebCore { class ScriptArray : public ScriptObject { public: ScriptArray(ScriptState* scriptState, v8::Handle<v8::Array>); + ScriptArray() {}; virtual ~ScriptArray() {} bool set(unsigned index, const ScriptObject&); diff --git a/WebCore/bindings/v8/ScriptCallStack.cpp b/WebCore/bindings/v8/ScriptCallStack.cpp index 9bc2953..e55f8b5 100644 --- a/WebCore/bindings/v8/ScriptCallStack.cpp +++ b/WebCore/bindings/v8/ScriptCallStack.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "ScriptCallStack.h" +#include "ScriptScope.h" #include "ScriptController.h" #include "ScriptDebugServer.h" #include "V8Binding.h" @@ -40,8 +41,6 @@ namespace WebCore { -v8::Persistent<v8::Context> ScriptCallStack::s_utilityContext; - ScriptCallStack* ScriptCallStack::create(const v8::Arguments& arguments, unsigned skipArgumentCount) { String sourceName; int sourceLineNumber; @@ -53,12 +52,34 @@ ScriptCallStack* ScriptCallStack::create(const v8::Arguments& arguments, unsigne bool ScriptCallStack::callLocation(String* sourceName, int* sourceLineNumber, String* functionName) { +<<<<<<< HEAD #if PLATFORM(ANDROID) return false; #else if (!topStackFrame(*sourceName, *sourceLineNumber, *functionName)) +======= + v8::HandleScope scope; + v8::Context::Scope contextScope(v8::Context::GetCurrent()); + v8::Handle<v8::StackTrace> stackTrace(v8::StackTrace::CurrentStackTrace(1)); + if (stackTrace.IsEmpty()) +>>>>>>> webkit.org at r60469 return false; - *sourceLineNumber += 1; + if (stackTrace->GetFrameCount() <= 0) { + // Successfully grabbed stack trace, but there are no frames. + // Fallback to setting lineNumber to 0, and source and function name to "undefined". + *sourceName = toWebCoreString(v8::Undefined()); + *sourceLineNumber = 0; + *functionName = toWebCoreString(v8::Undefined()); + return true; + } + v8::Handle<v8::StackFrame> frame = stackTrace->GetFrame(0); + // There must be at least one valid frame. + ASSERT(!frame.IsEmpty()); + v8::Local<v8::String> sourceNameValue(frame->GetScriptName()); + v8::Local<v8::String> functionNameValue(frame->GetFunctionName()); + *sourceName = sourceNameValue.IsEmpty() ? "" : toWebCoreString(sourceNameValue); + *functionName = functionNameValue.IsEmpty() ? "" : toWebCoreString(functionNameValue); + *sourceLineNumber = frame->GetLineNumber(); return true; #endif } @@ -81,66 +102,13 @@ const ScriptCallFrame& ScriptCallStack::at(unsigned index) const return m_lastCaller; } -// Create the utility context for holding JavaScript functions used internally -// which are not visible to JavaScript executing on the page. -void ScriptCallStack::createUtilityContext() +bool ScriptCallStack::stackTrace(int frameLimit, ScriptState* state, ScriptArray& stackTrace) { - ASSERT(s_utilityContext.IsEmpty()); - - v8::HandleScope scope; - v8::Handle<v8::ObjectTemplate> globalTemplate = v8::ObjectTemplate::New(); - s_utilityContext = v8::Context::New(0, globalTemplate); - v8::Context::Scope contextScope(s_utilityContext); - - // Compile JavaScript function for retrieving the source line, the source - // name and the symbol name for the top JavaScript stack frame. - const char* topStackFrame = - "function topStackFrame(exec_state) {" - " if (!exec_state.frameCount())" - " return undefined;" - " var frame = exec_state.frame(0);" - " var func = frame.func();" - " var scriptName;" - " if (func.resolved() && func.script())" - " scriptName = func.script().name();" - " return [scriptName, frame.sourceLine(), (func.name() || func.inferredName())];" - "}"; - v8::Script::Compile(v8::String::New(topStackFrame))->Run(); -} - -bool ScriptCallStack::topStackFrame(String& sourceName, int& lineNumber, String& functionName) -{ - v8::HandleScope scope; - v8::Handle<v8::Context> v8UtilityContext = utilityContext(); - if (v8UtilityContext.IsEmpty()) - return false; - v8::Context::Scope contextScope(v8UtilityContext); - v8::Handle<v8::Function> topStackFrame; - topStackFrame = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("topStackFrame"))); - if (topStackFrame.IsEmpty()) - return false; - v8::Handle<v8::Value> value = v8::Debug::Call(topStackFrame); - if (value.IsEmpty()) - return false; - // If there is no top stack frame, we still return success, but fill the input params with defaults. - if (value->IsUndefined()) { - // Fallback to setting lineNumber to 0, and source and function name to "undefined". - sourceName = toWebCoreString(value); - lineNumber = 0; - functionName = toWebCoreString(value); - return true; - } - if (!value->IsArray()) - return false; - v8::Local<v8::Object> jsArray = value->ToObject(); - v8::Local<v8::Value> sourceNameValue = jsArray->Get(0); - v8::Local<v8::Value> lineNumberValue = jsArray->Get(1); - v8::Local<v8::Value> functionNameValue = jsArray->Get(2); - if (sourceNameValue.IsEmpty() || lineNumberValue.IsEmpty() || functionNameValue.IsEmpty()) + ScriptScope scope(state); + v8::Handle<v8::StackTrace> trace(v8::StackTrace::CurrentStackTrace(frameLimit)); + if (trace.IsEmpty() || !trace->GetFrameCount()) return false; - sourceName = toWebCoreString(sourceNameValue); - lineNumber = lineNumberValue->Int32Value(); - functionName = toWebCoreString(functionNameValue); + stackTrace = ScriptArray(state, trace->AsArray()); return true; } diff --git a/WebCore/bindings/v8/ScriptCallStack.h b/WebCore/bindings/v8/ScriptCallStack.h index 11ec3bb..8b02814 100644 --- a/WebCore/bindings/v8/ScriptCallStack.h +++ b/WebCore/bindings/v8/ScriptCallStack.h @@ -31,6 +31,7 @@ #ifndef ScriptCallStack_h #define ScriptCallStack_h +#include "ScriptArray.h" #include "ScriptCallFrame.h" #include "ScriptState.h" #include "ScriptValue.h" @@ -47,7 +48,16 @@ public: static ScriptCallStack* create(const v8::Arguments&, unsigned skipArgumentCount = 0); ~ScriptCallStack(); - static bool callLocation(String* sourceName, int* sourceLineNumber, String* functionName); + // Returns false if there is no running JavaScript or if fetching the stack failed. + // Sets stackTrace to be an array of stack frame objects. + // A stack frame object looks like: + // { + // scriptName: <file name for the associated script resource> + // functionName: <name of the JavaScript function> + // lineNumber: <1 based line number> + // column: <1 based column offset on the line> + // } + static bool stackTrace(int frameLimit, ScriptState* state, ScriptArray& stackTrace); const ScriptCallFrame& at(unsigned) const; // FIXME: implement retrieving and storing call stack trace @@ -59,30 +69,10 @@ public: private: ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber, String funcName); - // Function for retrieving the source name, line number and function name for the top - // JavaScript stack frame. - // - // It will return true if the caller information was successfully retrieved and written - // into the function parameters, otherwise the function will return false. It may - // fail due to a stack overflow in the underlying JavaScript implementation, handling - // of such exception is up to the caller. - static bool topStackFrame(String& sourceName, int& lineNumber, String& functionName); - - static void createUtilityContext(); - - // Returns a local handle of the utility context. - static v8::Local<v8::Context> utilityContext() - { - if (s_utilityContext.IsEmpty()) - createUtilityContext(); - return v8::Local<v8::Context>::New(s_utilityContext); - } + static bool callLocation(String* sourceName, int* sourceLineNumber, String* functionName); ScriptCallFrame m_lastCaller; ScriptState* m_scriptState; - - // Utility context holding JavaScript functions used internally. - static v8::Persistent<v8::Context> s_utilityContext; }; } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp index 41cb5a2..f6cf3a4 100644 --- a/WebCore/bindings/v8/ScriptController.cpp +++ b/WebCore/bindings/v8/ScriptController.cpp @@ -467,4 +467,12 @@ void ScriptController::updateDocument() m_proxy->windowShell()->updateDocument(); } +void ScriptController::namedItemAdded(HTMLDocument* doc, const AtomicString& name) +{ +} + +void ScriptController::namedItemRemoved(HTMLDocument* doc, const AtomicString& name) +{ +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h index ee39e9a..5d4b83e 100644 --- a/WebCore/bindings/v8/ScriptController.h +++ b/WebCore/bindings/v8/ScriptController.h @@ -169,6 +169,9 @@ public: void clearWindowShell(bool = false); void updateDocument(); + void namedItemAdded(HTMLDocument*, const AtomicString&); + void namedItemRemoved(HTMLDocument*, const AtomicString&); + void updateSecurityOrigin(); void clearScriptObjects(); void updatePlatformScriptObjects(); diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp index ce258fb..fdbb26b 100644 --- a/WebCore/bindings/v8/ScriptDebugServer.cpp +++ b/WebCore/bindings/v8/ScriptDebugServer.cpp @@ -44,7 +44,24 @@ namespace WebCore { -ScriptDebugServer::MessageLoopDispatchHandler ScriptDebugServer::s_messageLoopDispatchHandler = 0; +#if ENABLE(V8_SCRIPT_DEBUG_SERVER) +static Frame* retrieveFrame(v8::Handle<v8::Context> context) +{ + if (context.IsEmpty()) + return 0; + + // Test that context has associated global dom window object. + v8::Handle<v8::Object> global = context->Global(); + if (global.IsEmpty()) + return 0; + + global = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global); + if (global.IsEmpty()) + return 0; + + return V8Proxy::retrieveFrame(context); +} +#endif ScriptDebugServer& ScriptDebugServer::shared() { @@ -54,7 +71,7 @@ ScriptDebugServer& ScriptDebugServer::shared() ScriptDebugServer::ScriptDebugServer() : m_pauseOnExceptionsState(DontPauseOnExceptions) - , m_currentCallFrameState(0) + , m_pausedPage(0) { } @@ -73,8 +90,7 @@ void ScriptDebugServer::addListener(ScriptDebugListener* listener, Page* page) if (!m_listenersMap.size()) { ensureDebuggerScriptCompiled(); ASSERT(!m_debuggerScript.get()->IsUndefined()); - v8::Debug::SetMessageHandler2(&ScriptDebugServer::onV8DebugMessage); - v8::Debug::SetHostDispatchHandler(&ScriptDebugServer::onV8DebugHostDispatch, 100 /* ms */); + v8::Debug::SetDebugEventListener2(&ScriptDebugServer::v8DebugEventCallback); } m_listenersMap.set(page, listener); V8Proxy* proxy = V8Proxy::retrieve(page->mainFrame()); @@ -97,17 +113,14 @@ void ScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page if (!m_listenersMap.contains(page)) return; + if (m_pausedPage == page) + continueProgram(); + m_listenersMap.remove(page); - if (m_listenersMap.isEmpty()) { - v8::Debug::SetMessageHandler2(0); - v8::Debug::SetHostDispatchHandler(0); - } + if (m_listenersMap.isEmpty()) + v8::Debug::SetDebugEventListener(0); // FIXME: Remove all breakpoints set by the agent. - // FIXME: Force continue if detach happened in nessted message loop while - // debugger was paused on a breakpoint(as long as there are other - // attached agents v8 will wait for explicit'continue' message). - // FIXME: send continue command to v8 if necessary; } void ScriptDebugServer::setBreakpoint(const String& sourceID, unsigned lineNumber, ScriptBreakpoint breakpoint) @@ -152,8 +165,8 @@ void ScriptDebugServer::clearBreakpoints() v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext(); v8::Context::Scope contextScope(debuggerContext); - v8::Handle<v8::Function> setBreakpointsActivated = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("clearBreakpoints"))); - v8::Debug::Call(setBreakpointsActivated); + v8::Handle<v8::Function> clearBreakpoints = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("clearBreakpoints"))); + v8::Debug::Call(clearBreakpoints); #endif } @@ -179,9 +192,9 @@ ScriptDebugServer::PauseOnExceptionsState ScriptDebugServer::pauseOnExceptionsSt v8::HandleScope scope; v8::Context::Scope contextScope(v8::Debug::GetDebugContext()); - v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("pauseOnExceptionsState"))); + v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("pauseOnExceptionsState"))); v8::Handle<v8::Value> argv[] = { v8::Handle<v8::Value>() }; - v8::Handle<v8::Value> result = currentCallFrameFunction->Call(m_debuggerScript.get(), 0, argv); + v8::Handle<v8::Value> result = function->Call(m_debuggerScript.get(), 0, argv); return static_cast<ScriptDebugServer::PauseOnExceptionsState>(result->Int32Value()); #else return DontPauseOnExceptions; @@ -195,17 +208,17 @@ void ScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pauseOn v8::HandleScope scope; v8::Context::Scope contextScope(v8::Debug::GetDebugContext()); - v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("setPauseOnExceptionsState"))); + v8::Handle<v8::Function> setPauseOnExceptionsFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("setPauseOnExceptionsState"))); v8::Handle<v8::Value> argv[] = { v8::Int32::New(pauseOnExceptionsState) }; - currentCallFrameFunction->Call(m_debuggerScript.get(), 1, argv); + setPauseOnExceptionsFunction->Call(m_debuggerScript.get(), 1, argv); #endif } void ScriptDebugServer::continueProgram() { #if ENABLE(V8_SCRIPT_DEBUG_SERVER) - String cmd("{\"seq\":1,\"type\":\"request\",\"command\":\"continue\"}"); - v8::Debug::SendCommand(reinterpret_cast<const uint16_t*>(cmd.characters()), cmd.length(), new v8::Debug::ClientData()); + if (m_pausedPage) + m_clientMessageLoop->quitNow(); didResume(); #endif } @@ -213,35 +226,36 @@ void ScriptDebugServer::continueProgram() void ScriptDebugServer::stepIntoStatement() { #if ENABLE(V8_SCRIPT_DEBUG_SERVER) - String cmd("{\"seq\":1,\"type\":\"request\",\"command\":\"continue\",\"arguments\":{\"stepaction\":\"in\"}}"); - v8::Debug::SendCommand(reinterpret_cast<const uint16_t*>(cmd.characters()), cmd.length(), new v8::Debug::ClientData()); - didResume(); + ASSERT(m_pausedPage); + v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("stepIntoStatement"))); + v8::Handle<v8::Value> argv[] = { m_executionState.get() }; + function->Call(m_debuggerScript.get(), 1, argv); + continueProgram(); #endif } void ScriptDebugServer::stepOverStatement() { #if ENABLE(V8_SCRIPT_DEBUG_SERVER) - String cmd("{\"seq\":1,\"type\":\"request\",\"command\":\"continue\",\"arguments\":{\"stepaction\":\"next\"}}"); - v8::Debug::SendCommand(reinterpret_cast<const uint16_t*>(cmd.characters()), cmd.length(), new v8::Debug::ClientData()); - didResume(); + ASSERT(m_pausedPage); + v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("stepOverStatement"))); + v8::Handle<v8::Value> argv[] = { m_executionState.get() }; + function->Call(m_debuggerScript.get(), 1, argv); + continueProgram(); #endif } void ScriptDebugServer::stepOutOfFunction() { #if ENABLE(V8_SCRIPT_DEBUG_SERVER) - String cmd("{\"seq\":1,\"type\":\"request\",\"command\":\"continue\",\"arguments\":{\"stepaction\":\"out\"}}"); - v8::Debug::SendCommand(reinterpret_cast<const uint16_t*>(cmd.characters()), cmd.length(), new v8::Debug::ClientData()); - didResume(); + ASSERT(m_pausedPage); + v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("stepOutOfFunction"))); + v8::Handle<v8::Value> argv[] = { m_executionState.get() }; + function->Call(m_debuggerScript.get(), 1, argv); + continueProgram(); #endif } -ScriptState* ScriptDebugServer::currentCallFrameState() -{ - return m_currentCallFrameState; -} - PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::currentCallFrame() { if (!m_currentCallFrame) { @@ -253,90 +267,59 @@ PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::currentCallFrame() return m_currentCallFrame; } -void ScriptDebugServer::onV8DebugMessage(const v8::Debug::Message& message) -{ - ScriptDebugServer::shared().handleV8DebugMessage(message); -} - -void ScriptDebugServer::onV8DebugHostDispatch() -{ - ScriptDebugServer::shared().handleV8DebugHostDispatch(); -} - -void ScriptDebugServer::handleV8DebugHostDispatch() +#if ENABLE(V8_SCRIPT_DEBUG_SERVER) +void ScriptDebugServer::v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails) { - if (!s_messageLoopDispatchHandler) - return; - - Vector<WebCore::Page*> pages; - for (ListenersMap::iterator it = m_listenersMap.begin(); it != m_listenersMap.end(); ++it) - pages.append(it->first); - - s_messageLoopDispatchHandler(pages); + ScriptDebugServer::shared().handleV8DebugEvent(eventDetails); } -void ScriptDebugServer::handleV8DebugMessage(const v8::Debug::Message& message) +void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails) { - v8::HandleScope scope; - - if (!message.IsEvent()) - return; - - // Ignore unsupported event types. - if (message.GetEvent() != v8::AfterCompile && message.GetEvent() != v8::Break && message.GetEvent() != v8::Exception) - return; - - v8::Handle<v8::Context> context = message.GetEventContext(); - // If the context is from one of the inpected tabs it should have its context - // data. Skip events from unknown contexts. - if (context.IsEmpty()) - return; - - // Test that context has associated global dom window object. - v8::Handle<v8::Object> global = context->Global(); - if (global.IsEmpty()) + v8::DebugEvent event = eventDetails.GetEvent(); + if (event != v8::Break && event != v8::Exception && event != v8::AfterCompile) return; - global = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global); - if (global.IsEmpty()) - return; + v8::Handle<v8::Context> eventContext = eventDetails.GetEventContext(); + ASSERT(!eventContext.IsEmpty()); - bool handled = false; - Frame* frame = V8Proxy::retrieveFrame(context); + Frame* frame = retrieveFrame(eventContext); if (frame) { ScriptDebugListener* listener = m_listenersMap.get(frame->page()); if (listener) { - if (message.GetEvent() == v8::AfterCompile) { - handled = true; + v8::HandleScope scope; + if (event == v8::AfterCompile) { v8::Context::Scope contextScope(v8::Debug::GetDebugContext()); - v8::Local<v8::Object> args = v8::Object::New(); - args->Set(v8::String::New("eventData"), message.GetEventData()); v8::Handle<v8::Function> onAfterCompileFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("getAfterCompileScript"))); - v8::Handle<v8::Value> argv[] = { message.GetExecutionState(), args }; - v8::Handle<v8::Value> value = onAfterCompileFunction->Call(m_debuggerScript.get(), 2, argv); + v8::Handle<v8::Value> argv[] = { eventDetails.GetEventData() }; + v8::Handle<v8::Value> value = onAfterCompileFunction->Call(m_debuggerScript.get(), 1, argv); ASSERT(value->IsObject()); v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value); dispatchDidParseSource(listener, object); - } else if (message.GetEvent() == v8::Break || message.GetEvent() == v8::Exception) { - handled = true; - m_executionState.set(message.GetExecutionState()); - m_currentCallFrameState = mainWorldScriptState(frame); - listener->didPause(); - m_currentCallFrameState = 0; + } else if (event == v8::Break || event == v8::Exception) { + m_executionState.set(eventDetails.GetExecutionState()); + m_pausedPage = frame->page(); + ScriptState* currentCallFrameState = mainWorldScriptState(frame); + listener->didPause(currentCallFrameState); + + // Wait for continue or step command. + m_clientMessageLoop->run(m_pausedPage); + ASSERT(!m_pausedPage); + + // The listener may have been removed in the nested loop. + if (ScriptDebugListener* listener = m_listenersMap.get(frame->page())) + listener->didContinue(); } } } - - if (!handled && !message.WillStartRunning()) - continueProgram(); } +#endif void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Object> object) { listener->didParseSource( - toWebCoreStringWithNullCheck(object->Get(v8::String::New("id"))), - toWebCoreStringWithNullCheck(object->Get(v8::String::New("name"))), - toWebCoreStringWithNullCheck(object->Get(v8::String::New("source"))), + toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("id"))), + toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("name"))), + toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("source"))), object->Get(v8::String::New("lineOffset"))->ToInteger()->Value()); } @@ -354,6 +337,7 @@ void ScriptDebugServer::didResume() { m_currentCallFrame.clear(); m_executionState.clear(); + m_pausedPage = 0; } } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h index 6ef0afd..7c8c5cc 100644 --- a/WebCore/bindings/v8/ScriptDebugServer.h +++ b/WebCore/bindings/v8/ScriptDebugServer.h @@ -36,12 +36,12 @@ #include "JavaScriptCallFrame.h" #include "PlatformString.h" #include "ScriptBreakpoint.h" -#include "ScriptState.h" #include "StringHash.h" #include "Timer.h" #include <v8-debug.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> namespace WebCore { @@ -77,15 +77,18 @@ public: void recompileAllJSFunctionsSoon() { } void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) { } - ScriptState* currentCallFrameState(); - void pageCreated(Page*) { } // v8-specific methods. void setDebuggerScriptSource(const String& scriptSource); - typedef void (*MessageLoopDispatchHandler)(const Vector<WebCore::Page*>&); - static void setMessageLoopDispatchHandler(MessageLoopDispatchHandler messageLoopDispatchHandler) { s_messageLoopDispatchHandler = messageLoopDispatchHandler; } + class ClientMessageLoop { + public: + virtual ~ClientMessageLoop() { } + virtual void run(Page*) = 0; + virtual void quitNow() = 0; + }; + void setClientMessageLoop(PassOwnPtr<ClientMessageLoop> clientMessageLoop) { m_clientMessageLoop = clientMessageLoop; } PassRefPtr<JavaScriptCallFrame> currentCallFrame(); @@ -93,14 +96,13 @@ private: ScriptDebugServer(); ~ScriptDebugServer() { } - static void onV8DebugMessage(const v8::Debug::Message& message); - static void onV8DebugHostDispatch(); - - void handleV8DebugMessage(const v8::Debug::Message& message); - void handleV8DebugHostDispatch(); +#if ENABLE(V8_SCRIPT_DEBUG_SERVER) + static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails); + void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails); +#endif void dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Object> sourceObject); - + void ensureDebuggerScriptCompiled(); void didResume(); @@ -109,11 +111,10 @@ private: String m_debuggerScriptSource; PauseOnExceptionsState m_pauseOnExceptionsState; OwnHandle<v8::Object> m_debuggerScript; - ScriptState* m_currentCallFrameState; RefPtr<JavaScriptCallFrame> m_currentCallFrame; OwnHandle<v8::Object> m_executionState; - - static MessageLoopDispatchHandler s_messageLoopDispatchHandler; + OwnPtr<ClientMessageLoop> m_clientMessageLoop; + Page* m_pausedPage; }; } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp index 19300b0..5e20e376 100644 --- a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp @@ -61,7 +61,7 @@ void V8CustomPositionCallback::handleEvent(Geoposition* position) RefPtr<Frame> protector(m_frame); bool callbackReturnValue = false; - invokeCallback(m_callback, 1, argv, callbackReturnValue); + invokeCallback(m_callback, 1, argv, callbackReturnValue, m_frame->document()); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp index c6c632b..bd42d94 100644 --- a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp @@ -61,7 +61,7 @@ void V8CustomPositionErrorCallback::handleEvent(PositionError* error) RefPtr<Frame> protector(m_frame); bool callbackReturnValue = false; - invokeCallback(m_callback, 1, argv, callbackReturnValue); + invokeCallback(m_callback, 1, argv, callbackReturnValue, m_frame->document()); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp index e033684..3bdc79b 100644 --- a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp @@ -34,9 +34,9 @@ #include "V8SQLStatementErrorCallback.h" -#include "Frame.h" #include "ScriptExecutionContext.h" #include "V8CustomVoidCallback.h" +#include "V8Proxy.h" #include "V8SQLError.h" #include "V8SQLTransaction.h" @@ -57,15 +57,15 @@ bool V8SQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, S toV8(error) }; - // Protect the frame until the callback returns. - RefPtr<Frame> protector(m_frame); + // Protect the context until the callback returns. + RefPtr<ScriptExecutionContext> protector(context); bool callbackReturnValue = false; // Step 6: If the error callback returns false, then move on to the next // statement, if any, or onto the next overall step otherwise. Otherwise, // the error callback did not return false, or there was no error callback. // Jump to the last step in the overall steps. - return invokeCallback(m_callback, 2, argv, callbackReturnValue) || callbackReturnValue; + return invokeCallback(m_callback, 2, argv, callbackReturnValue, context) || callbackReturnValue; } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp index f4ea62a..bc7bb6c 100644 --- a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp @@ -31,14 +31,15 @@ #include "config.h" #include "V8CustomVoidCallback.h" -#include "Frame.h" +#include "ScriptExecutionContext.h" #include "V8Binding.h" +#include "V8Proxy.h" namespace WebCore { -V8CustomVoidCallback::V8CustomVoidCallback(v8::Local<v8::Object> callback, Frame* frame) +V8CustomVoidCallback::V8CustomVoidCallback(v8::Local<v8::Object> callback, ScriptExecutionContext *context) : m_callback(v8::Persistent<v8::Object>::New(callback)) - , m_frame(frame) + , m_scriptExecutionContext(context) { } @@ -51,20 +52,17 @@ void V8CustomVoidCallback::handleEvent() { v8::HandleScope handleScope; - v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get()); - if (context.IsEmpty()) + v8::Handle<v8::Context> v8Context = toV8Context(m_scriptExecutionContext.get(), WorldContextHandle(UseCurrentWorld)); + if (v8Context.IsEmpty()) return; - v8::Context::Scope scope(context); - - // Protect the frame until the callback returns. - RefPtr<Frame> protector(m_frame); + v8::Context::Scope scope(v8Context); bool callbackReturnValue = false; - invokeCallback(m_callback, 0, 0, callbackReturnValue); + invokeCallback(m_callback, 0, 0, callbackReturnValue, m_scriptExecutionContext.get()); } -bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue) +bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext) { v8::TryCatch exceptionCatcher; @@ -83,15 +81,12 @@ bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8 v8::Handle<v8::Object> thisObject = v8::Context::GetCurrent()->Global(); - V8Proxy* proxy = V8Proxy::retrieve(); - ASSERT(proxy); - - v8::Handle<v8::Value> result = proxy->callFunction(callbackFunction, thisObject, argc, argv); + v8::Handle<v8::Value> result = callbackFunction->Call(thisObject, argc, argv); callbackReturnValue = !result.IsEmpty() && result->BooleanValue(); if (exceptionCatcher.HasCaught()) { v8::Local<v8::Message> message = exceptionCatcher.Message(); - proxy->frame()->document()->reportException(toWebCoreString(message->Get()), message->GetLineNumber(), toWebCoreString(message->GetScriptResourceName())); + scriptExecutionContext->reportException(toWebCoreString(message->Get()), message->GetLineNumber(), toWebCoreString(message->GetScriptResourceName())); return true; } diff --git a/WebCore/bindings/v8/custom/V8CustomVoidCallback.h b/WebCore/bindings/v8/custom/V8CustomVoidCallback.h index 586296b..03a47bc 100644 --- a/WebCore/bindings/v8/custom/V8CustomVoidCallback.h +++ b/WebCore/bindings/v8/custom/V8CustomVoidCallback.h @@ -38,28 +38,28 @@ namespace WebCore { -class Frame; +class ScriptExecutionContext; class V8CustomVoidCallback : public VoidCallback { public: - static PassRefPtr<V8CustomVoidCallback> create(v8::Local<v8::Value> value, Frame* frame) + static PassRefPtr<V8CustomVoidCallback> create(v8::Local<v8::Value> value, ScriptExecutionContext* context) { ASSERT(value->IsObject()); - return adoptRef(new V8CustomVoidCallback(value->ToObject(), frame)); + return adoptRef(new V8CustomVoidCallback(value->ToObject(), context)); } virtual ~V8CustomVoidCallback(); virtual void handleEvent(); private: - V8CustomVoidCallback(v8::Local<v8::Object>, Frame*); + V8CustomVoidCallback(v8::Local<v8::Object>, ScriptExecutionContext* context); v8::Persistent<v8::Object> m_callback; - RefPtr<Frame> m_frame; + RefPtr<ScriptExecutionContext> m_scriptExecutionContext; }; // Returns false if callback failed (null, wrong type, or threw exception). -bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue); +bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext); } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index 921d756..badf332 100644 --- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -697,12 +697,21 @@ v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args) windowFeatures.ySet = false; } if (!rawFeatures.widthSet) { +<<<<<<< HEAD windowFeatures.width = 0; windowFeatures.widthSet = false; } if (!rawFeatures.heightSet) { windowFeatures.height = 0; windowFeatures.heightSet = false; +======= + windowFeatures.width = 0; + windowFeatures.widthSet = false; + } + if (!rawFeatures.heightSet) { + windowFeatures.height = 0; + windowFeatures.heightSet = false; +>>>>>>> webkit.org at r60469 } frame = V8BindingDOMWindow::createWindow(V8BindingState::Only(), callingFrame, enteredFrame, frame, urlString, frameName, windowFeatures, v8::Local<v8::Value>()); @@ -809,7 +818,7 @@ v8::Handle<v8::Value> V8DOMWindow::openDatabaseCallback(const v8::Arguments& arg if (!args[4]->IsObject()) return throwError(TYPE_MISMATCH_ERR); - creationCallback = V8DatabaseCallback::create(args[4], imp->frame()); + creationCallback = V8DatabaseCallback::create(args[4]); } ExceptionCode ec = 0; diff --git a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp index 89d582e..20f7c40 100644 --- a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp @@ -55,8 +55,8 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg Database* database = V8Database::toNative(args.Holder()); - Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); - if (!frame) + ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext(); + if (!scriptExecutionContext) return v8::Undefined(); RefPtr<V8SQLTransactionCallback> callback; @@ -64,7 +64,7 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg if (!args[2]->IsObject()) return throwError(TYPE_MISMATCH_ERR); - callback = V8SQLTransactionCallback::create(args[2], frame); + callback = V8SQLTransactionCallback::create(args[2]); } RefPtr<V8SQLTransactionErrorCallback> errorCallback; @@ -72,7 +72,7 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg if (!args[3]->IsObject()) return throwError(TYPE_MISMATCH_ERR); - errorCallback = V8SQLTransactionErrorCallback::create(args[3], frame); + errorCallback = V8SQLTransactionErrorCallback::create(args[3]); } RefPtr<V8CustomVoidCallback> successCallback; @@ -80,7 +80,7 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg if (!args[4]->IsObject()) return throwError(TYPE_MISMATCH_ERR); - successCallback = V8CustomVoidCallback::create(args[4], frame); + successCallback = V8CustomVoidCallback::create(args[4], scriptExecutionContext); } database->changeVersion(oldVersion, newVersion, callback.release(), errorCallback.release(), successCallback.release()); @@ -98,18 +98,17 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r Database* database = V8Database::toNative(args.Holder()); - Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); - if (!frame) + ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext(); + if (!scriptExecutionContext) return v8::Undefined(); - - RefPtr<V8SQLTransactionCallback> callback = V8SQLTransactionCallback::create(args[0], frame); + RefPtr<V8SQLTransactionCallback> callback = V8SQLTransactionCallback::create(args[0]); RefPtr<V8SQLTransactionErrorCallback> errorCallback; if (args.Length() > 1 && !isUndefinedOrNull(args[1])) { if (!args[1]->IsObject()) return throwError(TYPE_MISMATCH_ERR); - errorCallback = V8SQLTransactionErrorCallback::create(args[1], frame); + errorCallback = V8SQLTransactionErrorCallback::create(args[1]); } RefPtr<V8CustomVoidCallback> successCallback; @@ -117,7 +116,7 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r if (!args[2]->IsObject()) return throwError(TYPE_MISMATCH_ERR); - successCallback = V8CustomVoidCallback::create(args[2], frame); + successCallback = V8CustomVoidCallback::create(args[2], scriptExecutionContext); } database->transaction(callback.release(), errorCallback.release(), successCallback.release(), readOnly); diff --git a/WebCore/bindings/v8/custom/V8DatabaseSyncCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseSyncCustom.cpp index c7d6d1f..4fe30dc 100644 --- a/WebCore/bindings/v8/custom/V8DatabaseSyncCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DatabaseSyncCustom.cpp @@ -58,7 +58,7 @@ v8::Handle<v8::Value> V8DatabaseSync::changeVersionCallback(const v8::Arguments& if (!args[2]->IsObject()) return throwError(TYPE_MISMATCH_ERR); - callback = V8SQLTransactionSyncCallback::create(args[2], 0); + callback = V8SQLTransactionSyncCallback::create(args[2]); } ExceptionCode ec = 0; @@ -78,7 +78,7 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r DatabaseSync* database = V8DatabaseSync::toNative(args.Holder()); - RefPtr<V8SQLTransactionSyncCallback> callback = V8SQLTransactionSyncCallback::create(args[0], 0); + RefPtr<V8SQLTransactionSyncCallback> callback = V8SQLTransactionSyncCallback::create(args[0]); ExceptionCode ec = 0; database->transaction(callback.release(), readOnly, ec); diff --git a/WebCore/bindings/v8/custom/V8ElementCustom.cpp b/WebCore/bindings/v8/custom/V8ElementCustom.cpp index 8256110..3f6cd6a 100644 --- a/WebCore/bindings/v8/custom/V8ElementCustom.cpp +++ b/WebCore/bindings/v8/custom/V8ElementCustom.cpp @@ -54,71 +54,6 @@ namespace WebCore { -v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.Element.setAttribute()"); - Element* element = V8Element::toNative(args.Holder()); - String name = toWebCoreString(args[0]); - String value = toWebCoreString(args[1]); - - ExceptionCode ec = 0; - V8BindingElement::setAttribute(V8BindingState::Only(), element, name, value, ec); - if (ec) - return throwError(ec); - - return v8::Undefined(); -} - -v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.Element.setAttributeNode()"); - if (!V8Attr::HasInstance(args[0])) - return throwError(TYPE_MISMATCH_ERR); - - Attr* newAttr = V8Attr::toNative(v8::Handle<v8::Object>::Cast(args[0])); - Element* element = V8Element::toNative(args.Holder()); - - ExceptionCode ec = 0; - RefPtr<Attr> result = V8BindingElement::setAttributeNode(V8BindingState::Only(), element, newAttr, ec); - if (ec) - throwError(ec); - - return toV8(result.release()); -} - -v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.Element.setAttributeNS()"); - Element* element = V8Element::toNative(args.Holder()); - String namespaceURI = toWebCoreStringWithNullCheck(args[0]); - String qualifiedName = toWebCoreString(args[1]); - String value = toWebCoreString(args[2]); - - ExceptionCode ec = 0; - V8BindingElement::setAttributeNS(V8BindingState::Only(), element, namespaceURI, qualifiedName, value, ec); - if (ec) - throwError(ec); - - return v8::Undefined(); -} - -v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.Element.setAttributeNodeNS()"); - if (!V8Attr::HasInstance(args[0])) - return throwError(TYPE_MISMATCH_ERR); - - Attr* newAttr = V8Attr::toNative(v8::Handle<v8::Object>::Cast(args[0])); - Element* element = V8Element::toNative(args.Holder()); - - ExceptionCode ec = 0; - RefPtr<Attr> result = V8BindingElement::setAttributeNodeNS(V8BindingState::Only(), element, newAttr, ec); - if (ec) - throwError(ec); - - return toV8(result.release()); -} - v8::Handle<v8::Value> toV8(Element* impl, bool forceNewObject) { if (!impl) diff --git a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp index 072a28f..66e326c 100644 --- a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2007-2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,6 +35,7 @@ #include "CanvasContextAttributes.h" #include "CanvasRenderingContext.h" #include "HTMLCanvasElement.h" +#include "PlatformString.h" #include "WebGLContextAttributes.h" #include "V8Binding.h" #include "V8CanvasRenderingContext2D.h" @@ -42,6 +44,7 @@ #if ENABLE(3D_CANVAS) #include "V8WebGLRenderingContext.h" #endif +#include <wtf/MathExtras.h> namespace WebCore { @@ -89,4 +92,22 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument return v8::Null(); } +v8::Handle<v8::Value> V8HTMLCanvasElement::toDataURLCallback(const v8::Arguments& args) +{ + double quality = 1.0; + if (args.Length() > 1) { + if (args[1]->IsNumber()) + quality = args[1]->NumberValue(); + if (!(0.0 <= quality && quality <= 1.0)) + quality = 1.0; + } + v8::Handle<v8::Object> holder = args.Holder(); + HTMLCanvasElement* canvas = V8HTMLCanvasElement::toNative(holder); + String type = toWebCoreString(args[0]); + ExceptionCode ec = 0; + String result = canvas->toDataURL(type, quality, ec); + V8Proxy::setDOMException(ec); + return v8StringOrUndefined(result); +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp index 2e20e82..5ef50a6 100644 --- a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp +++ b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp @@ -36,6 +36,8 @@ #include "SerializedScriptValue.h" #include "V8IDBDatabaseRequest.h" +#include "V8IDBIndexRequest.h" +#include "V8IDBObjectStoreRequest.h" #include "V8IndexedDatabaseRequest.h" namespace WebCore { @@ -48,8 +50,14 @@ v8::Handle<v8::Value> toV8(IDBAny* impl) switch (impl->type()) { case IDBAny::UndefinedType: return v8::Undefined(); + case IDBAny::NullType: + return v8::Null(); case IDBAny::IDBDatabaseRequestType: return toV8(impl->idbDatabaseRequest()); + case IDBAny::IDBIndexRequestType: + return toV8(impl->idbIndexRequest()); + case IDBAny::IDBObjectStoreRequestType: + return toV8(impl->idbObjectStoreRequest()); case IDBAny::IndexedDatabaseRequestType: return toV8(impl->indexedDatabaseRequest()); case IDBAny::SerializedScriptValueType: diff --git a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp index 30773e3..bf81ae9 100644 --- a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp +++ b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp @@ -90,7 +90,7 @@ v8::Handle<v8::Value> V8NotificationCenter::requestPermissionCallback(const v8:: if (!args[0]->IsObject()) return throwError("Callback must be of valid type.", V8Proxy::TypeError); - callback = V8CustomVoidCallback::create(args[0], V8Proxy::retrieveFrameForCurrentContext()); + callback = V8CustomVoidCallback::create(args[0], context); } notificationCenter->requestPermission(callback.release()); diff --git a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp index e6ffe30..f1b708a 100644 --- a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp +++ b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp @@ -89,24 +89,22 @@ v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments& SQLTransaction* transaction = V8SQLTransaction::toNative(args.Holder()); - Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); + ScriptExecutionContext* executionContext = getScriptExecutionContext(); + if (!executionContext) + return v8::Undefined(); RefPtr<SQLStatementCallback> callback; if (args.Length() > 2 && !isUndefinedOrNull(args[2])) { if (!args[2]->IsObject()) return throwError(TYPE_MISMATCH_ERR); - - if (frame) - callback = V8SQLStatementCallback::create(args[2], frame); + callback = V8SQLStatementCallback::create(args[2]); } RefPtr<SQLStatementErrorCallback> errorCallback; if (args.Length() > 3 && !isUndefinedOrNull(args[3])) { if (!args[3]->IsObject()) return throwError(TYPE_MISMATCH_ERR); - - if (frame) - errorCallback = V8SQLStatementErrorCallback::create(args[3], frame); + errorCallback = V8SQLStatementErrorCallback::create(args[3]); } ExceptionCode ec = 0; diff --git a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp index 446a8ea..acf10b7 100755 --- a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp @@ -34,6 +34,7 @@ #include "V8WorkerContext.h" #if ENABLE(DATABASE) +#include "Database.h" #include "V8Database.h" #include "V8DatabaseCallback.h" #include "V8DatabaseSync.h" @@ -143,12 +144,33 @@ v8::Handle<v8::Value> toV8(WorkerContext* impl) } #if ENABLE(DATABASE) -v8::Handle<v8::Value> V8WorkerContext::openDatabaseCallback(const v8::Arguments& args) -{ - INC_STATS("DOM.WorkerContext.openDatabase()"); - // Implementation coming soon. - return throwError(NOT_SUPPORTED_ERR); -} +v8::Handle<v8::Value> V8WorkerContext::openDatabaseCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.V8WorkerContext.openDatabase()"); + if (args.Length() < 4) + return throwError(SYNTAX_ERR); + + EXCEPTION_BLOCK(String, name, toWebCoreString(args[0])); + EXCEPTION_BLOCK(String, version, toWebCoreString(args[1])); + EXCEPTION_BLOCK(String, displayName, toWebCoreString(args[2])); + EXCEPTION_BLOCK(unsigned long, estimatedSize, args[3]->Uint32Value()); + + WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder()); + + RefPtr<DatabaseCallback> creationCallback; + if (args.Length() >= 5) { + if (!args[4]->IsObject()) + return throwError(TYPE_MISMATCH_ERR); + + creationCallback = V8DatabaseCallback::create(args[4]); + } + + ExceptionCode ec = 0; + v8::Handle<v8::Value> result = toV8(workerContext->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec)); + + V8Proxy::setDOMException(ec); + return result; +} v8::Handle<v8::Value> V8WorkerContext::openDatabaseSyncCallback(const v8::Arguments& args) { @@ -168,7 +190,7 @@ v8::Handle<v8::Value> V8WorkerContext::openDatabaseSyncCallback(const v8::Argume if (!args[4]->IsObject()) return throwError(TYPE_MISMATCH_ERR); - creationCallback = V8DatabaseCallback::create(args[4], 0); + creationCallback = V8DatabaseCallback::create(args[4]); } ExceptionCode ec = 0; |