diff options
Diffstat (limited to 'WebCore/bindings/js/JSDOMWindowCustom.cpp')
-rw-r--r-- | WebCore/bindings/js/JSDOMWindowCustom.cpp | 126 |
1 files changed, 95 insertions, 31 deletions
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp index 05ea9b1..656d580 100644 --- a/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -58,14 +58,14 @@ #endif #if ENABLE(3D_CANVAS) -#include "JSWebGLArrayBufferConstructor.h" -#include "JSWebGLByteArrayConstructor.h" -#include "JSWebGLUnsignedByteArrayConstructor.h" -#include "JSWebGLIntArrayConstructor.h" -#include "JSWebGLUnsignedIntArrayConstructor.h" -#include "JSWebGLShortArrayConstructor.h" -#include "JSWebGLUnsignedShortArrayConstructor.h" -#include "JSWebGLFloatArrayConstructor.h" +#include "JSArrayBufferConstructor.h" +#include "JSInt8ArrayConstructor.h" +#include "JSUint8ArrayConstructor.h" +#include "JSInt32ArrayConstructor.h" +#include "JSUint32ArrayConstructor.h" +#include "JSInt16ArrayConstructor.h" +#include "JSUint16ArrayConstructor.h" +#include "JSFloatArrayConstructor.h" #endif #include "JSWebKitCSSMatrixConstructor.h" #include "JSWebKitPointConstructor.h" @@ -571,44 +571,86 @@ JSValue JSDOMWindow::webKitCSSMatrix(ExecState* exec) const } #if ENABLE(3D_CANVAS) -JSValue JSDOMWindow::webGLArrayBuffer(ExecState* exec) const +JSValue JSDOMWindow::arrayBuffer(ExecState* exec) const { - return getDOMConstructor<JSWebGLArrayBufferConstructor>(exec, this); + return getDOMConstructor<JSArrayBufferConstructor>(exec, this); } -JSValue JSDOMWindow::webGLByteArray(ExecState* exec) const +JSValue JSDOMWindow::int8Array(ExecState* exec) const { - return getDOMConstructor<JSWebGLByteArrayConstructor>(exec, this); + return getDOMConstructor<JSInt8ArrayConstructor>(exec, this); } -JSValue JSDOMWindow::webGLUnsignedByteArray(ExecState* exec) const +JSValue JSDOMWindow::uint8Array(ExecState* exec) const { - return getDOMConstructor<JSWebGLUnsignedByteArrayConstructor>(exec, this); + return getDOMConstructor<JSUint8ArrayConstructor>(exec, this); } -JSValue JSDOMWindow::webGLIntArray(ExecState* exec) const +JSValue JSDOMWindow::int32Array(ExecState* exec) const { - return getDOMConstructor<JSWebGLIntArrayConstructor>(exec, this); + return getDOMConstructor<JSInt32ArrayConstructor>(exec, this); } -JSValue JSDOMWindow::webGLUnsignedIntArray(ExecState* exec) const +JSValue JSDOMWindow::uint32Array(ExecState* exec) const { - return getDOMConstructor<JSWebGLUnsignedIntArrayConstructor>(exec, this); + return getDOMConstructor<JSUint32ArrayConstructor>(exec, this); } -JSValue JSDOMWindow::webGLShortArray(ExecState* exec) const +JSValue JSDOMWindow::int16Array(ExecState* exec) const { - return getDOMConstructor<JSWebGLShortArrayConstructor>(exec, this); + return getDOMConstructor<JSInt16ArrayConstructor>(exec, this); } -JSValue JSDOMWindow::webGLUnsignedShortArray(ExecState* exec) const +JSValue JSDOMWindow::uint16Array(ExecState* exec) const { - return getDOMConstructor<JSWebGLUnsignedShortArrayConstructor>(exec, this); + return getDOMConstructor<JSUint16ArrayConstructor>(exec, this); } +JSValue JSDOMWindow::floatArray(ExecState* exec) const +{ + return getDOMConstructor<JSFloatArrayConstructor>(exec, this); +} + +// Temporary aliases to keep current WebGL content working during transition period to TypedArray spec. +// To be removed before WebGL spec is finalized. (FIXME) +JSValue JSDOMWindow::webGLArrayBuffer(ExecState* exec) const +{ + return getDOMConstructor<JSArrayBufferConstructor>(exec, this); +} + +JSValue JSDOMWindow::webGLByteArray(ExecState* exec) const +{ + return getDOMConstructor<JSInt8ArrayConstructor>(exec, this); +} + +JSValue JSDOMWindow::webGLUnsignedByteArray(ExecState* exec) const +{ + return getDOMConstructor<JSUint8ArrayConstructor>(exec, this); +} + +JSValue JSDOMWindow::webGLIntArray(ExecState* exec) const +{ + return getDOMConstructor<JSInt32ArrayConstructor>(exec, this); +} + +JSValue JSDOMWindow::webGLUnsignedIntArray(ExecState* exec) const +{ + return getDOMConstructor<JSUint32ArrayConstructor>(exec, this); +} + +JSValue JSDOMWindow::webGLShortArray(ExecState* exec) const +{ + return getDOMConstructor<JSInt16ArrayConstructor>(exec, this); +} + +JSValue JSDOMWindow::webGLUnsignedShortArray(ExecState* exec) const +{ + return getDOMConstructor<JSUint16ArrayConstructor>(exec, this); +} + JSValue JSDOMWindow::webGLFloatArray(ExecState* exec) const { - return getDOMConstructor<JSWebGLFloatArrayConstructor>(exec, this); + return getDOMConstructor<JSFloatArrayConstructor>(exec, this); } #endif @@ -967,18 +1009,40 @@ JSValue JSDOMWindow::removeEventListener(ExecState* exec, const ArgList& args) #if ENABLE(DATABASE) JSValue JSDOMWindow::openDatabase(ExecState* exec, const ArgList& args) { - if (!allowsAccessFrom(exec) || (args.size() < 4)) + if (!allowsAccessFrom(exec) || (args.size() < 4)) { + setDOMException(exec, SYNTAX_ERR); return jsUndefined(); - ExceptionCode ec = 0; - const UString& name = args.at(0).toString(exec); - const UString& version = args.at(1).toString(exec); - const UString& displayName = args.at(2).toString(exec); - unsigned long estimatedSize = args.at(3).toInt32(exec); + } + + String name = ustringToString(args.at(0).toString(exec)); + if (exec->hadException()) + return jsUndefined(); + + String version = ustringToString(args.at(1).toString(exec)); + if (exec->hadException()) + return jsUndefined(); + + String displayName = ustringToString(args.at(2).toString(exec)); + if (exec->hadException()) + return jsUndefined(); + + // args.at(3) = estimated size + unsigned long estimatedSize = args.at(3).toUInt32(exec); + if (exec->hadException()) + return jsUndefined(); + RefPtr<DatabaseCallback> creationCallback; - if ((args.size() >= 5) && args.at(4).isObject()) + if (args.size() >= 5) { + if (!args.at(4).isObject()) { + setDOMException(exec, TYPE_MISMATCH_ERR); + return jsUndefined(); + } + creationCallback = JSDatabaseCallback::create(asObject(args.at(4)), globalObject()); + } - JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabase(ustringToString(name), ustringToString(version), ustringToString(displayName), estimatedSize, creationCallback.release(), ec))); + ExceptionCode ec = 0; + JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec))); setDOMException(exec, ec); return result; |