summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/js
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/js')
-rw-r--r--WebCore/bindings/js/DOMWrapperWorld.h2
-rw-r--r--WebCore/bindings/js/IDBBindingUtilities.h2
-rw-r--r--WebCore/bindings/js/JSBindingsAllInOne.cpp3
-rw-r--r--WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp16
-rw-r--r--WebCore/bindings/js/JSDOMBinding.h2
-rw-r--r--WebCore/bindings/js/JSDOMWindowBase.h2
-rw-r--r--WebCore/bindings/js/JSDOMWindowCustom.cpp48
-rw-r--r--WebCore/bindings/js/JSDatabaseCustom.cpp146
-rw-r--r--WebCore/bindings/js/JSDatabaseSyncCustom.cpp102
-rw-r--r--WebCore/bindings/js/JSDesktopNotificationsCustom.cpp9
-rw-r--r--WebCore/bindings/js/JSDeviceMotionEventCustom.cpp129
-rw-r--r--WebCore/bindings/js/JSEventCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSEventTarget.cpp4
-rw-r--r--WebCore/bindings/js/JSHTMLDocumentCustom.cpp2
-rw-r--r--WebCore/bindings/js/JSIDBAnyCustom.cpp20
-rw-r--r--WebCore/bindings/js/JSInjectedScriptHostCustom.cpp37
-rw-r--r--WebCore/bindings/js/JSMessagePortCustom.h3
-rw-r--r--WebCore/bindings/js/JSSQLTransactionCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSWorkerContextCustom.cpp90
-rw-r--r--WebCore/bindings/js/JavaScriptCallFrame.h3
-rw-r--r--WebCore/bindings/js/ScheduledAction.cpp1
-rw-r--r--WebCore/bindings/js/ScriptArray.cpp127
-rw-r--r--WebCore/bindings/js/ScriptArray.h61
-rw-r--r--WebCore/bindings/js/ScriptCallStack.h1
-rw-r--r--WebCore/bindings/js/ScriptController.h2
-rw-r--r--WebCore/bindings/js/ScriptControllerEfl.cpp4
-rw-r--r--WebCore/bindings/js/ScriptObject.cpp90
-rw-r--r--WebCore/bindings/js/ScriptObject.h13
-rw-r--r--WebCore/bindings/js/ScriptProfile.cpp100
-rw-r--r--WebCore/bindings/js/ScriptProfile.h30
-rw-r--r--WebCore/bindings/js/ScriptProfiler.cpp3
-rw-r--r--WebCore/bindings/js/ScriptProfiler.h1
-rw-r--r--WebCore/bindings/js/ScriptSourceProvider.h3
-rw-r--r--WebCore/bindings/js/ScriptString.h3
-rw-r--r--WebCore/bindings/js/ScriptValue.cpp1
-rw-r--r--WebCore/bindings/js/WorkerScriptController.h2
36 files changed, 307 insertions, 763 deletions
diff --git a/WebCore/bindings/js/DOMWrapperWorld.h b/WebCore/bindings/js/DOMWrapperWorld.h
index 832c5e0..35b68fc 100644
--- a/WebCore/bindings/js/DOMWrapperWorld.h
+++ b/WebCore/bindings/js/DOMWrapperWorld.h
@@ -26,11 +26,11 @@
#include "JSDOMGlobalObject.h"
#include "JSDOMWrapper.h"
#include <runtime/WeakGCMap.h>
+#include <wtf/Forward.h>
namespace WebCore {
class ScriptController;
-class StringImpl;
typedef JSC::WeakGCMap<void*, DOMObject*> DOMObjectWrapperMap;
typedef JSC::WeakGCMap<StringImpl*, JSC::JSString*> JSStringCache;
diff --git a/WebCore/bindings/js/IDBBindingUtilities.h b/WebCore/bindings/js/IDBBindingUtilities.h
index f410344..7e72152 100644
--- a/WebCore/bindings/js/IDBBindingUtilities.h
+++ b/WebCore/bindings/js/IDBBindingUtilities.h
@@ -28,7 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
-#include "ScriptValue.h"
+#include "ScriptValue.h"
#include <wtf/Forward.h>
namespace WebCore {
diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp
index b517496..922e449 100644
--- a/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -57,8 +57,6 @@
#include "JSDOMWrapper.cpp"
#include "JSDataGridColumnListCustom.cpp"
#include "JSDataGridDataSource.cpp"
-#include "JSDatabaseCustom.cpp"
-#include "JSDatabaseSyncCustom.cpp"
#include "JSDebugWrapperSet.cpp"
#include "JSDedicatedWorkerContextCustom.cpp"
#include "JSDesktopNotificationsCustom.cpp"
@@ -139,7 +137,6 @@
#include "JavaScriptCallFrame.cpp"
#include "MemoryInfo.cpp"
#include "ScheduledAction.cpp"
-#include "ScriptArray.cpp"
#include "ScriptCachedFrameData.cpp"
#include "ScriptCallFrame.cpp"
#include "ScriptCallStack.cpp"
diff --git a/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp b/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
index 3026a33..69c8865 100644
--- a/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
+++ b/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
@@ -31,7 +31,6 @@
#if ENABLE(DATABASE)
-#include "Frame.h"
#include "JSSQLError.h"
#include "JSSQLTransaction.h"
#include "ScriptExecutionContext.h"
@@ -41,22 +40,19 @@ namespace WebCore {
using namespace JSC;
-bool JSSQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error)
+bool JSSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error)
{
- ASSERT(m_data);
- ASSERT(context);
+ if (!m_data || !m_data->globalObject() || !canInvokeCallback())
+ return true;
RefPtr<JSSQLStatementErrorCallback> protect(this);
JSC::JSLock lock(SilenceAssertionsOnly);
- JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());
- if (!globalObject)
- return true; // if we cannot invoke the callback, roll back the transaction
- ExecState* exec = globalObject->globalExec();
+ ExecState* exec = m_data->globalObject()->globalExec();
MarkedArgumentBuffer args;
- args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction));
- args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), error));
+ args.append(toJS(exec, transaction));
+ args.append(toJS(exec, error));
bool raisedException = false;
JSValue result = m_data->invokeCallback(args, &raisedException);
diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h
index 3f2502d..7086a89 100644
--- a/WebCore/bindings/js/JSDOMBinding.h
+++ b/WebCore/bindings/js/JSDOMBinding.h
@@ -30,6 +30,7 @@
#include <runtime/Completion.h>
#include <runtime/Lookup.h>
#include <runtime/WeakGCMap.h>
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
namespace JSC {
@@ -44,7 +45,6 @@ namespace WebCore {
class JSNode;
class KURL;
class Node;
- class String;
class ScriptController;
class ScriptCachedFrameData;
diff --git a/WebCore/bindings/js/JSDOMWindowBase.h b/WebCore/bindings/js/JSDOMWindowBase.h
index 2726996..f4f1ef9 100644
--- a/WebCore/bindings/js/JSDOMWindowBase.h
+++ b/WebCore/bindings/js/JSDOMWindowBase.h
@@ -23,12 +23,12 @@
#include "PlatformString.h"
#include "JSDOMBinding.h"
#include <runtime/Protect.h>
+#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
namespace WebCore {
- class AtomicString;
class DOMWindow;
class Event;
class Frame;
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index 30d79b3..252ea93 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -22,7 +22,6 @@
#include "AtomicString.h"
#include "Chrome.h"
-#include "Database.h"
#include "DOMWindow.h"
#include "Document.h"
#include "ExceptionCode.h"
@@ -36,10 +35,6 @@
#include "HTMLDocument.h"
#include "History.h"
#include "JSAudioConstructor.h"
-#if ENABLE(DATABASE)
-#include "JSDatabase.h"
-#include "JSDatabaseCallback.h"
-#endif
#include "JSDOMWindowShell.h"
#include "JSEvent.h"
#include "JSEventListener.h"
@@ -1006,49 +1001,6 @@ JSValue JSDOMWindow::removeEventListener(ExecState* exec)
return jsUndefined();
}
-#if ENABLE(DATABASE)
-JSValue JSDOMWindow::openDatabase(ExecState* exec)
-{
- if (!allowsAccessFrom(exec) || (exec->argumentCount() < 4)) {
- setDOMException(exec, SYNTAX_ERR);
- return jsUndefined();
- }
-
- String name = ustringToString(exec->argument(0).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- String version = ustringToString(exec->argument(1).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- String displayName = ustringToString(exec->argument(2).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- // exec->argument(3) = estimated size
- unsigned long estimatedSize = exec->argument(3).toUInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- RefPtr<DatabaseCallback> creationCallback;
- if (exec->argumentCount() >= 5) {
- if (!exec->argument(4).isObject()) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject());
- }
-
- ExceptionCode ec = 0;
- JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec)));
-
- setDOMException(exec, ec);
- return result;
-}
-#endif
-
DOMWindow* toDOMWindow(JSValue value)
{
if (!value.isObject())
diff --git a/WebCore/bindings/js/JSDatabaseCustom.cpp b/WebCore/bindings/js/JSDatabaseCustom.cpp
deleted file mode 100644
index 6733320..0000000
--- a/WebCore/bindings/js/JSDatabaseCustom.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSDatabase.h"
-
-#if ENABLE(DATABASE)
-
-#include "DOMWindow.h"
-#include "Database.h"
-#include "Document.h"
-#include "ExceptionCode.h"
-#include "JSSQLTransactionCallback.h"
-#include "JSSQLTransactionErrorCallback.h"
-#include "JSCustomVoidCallback.h"
-#include "JSDOMWindowCustom.h"
-#include "PlatformString.h"
-#include "SQLValue.h"
-#include <runtime/JSArray.h>
-
-namespace WebCore {
-
-using namespace JSC;
-
-JSValue JSDatabase::changeVersion(ExecState* exec)
-{
- String oldVersion = ustringToString(exec->argument(0).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- String newVersion = ustringToString(exec->argument(1).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- RefPtr<SQLTransactionCallback> callback;
- if (exec->argumentCount() > 2 && !exec->argument(2).isNull()) {
- JSObject* object = exec->argument(2).getObject();
- if (!object) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- callback = JSSQLTransactionCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
- }
-
- RefPtr<SQLTransactionErrorCallback> errorCallback;
- if (exec->argumentCount() > 3 && !exec->argument(3).isNull()) {
- JSObject* object = exec->argument(3).getObject();
- if (!object) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- errorCallback = JSSQLTransactionErrorCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
- }
-
- RefPtr<VoidCallback> successCallback;
- if (exec->argumentCount() > 4 && !exec->argument(4).isNull()) {
- JSObject* object = exec->argument(4).getObject();
- if (!object) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- successCallback = JSCustomVoidCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
- }
-
- m_impl->changeVersion(oldVersion, newVersion, callback.release(), errorCallback.release(), successCallback.release());
-
- return jsUndefined();
-}
-
-static JSValue createTransaction(ExecState* exec, Database* database, JSDOMGlobalObject* globalObject, bool readOnly)
-{
- JSObject* object = exec->argument(0).getObject();
-
- if (!object) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- RefPtr<SQLTransactionCallback> callback(JSSQLTransactionCallback::create(object, globalObject));
- RefPtr<SQLTransactionErrorCallback> errorCallback;
- if (exec->argumentCount() > 1 && !exec->argument(1).isNull()) {
- object = exec->argument(1).getObject();
- if (!object) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- errorCallback = JSSQLTransactionErrorCallback::create(object, globalObject);
- }
-
- RefPtr<VoidCallback> successCallback;
- if (exec->argumentCount() > 2 && !exec->argument(2).isNull()) {
- object = exec->argument(2).getObject();
- if (!object) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- successCallback = JSCustomVoidCallback::create(object, globalObject);
- }
-
- database->transaction(callback.release(), errorCallback.release(), successCallback.release(), readOnly);
- return jsUndefined();
-}
-
-JSValue JSDatabase::transaction(ExecState* exec)
-{
- return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), false);
-}
-
-JSValue JSDatabase::readTransaction(ExecState* exec)
-{
- return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), true);
-}
-
-}
-
-#endif // ENABLE(DATABASE)
diff --git a/WebCore/bindings/js/JSDatabaseSyncCustom.cpp b/WebCore/bindings/js/JSDatabaseSyncCustom.cpp
deleted file mode 100644
index f929658..0000000
--- a/WebCore/bindings/js/JSDatabaseSyncCustom.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSDatabaseSync.h"
-
-#if ENABLE(DATABASE)
-
-#include "DatabaseSync.h"
-#include "ExceptionCode.h"
-#include "JSSQLTransactionSyncCallback.h"
-#include "PlatformString.h"
-#include "SQLValue.h"
-#include <runtime/JSArray.h>
-
-namespace WebCore {
-
-using namespace JSC;
-
-JSValue JSDatabaseSync::changeVersion(ExecState* exec)
-{
- String oldVersion = ustringToString(exec->argument(0).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- String newVersion = ustringToString(exec->argument(1).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- RefPtr<SQLTransactionSyncCallback> callback;
- if (exec->argumentCount() > 2 && !exec->argument(2).isNull()) {
- JSObject* object = exec->argument(2).getObject();
- if (!object) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- callback = JSSQLTransactionSyncCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
- }
-
- ExceptionCode ec = 0;
- m_impl->changeVersion(oldVersion, newVersion, callback.release(), ec);
- setDOMException(exec, ec);
-
- return jsUndefined();
-}
-
-static JSValue createTransaction(ExecState* exec, DatabaseSync* database, JSDOMGlobalObject* globalObject, bool readOnly)
-{
- JSObject* object = exec->argument(0).getObject();
- if (!object) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- RefPtr<SQLTransactionSyncCallback> callback(JSSQLTransactionSyncCallback::create(object, globalObject));
-
- ExceptionCode ec = 0;
- database->transaction(callback.release(), readOnly, ec);
- setDOMException(exec, ec);
-
- return jsUndefined();
-}
-
-JSValue JSDatabaseSync::transaction(ExecState* exec)
-{
- return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), false);
-}
-
-JSValue JSDatabaseSync::readTransaction(ExecState* exec)
-{
- return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), true);
-}
-
-}
-
-#endif // ENABLE(DATABASE)
diff --git a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
index 6c4dfb4..38334b9 100644
--- a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
+++ b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp
@@ -47,8 +47,15 @@ namespace WebCore {
JSValue JSNotificationCenter::requestPermission(ExecState* exec)
{
- // Permission request is only valid from page context.
ScriptExecutionContext* context = impl()->context();
+
+ // Make sure that script execution context is valid.
+ if (!context) {
+ setDOMException(exec, INVALID_STATE_ERR);
+ return jsUndefined();
+ }
+
+ // Permission request is only valid from page context.
if (context->isWorkerContext())
return throwSyntaxError(exec);
diff --git a/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp b/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
new file mode 100644
index 0000000..225a626
--- /dev/null
+++ b/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSDeviceMotionEvent.h"
+
+#if ENABLE(DEVICE_ORIENTATION)
+
+#include "DeviceMotionData.h"
+#include "DeviceMotionEvent.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSValue JSDeviceMotionEvent::xAcceleration(ExecState* exec) const
+{
+ DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+ if (!imp->deviceMotionData()->canProvideXAcceleration())
+ return jsNull();
+ return jsNumber(exec, imp->deviceMotionData()->xAcceleration());
+}
+
+JSValue JSDeviceMotionEvent::yAcceleration(ExecState* exec) const
+{
+ DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+ if (!imp->deviceMotionData()->canProvideYAcceleration())
+ return jsNull();
+ return jsNumber(exec, imp->deviceMotionData()->yAcceleration());
+}
+
+JSValue JSDeviceMotionEvent::zAcceleration(ExecState* exec) const
+{
+ DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+ if (!imp->deviceMotionData()->canProvideZAcceleration())
+ return jsNull();
+ return jsNumber(exec, imp->deviceMotionData()->zAcceleration());
+}
+
+JSValue JSDeviceMotionEvent::xRotationRate(ExecState* exec) const
+{
+ DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+ if (!imp->deviceMotionData()->canProvideXRotationRate())
+ return jsNull();
+ return jsNumber(exec, imp->deviceMotionData()->xRotationRate());
+}
+
+JSValue JSDeviceMotionEvent::yRotationRate(ExecState* exec) const
+{
+ DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+ if (!imp->deviceMotionData()->canProvideYRotationRate())
+ return jsNull();
+ return jsNumber(exec, imp->deviceMotionData()->yRotationRate());
+}
+
+JSValue JSDeviceMotionEvent::zRotationRate(ExecState* exec) const
+{
+ DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+ if (!imp->deviceMotionData()->canProvideZRotationRate())
+ return jsNull();
+ return jsNumber(exec, imp->deviceMotionData()->zRotationRate());
+}
+
+JSValue JSDeviceMotionEvent::interval(ExecState* exec) const
+{
+ DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+ if (!imp->deviceMotionData()->canProvideInterval())
+ return jsNull();
+ return jsNumber(exec, imp->deviceMotionData()->interval());
+}
+
+JSValue JSDeviceMotionEvent::initDeviceMotionEvent(ExecState* exec)
+{
+ const String& type = ustringToString(exec->argument(0).toString(exec));
+ bool bubbles = exec->argument(1).toBoolean(exec);
+ bool cancelable = exec->argument(2).toBoolean(exec);
+ // If any of the parameters are null or undefined, mark them as not provided.
+ // Otherwise, use the standard JavaScript conversion.
+ bool xAccelerationProvided = !exec->argument(3).isUndefinedOrNull();
+ double xAcceleration = exec->argument(3).toNumber(exec);
+ bool yAccelerationProvided = !exec->argument(4).isUndefinedOrNull();
+ double yAcceleration = exec->argument(4).toNumber(exec);
+ bool zAccelerationProvided = !exec->argument(5).isUndefinedOrNull();
+ double zAcceleration = exec->argument(5).toNumber(exec);
+ bool xRotationRateProvided = !exec->argument(6).isUndefinedOrNull();
+ double xRotationRate = exec->argument(6).toNumber(exec);
+ bool yRotationRateProvided = !exec->argument(7).isUndefinedOrNull();
+ double yRotationRate = exec->argument(7).toNumber(exec);
+ bool zRotationRateProvided = !exec->argument(8).isUndefinedOrNull();
+ double zRotationRate = exec->argument(8).toNumber(exec);
+ bool intervalProvided = !exec->argument(9).isUndefinedOrNull();
+ double interval = exec->argument(9).toNumber(exec);
+ RefPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::create(xAccelerationProvided, xAcceleration,
+ yAccelerationProvided, yAcceleration,
+ zAccelerationProvided, zAcceleration,
+ xRotationRateProvided, xRotationRate,
+ yRotationRateProvided, yRotationRate,
+ zRotationRateProvided, zRotationRate,
+ intervalProvided, interval);
+ DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+ imp->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.get());
+ return jsUndefined();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(DEVICE_ORIENTATION)
diff --git a/WebCore/bindings/js/JSEventCustom.cpp b/WebCore/bindings/js/JSEventCustom.cpp
index b6190ff..7479020 100644
--- a/WebCore/bindings/js/JSEventCustom.cpp
+++ b/WebCore/bindings/js/JSEventCustom.cpp
@@ -32,12 +32,14 @@
#include "Clipboard.h"
#include "CompositionEvent.h"
#include "CustomEvent.h"
+#include "DeviceMotionEvent.h"
#include "DeviceOrientationEvent.h"
#include "Event.h"
#include "JSBeforeLoadEvent.h"
#include "JSClipboard.h"
#include "JSCustomEvent.h"
#include "JSCompositionEvent.h"
+#include "JSDeviceMotionEvent.h"
#include "JSDeviceOrientationEvent.h"
#include "JSErrorEvent.h"
#include "JSKeyboardEvent.h"
@@ -173,6 +175,8 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
else if (event->isCustomEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CustomEvent, event);
#if ENABLE(DEVICE_ORIENTATION)
+ else if (event->isDeviceMotionEvent())
+ wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, DeviceMotionEvent, event);
else if (event->isDeviceOrientationEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, DeviceOrientationEvent, event);
#endif
diff --git a/WebCore/bindings/js/JSEventTarget.cpp b/WebCore/bindings/js/JSEventTarget.cpp
index c5fce64..c86845d 100644
--- a/WebCore/bindings/js/JSEventTarget.cpp
+++ b/WebCore/bindings/js/JSEventTarget.cpp
@@ -88,7 +88,7 @@
#include "WebSocket.h"
#endif
-#if ENABLE(FILE_READER)
+#if ENABLE(BLOB)
#include "JSFileReader.h"
#include "FileReader.h"
#endif
@@ -164,7 +164,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ
return toJS(exec, webSocket);
#endif
-#if ENABLE(FILE_READER)
+#if ENABLE(BLOB)
if (FileReader* fileReader = target->toFileReader())
return toJS(exec, globalObject, fileReader);
#endif
diff --git a/WebCore/bindings/js/JSHTMLDocumentCustom.cpp b/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
index a0e189e..0b40ef0 100644
--- a/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
+++ b/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
@@ -150,7 +150,7 @@ static inline void documentWrite(ExecState* exec, HTMLDocument* document, Newlin
}
}
if (addNewline)
- segmentedString.append(SegmentedString(&newlineCharacter, 1));
+ segmentedString.append(SegmentedString(String(&newlineCharacter, 1)));
Document* activeDocument = asJSDOMWindow(exec->lexicalGlobalObject())->impl()->document();
document->write(segmentedString, activeDocument);
diff --git a/WebCore/bindings/js/JSIDBAnyCustom.cpp b/WebCore/bindings/js/JSIDBAnyCustom.cpp
index 92f725a..e428bf6 100644
--- a/WebCore/bindings/js/JSIDBAnyCustom.cpp
+++ b/WebCore/bindings/js/JSIDBAnyCustom.cpp
@@ -32,16 +32,18 @@
#include "JSIDBAny.h"
#include "IDBAny.h"
-#include "IDBDatabaseRequest.h"
+#include "IDBCursor.h"
+#include "IDBDatabase.h"
#include "IDBFactory.h"
#include "IDBIndex.h"
#include "IDBKey.h"
-#include "IDBObjectStoreRequest.h"
-#include "JSIDBDatabaseRequest.h"
+#include "IDBObjectStore.h"
+#include "JSIDBCursor.h"
+#include "JSIDBDatabase.h"
#include "JSIDBFactory.h"
#include "JSIDBIndex.h"
#include "JSIDBKey.h"
-#include "JSIDBObjectStoreRequest.h"
+#include "JSIDBObjectStore.h"
#include "SerializedScriptValue.h"
using namespace JSC;
@@ -58,14 +60,16 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, IDBAny* idbAny)
return jsUndefined();
case IDBAny::NullType:
return jsNull();
- case IDBAny::IDBDatabaseRequestType:
- return toJS(exec, globalObject, idbAny->idbDatabaseRequest());
+ case IDBAny::IDBCursorType:
+ return toJS(exec, globalObject, idbAny->idbCursor());
+ case IDBAny::IDBDatabaseType:
+ return toJS(exec, globalObject, idbAny->idbDatabase());
case IDBAny::IDBIndexType:
return toJS(exec, globalObject, idbAny->idbIndex());
case IDBAny::IDBKeyType:
return toJS(exec, globalObject, idbAny->idbKey());
- case IDBAny::IDBObjectStoreRequestType:
- return toJS(exec, globalObject, idbAny->idbObjectStoreRequest());
+ case IDBAny::IDBObjectStoreType:
+ return toJS(exec, globalObject, idbAny->idbObjectStore());
case IDBAny::IDBFactoryType:
return toJS(exec, globalObject, idbAny->idbFactory());
case IDBAny::SerializedScriptValueType:
diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index a0d75f8..0c891a3 100644
--- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -48,6 +48,7 @@
#include "InjectedScriptHost.h"
#include "InspectorController.h"
#include "InspectorResource.h"
+#include "InspectorValues.h"
#include "JSDOMWindow.h"
#include "JSDOMWindowCustom.h"
#include "JSNode.h"
@@ -55,7 +56,6 @@
#include "Node.h"
#include "Page.h"
#if ENABLE(DOM_STORAGE)
-#include "SerializedScriptValue.h"
#include "Storage.h"
#include "JSStorage.h"
#endif
@@ -103,23 +103,6 @@ ScriptObject InjectedScriptHost::createInjectedScript(const String& source, Scri
return ScriptObject();
}
-#if ENABLE(DATABASE)
-JSValue JSInjectedScriptHost::databaseForId(ExecState* exec)
-{
- if (exec->argumentCount() < 1)
- return jsUndefined();
-
- InspectorController* ic = impl()->inspectorController();
- if (!ic)
- return jsUndefined();
-
- Database* database = impl()->databaseForId(exec->argument(0).toInt32(exec));
- if (!database)
- return jsUndefined();
- return toJS(exec, database);
-}
-#endif
-
#if ENABLE(JAVASCRIPT_DEBUGGER)
JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec)
{
@@ -192,24 +175,6 @@ JSValue JSInjectedScriptHost::selectDOMStorage(ExecState* exec)
}
#endif
-JSValue JSInjectedScriptHost::reportDidDispatchOnInjectedScript(ExecState* exec)
-{
- if (exec->argumentCount() < 3)
- return jsUndefined();
-
- if (!exec->argument(0).isInt32())
- return jsUndefined();
- int callId = exec->argument(0).asInt32();
-
- RefPtr<SerializedScriptValue> result(SerializedScriptValue::create(exec, exec->argument(1)));
-
- bool isException;
- if (!exec->argument(2).getBoolean(isException))
- return jsUndefined();
- impl()->reportDidDispatchOnInjectedScript(callId, result.get(), isException);
- return jsUndefined();
-}
-
InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* scriptState)
{
JSLock lock(SilenceAssertionsOnly);
diff --git a/WebCore/bindings/js/JSMessagePortCustom.h b/WebCore/bindings/js/JSMessagePortCustom.h
index 62ebef1..8396ae1 100644
--- a/WebCore/bindings/js/JSMessagePortCustom.h
+++ b/WebCore/bindings/js/JSMessagePortCustom.h
@@ -33,13 +33,12 @@
#include "MessagePort.h"
#include <runtime/JSValue.h>
+#include <wtf/Forward.h>
namespace WebCore {
typedef int ExceptionCode;
- class String;
-
// Helper function which pulls the values out of a JS sequence and into a MessagePortArray.
// Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL spec and section 8.3.3 of the HTML5 spec.
// May generate an exception via the passed ExecState.
diff --git a/WebCore/bindings/js/JSSQLTransactionCustom.cpp b/WebCore/bindings/js/JSSQLTransactionCustom.cpp
index 44ebb02..e32ea55 100644
--- a/WebCore/bindings/js/JSSQLTransactionCustom.cpp
+++ b/WebCore/bindings/js/JSSQLTransactionCustom.cpp
@@ -95,7 +95,7 @@ JSValue JSSQLTransaction::executeSql(ExecState* exec)
return jsUndefined();
}
- callback = JSSQLStatementCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject()));
+ callback = JSSQLStatementCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
}
RefPtr<SQLStatementErrorCallback> errorCallback;
@@ -106,7 +106,7 @@ JSValue JSSQLTransaction::executeSql(ExecState* exec)
return jsUndefined();
}
- errorCallback = JSSQLStatementErrorCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject()));
+ errorCallback = JSSQLStatementErrorCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
}
ExceptionCode ec = 0;
diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp
index b443f90..b8885cf 100644
--- a/WebCore/bindings/js/JSWorkerContextCustom.cpp
+++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp
@@ -29,13 +29,6 @@
#include "JSWorkerContext.h"
-#if ENABLE(DATABASE)
-#include "Database.h"
-#include "DatabaseSync.h"
-#include "JSDatabase.h"
-#include "JSDatabaseCallback.h"
-#include "JSDatabaseSync.h"
-#endif
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMGlobalObject.h"
@@ -153,89 +146,6 @@ JSValue JSWorkerContext::messageChannel(ExecState* exec) const
}
#endif
-#if ENABLE(DATABASE)
-JSValue JSWorkerContext::openDatabase(ExecState* exec)
-{
- if (exec->argumentCount() < 4) {
- setDOMException(exec, SYNTAX_ERR);
- return jsUndefined();
- }
-
- String name = ustringToString(exec->argument(0).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- String version = ustringToString(exec->argument(1).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- String displayName = ustringToString(exec->argument(2).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- // exec->argument(3) = estimated size
- unsigned long estimatedSize = exec->argument(3).toUInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- RefPtr<DatabaseCallback> creationCallback;
- if (exec->argumentCount() >= 5) {
- if (!exec->argument(4).isObject()) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject());
- }
-
- ExceptionCode ec = 0;
- JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec)));
- setDOMException(exec, ec);
- return result;
-}
-
-JSValue JSWorkerContext::openDatabaseSync(ExecState* exec)
-{
- if (exec->argumentCount() < 4) {
- setDOMException(exec, SYNTAX_ERR);
- return jsUndefined();
- }
-
- String name = ustringToString(exec->argument(0).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- String version = ustringToString(exec->argument(1).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- String displayName = ustringToString(exec->argument(2).toString(exec));
- if (exec->hadException())
- return jsUndefined();
-
- // exec->argument(3) = estimated size
- unsigned long estimatedSize = exec->argument(3).toUInt32(exec);
- if (exec->hadException())
- return jsUndefined();
-
- RefPtr<DatabaseCallback> creationCallback;
- if (exec->argumentCount() >= 5) {
- if (!exec->argument(4).isObject()) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return jsUndefined();
- }
-
- creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject());
- }
-
- ExceptionCode ec = 0;
- JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabaseSync(name, version, displayName, estimatedSize, creationCallback.release(), ec)));
-
- setDOMException(exec, ec);
- return result;
-}
-#endif
-
} // namespace WebCore
#endif // ENABLE(WORKERS)
diff --git a/WebCore/bindings/js/JavaScriptCallFrame.h b/WebCore/bindings/js/JavaScriptCallFrame.h
index 574c782..c23a43d 100644
--- a/WebCore/bindings/js/JavaScriptCallFrame.h
+++ b/WebCore/bindings/js/JavaScriptCallFrame.h
@@ -30,13 +30,12 @@
#include <debugger/DebuggerCallFrame.h>
#include <interpreter/CallFrame.h>
+#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
-class String;
-
class JavaScriptCallFrame : public RefCounted<JavaScriptCallFrame> {
public:
static PassRefPtr<JavaScriptCallFrame> create(const JSC::DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, int line)
diff --git a/WebCore/bindings/js/ScheduledAction.cpp b/WebCore/bindings/js/ScheduledAction.cpp
index f69f8bd..a9dc6a8 100644
--- a/WebCore/bindings/js/ScheduledAction.cpp
+++ b/WebCore/bindings/js/ScheduledAction.cpp
@@ -34,7 +34,6 @@
#include "ScriptController.h"
#include "ScriptExecutionContext.h"
#include "ScriptSourceCode.h"
-#include "ScriptValue.h"
#include <runtime/JSLock.h>
#if ENABLE(WORKERS)
diff --git a/WebCore/bindings/js/ScriptArray.cpp b/WebCore/bindings/js/ScriptArray.cpp
deleted file mode 100644
index 119d303..0000000
--- a/WebCore/bindings/js/ScriptArray.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ScriptArray.h"
-
-#include "SerializedScriptValue.h"
-
-#include <runtime/JSLock.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-ScriptArray::ScriptArray(ScriptState* scriptState, JSArray* object)
- : ScriptObject(scriptState, object)
-{
-}
-
-static bool handleException(ScriptState* scriptState)
-{
- if (!scriptState->hadException())
- return true;
-
- reportException(scriptState, scriptState->exception());
- return false;
-}
-
-bool ScriptArray::set(unsigned index, const ScriptObject& value)
-{
- if (value.scriptState() != m_scriptState) {
- ASSERT_NOT_REACHED();
- return false;
- }
- JSLock lock(SilenceAssertionsOnly);
- jsArray()->put(m_scriptState, index, value.jsObject());
- return handleException(m_scriptState);
-}
-
-bool ScriptArray::set(unsigned index, SerializedScriptValue* value)
-{
- ScriptValue scriptValue = ScriptValue::deserialize(m_scriptState, value);
- if (scriptValue.hasNoValue()) {
- ASSERT_NOT_REACHED();
- return false;
- }
-
- JSLock lock(SilenceAssertionsOnly);
- jsArray()->put(m_scriptState, index, scriptValue.jsValue());
- return handleException(m_scriptState);
-}
-
-bool ScriptArray::set(unsigned index, const String& value)
-{
- JSLock lock(SilenceAssertionsOnly);
- jsArray()->put(m_scriptState, index, jsString(m_scriptState, value));
- return handleException(m_scriptState);
-}
-
-bool ScriptArray::set(unsigned index, double value)
-{
- JSLock lock(SilenceAssertionsOnly);
- jsArray()->put(m_scriptState, index, jsNumber(m_scriptState, value));
- return handleException(m_scriptState);
-}
-
-bool ScriptArray::set(unsigned index, long long value)
-{
- JSLock lock(SilenceAssertionsOnly);
- jsArray()->put(m_scriptState, index, jsNumber(m_scriptState, value));
- return handleException(m_scriptState);
-}
-
-bool ScriptArray::set(unsigned index, int value)
-{
- JSLock lock(SilenceAssertionsOnly);
- jsArray()->put(m_scriptState, index, jsNumber(m_scriptState, value));
- return handleException(m_scriptState);
-}
-
-bool ScriptArray::set(unsigned index, bool value)
-{
- JSLock lock(SilenceAssertionsOnly);
- jsArray()->put(m_scriptState, index, jsBoolean(value));
- return handleException(m_scriptState);
-}
-
-unsigned ScriptArray::length()
-{
- JSLock lock(SilenceAssertionsOnly);
- return jsArray()->length();
-}
-
-ScriptArray ScriptArray::createNew(ScriptState* scriptState)
-{
- JSLock lock(SilenceAssertionsOnly);
- return ScriptArray(scriptState, constructEmptyArray(scriptState));
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptArray.h b/WebCore/bindings/js/ScriptArray.h
deleted file mode 100644
index 2badd09..0000000
--- a/WebCore/bindings/js/ScriptArray.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ScriptArray_h
-#define ScriptArray_h
-
-#include "ScriptObject.h"
-#include "ScriptState.h"
-
-#include <runtime/JSArray.h>
-
-namespace WebCore {
-class SerializedScriptValue;
-
-class ScriptArray : public ScriptObject {
-public:
- ScriptArray(ScriptState*, JSC::JSArray*);
- ScriptArray() {}
- JSC::JSArray* jsArray() const { return asArray(jsValue()); }
-
- bool set(unsigned index, const ScriptObject&);
- bool set(unsigned index, SerializedScriptValue*);
- bool set(unsigned index, const String&);
- bool set(unsigned index, double);
- bool set(unsigned index, long long);
- bool set(unsigned index, int);
- bool set(unsigned index, bool);
- unsigned length();
-
- static ScriptArray createNew(ScriptState*);
-};
-}
-
-#endif // ScriptArray_h
diff --git a/WebCore/bindings/js/ScriptCallStack.h b/WebCore/bindings/js/ScriptCallStack.h
index e461ac3..a45e65a 100644
--- a/WebCore/bindings/js/ScriptCallStack.h
+++ b/WebCore/bindings/js/ScriptCallStack.h
@@ -31,7 +31,6 @@
#ifndef ScriptCallStack_h
#define ScriptCallStack_h
-#include "ScriptArray.h"
#include "ScriptCallFrame.h"
#include "ScriptState.h"
#include "ScriptString.h"
diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h
index 80155e4..8dae637 100644
--- a/WebCore/bindings/js/ScriptController.h
+++ b/WebCore/bindings/js/ScriptController.h
@@ -26,6 +26,7 @@
#include "ScriptControllerBase.h"
#include "ScriptInstance.h"
#include <runtime/Protect.h>
+#include <wtf/Forward.h>
#include <wtf/RefPtr.h>
#if PLATFORM(MAC)
@@ -57,7 +58,6 @@ class Frame;
class Node;
class ScriptSourceCode;
class ScriptValue;
-class String;
class Widget;
class XSSAuditor;
diff --git a/WebCore/bindings/js/ScriptControllerEfl.cpp b/WebCore/bindings/js/ScriptControllerEfl.cpp
index 950c11e..fea172e 100644
--- a/WebCore/bindings/js/ScriptControllerEfl.cpp
+++ b/WebCore/bindings/js/ScriptControllerEfl.cpp
@@ -39,14 +39,10 @@ namespace WebCore {
PassRefPtr<JSC::Bindings::Instance> ScriptController::createScriptInstanceForWidget(Widget* widget)
{
- return 0;
-
-#if 0 // FIXME: disabled until we have Plugin system done.
if (!widget->isPluginView())
return 0;
return static_cast<PluginView*>(widget)->bindingInstance();
-#endif
}
}
diff --git a/WebCore/bindings/js/ScriptObject.cpp b/WebCore/bindings/js/ScriptObject.cpp
index de397f7..e06eccb 100644
--- a/WebCore/bindings/js/ScriptObject.cpp
+++ b/WebCore/bindings/js/ScriptObject.cpp
@@ -59,96 +59,6 @@ static bool handleException(ScriptState* scriptState)
return false;
}
-bool ScriptObject::set(const String& name, const String& value)
-{
- JSLock lock(SilenceAssertionsOnly);
- PutPropertySlot slot;
- jsObject()->put(m_scriptState, Identifier(m_scriptState, stringToUString(name)), jsString(m_scriptState, stringToUString(value)), slot);
- return handleException(m_scriptState);
-}
-
-bool ScriptObject::set(const char* name, const ScriptObject& value)
-{
- if (value.scriptState() != m_scriptState) {
- ASSERT_NOT_REACHED();
- return false;
- }
- JSLock lock(SilenceAssertionsOnly);
- PutPropertySlot slot;
- jsObject()->put(m_scriptState, Identifier(m_scriptState, name), value.jsObject(), slot);
- return handleException(m_scriptState);
-}
-
-bool ScriptObject::set(const char* name, const String& value)
-{
- JSLock lock(SilenceAssertionsOnly);
- PutPropertySlot slot;
- jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsString(m_scriptState, value), slot);
- return handleException(m_scriptState);
-}
-
-bool ScriptObject::set(const char* name, double value)
-{
- JSLock lock(SilenceAssertionsOnly);
- PutPropertySlot slot;
- jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsNumber(m_scriptState, value), slot);
- return handleException(m_scriptState);
-}
-
-bool ScriptObject::set(const char* name, long value)
-{
- JSLock lock(SilenceAssertionsOnly);
- PutPropertySlot slot;
- jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsNumber(m_scriptState, value), slot);
- return handleException(m_scriptState);
-}
-
-bool ScriptObject::set(const char* name, long long value)
-{
- JSLock lock(SilenceAssertionsOnly);
- PutPropertySlot slot;
- jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsNumber(m_scriptState, value), slot);
- return handleException(m_scriptState);
-}
-
-bool ScriptObject::set(const char* name, int value)
-{
- JSLock lock(SilenceAssertionsOnly);
- PutPropertySlot slot;
- jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsNumber(m_scriptState, value), slot);
- return handleException(m_scriptState);
-}
-
-bool ScriptObject::set(const char* name, unsigned value)
-{
- JSLock lock(SilenceAssertionsOnly);
- PutPropertySlot slot;
- jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsNumber(m_scriptState, value), slot);
- return handleException(m_scriptState);
-}
-
-bool ScriptObject::set(const char* name, unsigned long value)
-{
- JSLock lock(SilenceAssertionsOnly);
- PutPropertySlot slot;
- jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsNumber(m_scriptState, value), slot);
- return handleException(m_scriptState);
-}
-
-bool ScriptObject::set(const char* name, bool value)
-{
- JSLock lock(SilenceAssertionsOnly);
- PutPropertySlot slot;
- jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsBoolean(value), slot);
- return handleException(m_scriptState);
-}
-
-ScriptObject ScriptObject::createNew(ScriptState* scriptState)
-{
- JSLock lock(SilenceAssertionsOnly);
- return ScriptObject(scriptState, constructEmptyObject(scriptState));
-}
-
bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, const ScriptObject& value)
{
JSLock lock(SilenceAssertionsOnly);
diff --git a/WebCore/bindings/js/ScriptObject.h b/WebCore/bindings/js/ScriptObject.h
index 9880976..f085e8b 100644
--- a/WebCore/bindings/js/ScriptObject.h
+++ b/WebCore/bindings/js/ScriptObject.h
@@ -48,19 +48,6 @@ namespace WebCore {
JSC::JSObject* jsObject() const { return asObject(jsValue()); }
ScriptState* scriptState() const { return m_scriptState; }
- bool set(const String& name, const String&);
- bool set(const char* name, const ScriptObject&);
- bool set(const char* name, const String&);
- bool set(const char* name, double);
- bool set(const char* name, long);
- bool set(const char* name, long long);
- bool set(const char* name, int);
- bool set(const char* name, unsigned);
- bool set(const char* name, unsigned long);
- bool set(const char* name, bool);
-
- static ScriptObject createNew(ScriptState*);
-
protected:
ScriptState* m_scriptState;
};
diff --git a/WebCore/bindings/js/ScriptProfile.cpp b/WebCore/bindings/js/ScriptProfile.cpp
new file mode 100644
index 0000000..1fbd040
--- /dev/null
+++ b/WebCore/bindings/js/ScriptProfile.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 "ScriptProfile.h"
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+#include "InspectorValues.h"
+#include "JSDOMBinding.h"
+#include <profiler/Profile.h>
+#include <profiler/ProfileNode.h>
+
+namespace WebCore {
+
+PassRefPtr<ScriptProfile> ScriptProfile::create(PassRefPtr<JSC::Profile> profile)
+{
+ if (!profile)
+ return 0;
+ return adoptRef(new ScriptProfile(profile));
+}
+
+ScriptProfile::ScriptProfile(PassRefPtr<JSC::Profile> profile)
+ : m_profile(profile)
+{
+}
+
+ScriptProfile::~ScriptProfile()
+{
+}
+
+String ScriptProfile::title() const
+{
+ return ustringToString(m_profile->title());
+}
+
+unsigned int ScriptProfile::uid() const
+{
+ return m_profile->uid();
+}
+
+ScriptProfileNode* ScriptProfile::head() const
+{
+ return m_profile->head();
+}
+
+static PassRefPtr<InspectorObject> buildInspectorObjectFor(const JSC::ProfileNode* node)
+{
+ RefPtr<InspectorObject> result = InspectorObject::create();
+
+ result->setString("functionName", ustringToString(node->functionName()));
+ result->setString("url", ustringToString(node->url()));
+ result->setNumber("lineNumber", node->lineNumber());
+ result->setNumber("totalTime", node->totalTime());
+ result->setNumber("selfTime", node->selfTime());
+ result->setNumber("numberOfCalls", node->numberOfCalls());
+ result->setBool("visible", node->visible());
+ result->setNumber("callUID", node->callIdentifier().hash());
+
+ RefPtr<InspectorArray> childrenArray = InspectorArray::create();
+ typedef Vector<RefPtr<JSC::ProfileNode> > ProfileNodesList;
+ const ProfileNodesList& children = node->children();
+ ProfileNodesList::const_iterator end = children.end();
+ for (ProfileNodesList::const_iterator iter = children.begin(); iter != end; ++iter)
+ childrenArray->push(buildInspectorObjectFor(iter->get()));
+ result->set("children", childrenArray);
+
+ return result;
+}
+
+PassRefPtr<InspectorObject> ScriptProfile::buildInspectorObjectForHead() const
+{
+ return buildInspectorObjectFor(m_profile->head());
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebCore/bindings/js/ScriptProfile.h b/WebCore/bindings/js/ScriptProfile.h
index 32095e3..b39d2c9 100644
--- a/WebCore/bindings/js/ScriptProfile.h
+++ b/WebCore/bindings/js/ScriptProfile.h
@@ -28,11 +28,37 @@
#define ScriptProfile_h
#if ENABLE(JAVASCRIPT_DEBUGGER)
-#include <profiler/Profile.h>
+#include "ScriptProfileNode.h"
+#include <wtf/Forward.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+class Profile;
+}
namespace WebCore {
-typedef JSC::Profile ScriptProfile;
+class InspectorObject;
+
+class ScriptProfile : public RefCounted<ScriptProfile> {
+public:
+ static PassRefPtr<ScriptProfile> create(PassRefPtr<JSC::Profile> profile);
+ virtual ~ScriptProfile();
+
+ String title() const;
+ unsigned int uid() const;
+ ScriptProfileNode* head() const;
+
+ PassRefPtr<InspectorObject> buildInspectorObjectForHead() const;
+
+private:
+ ScriptProfile(PassRefPtr<JSC::Profile> profile);
+
+ RefPtr<JSC::Profile> m_profile;
+};
+
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptProfiler.cpp b/WebCore/bindings/js/ScriptProfiler.cpp
index 5121232..f372c3c 100644
--- a/WebCore/bindings/js/ScriptProfiler.cpp
+++ b/WebCore/bindings/js/ScriptProfiler.cpp
@@ -42,7 +42,8 @@ void ScriptProfiler::start(ScriptState* state, const String& title)
PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
{
- return JSC::Profiler::profiler()->stopProfiling(state, stringToUString(title));
+ RefPtr<JSC::Profile> profile = JSC::Profiler::profiler()->stopProfiling(state, stringToUString(title));
+ return ScriptProfile::create(profile);
}
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptProfiler.h b/WebCore/bindings/js/ScriptProfiler.h
index 16195a3..4fa331c 100644
--- a/WebCore/bindings/js/ScriptProfiler.h
+++ b/WebCore/bindings/js/ScriptProfiler.h
@@ -40,6 +40,7 @@ public:
static void start(ScriptState* state, const String& title);
static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
static void takeHeapSnapshot() { }
+ static long getProfilerLogLines(long, String*) { return 0; }
};
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptSourceProvider.h b/WebCore/bindings/js/ScriptSourceProvider.h
index 2144169..de4e307 100644
--- a/WebCore/bindings/js/ScriptSourceProvider.h
+++ b/WebCore/bindings/js/ScriptSourceProvider.h
@@ -28,11 +28,10 @@
#define ScriptSourceProvider_h
#include <parser/SourceProvider.h>
+#include <wtf/Forward.h>
namespace WebCore {
- class String;
-
class ScriptSourceProvider : public JSC::SourceProvider {
public:
ScriptSourceProvider(const JSC::UString& url)
diff --git a/WebCore/bindings/js/ScriptString.h b/WebCore/bindings/js/ScriptString.h
index ad0ae95..558ad33 100644
--- a/WebCore/bindings/js/ScriptString.h
+++ b/WebCore/bindings/js/ScriptString.h
@@ -35,11 +35,10 @@
#include "PlatformString.h"
#include <runtime/UString.h>
#include <runtime/StringBuilder.h>
+#include <wtf/Forward.h>
namespace WebCore {
-class String;
-
class ScriptString {
public:
ScriptString() {}
diff --git a/WebCore/bindings/js/ScriptValue.cpp b/WebCore/bindings/js/ScriptValue.cpp
index abc31e2..23934cd 100644
--- a/WebCore/bindings/js/ScriptValue.cpp
+++ b/WebCore/bindings/js/ScriptValue.cpp
@@ -143,6 +143,7 @@ static PassRefPtr<InspectorValue> jsToInspectorValue(ScriptState* scriptState, J
}
return inspectorObject;
}
+ ASSERT_NOT_REACHED();
return 0;
}
diff --git a/WebCore/bindings/js/WorkerScriptController.h b/WebCore/bindings/js/WorkerScriptController.h
index 60c3b04..be7da4d 100644
--- a/WebCore/bindings/js/WorkerScriptController.h
+++ b/WebCore/bindings/js/WorkerScriptController.h
@@ -30,6 +30,7 @@
#if ENABLE(WORKERS)
#include <runtime/Protect.h>
+#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/Threading.h>
@@ -42,7 +43,6 @@ namespace WebCore {
class JSWorkerContext;
class ScriptSourceCode;
class ScriptValue;
- class String;
class WorkerContext;
class WorkerScriptController : public Noncopyable {