summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings')
-rw-r--r--WebCore/bindings/ScriptControllerBase.cpp1
-rw-r--r--WebCore/bindings/generic/BindingDOMWindow.h9
-rw-r--r--WebCore/bindings/generic/BindingElement.h102
-rw-r--r--WebCore/bindings/generic/RuntimeEnabledFeatures.cpp98
-rw-r--r--WebCore/bindings/generic/RuntimeEnabledFeatures.h (renamed from WebCore/bindings/v8/RuntimeEnabledFeatures.h)37
-rw-r--r--WebCore/bindings/js/JSAbstractWorkerCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSBindingsAllInOne.cpp1
-rw-r--r--WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSDOMBinding.cpp8
-rw-r--r--WebCore/bindings/js/JSDOMBinding.h25
-rw-r--r--WebCore/bindings/js/JSDOMWindowCustom.cpp14
-rw-r--r--WebCore/bindings/js/JSEventListener.cpp8
-rw-r--r--WebCore/bindings/js/JSEventListener.h47
-rw-r--r--WebCore/bindings/js/JSEventSourceCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSInjectedScriptHostCustom.cpp20
-rw-r--r--WebCore/bindings/js/JSLazyEventListener.cpp71
-rw-r--r--WebCore/bindings/js/JSLazyEventListener.h11
-rw-r--r--WebCore/bindings/js/JSMessagePortCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSNodeCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSSVGElementInstanceCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSSVGMatrixCustom.cpp16
-rw-r--r--WebCore/bindings/js/JSSVGPODTypeWrapper.h6
-rw-r--r--WebCore/bindings/js/JSWebSocketCustom.cpp4
-rw-r--r--WebCore/bindings/js/JSWorkerContextCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSXMLHttpRequestCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp6
-rw-r--r--WebCore/bindings/js/ScriptArray.cpp4
-rw-r--r--WebCore/bindings/js/ScriptController.cpp5
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.cpp49
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.h46
-rw-r--r--WebCore/bindings/js/ScriptEventListener.cpp20
-rw-r--r--WebCore/bindings/js/ScriptFunctionCall.cpp8
-rw-r--r--WebCore/bindings/js/ScriptFunctionCall.h2
-rw-r--r--WebCore/bindings/js/ScriptObject.cpp4
-rw-r--r--WebCore/bindings/js/ScriptString.h2
-rw-r--r--WebCore/bindings/js/ScriptValue.cpp12
-rw-r--r--WebCore/bindings/js/ScriptValue.h5
-rw-r--r--WebCore/bindings/js/SerializedScriptValue.cpp49
-rw-r--r--WebCore/bindings/js/SerializedScriptValue.h14
-rw-r--r--WebCore/bindings/scripts/CodeGenerator.pm23
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorJS.pm16
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorObjC.pm6
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorV8.pm208
-rw-r--r--WebCore/bindings/v8/NPV8Object.cpp2
-rw-r--r--WebCore/bindings/v8/ScheduledAction.cpp6
-rw-r--r--WebCore/bindings/v8/ScriptArray.cpp4
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.cpp (renamed from WebCore/bindings/v8/RuntimeEnabledFeatures.cpp)21
-rw-r--r--WebCore/bindings/v8/ScriptDebugServer.h46
-rw-r--r--WebCore/bindings/v8/ScriptFunctionCall.cpp8
-rw-r--r--WebCore/bindings/v8/ScriptFunctionCall.h2
-rw-r--r--WebCore/bindings/v8/ScriptObject.cpp4
-rw-r--r--WebCore/bindings/v8/ScriptState.h2
-rwxr-xr-x[-rw-r--r--]WebCore/bindings/v8/ScriptValue.cpp14
-rw-r--r--WebCore/bindings/v8/ScriptValue.h6
-rw-r--r--WebCore/bindings/v8/V8Binding.cpp8
-rw-r--r--WebCore/bindings/v8/V8Binding.h7
-rw-r--r--WebCore/bindings/v8/V8DOMWindowShell.cpp9
-rw-r--r--WebCore/bindings/v8/V8DOMWindowShell.h5
-rw-r--r--WebCore/bindings/v8/V8DOMWrapper.cpp48
-rw-r--r--WebCore/bindings/v8/V8DOMWrapper.h6
-rw-r--r--WebCore/bindings/v8/V8Index.cpp26
-rw-r--r--WebCore/bindings/v8/V8Index.h11
-rw-r--r--WebCore/bindings/v8/V8NPObject.cpp1
-rw-r--r--WebCore/bindings/v8/V8Proxy.cpp2
-rw-r--r--WebCore/bindings/v8/V8Utilities.cpp1
-rw-r--r--WebCore/bindings/v8/V8WorkerContextEventListener.cpp7
-rw-r--r--WebCore/bindings/v8/WorkerContextExecutionProxy.cpp191
-rw-r--r--WebCore/bindings/v8/WorkerContextExecutionProxy.h18
-rw-r--r--WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8AttrCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8ClipboardCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8CustomBinding.h51
-rw-r--r--WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp113
-rw-r--r--WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8DatabaseCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8DocumentCustom.cpp6
-rw-r--r--WebCore/bindings/v8/custom/V8ElementCustom.cpp21
-rw-r--r--WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8EventSourceCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8GeolocationCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp40
-rwxr-xr-xWebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h4
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp40
-rwxr-xr-xWebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h10
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp40
-rwxr-xr-xWebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h10
-rw-r--r--WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8HistoryCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp17
-rw-r--r--WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8LocationCustom.cpp7
-rw-r--r--WebCore/bindings/v8/custom/V8MessageEventCustom.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8MessagePortCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8NavigatorCustom.cpp13
-rw-r--r--WebCore/bindings/v8/custom/V8NodeCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp7
-rw-r--r--WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp2
-rw-r--r--WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp20
-rw-r--r--WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp1
-rwxr-xr-xWebCore/bindings/v8/custom/V8StorageCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLArrayCustom.h1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp1
-rwxr-xr-xWebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp1
-rwxr-xr-xWebCore/bindings/v8/custom/V8WorkerContextCustom.cpp26
-rwxr-xr-xWebCore/bindings/v8/custom/V8WorkerCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp1
-rw-r--r--WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp1
131 files changed, 1023 insertions, 904 deletions
diff --git a/WebCore/bindings/ScriptControllerBase.cpp b/WebCore/bindings/ScriptControllerBase.cpp
index f1217e3..abe96ee 100644
--- a/WebCore/bindings/ScriptControllerBase.cpp
+++ b/WebCore/bindings/ScriptControllerBase.cpp
@@ -33,6 +33,7 @@ namespace WebCore {
bool ScriptController::canExecuteScripts()
{
+ // FIXME: We should get this information from the document instead of the frame.
if (m_frame->loader()->isSandboxed(SandboxScripts))
return false;
diff --git a/WebCore/bindings/generic/BindingDOMWindow.h b/WebCore/bindings/generic/BindingDOMWindow.h
index b968e2c..d6d3087 100644
--- a/WebCore/bindings/generic/BindingDOMWindow.h
+++ b/WebCore/bindings/generic/BindingDOMWindow.h
@@ -35,6 +35,7 @@
#include "FrameLoadRequest.h"
#include "GenericBinding.h"
#include "Page.h"
+#include "SecurityOrigin.h"
namespace WebCore {
@@ -68,9 +69,11 @@ Frame* BindingDOMWindow<Binding>::createWindow(State<Binding>* state,
ASSERT(callingFrame);
ASSERT(enteredFrame);
- // Sandboxed iframes cannot open new auxiliary browsing contexts.
- if (callingFrame && callingFrame->loader()->isSandboxed(SandboxNavigation))
- return 0;
+ if (Document* callingDocument = callingFrame->document()) {
+ // Sandboxed iframes cannot open new auxiliary browsing contexts.
+ if (callingDocument->securityOrigin()->isSandboxed(SandboxNavigation))
+ return 0;
+ }
ResourceRequest request;
diff --git a/WebCore/bindings/generic/BindingElement.h b/WebCore/bindings/generic/BindingElement.h
new file mode 100644
index 0000000..ba7856a
--- /dev/null
+++ b/WebCore/bindings/generic/BindingElement.h
@@ -0,0 +1,102 @@
+/*
+ * 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:
+ *
+ * * 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 BindingElement_h
+#define BindingElement_h
+
+#include "Attr.h"
+#include "BindingSecurity.h"
+#include "Element.h"
+#include "ExceptionCode.h"
+
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+template <class Binding>
+class BindingElement {
+public:
+ static void setAttribute(State<Binding>*, Element*, const AtomicString&, const AtomicString&, ExceptionCode&);
+ static RefPtr<Attr> setAttributeNode(State<Binding>*, Element*, Attr*, ExceptionCode&);
+ static void setAttributeNS(State<Binding>*, Element*, const AtomicString&, const AtomicString&, const AtomicString&, ExceptionCode&);
+ static RefPtr<Attr> setAttributeNodeNS(State<Binding>*, Element*, Attr*, ExceptionCode&);
+};
+
+// Implementations of templated methods must be in this file.
+
+template <class Binding>
+void BindingElement<Binding>::setAttribute(State<Binding>* state, Element* element, const AtomicString& name, const AtomicString& value, ExceptionCode& ec)
+{
+ ASSERT(element);
+
+ if (!BindingSecurity<Binding>::allowSettingSrcToJavascriptURL(state, element, name, value))
+ return;
+
+ element->setAttribute(name, value, ec);
+}
+
+template <class Binding>
+RefPtr<Attr> BindingElement<Binding>::setAttributeNode(State<Binding>* state, Element* element, Attr* newAttr, ExceptionCode& ec)
+{
+ ASSERT(element);
+ ASSERT(newAttr);
+
+ if (!BindingSecurity<Binding>::allowSettingSrcToJavascriptURL(state, element, newAttr->name(), newAttr->value()))
+ return 0;
+
+ return element->setAttributeNode(newAttr, ec);
+}
+
+template <class Binding>
+void BindingElement<Binding>::setAttributeNS(State<Binding>* state, Element* element, const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode& ec)
+{
+ ASSERT(element);
+
+ if (!BindingSecurity<Binding>::allowSettingSrcToJavascriptURL(state, element, qualifiedName, value))
+ return;
+
+ element->setAttributeNS(namespaceURI, qualifiedName, value, ec);
+}
+
+template <class Binding>
+RefPtr<Attr> BindingElement<Binding>::setAttributeNodeNS(State<Binding>* state, Element* element, Attr* newAttr, ExceptionCode& ec)
+{
+ ASSERT(element);
+ ASSERT(newAttr);
+
+ if (!BindingSecurity<Binding>::allowSettingSrcToJavascriptURL(state, element, newAttr->name(), newAttr->value()))
+ return 0;
+
+ return element->setAttributeNodeNS(newAttr, ec);
+}
+
+} // namespace WebCore
+
+#endif // BindingElement_h
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
new file mode 100644
index 0000000..3fdbb6d
--- /dev/null
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
@@ -0,0 +1,98 @@
+/*
+ * 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 "RuntimeEnabledFeatures.h"
+
+#include "Database.h"
+#include "MediaPlayer.h"
+#include "SharedWorkerRepository.h"
+#include "WebSocket.h"
+
+namespace WebCore {
+
+bool RuntimeEnabledFeatures::isLocalStorageEnabled = true;
+bool RuntimeEnabledFeatures::isSessionStorageEnabled = true;
+bool RuntimeEnabledFeatures::isWebkitNotificationsEnabled = false;
+bool RuntimeEnabledFeatures::isApplicationCacheEnabled = false;
+bool RuntimeEnabledFeatures::isGeolocationEnabled = false;
+bool RuntimeEnabledFeatures::isIndexedDBEnabled = false;
+
+#if ENABLE(VIDEO)
+
+bool RuntimeEnabledFeatures::audioEnabled()
+{
+ return MediaPlayer::isAvailable();
+}
+
+bool RuntimeEnabledFeatures::htmlMediaElementEnabled()
+{
+ return MediaPlayer::isAvailable();
+}
+
+bool RuntimeEnabledFeatures::htmlAudioElementEnabled()
+{
+ return MediaPlayer::isAvailable();
+}
+
+bool RuntimeEnabledFeatures::htmlVideoElementEnabled()
+{
+ return MediaPlayer::isAvailable();
+}
+
+bool RuntimeEnabledFeatures::mediaErrorEnabled()
+{
+ return MediaPlayer::isAvailable();
+}
+
+#endif
+
+#if ENABLE(SHARED_WORKERS)
+bool RuntimeEnabledFeatures::sharedWorkerEnabled()
+{
+ return SharedWorkerRepository::isAvailable();
+}
+#endif
+
+#if ENABLE(WEB_SOCKETS)
+bool RuntimeEnabledFeatures::webSocketEnabled()
+{
+ return WebSocket::isAvailable();
+}
+#endif
+
+#if ENABLE(DATABASE)
+bool RuntimeEnabledFeatures::openDatabaseEnabled()
+{
+ return Database::isAvailable();
+}
+#endif
+
+} // namespace WebCore
diff --git a/WebCore/bindings/v8/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
index 4428004..6f0f78f 100644
--- a/WebCore/bindings/v8/RuntimeEnabledFeatures.h
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
@@ -33,7 +33,10 @@
namespace WebCore {
-// A class that stores static enablers for all experimental features
+// A class that stores static enablers for all experimental features. Note that
+// the method names must line up with the JavaScript method they enable for code
+// generation to work properly.
+
class RuntimeEnabledFeatures {
public:
static void setLocalStorageEnabled(bool isEnabled) { isLocalStorageEnabled = isEnabled; }
@@ -42,8 +45,8 @@ public:
static void setSessionStorageEnabled(bool isEnabled) { isSessionStorageEnabled = isEnabled; }
static bool sessionStorageEnabled() { return isSessionStorageEnabled; }
- static void setNotificationsEnabled(bool isEnabled) { isNotificationsEnabled = isEnabled; }
- static bool notificationsEnabled() { return isNotificationsEnabled; }
+ static void setWebkitNotificationsEnabled(bool isEnabled) { isWebkitNotificationsEnabled = isEnabled; }
+ static bool webkitNotificationsEnabled() { return isWebkitNotificationsEnabled; }
static void setApplicationCacheEnabled(bool isEnabled) { isApplicationCacheEnabled = isEnabled; }
static bool applicationCacheEnabled() { return isApplicationCacheEnabled; }
@@ -51,8 +54,28 @@ public:
static void setGeolocationEnabled(bool isEnabled) { isGeolocationEnabled = isEnabled; }
static bool geolocationEnabled() { return isGeolocationEnabled; }
- static void setIndexedDatabaseEnabled(bool isEnabled) { isIndexedDatabaseEnabled = isEnabled; }
- static bool indexedDatabaseEnabled() { return isIndexedDatabaseEnabled; }
+ static void setIndexedDBEnabled(bool isEnabled) { isIndexedDBEnabled = isEnabled; }
+ static bool indexedDBEnabled() { return isIndexedDBEnabled; }
+
+#if ENABLE(VIDEO)
+ static bool audioEnabled();
+ static bool htmlMediaElementEnabled();
+ static bool htmlAudioElementEnabled();
+ static bool htmlVideoElementEnabled();
+ static bool mediaErrorEnabled();
+#endif
+
+#if ENABLE(SHARED_WORKERS)
+ static bool sharedWorkerEnabled();
+#endif
+
+#if ENABLE(WEB_SOCKETS)
+ static bool webSocketEnabled();
+#endif
+
+#if ENABLE(DATABASE)
+ static bool openDatabaseEnabled();
+#endif
private:
// Never instantiate.
@@ -60,10 +83,10 @@ private:
static bool isLocalStorageEnabled;
static bool isSessionStorageEnabled;
- static bool isNotificationsEnabled;
+ static bool isWebkitNotificationsEnabled;
static bool isApplicationCacheEnabled;
static bool isGeolocationEnabled;
- static bool isIndexedDatabaseEnabled;
+ static bool isIndexedDBEnabled;
};
} // namespace WebCore
diff --git a/WebCore/bindings/js/JSAbstractWorkerCustom.cpp b/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
index 6eca7bd..61fcf98 100644
--- a/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
+++ b/WebCore/bindings/js/JSAbstractWorkerCustom.cpp
@@ -50,7 +50,7 @@ JSValue JSAbstractWorker::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -60,7 +60,7 @@ JSValue JSAbstractWorker::removeEventListener(ExecState* exec, const ArgList& ar
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp
index 8a918a3..5a0820b 100644
--- a/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -140,6 +140,7 @@
#include "ScriptCallStack.cpp"
#include "ScriptController.cpp"
#include "ScriptControllerWin.cpp"
+#include "ScriptDebugServer.cpp"
#include "ScriptEventListener.cpp"
#include "ScriptFunctionCall.cpp"
#include "ScriptProfiler.cpp"
diff --git a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
index 91ee51a..5637087 100644
--- a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
+++ b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
@@ -91,7 +91,7 @@ JSValue JSDOMApplicationCache::addEventListener(ExecState* exec, const ArgList&
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -101,7 +101,7 @@ JSValue JSDOMApplicationCache::removeEventListener(ExecState* exec, const ArgLis
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index abba405..d718cba 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -151,9 +151,11 @@ DOMWrapperWorld::DOMWrapperWorld(JSC::JSGlobalData* globalData, bool isNormal)
DOMWrapperWorld::~DOMWrapperWorld()
{
- JSGlobalData::ClientData* clientData = m_globalData->clientData;
- ASSERT(clientData);
- static_cast<WebCoreJSClientData*>(clientData)->forgetWorld(this);
+ if (m_globalData) {
+ JSGlobalData::ClientData* clientData = m_globalData->clientData;
+ ASSERT(clientData);
+ static_cast<WebCoreJSClientData*>(clientData)->forgetWorld(this);
+ }
for (HashSet<Document*>::iterator iter = documentsWithWrappers.begin(); iter != documentsWithWrappers.end(); ++iter)
forgetWorldOfDOMNodesForDocument(*iter, this);
diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h
index 5456c75..930f9cc 100644
--- a/WebCore/bindings/js/JSDOMBinding.h
+++ b/WebCore/bindings/js/JSDOMBinding.h
@@ -138,9 +138,13 @@ namespace WebCore {
class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
public:
- DOMWrapperWorld(JSC::JSGlobalData*, bool isNormal);
+ static PassRefPtr<DOMWrapperWorld> create(JSC::JSGlobalData* globalData, bool isNormal)
+ {
+ return adoptRef(new DOMWrapperWorld(globalData, isNormal));
+ }
~DOMWrapperWorld();
+ void detachFromGlobalData() { m_globalData = 0; }
void rememberDocument(Document* document) { documentsWithWrappers.add(document); }
void forgetDocument(Document* document) { documentsWithWrappers.remove(document); }
@@ -150,6 +154,9 @@ namespace WebCore {
bool isNormal() const { return m_isNormal; }
+ protected:
+ DOMWrapperWorld(JSC::JSGlobalData*, bool isNormal);
+
private:
JSC::JSGlobalData* m_globalData;
HashSet<Document*> documentsWithWrappers;
@@ -185,13 +192,19 @@ namespace WebCore {
public:
WebCoreJSClientData(JSC::JSGlobalData* globalData)
- : m_normalWorld(globalData, true)
+ : m_normalWorld(DOMWrapperWorld::create(globalData, true))
+ {
+ m_worldSet.add(m_normalWorld.get());
+ }
+
+ virtual ~WebCoreJSClientData()
{
- m_worldSet.add(&m_normalWorld);
+ ASSERT(m_worldSet.contains(m_normalWorld.get()));
+ ASSERT(m_worldSet.size() == 1);
+ m_normalWorld->detachFromGlobalData();
}
- // FIXME: add a destructor to assert m_worldSet only contains m_normalWorld?
- DOMWrapperWorld* normalWorld() { return &m_normalWorld; }
+ DOMWrapperWorld* normalWorld() { return m_normalWorld.get(); }
void getAllWorlds(Vector<DOMWrapperWorld*>& worlds)
{
@@ -212,7 +225,7 @@ namespace WebCore {
DOMObjectHashTableMap hashTableMap;
private:
HashSet<DOMWrapperWorld*> m_worldSet;
- DOMWrapperWorld m_normalWorld;
+ RefPtr<DOMWrapperWorld> m_normalWorld;
};
DOMObject* getCachedDOMObjectWrapper(JSC::ExecState*, void* objectHandle);
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index f7be2c5..b8cd1dc 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -97,7 +97,7 @@ void JSDOMWindow::markChildren(MarkStack& markStack)
{
Base::markChildren(markStack);
- impl()->markEventListeners(markStack);
+ impl()->markJSEventListeners(markStack);
JSGlobalData& globalData = *Heap::heap(this)->globalData();
@@ -666,9 +666,11 @@ static Frame* createWindow(ExecState* exec, Frame* lexicalFrame, Frame* dynamicF
ASSERT(lexicalFrame);
ASSERT(dynamicFrame);
- // Sandboxed iframes cannot open new auxiliary browsing contexts.
- if (lexicalFrame && lexicalFrame->loader()->isSandboxed(SandboxNavigation))
- return 0;
+ if (Document* lexicalDocument = lexicalFrame->document()) {
+ // Sandboxed iframes cannot open new auxiliary browsing contexts.
+ if (lexicalDocument->securityOrigin()->isSandboxed(SandboxNavigation))
+ return 0;
+ }
ResourceRequest request;
@@ -997,7 +999,7 @@ JSValue JSDOMWindow::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -1011,7 +1013,7 @@ JSValue JSDOMWindow::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSEventListener.cpp b/WebCore/bindings/js/JSEventListener.cpp
index d3b5fe1..61f21be 100644
--- a/WebCore/bindings/js/JSEventListener.cpp
+++ b/WebCore/bindings/js/JSEventListener.cpp
@@ -31,9 +31,10 @@ using namespace JSC;
namespace WebCore {
-JSEventListener::JSEventListener(JSObject* function, bool isAttribute, DOMWrapperWorld* isolatedWorld)
+JSEventListener::JSEventListener(JSObject* function, JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld)
: EventListener(JSEventListenerType)
, m_jsFunction(function)
+ , m_wrapper(wrapper)
, m_isAttribute(isAttribute)
, m_isolatedWorld(isolatedWorld)
{
@@ -43,9 +44,10 @@ JSEventListener::~JSEventListener()
{
}
-JSObject* JSEventListener::jsFunction(ScriptExecutionContext*) const
+JSObject* JSEventListener::initializeJSFunction(ScriptExecutionContext*) const
{
- return m_jsFunction;
+ ASSERT_NOT_REACHED();
+ return 0;
}
void JSEventListener::markJSFunction(MarkStack& markStack)
diff --git a/WebCore/bindings/js/JSEventListener.h b/WebCore/bindings/js/JSEventListener.h
index 9ba09c6..569c192 100644
--- a/WebCore/bindings/js/JSEventListener.h
+++ b/WebCore/bindings/js/JSEventListener.h
@@ -22,7 +22,7 @@
#include "EventListener.h"
#include "JSDOMWindow.h"
-#include <runtime/Protect.h>
+#include <runtime/WeakGCPtr.h>
namespace WebCore {
@@ -30,9 +30,9 @@ namespace WebCore {
class JSEventListener : public EventListener {
public:
- static PassRefPtr<JSEventListener> create(JSC::JSObject* listener, bool isAttribute, DOMWrapperWorld* isolatedWorld)
+ static PassRefPtr<JSEventListener> create(JSC::JSObject* listener, JSC::JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld)
{
- return adoptRef(new JSEventListener(listener, isAttribute, isolatedWorld));
+ return adoptRef(new JSEventListener(listener, wrapper, isAttribute, isolatedWorld));
}
static const JSEventListener* cast(const EventListener* listener)
@@ -49,30 +49,61 @@ namespace WebCore {
// Returns true if this event listener was created for an event handler attribute, like "onload" or "onclick".
bool isAttribute() const { return m_isAttribute; }
- virtual JSC::JSObject* jsFunction(ScriptExecutionContext*) const;
+ JSC::JSObject* jsFunction(ScriptExecutionContext*) const;
+ DOMWrapperWorld* isolatedWorld() const { return m_isolatedWorld.get(); }
+
+ JSC::JSObject* wrapper() const { return m_wrapper.get(); }
+ void setWrapper(JSC::JSObject* wrapper) const { m_wrapper = wrapper; }
private:
+ virtual JSC::JSObject* initializeJSFunction(ScriptExecutionContext*) const;
virtual void markJSFunction(JSC::MarkStack&);
+ virtual void invalidateJSFunction(JSC::JSObject*);
virtual void handleEvent(ScriptExecutionContext*, Event*);
virtual bool reportError(ScriptExecutionContext*, const String& message, const String& url, int lineNumber);
virtual bool virtualisAttribute() const;
- void clearJSFunctionInline();
protected:
- JSEventListener(JSC::JSObject* function, bool isAttribute, DOMWrapperWorld* isolatedWorld);
+ JSEventListener(JSC::JSObject* function, JSC::JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld);
+ private:
mutable JSC::JSObject* m_jsFunction;
+ mutable JSC::WeakGCPtr<JSC::JSObject> m_wrapper;
+
bool m_isAttribute;
RefPtr<DOMWrapperWorld> m_isolatedWorld;
};
+ inline JSC::JSObject* JSEventListener::jsFunction(ScriptExecutionContext* scriptExecutionContext) const
+ {
+ if (!m_jsFunction)
+ m_jsFunction = initializeJSFunction(scriptExecutionContext);
+
+ // Verify that we have a valid wrapper protecting our function from
+ // garbage collection.
+ ASSERT(m_wrapper || !m_jsFunction);
+ if (!m_wrapper)
+ return 0;
+
+ // Try to verify that m_jsFunction wasn't recycled. (Not exact, since an
+ // event listener can be almost anything, but this makes test-writing easier).
+ ASSERT(!m_jsFunction || static_cast<JSC::JSCell*>(m_jsFunction)->isObject());
+
+ return m_jsFunction;
+ }
+
+ inline void JSEventListener::invalidateJSFunction(JSC::JSObject* wrapper)
+ {
+ m_wrapper.clear(wrapper);
+ }
+
// Creates a JS EventListener for an "onXXX" event attribute.
- inline PassRefPtr<JSEventListener> createJSAttributeEventListener(JSC::ExecState* exec, JSC::JSValue listener)
+ inline PassRefPtr<JSEventListener> createJSAttributeEventListener(JSC::ExecState* exec, JSC::JSValue listener, JSC::JSObject* wrapper)
{
if (!listener.isObject())
return 0;
- return JSEventListener::create(asObject(listener), true, currentWorld(exec));
+ return JSEventListener::create(asObject(listener), wrapper, true, currentWorld(exec));
}
diff --git a/WebCore/bindings/js/JSEventSourceCustom.cpp b/WebCore/bindings/js/JSEventSourceCustom.cpp
index 8f0dfb1..dab3285 100644
--- a/WebCore/bindings/js/JSEventSourceCustom.cpp
+++ b/WebCore/bindings/js/JSEventSourceCustom.cpp
@@ -49,7 +49,7 @@ JSValue JSEventSource::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -59,7 +59,7 @@ JSValue JSEventSource::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index 96c5c43..3db894d 100644
--- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -53,6 +53,7 @@
#include "Node.h"
#include "Page.h"
#if ENABLE(DOM_STORAGE)
+#include "SerializedScriptValue.h"
#include "Storage.h"
#include "JSStorage.h"
#endif
@@ -61,6 +62,7 @@
#include <parser/SourceCode.h>
#include <runtime/JSArray.h>
#include <runtime/JSLock.h>
+#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
#if ENABLE(JAVASCRIPT_DEBUGGER)
@@ -195,6 +197,24 @@ JSValue JSInjectedScriptHost::selectDOMStorage(ExecState*, const ArgList& args)
}
#endif
+JSValue JSInjectedScriptHost::reportDidDispatchOnInjectedScript(ExecState* exec, const ArgList& args)
+{
+ if (args.size() < 3)
+ return jsUndefined();
+
+ if (!args.at(0).isInt32())
+ return jsUndefined();
+ int callId = args.at(0).asInt32();
+
+ RefPtr<SerializedScriptValue> result(SerializedScriptValue::create(exec, args.at(1)));
+
+ bool isException;
+ if (!args.at(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/JSLazyEventListener.cpp b/WebCore/bindings/js/JSLazyEventListener.cpp
index b707991..4fbdaa6 100644
--- a/WebCore/bindings/js/JSLazyEventListener.cpp
+++ b/WebCore/bindings/js/JSLazyEventListener.cpp
@@ -35,12 +35,11 @@ namespace WebCore {
static WTF::RefCountedLeakCounter eventListenerCounter("JSLazyEventListener");
#endif
-JSLazyEventListener::JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber, DOMWrapperWorld* isolatedWorld)
- : JSEventListener(0, true, isolatedWorld)
+JSLazyEventListener::JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber, JSObject* wrapper, DOMWrapperWorld* isolatedWorld)
+ : JSEventListener(0, wrapper, true, isolatedWorld)
, m_functionName(functionName)
, m_eventParameterName(eventParameterName)
, m_code(code)
- , m_parsed(false)
, m_sourceURL(sourceURL)
, m_lineNumber(lineNumber)
, m_originalNode(node)
@@ -48,8 +47,8 @@ JSLazyEventListener::JSLazyEventListener(const String& functionName, const Strin
// We don't retain the original node because we assume it
// will stay alive as long as this handler object is around
// and we need to avoid a reference cycle. If JS transfers
- // this handler to another node, parseCode will be called and
- // then originalNode is no longer needed.
+ // this handler to another node, initializeJSFunction will
+ // be called and then originalNode is no longer needed.
// A JSLazyEventListener can be created with a line number of zero when it is created with
// a setAttribute call from JavaScript, so make the line number 1 in that case.
@@ -68,79 +67,62 @@ JSLazyEventListener::~JSLazyEventListener()
#endif
}
-JSObject* JSLazyEventListener::jsFunction(ScriptExecutionContext* executionContext) const
-{
- parseCode(executionContext);
- return m_jsFunction;
-}
-
-void JSLazyEventListener::parseCode(ScriptExecutionContext* executionContext) const
+JSObject* JSLazyEventListener::initializeJSFunction(ScriptExecutionContext* executionContext) const
{
ASSERT(executionContext);
ASSERT(executionContext->isDocument());
if (!executionContext)
- return;
-
- if (m_parsed)
- return;
+ return 0;
Frame* frame = static_cast<Document*>(executionContext)->frame();
if (!frame)
- return;
+ return 0;
ScriptController* scriptController = frame->script();
if (!scriptController->canExecuteScripts())
- return;
+ return 0;
- JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext, m_isolatedWorld.get());
+ JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(executionContext, isolatedWorld());
if (!globalObject)
- return;
-
- // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating.
- if (m_originalNode) {
- JSLock lock(SilenceAssertionsOnly);
- // FIXME: Should pass the global object associated with the node
- toJS(globalObject->globalExec(), globalObject, m_originalNode);
- }
+ return 0;
if (executionContext->isDocument()) {
JSDOMWindow* window = static_cast<JSDOMWindow*>(globalObject);
Frame* frame = window->impl()->frame();
if (!frame)
- return;
+ return 0;
// FIXME: Is this check needed for non-Document contexts?
ScriptController* script = frame->script();
if (!script->canExecuteScripts() || script->isPaused())
- return;
+ return 0;
}
- m_parsed = true;
-
ExecState* exec = globalObject->globalExec();
MarkedArgumentBuffer args;
args.append(jsNontrivialString(exec, m_eventParameterName));
args.append(jsString(exec, m_code));
- m_jsFunction = constructFunction(exec, args, Identifier(exec, m_functionName), m_sourceURL, m_lineNumber); // FIXME: is globalExec ok?
-
- JSFunction* listenerAsFunction = static_cast<JSFunction*>(m_jsFunction);
-
+ JSObject* jsFunction = constructFunction(exec, args, Identifier(exec, m_functionName), m_sourceURL, m_lineNumber); // FIXME: is globalExec ok?
if (exec->hadException()) {
exec->clearException();
+ return 0;
+ }
+
+ JSFunction* listenerAsFunction = static_cast<JSFunction*>(jsFunction);
+ if (m_originalNode) {
+ if (!wrapper()) {
+ // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating.
+ JSLock lock(SilenceAssertionsOnly);
+ // FIXME: Should pass the global object associated with the node
+ setWrapper(asObject(toJS(globalObject->globalExec(), globalObject, m_originalNode)));
+ }
- // failed to parse, so let's just make this listener a no-op
- m_jsFunction = 0;
- } else if (m_originalNode) {
// Add the event's home element to the scope
// (and the document, and the form - see JSHTMLElement::eventHandlerScope)
ScopeChain scope = listenerAsFunction->scope();
-
- JSValue thisObj = toJS(exec, globalObject, m_originalNode);
- if (thisObj.isObject()) {
- static_cast<JSNode*>(asObject(thisObj))->pushEventHandlerScope(exec, scope);
- listenerAsFunction->setScope(scope);
- }
+ static_cast<JSNode*>(wrapper())->pushEventHandlerScope(exec, scope);
+ listenerAsFunction->setScope(scope);
}
// Since we only parse once, there's no need to keep data used for parsing around anymore.
@@ -148,6 +130,7 @@ void JSLazyEventListener::parseCode(ScriptExecutionContext* executionContext) co
m_code = String();
m_eventParameterName = String();
m_sourceURL = String();
+ return jsFunction;
}
} // namespace WebCore
diff --git a/WebCore/bindings/js/JSLazyEventListener.h b/WebCore/bindings/js/JSLazyEventListener.h
index ba26ef6..1b00b75 100644
--- a/WebCore/bindings/js/JSLazyEventListener.h
+++ b/WebCore/bindings/js/JSLazyEventListener.h
@@ -29,24 +29,21 @@ namespace WebCore {
class JSLazyEventListener : public JSEventListener {
public:
- static PassRefPtr<JSLazyEventListener> create(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber, DOMWrapperWorld* isolatedWorld)
+ static PassRefPtr<JSLazyEventListener> create(const String& functionName, const String& eventParameterName, const String& code, Node* node, const String& sourceURL, int lineNumber, JSC::JSObject* wrapper, DOMWrapperWorld* isolatedWorld)
{
- return adoptRef(new JSLazyEventListener(functionName, eventParameterName, code, node, sourceURL, lineNumber, isolatedWorld));
+ return adoptRef(new JSLazyEventListener(functionName, eventParameterName, code, node, sourceURL, lineNumber, wrapper, isolatedWorld));
}
virtual ~JSLazyEventListener();
private:
- JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node*, const String& sourceURL, int lineNumber, DOMWrapperWorld* isolatedWorld);
+ JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, Node*, const String& sourceURL, int lineNumber, JSC::JSObject* wrapper, DOMWrapperWorld* isolatedWorld);
- virtual JSC::JSObject* jsFunction(ScriptExecutionContext*) const;
+ virtual JSC::JSObject* initializeJSFunction(ScriptExecutionContext*) const;
virtual bool wasCreatedFromMarkup() const { return true; }
- void parseCode(ScriptExecutionContext*) const;
-
mutable String m_functionName;
mutable String m_eventParameterName;
mutable String m_code;
- mutable bool m_parsed;
mutable String m_sourceURL;
int m_lineNumber;
Node* m_originalNode;
diff --git a/WebCore/bindings/js/JSMessagePortCustom.cpp b/WebCore/bindings/js/JSMessagePortCustom.cpp
index 2c09620..2ee8125 100644
--- a/WebCore/bindings/js/JSMessagePortCustom.cpp
+++ b/WebCore/bindings/js/JSMessagePortCustom.cpp
@@ -49,7 +49,7 @@ void JSMessagePort::markChildren(MarkStack& markStack)
if (MessagePort* entangledPort = m_impl->locallyEntangledPort())
markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), entangledPort);
- m_impl->markEventListeners(markStack);
+ m_impl->markJSEventListeners(markStack);
}
JSValue JSMessagePort::addEventListener(ExecState* exec, const ArgList& args)
@@ -58,7 +58,7 @@ JSValue JSMessagePort::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -68,7 +68,7 @@ JSValue JSMessagePort::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSNodeCustom.cpp b/WebCore/bindings/js/JSNodeCustom.cpp
index 737430e..46a30a4 100644
--- a/WebCore/bindings/js/JSNodeCustom.cpp
+++ b/WebCore/bindings/js/JSNodeCustom.cpp
@@ -114,7 +114,7 @@ JSValue JSNode::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -124,7 +124,7 @@ JSValue JSNode::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -137,7 +137,7 @@ void JSNode::markChildren(MarkStack& markStack)
Base::markChildren(markStack);
Node* node = m_impl.get();
- node->markEventListeners(markStack);
+ node->markJSEventListeners(markStack);
// Nodes in the document are kept alive by JSDocument::mark, so, if we're in
// the document, we need to mark the document, but we don't need to explicitly
diff --git a/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp b/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
index 5f26df3..b3bded5 100644
--- a/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
+++ b/WebCore/bindings/js/JSSVGElementInstanceCustom.cpp
@@ -52,7 +52,7 @@ JSValue JSSVGElementInstance::addEventListener(ExecState* exec, const ArgList& a
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -62,7 +62,7 @@ JSValue JSSVGElementInstance::removeEventListener(ExecState* exec, const ArgList
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSSVGMatrixCustom.cpp b/WebCore/bindings/js/JSSVGMatrixCustom.cpp
index d2d3d6f..59e3f03 100644
--- a/WebCore/bindings/js/JSSVGMatrixCustom.cpp
+++ b/WebCore/bindings/js/JSSVGMatrixCustom.cpp
@@ -23,7 +23,7 @@
#if ENABLE(SVG)
#include "JSSVGMatrix.h"
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "SVGException.h"
#include <runtime/Error.h>
@@ -41,19 +41,19 @@ JSValue JSSVGMatrix::multiply(ExecState* exec, const ArgList& args)
JSSVGMatrix* matrixObj = static_cast<JSSVGMatrix*>(asObject(args.at(0)));
- TransformationMatrix m1(*impl());
- TransformationMatrix m2(*(matrixObj->impl()));
+ AffineTransform m1(*impl());
+ AffineTransform m2(*(matrixObj->impl()));
SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- return toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2)).get(), context);
+ return toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<AffineTransform>::create(m1.multLeft(m2)).get(), context);
}
JSValue JSSVGMatrix::inverse(ExecState* exec, const ArgList&)
{
- TransformationMatrix imp(*impl());
+ AffineTransform imp(*impl());
SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- JSValue result = toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(imp.inverse()).get(), context);
+ JSValue result = toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<AffineTransform>::create(imp.inverse()).get(), context);
if (!imp.isInvertible())
setDOMException(exec, SVGException::SVG_MATRIX_NOT_INVERTABLE);
@@ -63,13 +63,13 @@ JSValue JSSVGMatrix::inverse(ExecState* exec, const ArgList&)
JSValue JSSVGMatrix::rotateFromVector(ExecState* exec, const ArgList& args)
{
- TransformationMatrix imp(*impl());
+ AffineTransform imp(*impl());
float x = args.at(0).toFloat(exec);
float y = args.at(1).toFloat(exec);
SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- JSValue result = toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(imp.rotateFromVector(x, y)).get(), context);
+ JSValue result = toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<AffineTransform>::create(imp.rotateFromVector(x, y)).get(), context);
if (x == 0.0 || y == 0.0)
setDOMException(exec, SVGException::SVG_INVALID_VALUE_ERR);
diff --git a/WebCore/bindings/js/JSSVGPODTypeWrapper.h b/WebCore/bindings/js/JSSVGPODTypeWrapper.h
index 7c04f22..2efc60e 100644
--- a/WebCore/bindings/js/JSSVGPODTypeWrapper.h
+++ b/WebCore/bindings/js/JSSVGPODTypeWrapper.h
@@ -46,13 +46,13 @@ public:
};
// This file contains JS wrapper objects for SVG datatypes, that are passed around by value
-// in WebCore/svg (aka. 'POD types'). For instance SVGMatrix is mapped to TransformationMatrix, and
+// in WebCore/svg (aka. 'POD types'). For instance SVGMatrix is mapped to AffineTransform, and
// passed around as const reference. SVG DOM demands these objects to be "live", changes to any
// of the writable attributes of SVGMatrix need to be reflected in the object which exposed the
// SVGMatrix object (i.e. 'someElement.transform.matrix.a = 50.0', in that case 'SVGTransform').
-// The SVGTransform class stores its "TransformationMatrix m_matrix" object on the stack. If it would
+// The SVGTransform class stores its "AffineTransform m_matrix" object on the stack. If it would
// be stored as pointer we could just build an auto-generated JSSVG* wrapper object around it
-// and all changes to that object would automatically affect the TransformationMatrix* object stored
+// and all changes to that object would automatically affect the AffineTransform* object stored
// in the SVGTransform object. For the sake of efficiency and memory we don't pass around any
// primitive values as pointers, so a custom JS wrapper object is needed for all SVG types, that
// are internally represented by POD types (SVGRect <-> FloatRect, SVGPoint <-> FloatPoint, ...).
diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp
index 238b041..d610f01 100644
--- a/WebCore/bindings/js/JSWebSocketCustom.cpp
+++ b/WebCore/bindings/js/JSWebSocketCustom.cpp
@@ -65,7 +65,7 @@ JSValue JSWebSocket::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -75,7 +75,7 @@ JSValue JSWebSocket::removeEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp
index ab28674..d6c8dbd 100644
--- a/WebCore/bindings/js/JSWorkerContextCustom.cpp
+++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp
@@ -60,7 +60,7 @@ void JSWorkerContext::markChildren(MarkStack& markStack)
markDOMObjectWrapper(markStack, globalData, impl()->optionalLocation());
markDOMObjectWrapper(markStack, globalData, impl()->optionalNavigator());
- impl()->markEventListeners(markStack);
+ impl()->markJSEventListeners(markStack);
}
bool JSWorkerContext::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
@@ -127,7 +127,7 @@ JSValue JSWorkerContext::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -137,7 +137,7 @@ JSValue JSWorkerContext::removeEventListener(ExecState* exec, const ArgList& arg
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index d35d53a..e20b6d9 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -56,7 +56,7 @@ void JSXMLHttpRequest::markChildren(MarkStack& markStack)
if (XMLHttpRequestUpload* upload = m_impl->optionalUpload())
markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), upload);
- m_impl->markEventListeners(markStack);
+ m_impl->markJSEventListeners(markStack);
}
// Custom functions
@@ -153,7 +153,7 @@ JSValue JSXMLHttpRequest::addEventListener(ExecState* exec, const ArgList& args)
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -163,7 +163,7 @@ JSValue JSXMLHttpRequest::removeEventListener(ExecState* exec, const ArgList& ar
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
index fa7cfec..857c12d 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp
@@ -48,7 +48,7 @@ void JSXMLHttpRequestUpload::markChildren(MarkStack& markStack)
if (XMLHttpRequest* xmlHttpRequest = m_impl->associatedXMLHttpRequest())
markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), xmlHttpRequest);
- m_impl->markEventListeners(markStack);
+ m_impl->markJSEventListeners(markStack);
}
JSValue JSXMLHttpRequestUpload::addEventListener(ExecState* exec, const ArgList& args)
@@ -57,7 +57,7 @@ JSValue JSXMLHttpRequestUpload::addEventListener(ExecState* exec, const ArgList&
if (!listener.isObject())
return jsUndefined();
- impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)), args.at(2).toBoolean(exec));
+ impl()->addEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
@@ -67,7 +67,7 @@ JSValue JSXMLHttpRequestUpload::removeEventListener(ExecState* exec, const ArgLi
if (!listener.isObject())
return jsUndefined();
- impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
+ impl()->removeEventListener(args.at(0).toString(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/ScriptArray.cpp b/WebCore/bindings/js/ScriptArray.cpp
index 2c4075a..caecc40 100644
--- a/WebCore/bindings/js/ScriptArray.cpp
+++ b/WebCore/bindings/js/ScriptArray.cpp
@@ -53,6 +53,10 @@ static bool handleException(ScriptState* scriptState)
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);
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index bd36689..171d4dd 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -155,6 +155,9 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
// An DOMWrapperWorld other than the thread's normal world.
class IsolatedWorld : public DOMWrapperWorld {
public:
+ static PassRefPtr<IsolatedWorld> create(JSGlobalData* globalData) { return adoptRef(new IsolatedWorld(globalData)); }
+
+protected:
IsolatedWorld(JSGlobalData* globalData)
: DOMWrapperWorld(globalData, false)
{
@@ -162,8 +165,6 @@ public:
ASSERT(clientData);
static_cast<WebCoreJSClientData*>(clientData)->rememberWorld(this);
}
-
- static PassRefPtr<IsolatedWorld> create(JSGlobalData* globalData) { return adoptRef(new IsolatedWorld(globalData)); }
};
PassRefPtr<DOMWrapperWorld> ScriptController::createWorld()
diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp
new file mode 100644
index 0000000..9869775
--- /dev/null
+++ b/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -0,0 +1,49 @@
+/*
+ * 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"
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "ScriptDebugServer.h"
+
+#include "JavaScriptDebugServer.h"
+
+namespace WebCore {
+
+void ScriptDebugServer::recompileAllJSFunctions()
+{
+ JavaScriptDebugServer::shared().recompileAllJSFunctions();
+}
+
+void ScriptDebugServer::recompileAllJSFunctionsSoon()
+{
+ JavaScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebCore/bindings/js/ScriptDebugServer.h b/WebCore/bindings/js/ScriptDebugServer.h
new file mode 100644
index 0000000..027ffa5
--- /dev/null
+++ b/WebCore/bindings/js/ScriptDebugServer.h
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+#ifndef ScriptDebugServer_h
+#define ScriptDebugServer_h
+
+#if ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class ScriptDebugServer : public Noncopyable {
+public:
+ static void recompileAllJSFunctions();
+ static void recompileAllJSFunctionsSoon();
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER)
+
+#endif // ScriptDebugServer_h
diff --git a/WebCore/bindings/js/ScriptEventListener.cpp b/WebCore/bindings/js/ScriptEventListener.cpp
index 4325dc3..fd45546 100644
--- a/WebCore/bindings/js/ScriptEventListener.cpp
+++ b/WebCore/bindings/js/ScriptEventListener.cpp
@@ -37,6 +37,7 @@
#include "JSNode.h"
#include "Frame.h"
#include "XSSAuditor.h"
+#include <runtime/JSLock.h>
using namespace JSC;
@@ -58,6 +59,7 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node* node, Attribu
int lineNumber = 1;
String sourceURL;
+ JSObject* wrapper = 0;
// FIXME: We should be able to provide accurate source information for frameless documents, too (e.g. for importing nodes from XMLHttpRequest.responseXML).
if (Frame* frame = node->document()->frame()) {
@@ -72,9 +74,13 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node* node, Attribu
lineNumber = scriptController->eventHandlerLineNumber();
sourceURL = node->document()->url().string();
+
+ JSC::JSLock lock(SilenceAssertionsOnly);
+ JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(node->document(), mainThreadNormalWorld());
+ wrapper = asObject(toJS(globalObject->globalExec(), globalObject, node));
}
- return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, lineNumber, mainThreadNormalWorld());
+ return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, lineNumber, wrapper, mainThreadNormalWorld());
}
PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attribute* attr)
@@ -100,15 +106,19 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attri
lineNumber = scriptController->eventHandlerLineNumber();
sourceURL = frame->document()->url().string();
- return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber, mainThreadNormalWorld());
+ JSObject* wrapper = toJSDOMWindow(frame, mainThreadNormalWorld());
+ return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber, wrapper, mainThreadNormalWorld());
}
String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* eventListener)
{
- JSC::JSObject* functionObject = eventListener->jsFunction(context);
- if (!functionObject)
+ const JSEventListener* jsListener = JSEventListener::cast(eventListener);
+ if (!jsListener)
+ return "";
+ JSC::JSObject* jsFunction = jsListener->jsFunction(context);
+ if (!jsFunction)
return "";
- return functionObject->toString(scriptState);
+ return jsFunction->toString(scriptState);
}
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptFunctionCall.cpp b/WebCore/bindings/js/ScriptFunctionCall.cpp
index a2284bc..5001d3c 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/js/ScriptFunctionCall.cpp
@@ -42,8 +42,8 @@ using namespace JSC;
namespace WebCore {
-ScriptFunctionCall::ScriptFunctionCall(ScriptState* exec, const ScriptObject& thisObject, const String& name)
- : m_exec(exec)
+ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name)
+ : m_exec(thisObject.scriptState())
, m_thisObject(thisObject)
, m_name(name)
{
@@ -51,6 +51,10 @@ ScriptFunctionCall::ScriptFunctionCall(ScriptState* exec, const ScriptObject& th
void ScriptFunctionCall::appendArgument(const ScriptObject& argument)
{
+ if (argument.scriptState() != m_exec) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
m_arguments.append(argument.jsObject());
}
diff --git a/WebCore/bindings/js/ScriptFunctionCall.h b/WebCore/bindings/js/ScriptFunctionCall.h
index 7c5074f..9742e8f 100644
--- a/WebCore/bindings/js/ScriptFunctionCall.h
+++ b/WebCore/bindings/js/ScriptFunctionCall.h
@@ -48,7 +48,7 @@ namespace WebCore {
class ScriptFunctionCall {
public:
- ScriptFunctionCall(ScriptState* exec, const ScriptObject& thisObject, const String& name);
+ ScriptFunctionCall(const ScriptObject& thisObject, const String& name);
virtual ~ScriptFunctionCall() {};
void appendArgument(const ScriptObject&);
diff --git a/WebCore/bindings/js/ScriptObject.cpp b/WebCore/bindings/js/ScriptObject.cpp
index 03ecfc6..7948219 100644
--- a/WebCore/bindings/js/ScriptObject.cpp
+++ b/WebCore/bindings/js/ScriptObject.cpp
@@ -70,6 +70,10 @@ bool ScriptObject::set(const String& name, const String& value)
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);
diff --git a/WebCore/bindings/js/ScriptString.h b/WebCore/bindings/js/ScriptString.h
index a33d639..18964b8 100644
--- a/WebCore/bindings/js/ScriptString.h
+++ b/WebCore/bindings/js/ScriptString.h
@@ -61,7 +61,7 @@ public:
JSC::StringBuilder buffer;
buffer.append(m_str);
buffer.append(s);
- m_str = buffer.release();
+ m_str = buffer.build();
return *this;
}
diff --git a/WebCore/bindings/js/ScriptValue.cpp b/WebCore/bindings/js/ScriptValue.cpp
index ac92e14..005c329 100644
--- a/WebCore/bindings/js/ScriptValue.cpp
+++ b/WebCore/bindings/js/ScriptValue.cpp
@@ -29,6 +29,8 @@
#include "config.h"
#include "ScriptValue.h"
+#include "SerializedScriptValue.h"
+
#include <JavaScriptCore/APICast.h>
#include <JavaScriptCore/JSValueRef.h>
@@ -81,4 +83,14 @@ bool ScriptValue::isObject() const
return m_value.get().isObject();
}
+PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState)
+{
+ return SerializedScriptValue::create(scriptState, jsValue());
+}
+
+ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value)
+{
+ return ScriptValue(value->deserialize(scriptState, scriptState->lexicalGlobalObject()));
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptValue.h b/WebCore/bindings/js/ScriptValue.h
index b1eaa21..9ccb7ac 100644
--- a/WebCore/bindings/js/ScriptValue.h
+++ b/WebCore/bindings/js/ScriptValue.h
@@ -34,10 +34,12 @@
#include "PlatformString.h"
#include "ScriptState.h"
#include <runtime/Protect.h>
+#include <wtf/PassRefPtr.h>
namespace WebCore {
class String;
+class SerializedScriptValue;
class ScriptValue {
public:
@@ -53,6 +55,9 @@ public:
bool isObject() const;
bool hasNoValue() const { return m_value == JSC::JSValue(); }
+ PassRefPtr<SerializedScriptValue> serialize(ScriptState*);
+ static ScriptValue deserialize(ScriptState*, SerializedScriptValue*);
+
private:
JSC::ProtectedJSValue m_value;
};
diff --git a/WebCore/bindings/js/SerializedScriptValue.cpp b/WebCore/bindings/js/SerializedScriptValue.cpp
index fd9cb59..fbf8899 100644
--- a/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -29,14 +29,17 @@
#include "File.h"
#include "FileList.h"
+#include "ImageData.h"
#include "JSDOMGlobalObject.h"
#include "JSFile.h"
#include "JSFileList.h"
+#include "JSImageData.h"
#include <JavaScriptCore/APICast.h>
#include <runtime/DateInstance.h>
#include <runtime/ExceptionHelpers.h>
#include <runtime/JSLock.h>
#include <runtime/PropertyNameArray.h>
+#include <wtf/ByteArray.h>
#include <wtf/HashTraits.h>
#include <wtf/Vector.h>
@@ -165,6 +168,30 @@ private:
Vector<String> m_files;
};
+class SerializedImageData : public SharedSerializedData {
+public:
+ static PassRefPtr<SerializedImageData> create(const ImageData* imageData)
+ {
+ return adoptRef(new SerializedImageData(imageData));
+ }
+
+ unsigned width() const { return m_width; }
+ unsigned height() const { return m_height; }
+ WTF::ByteArray* data() const { return m_storage.get(); }
+private:
+ SerializedImageData(const ImageData* imageData)
+ : m_width(imageData->width())
+ , m_height(imageData->height())
+ {
+ WTF::ByteArray* array = imageData->data()->data();
+ m_storage = WTF::ByteArray::create(array->length());
+ memcpy(m_storage->data(), array->data(), array->length());
+ }
+ unsigned m_width;
+ unsigned m_height;
+ RefPtr<WTF::ByteArray> m_storage;
+};
+
SerializedScriptValueData::SerializedScriptValueData(RefPtr<SerializedObject> data)
: m_type(ObjectType)
, m_sharedData(data)
@@ -183,6 +210,12 @@ SerializedScriptValueData::SerializedScriptValueData(const FileList* fileList)
{
}
+SerializedScriptValueData::SerializedScriptValueData(const ImageData* imageData)
+ : m_type(ImageDataType)
+ , m_sharedData(SerializedImageData::create(imageData))
+{
+}
+
SerializedScriptValueData::SerializedScriptValueData(const File* file)
: m_type(FileType)
, m_string(file->path().crossThreadString())
@@ -204,6 +237,11 @@ SerializedFileList* SharedSerializedData::asFileList()
return static_cast<SerializedFileList*>(this);
}
+SerializedImageData* SharedSerializedData::asImageData()
+{
+ return static_cast<SerializedImageData*>(this);
+}
+
static const unsigned maximumFilterRecursion = 40000;
enum WalkerState { StateUnknown, ArrayStartState, ArrayStartVisitMember, ArrayEndVisitMember,
ObjectStartState, ObjectStartVisitMember, ObjectEndVisitMember };
@@ -533,6 +571,8 @@ struct SerializingTreeWalker : public BaseWalker {
return SerializedScriptValueData(toFile(obj));
if (obj->inherits(&JSFileList::s_info))
return SerializedScriptValueData(toFileList(obj));
+ if (obj->inherits(&JSImageData::s_info))
+ return SerializedScriptValueData(toImageData(obj));
CallData unusedData;
if (value.getCallData(unusedData) == CallTypeNone)
@@ -709,6 +749,14 @@ struct DeserializingTreeWalker : public BaseWalker {
result->append(File::create(serializedFileList->item(i)));
return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), result.get());
}
+ case SerializedScriptValueData::ImageDataType: {
+ if (!m_isDOMGlobalObject)
+ return jsNull();
+ SerializedImageData* serializedImageData = value.asImageData();
+ RefPtr<ImageData> result = ImageData::create(serializedImageData->width(), serializedImageData->height());
+ memcpy(result->data()->data()->data(), serializedImageData->data()->data(), serializedImageData->data()->length());
+ return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), result.get());
+ }
case SerializedScriptValueData::EmptyType:
ASSERT_NOT_REACHED();
return jsNull();
@@ -868,6 +916,7 @@ struct TeardownTreeWalker {
case SerializedScriptValueData::EmptyType:
case SerializedScriptValueData::FileType:
case SerializedScriptValueData::FileListType:
+ case SerializedScriptValueData::ImageDataType:
return true;
}
ASSERT_NOT_REACHED();
diff --git a/WebCore/bindings/js/SerializedScriptValue.h b/WebCore/bindings/js/SerializedScriptValue.h
index 347d8f2..93bd0de 100644
--- a/WebCore/bindings/js/SerializedScriptValue.h
+++ b/WebCore/bindings/js/SerializedScriptValue.h
@@ -35,8 +35,10 @@ typedef const struct OpaqueJSValue* JSValueRef;
namespace WebCore {
class File;
class FileList;
+ class ImageData;
class SerializedArray;
class SerializedFileList;
+ class SerializedImageData;
class SerializedObject;
class SharedSerializedData : public RefCounted<SharedSerializedData> {
@@ -45,6 +47,7 @@ namespace WebCore {
SerializedArray* asArray();
SerializedObject* asObject();
SerializedFileList* asFileList();
+ SerializedImageData* asImageData();
};
class SerializedScriptValue;
@@ -60,7 +63,8 @@ namespace WebCore {
ArrayType,
StringType,
FileType,
- FileListType
+ FileListType,
+ ImageDataType
};
SerializedType type() const { return m_type; }
@@ -86,6 +90,7 @@ namespace WebCore {
explicit SerializedScriptValueData(const File*);
explicit SerializedScriptValueData(const FileList*);
+ explicit SerializedScriptValueData(const ImageData*);
explicit SerializedScriptValueData(JSC::JSValue value)
: m_type(ImmediateType)
@@ -141,6 +146,13 @@ namespace WebCore {
ASSERT(m_sharedData);
return m_sharedData->asFileList();
}
+
+ SerializedImageData* asImageData() const
+ {
+ ASSERT(m_type == ImageDataType);
+ ASSERT(m_sharedData);
+ return m_sharedData->asImageData();
+ }
operator bool() const { return m_type != EmptyType; }
diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm
index dc3c7c0..506e8ea 100644
--- a/WebCore/bindings/scripts/CodeGenerator.pm
+++ b/WebCore/bindings/scripts/CodeGenerator.pm
@@ -1,26 +1,26 @@
#
# WebKit IDL parser
-#
+#
# Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org>
# Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
# Copyright (C) 2007 Apple Inc. All rights reserved.
# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
-#
+#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
-#
+#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
-#
+#
# You should have received a copy of the GNU Library General Public License
# aint with this library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
-#
+#
package CodeGenerator;
@@ -39,10 +39,10 @@ my $codeGenerator = 0;
my $verbose = 0;
-my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1,
+my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1,
"unsigned int" => 1, "unsigned short" => 1,
- "unsigned long" => 1, "unsigned long long" => 1,
- "float" => 1, "double" => 1,
+ "unsigned long" => 1, "unsigned long long" => 1,
+ "float" => 1, "double" => 1,
"boolean" => 1, "void" => 1,
"Date" => 1);
@@ -328,10 +328,10 @@ sub IsSVGAnimatedType
my $type = shift;
return 1 if $svgAnimatedTypeHash{$type};
- return 0;
+ return 0;
}
-# Uppercase the first letter while respecting WebKit style guidelines.
+# Uppercase the first letter while respecting WebKit style guidelines.
# E.g., xmlEncoding becomes XMLEncoding, but xmlllang becomes Xmllang.
sub WK_ucfirst
{
@@ -341,12 +341,13 @@ sub WK_ucfirst
return $ret;
}
-# Lowercase the first letter while respecting WebKit style guidelines.
+# Lowercase the first letter while respecting WebKit style guidelines.
# URL becomes url, but SetURL becomes setURL.
sub WK_lcfirst
{
my ($object, $param) = @_;
my $ret = lcfirst($param);
+ $ret =~ s/hTML/html/ if $ret =~ /^hTML/;
$ret =~ s/uRL/url/ if $ret =~ /^uRL/;
$ret =~ s/jS/js/ if $ret =~ /^jS/;
$ret =~ s/xML/xml/ if $ret =~ /^xML/;
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index c774a57..94fc2b8 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -1198,7 +1198,7 @@ sub GenerateImplementation
if ($eventTarget) {
$implIncludes{"RegisteredEventListener.h"} = 1;
- push(@implContent, " impl()->invalidateEventListeners();\n");
+ push(@implContent, " impl()->invalidateJSEventListeners(this);\n");
}
if (!$dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) {
@@ -1218,7 +1218,7 @@ sub GenerateImplementation
push(@implContent, "void ${className}::markChildren(MarkStack& markStack)\n");
push(@implContent, "{\n");
push(@implContent, " Base::markChildren(markStack);\n");
- push(@implContent, " impl()->markEventListeners(markStack);\n");
+ push(@implContent, " impl()->markJSEventListeners(markStack);\n");
push(@implContent, "}\n\n");
}
@@ -1318,12 +1318,14 @@ sub GenerateImplementation
push(@implContent, " UNUSED_PARAM(exec);\n");
push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(castedThis->impl());\n");
push(@implContent, " if (EventListener* listener = imp->$implGetterFunctionName()) {\n");
+ push(@implContent, " if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {\n");
if ($implClassName eq "Document" || $implClassName eq "WorkerContext" || $implClassName eq "SharedWorkerContext" || $implClassName eq "DedicatedWorkerContext") {
- push(@implContent, " if (JSObject* jsFunction = listener->jsFunction(imp))\n");
+ push(@implContent, " if (JSObject* jsFunction = jsListener->jsFunction(imp))\n");
} else {
- push(@implContent, " if (JSObject* jsFunction = listener->jsFunction(imp->scriptExecutionContext()))\n");
+ push(@implContent, " if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))\n");
}
- push(@implContent, " return jsFunction;\n");
+ push(@implContent, " return jsFunction;\n");
+ push(@implContent, " }\n");
push(@implContent, " }\n");
push(@implContent, " return jsNull();\n");
} elsif ($attribute->signature->type =~ /Constructor$/) {
@@ -1477,7 +1479,7 @@ sub GenerateImplementation
$implIncludes{"JSEventListener.h"} = 1;
push(@implContent, " UNUSED_PARAM(exec);\n");
push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(thisObject)->impl());\n");
- push(@implContent, " imp->set$implSetterFunctionName(createJSAttributeEventListener(exec, value));\n");
+ push(@implContent, " imp->set$implSetterFunctionName(createJSAttributeEventListener(exec, value, thisObject));\n");
} elsif ($attribute->signature->type =~ /Constructor$/) {
my $constructorType = $attribute->signature->type;
$constructorType =~ s/Constructor$//;
@@ -1834,7 +1836,7 @@ my %nativeType = (
"NodeFilter" => "RefPtr<NodeFilter>",
"SVGAngle" => "SVGAngle",
"SVGLength" => "SVGLength",
- "SVGMatrix" => "TransformationMatrix",
+ "SVGMatrix" => "AffineTransform",
"SVGNumber" => "float",
"SVGPaintType" => "SVGPaint::SVGPaintType",
"SVGPreserveAspectRatio" => "SVGPreserveAspectRatio",
diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
index 698b4f5..dcb22a7 100644
--- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
@@ -578,7 +578,7 @@ sub AddIncludesForType
}
if ($type eq "SVGMatrix") {
- $implIncludes{"TransformationMatrix.h"} = 1;
+ $implIncludes{"AffineTransform.h"} = 1;
$implIncludes{"DOMSVGMatrixInternal.h"} = 1;
$implIncludes{"SVGException.h"} = 1;
return;
@@ -1426,8 +1426,8 @@ sub GenerateImplementation
}
# FIXME! We need [Custom] support for ObjC, to move these hacks into DOMSVGLength/MatrixCustom.mm
- my $svgMatrixRotateFromVector = ($podType and $podType eq "TransformationMatrix" and $functionName eq "rotateFromVector");
- my $svgMatrixInverse = ($podType and $podType eq "TransformationMatrix" and $functionName eq "inverse");
+ my $svgMatrixRotateFromVector = ($podType and $podType eq "AffineTransform" and $functionName eq "rotateFromVector");
+ my $svgMatrixInverse = ($podType and $podType eq "AffineTransform" and $functionName eq "inverse");
my $svgLengthConvertToSpecifiedUnits = ($podType and $podType eq "SVGLength" and $functionName eq "convertToSpecifiedUnits");
push(@parameterNames, "ec") if $raisesExceptions and !($svgMatrixRotateFromVector || $svgMatrixInverse);
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index cd70c55..2b89b54 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -272,6 +272,7 @@ sub GenerateHeader
public:
static bool HasInstance(v8::Handle<v8::Value> value);
static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
+ static v8::Persistent<v8::FunctionTemplate> GetTemplate();
static ${nativeType}* toNative(v8::Handle<v8::Object>);
static v8::Handle<v8::Object> wrap(${nativeType}*${forceNewObjectParameter});
END
@@ -302,7 +303,7 @@ END
static v8::Handle<v8::Value> constructorCallback(const v8::Arguments& args);
END
}
-
+
foreach my $attribute (@{$dataNode->attributes}) {
my $name = $attribute->signature->name;
my $attrExt = $attribute->signature->extendedAttributes;
@@ -323,11 +324,10 @@ END
}
}
- GenerateHeaderRuntimeEnablerDeclarations(@enabledAtRuntime);
GenerateHeaderNamedAndIndexedPropertyAccessors($dataNode);
GenerateHeaderCustomCall($dataNode);
GenerateHeaderCustomInternalFieldIndices($dataNode);
-
+
if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) {
push(@headerContent, <<END);
static bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType, v8::Local<v8::Value> data);
@@ -336,11 +336,6 @@ END
}
push(@headerContent, <<END);
-
- private:
- static v8::Persistent<v8::FunctionTemplate> GetTemplate();
-
- friend class V8ClassIndex;
};
v8::Handle<v8::Value> toV8(${nativeType}*${forceNewObjectParameter});
@@ -361,7 +356,7 @@ sub GetInternalFields
{
my $dataNode = shift;
my $name = $dataNode->name;
-
+
# FIXME: I am hideous and hard-coded. Make me beautiful.
return ("cacheIndex", "implementationIndex") if ($name eq "Document") || ($name eq "SVGDocument");
return ("cacheIndex", "implementationIndex", "markerIndex", "shadowIndex") if $name eq "HTMLDocument";
@@ -417,25 +412,6 @@ END
END
}
-sub GenerateHeaderRuntimeEnablerDeclarations
-{
- my @enabledAtRuntime = @_;
-
- foreach my $runtime_attr (@enabledAtRuntime) {
- my $enabledAtRuntimeConditionalString = GenerateConditionalString($runtime_attr->signature);
- my $enabler = $codeGenerator->WK_ucfirst($runtime_attr->signature->name);
- if ($enabledAtRuntimeConditionalString) {
- push(@headerContent, "\n#if ${enabledAtRuntimeConditionalString}\n");
- }
- push(@headerContent, <<END);
- static bool ${enabler}Enabled();
-END
- if ($enabledAtRuntimeConditionalString) {
- push(@headerContent, "#endif\n");
- }
- }
-}
-
my %indexerSpecialCases = (
"Storage" => 1,
"HTMLAppletElement" => 1,
@@ -473,7 +449,7 @@ sub GenerateHeaderNamedAndIndexedPropertyAccessors
static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info);
END
}
-
+
if ($isIndexerSpecialCase || $hasCustomIndexedSetter) {
push(@headerContent, <<END);
static v8::Handle<v8::Value> indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
@@ -509,7 +485,7 @@ END
sub GenerateHeaderCustomCall
{
my $dataNode = shift;
-
+
if ($dataNode->extendedAttributes->{"CustomCall"}) {
push(@headerContent, " static v8::Handle<v8::Value> callAsFunctionCallback(const v8::Arguments&);\n");
}
@@ -537,22 +513,34 @@ sub GenerateSetDOMException
return $result;
}
-sub IsNodeSubType
+sub IsSubType
{
my $dataNode = shift;
- return 1 if ($dataNode->name eq "Node");
+ my $parentType = shift;
+ return 1 if ($dataNode->name eq $parentType);
foreach (@allParents) {
my $parent = $codeGenerator->StripModule($_);
- return 1 if $parent eq "Node";
+ return 1 if $parent eq $parentType;
}
return 0;
}
+sub IsNodeSubType
+{
+ my $dataNode = shift;
+ return IsSubType($dataNode, "Node");
+}
+
+sub IsEventSubType
+{
+ my $dataNode = shift;
+ return IsSubType($dataNode, "Event");
+}
+
sub GenerateDomainSafeFunctionGetter
{
my $function = shift;
my $dataNode = shift;
- my $classIndex = shift;
my $implClassName = shift;
my $className = "V8" . $dataNode->name;
@@ -570,7 +558,7 @@ sub GenerateDomainSafeFunctionGetter
INC_STATS(\"DOM.$implClassName.$funcName._get\");
static v8::Persistent<v8::FunctionTemplate> private_template =
v8::Persistent<v8::FunctionTemplate>::New($newTemplateString);
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(${className}::GetTemplate(), info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
@@ -611,7 +599,6 @@ END
return V8DOMWrapper::getConstructor(type, V8DOMWindow::toNative(info.Holder()));
END
} elsif ($classIndex eq "DEDICATEDWORKERCONTEXT" or $classIndex eq "WORKERCONTEXT" or $classIndex eq "SHAREDWORKERCONTEXT") {
- $implIncludes{"WorkerContextExecutionProxy.h"} = 1;
push(@implContentDecls, <<END);
return V8DOMWrapper::getConstructor(type, V8WorkerContext::toNative(info.Holder()));
END
@@ -630,7 +617,6 @@ sub GenerateNormalAttrGetter
{
my $attribute = shift;
my $dataNode = shift;
- my $classIndex = shift;
my $implClassName = shift;
my $interfaceName = shift;
@@ -688,14 +674,14 @@ END
}
} elsif ($attrExt->{"v8OnProto"} || $attrExt->{"V8DisallowShadowing"}) {
- if ($classIndex eq "DOMWINDOW") {
+ if ($interfaceName eq "DOMWindow") {
push(@implContentDecls, <<END);
v8::Handle<v8::Object> holder = info.Holder();
END
} else {
# perform lookup first
push(@implContentDecls, <<END);
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8${interfaceName}::GetTemplate(), info.This());
if (holder.IsEmpty()) return v8::Handle<v8::Value>();
END
}
@@ -863,7 +849,6 @@ sub GenerateNormalAttrSetter
{
my $attribute = shift;
my $dataNode = shift;
- my $classIndex = shift;
my $implClassName = shift;
my $interfaceName = shift;
@@ -885,14 +870,14 @@ sub GenerateNormalAttrSetter
push(@implContentDecls, " $implClassName* imp = &imp_instance;\n");
} elsif ($attrExt->{"v8OnProto"}) {
- if ($classIndex eq "DOMWINDOW") {
+ if ($interfaceName eq "DOMWindow") {
push(@implContentDecls, <<END);
v8::Handle<v8::Object> holder = info.Holder();
END
} else {
# perform lookup first
push(@implContentDecls, <<END);
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8${interfaceName}::GetTemplate(), info.This());
if (holder.IsEmpty()) return;
END
}
@@ -999,7 +984,7 @@ sub GetFunctionTemplateCallbackName
{
$function = shift;
$dataNode = shift;
-
+
my $interfaceName = $dataNode->name;
my $name = $function->signature->name;
@@ -1067,7 +1052,7 @@ END
" return v8::Handle<v8::Value>();\n" .
" }\n");
}
-
+
my $raisesExceptions = @{$function->raisesExceptions};
if (!$raisesExceptions) {
foreach my $parameter (@{$function->parameters}) {
@@ -1152,7 +1137,7 @@ END
push(@implContentDecls, " V8Proxy::setDOMException(ec);\n");
push(@implContentDecls, " return v8::Handle<v8::Value>();\n");
}
-
+
push(@implContentDecls, " }\n\n");
}
@@ -1477,6 +1462,7 @@ sub GenerateImplementation
push(@implFixedHeader,
"#include \"config.h\"\n" .
+ "#include \"RuntimeEnabledFeatures.h\"\n" .
"#include \"V8Proxy.h\"\n" .
"#include \"V8Binding.h\"\n" .
"#include \"V8BindingState.h\"\n" .
@@ -1529,7 +1515,7 @@ sub GenerateImplementation
# Generate the accessor.
if (!($attribute->signature->extendedAttributes->{"CustomGetter"} ||
$attribute->signature->extendedAttributes->{"V8CustomGetter"})) {
- GenerateNormalAttrGetter($attribute, $dataNode, $classIndex, $implClassName, $interfaceName);
+ GenerateNormalAttrGetter($attribute, $dataNode, $implClassName, $interfaceName);
}
if (!($attribute->signature->extendedAttributes->{"CustomSetter"} ||
$attribute->signature->extendedAttributes->{"V8CustomSetter"})) {
@@ -1537,7 +1523,7 @@ sub GenerateImplementation
$dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"} || die "Replaceable attribute can only be used in interface that defines ExtendsDOMGlobalObject attribute!";
# GenerateReplaceableAttrSetter($implClassName);
} elsif ($attribute->type !~ /^readonly/ && !$attribute->signature->extendedAttributes->{"V8ReadOnly"}) {
- GenerateNormalAttrSetter($attribute, $dataNode, $classIndex, $implClassName, $interfaceName);
+ GenerateNormalAttrSetter($attribute, $dataNode, $implClassName, $interfaceName);
}
}
}
@@ -1545,7 +1531,7 @@ sub GenerateImplementation
if ($hasConstructors) {
GenerateConstructorGetter($implClassName, $classIndex);
}
-
+
my $indexer;
my $namedPropertyGetter;
# Generate methods for functions.
@@ -1568,7 +1554,7 @@ sub GenerateImplementation
# generate an access getter that returns different function objects
# for different calling context.
if (($dataNode->extendedAttributes->{"CheckDomainSecurity"} || ($interfaceName eq "DOMWindow")) && $function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) {
- GenerateDomainSafeFunctionGetter($function, $dataNode, $classIndex, $implClassName);
+ GenerateDomainSafeFunctionGetter($function, $dataNode, $implClassName);
}
}
@@ -1606,7 +1592,7 @@ sub GenerateImplementation
GenerateBatchedAttributeData($dataNode, $attributes);
push(@implContent, "};\n");
}
-
+
# Setup table of standard callback functions
$num_callbacks = 0;
$has_callbacks = 0;
@@ -1696,20 +1682,23 @@ END
}
# find the super descriptor
- my $parentClassIndex = "INVALID_CLASS_INDEX";
+ my $parentClassTemplate = "";
foreach (@{$dataNode->parents}) {
my $parent = $codeGenerator->StripModule($_);
if ($parent eq "EventTarget") { next; }
$implIncludes{"V8${parent}.h"} = 1;
- $parentClassIndex = uc($codeGenerator->StripModule($parent));
+ $parentClassTemplate = "V8" . $parent . "::GetTemplate()";
last;
}
-
+ if (!$parentClassTemplate) {
+ $parentClassTemplate = "v8::Persistent<v8::FunctionTemplate>()";
+ }
+
# Generate the template configuration method
push(@implContent, <<END);
static v8::Persistent<v8::FunctionTemplate> Configure${className}Template(v8::Persistent<v8::FunctionTemplate> desc) {
v8::Local<v8::Signature> default_signature = configureTemplate(desc, \"${interfaceName}\",
- V8ClassIndex::$parentClassIndex, V8${interfaceName}::internalFieldCount,
+ $parentClassTemplate, V8${interfaceName}::internalFieldCount,
END
# Set up our attributes if we have them
if ($has_attributes) {
@@ -1721,7 +1710,7 @@ END
NULL, 0,
END
}
-
+
if ($has_callbacks) {
push(@implContent, <<END);
${interfaceName}_callbacks, sizeof(${interfaceName}_callbacks)/sizeof(*${interfaceName}_callbacks));
@@ -1739,20 +1728,21 @@ END
}
if ($access_check or @enabledAtRuntime or @{$dataNode->functions} or $has_constants) {
- push(@implContent, <<END);
+ push(@implContent, <<END);
v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
END
}
push(@implContent, " $access_check\n");
-
+
# Setup the enable-at-runtime attrs if we have them
foreach my $runtime_attr (@enabledAtRuntime) {
- $enable_function = $interfaceName . "::" . $codeGenerator->WK_ucfirst($runtime_attr->signature->name);
+ # A function named RuntimeEnabledFeatures::{methodName}Enabled() need to be written by hand.
+ $enable_function = "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($runtime_attr->signature->name) . "Enabled";
my $conditionalString = GenerateConditionalString($runtime_attr->signature);
push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
- push(@implContent, " if (V8${enable_function}Enabled()) {\n");
+ push(@implContent, " if (${enable_function}()) {\n");
push(@implContent, " static const BatchedAttribute attrData =\\\n");
GenerateSingleBatchedAttribute($interfaceName, $runtime_attr, ";", " ");
push(@implContent, <<END);
@@ -1792,8 +1782,8 @@ END
my $conditional = "";
if ($attrExt->{"EnabledAtRuntime"}) {
# Only call Set()/SetAccessor() if this method should be enabled
- $enable_function = $interfaceName . "::" . $codeGenerator->WK_ucfirst($function->signature->name);
- $conditional = "if (V8${enable_function}Enabled())\n";
+ $enable_function = "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($function->signature->name) . "Enabled";
+ $conditional = "if (${enable_function}())\n";
}
if ($attrExt->{"DoNotCheckDomainSecurity"} &&
@@ -1840,24 +1830,24 @@ END
# Normal function call is a template
my $callback = GetFunctionTemplateCallbackName($function, $dataNode);
-
+
if ($property_attributes eq "v8::DontDelete") {
$property_attributes = "";
} else {
$property_attributes = ", static_cast<v8::PropertyAttribute>($property_attributes)";
}
-
+
if ($template eq "proto" && $conditional eq "" && $signature eq "default_signature" && $property_attributes eq "") {
# Standard type of callback, already created in the batch, so skip it here.
next;
}
-
+
push(@implContent, <<END);
${conditional}$template->Set(v8::String::New("$name"), v8::FunctionTemplate::New($callback, v8::Handle<v8::Value>(), ${signature})$property_attributes);
END
$num_callbacks++;
}
-
+
die "Wrong number of callbacks generated for $interfaceName ($num_callbacks, should be $total_functions)" if $num_callbacks != $total_functions;
if ($has_constants) {
@@ -1865,11 +1855,11 @@ END
batchConfigureConstants(desc, proto, ${interfaceName}_consts, sizeof(${interfaceName}_consts)/sizeof(*${interfaceName}_consts));
END
}
-
+
# Special cases
if ($interfaceName eq "DOMWindow") {
push(@implContent, <<END);
-
+
proto->SetInternalFieldCount(V8DOMWindow::internalFieldCount);
desc->SetHiddenPrototype(true);
instance->SetInternalFieldCount(V8DOMWindow::internalFieldCount);
@@ -1881,8 +1871,8 @@ END
}
if ($interfaceName eq "Location") {
push(@implContent, <<END);
-
- // For security reasons, these functions are on the instance instead
+
+ // For security reasons, these functions are on the instance instead
// of on the prototype object to insure that they cannot be overwritten.
instance->SetAccessor(v8::String::New("reload"), V8Location::reloadAccessorGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
instance->SetAccessor(v8::String::New("replace"), V8Location::replaceAccessorGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
@@ -1895,7 +1885,7 @@ END
$nativeType = "V8SVGPODTypeWrapper<${nativeType}>";
}
push(@implContent, <<END);
-
+
// Custom toString template
desc->Set(getToStringName(), getToStringTemplate());
return desc;
@@ -1912,7 +1902,7 @@ v8::Persistent<v8::FunctionTemplate> ${className}::GetTemplate() {
}
${nativeType}* ${className}::toNative(v8::Handle<v8::Object> object) {
- return reinterpret_cast<${nativeType}*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return reinterpret_cast<${nativeType}*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex));
}
bool ${className}::HasInstance(v8::Handle<v8::Value> value) {
@@ -1933,7 +1923,7 @@ v8::Persistent<v8::ObjectTemplate> V8DOMWindow::GetShadowObjectTemplate() {
}
END
}
-
+
GenerateToV8Converters($dataNode, $interfaceName, $className, $nativeType);
push(@implContent, <<END);
@@ -1943,24 +1933,24 @@ END
push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
}
-sub GenerateToV8Converters
+sub GenerateToV8Converters
{
my $dataNode = shift;
my $interfaceName = shift;
my $className = shift;
my $nativeType = shift;
-
+
my $wrapperType = "V8ClassIndex::" . uc($interfaceName);
my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName);
my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewObject" : "";
my $forceNewObjectCall = IsDOMNodeType($interfaceName) ? ", forceNewObject" : "";
-
- push(@implContent, <<END);
+
+ push(@implContent, <<END);
v8::Handle<v8::Object> ${className}::wrap(${nativeType}* impl${forceNewObjectInput}) {
v8::Handle<v8::Object> wrapper;
END
- if (!NeedsWorkerContextExecutionProxyToV8($interfaceName)) {
+ if (!MayBeInWorkerContext($dataNode, $interfaceName)) {
push(@implContent, <<END);
V8Proxy* proxy = 0;
END
@@ -2003,10 +1993,9 @@ END
END
}
- if (NeedsWorkerContextExecutionProxyToV8($interfaceName)) {
- $implIncludes{"WorkerContextExecutionProxy.h"} = 1;
+ if (MayBeInWorkerContext($dataNode, $interfaceName)) {
push(@implContent, <<END);
- wrapper = WorkerContextExecutionProxy::toV8(${wrapperType}, impl);
+ wrapper = V8DOMWrapper::instantiateV8ObjectInWorkerContext(${wrapperType}, impl);
END
} else {
push(@implContent, <<END);
@@ -2021,7 +2010,7 @@ END
context->Exit();
END
}
-
+
push(@implContent, <<END);
if (wrapper.IsEmpty())
return wrapper;
@@ -2047,7 +2036,7 @@ v8::Handle<v8::Value> toV8(PassRefPtr<${nativeType} > impl${forceNewObjectInput}
}
END
}
-
+
if (!HasCustomToV8Implementation($dataNode, $interfaceName)) {
push(@implContent, <<END);
@@ -2060,16 +2049,32 @@ END
}
}
-sub NeedsWorkerContextExecutionProxyToV8 {
+sub MayBeInWorkerContext {
# These objects can be constructed under WorkerContextExecutionProxy. They need special
# handling, since if we call V8Proxy::retrieve(), we will crash.
# FIXME: websocket?
- $interfaceName = shift;
+ my $dataNode = shift;
+ my $interfaceName = shift;
+ # FIXME: Doing the extra work to handle the WorkerContext case for all Event
+ # types is sad. We can probably be cleverer and only do the extra work for certain types.
+ return 1 if IsEventSubType($dataNode);
return 1 if $interfaceName eq "DOMCoreException";
return 1 if $interfaceName eq "EventException";
return 1 if $interfaceName eq "RangeException";
return 1 if $interfaceName eq "XMLHttpRequestException";
return 1 if $interfaceName eq "MessagePort";
+ return 1 if $interfaceName eq "DedicatedWorkerContext";
+ return 1 if $interfaceName eq "WorkerContext";
+ return 1 if $interfaceName eq "SharedWorkerContext";
+ return 1 if $interfaceName eq "WorkerLocation";
+ return 1 if $interfaceName eq "WorkerNavigator";
+ return 1 if $interfaceName eq "Notification";
+ return 1 if $interfaceName eq "NotificationCenter";
+ return 1 if $interfaceName eq "XMLHttpRequest";
+ return 1 if $interfaceName eq "WebSocket";
+ return 1 if $interfaceName eq "Worker";
+ return 1 if $interfaceName eq "SharedWorker";
+ return 1 if $interfaceName eq "EventSource";
return 0;
}
@@ -2077,7 +2082,7 @@ sub HasCustomToV8Implementation {
# FIXME: This subroutine is lame. Probably should be an .idl attribute (CustomToV8)?
$dataNode = shift;
$interfaceName = shift;
-
+
# We generate a custom converter (but JSC doesn't) for the following:
return 1 if $interfaceName eq "BarInfo";
return 1 if $interfaceName eq "CSSStyleSheet";
@@ -2094,7 +2099,7 @@ sub HasCustomToV8Implementation {
return 1 if $interfaceName eq "SVGDocument";
return 1 if $interfaceName eq "SVGElement";
return 1 if $interfaceName eq "Screen";
-
+ return 1 if $interfaceName eq "WorkerContext";
# We don't generate a custom converter (but JSC does) for the following:
return 0 if $interfaceName eq "AbstractWorker";
return 0 if $interfaceName eq "CanvasRenderingContext";
@@ -2135,7 +2140,7 @@ sub GetNativeTypeForConversions
my $type = shift;
return "FloatRect" if $type eq "SVGRect";
return "FloatPoint" if $type eq "SVGPoint";
- return "TransformationMatrix" if $type eq "SVGMatrix";
+ return "AffineTransform" if $type eq "SVGMatrix";
return "float" if $type eq "SVGNumber";
return $type;
}
@@ -2323,7 +2328,7 @@ sub GetNativeTypeFromSignature
}
$type = GetNativeType($type, $parameterIndex >= 0 ? 1 : 0);
-
+
if ($parameterIndex >= 0 && $type eq "V8Parameter") {
my $mode = "";
if ($signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}) {
@@ -2333,7 +2338,7 @@ sub GetNativeTypeFromSignature
}
$type .= "<$mode>";
}
-
+
return $type;
}
@@ -2357,17 +2362,6 @@ sub IsRefPtrType
return 1;
}
-sub IsWorkerClassName
-{
- my $class = shift;
- return 1 if $class eq "V8Worker";
- return 1 if $class eq "V8WorkerContext";
- return 1 if $class eq "V8WorkerLocation";
- return 1 if $class eq "V8WorkerNavigator";
-
- return 0;
-}
-
sub GetNativeType
{
my $type = shift;
@@ -2389,7 +2383,7 @@ sub GetNativeType
return "Range::CompareHow" if $type eq "CompareHow";
return "FloatRect" if $type eq "SVGRect";
return "FloatPoint" if $type eq "SVGPoint";
- return "TransformationMatrix" if $type eq "SVGMatrix";
+ return "AffineTransform" if $type eq "SVGMatrix";
return "SVGTransform" if $type eq "SVGTransform";
return "SVGLength" if $type eq "SVGLength";
return "SVGAngle" if $type eq "SVGAngle";
@@ -2785,18 +2779,6 @@ sub ReturnNativeToJSValue
return "return $value->deserialize()";
}
- if ($type eq "DedicatedWorkerContext" or $type eq "WorkerContext" or $type eq "SharedWorkerContext") {
- $implIncludes{"WorkerContextExecutionProxy.h"} = 1;
- return "return WorkerContextExecutionProxy::convertWorkerContextToV8Object($value)";
- }
-
- if ($type eq "WorkerLocation" or $type eq "WorkerNavigator" or $type eq "NotificationCenter") {
- $implIncludes{"WorkerContextExecutionProxy.h"} = 1;
- my $classIndex = uc($type);
-
- return "return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::$classIndex, $value)";
- }
-
$implIncludes{"wtf/RefCounted.h"} = 1;
$implIncludes{"wtf/RefPtr.h"} = 1;
$implIncludes{"wtf/GetPtr.h"} = 1;
diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp
index 258f579..1fe10b2 100644
--- a/WebCore/bindings/v8/NPV8Object.cpp
+++ b/WebCore/bindings/v8/NPV8Object.cpp
@@ -34,7 +34,6 @@
#include "OwnArrayPtr.h"
#include "PlatformString.h"
#include "ScriptController.h"
-#include "V8CustomBinding.h"
#include "V8GCController.h"
#include "V8Helpers.h"
#include "V8Index.h"
@@ -51,7 +50,6 @@ using WebCore::npObjectInternalFieldCount;
using WebCore::toV8Context;
using WebCore::toV8Proxy;
using WebCore::V8ClassIndex;
-using WebCore::V8Custom;
using WebCore::V8DOMWrapper;
using WebCore::V8GCController;
using WebCore::V8Proxy;
diff --git a/WebCore/bindings/v8/ScheduledAction.cpp b/WebCore/bindings/v8/ScheduledAction.cpp
index 4f321cb..f511e2b 100644
--- a/WebCore/bindings/v8/ScheduledAction.cpp
+++ b/WebCore/bindings/v8/ScheduledAction.cpp
@@ -95,11 +95,11 @@ void ScheduledAction::execute(ScriptExecutionContext* context)
if (proxy)
execute(proxy);
#if ENABLE(WORKERS)
- else {
- ASSERT(context->isWorkerContext());
+ else if (context->isWorkerContext())
execute(static_cast<WorkerContext*>(context));
- }
#endif
+ // It's possible that Javascript is disabled and that we have neither a V8Proxy
+ // nor a WorkerContext. Do nothing in that case.
}
void ScheduledAction::execute(V8Proxy* proxy)
diff --git a/WebCore/bindings/v8/ScriptArray.cpp b/WebCore/bindings/v8/ScriptArray.cpp
index 748ee19..01b0898 100644
--- a/WebCore/bindings/v8/ScriptArray.cpp
+++ b/WebCore/bindings/v8/ScriptArray.cpp
@@ -50,6 +50,10 @@ ScriptArray::ScriptArray(ScriptState* scriptState, v8::Handle<v8::Array> v8Array
bool ScriptArray::set(unsigned index, const ScriptObject& value)
{
+ if (value.scriptState() != m_scriptState) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
ScriptScope scope(m_scriptState);
v8Object()->Set(v8::Integer::New(index), value.v8Value());
return scope.success();
diff --git a/WebCore/bindings/v8/RuntimeEnabledFeatures.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp
index b712999..3fe8c34 100644
--- a/WebCore/bindings/v8/RuntimeEnabledFeatures.cpp
+++ b/WebCore/bindings/v8/ScriptDebugServer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Google 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
@@ -29,18 +29,17 @@
*/
#include "config.h"
-#include "RuntimeEnabledFeatures.h"
+
+#include "ScriptDebugServer.h"
namespace WebCore {
-bool RuntimeEnabledFeatures::isLocalStorageEnabled = true;
-bool RuntimeEnabledFeatures::isSessionStorageEnabled = true;
-bool RuntimeEnabledFeatures::isNotificationsEnabled = false;
-#if PLATFORM(ANDROID)
-// These should default to true, to match the behavior with JSC
-bool RuntimeEnabledFeatures::isApplicationCacheEnabled = true;
-bool RuntimeEnabledFeatures::isGeolocationEnabled = true;
-#endif
-bool RuntimeEnabledFeatures::isIndexedDatabaseEnabled = false;
+void ScriptDebugServer::recompileAllJSFunctions()
+{
+}
+
+void ScriptDebugServer::recompileAllJSFunctionsSoon()
+{
+}
} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h
new file mode 100644
index 0000000..b37af2f
--- /dev/null
+++ b/WebCore/bindings/v8/ScriptDebugServer.h
@@ -0,0 +1,46 @@
+/*
+ * 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:
+ *
+ * * 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 ScriptDebugServer_h
+#define ScriptDebugServer_h
+
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class ScriptDebugServer : public Noncopyable {
+public:
+ static void recompileAllJSFunctions();
+ static void recompileAllJSFunctionsSoon();
+};
+
+} // namespace WebCore
+
+#endif // ScriptDebugServer_h
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.cpp b/WebCore/bindings/v8/ScriptFunctionCall.cpp
index a232acd..e6b22ee 100644
--- a/WebCore/bindings/v8/ScriptFunctionCall.cpp
+++ b/WebCore/bindings/v8/ScriptFunctionCall.cpp
@@ -45,8 +45,8 @@
namespace WebCore {
-ScriptFunctionCall::ScriptFunctionCall(ScriptState* scriptState, const ScriptObject& thisObject, const String& name)
- : m_scriptState(scriptState)
+ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name)
+ : m_scriptState(thisObject.scriptState())
, m_thisObject(thisObject)
, m_name(name)
{
@@ -54,6 +54,10 @@ ScriptFunctionCall::ScriptFunctionCall(ScriptState* scriptState, const ScriptObj
void ScriptFunctionCall::appendArgument(const ScriptObject& argument)
{
+ if (argument.scriptState() != m_scriptState) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
m_arguments.append(argument);
}
diff --git a/WebCore/bindings/v8/ScriptFunctionCall.h b/WebCore/bindings/v8/ScriptFunctionCall.h
index 6203402..4cbbf7e 100644
--- a/WebCore/bindings/v8/ScriptFunctionCall.h
+++ b/WebCore/bindings/v8/ScriptFunctionCall.h
@@ -43,7 +43,7 @@ namespace WebCore {
class ScriptFunctionCall {
public:
- ScriptFunctionCall(ScriptState* scriptState, const ScriptObject& thisObject, const String& name);
+ ScriptFunctionCall(const ScriptObject& thisObject, const String& name);
virtual ~ScriptFunctionCall() {};
void appendArgument(const ScriptObject&);
diff --git a/WebCore/bindings/v8/ScriptObject.cpp b/WebCore/bindings/v8/ScriptObject.cpp
index 0fcd16f..520c57b 100644
--- a/WebCore/bindings/v8/ScriptObject.cpp
+++ b/WebCore/bindings/v8/ScriptObject.cpp
@@ -67,6 +67,10 @@ bool ScriptObject::set(const String& name, const String& value)
bool ScriptObject::set(const char* name, const ScriptObject& value)
{
+ if (value.scriptState() != m_scriptState) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
ScriptScope scope(m_scriptState);
v8Object()->Set(v8::String::New(name), value.v8Value());
return scope.success();
diff --git a/WebCore/bindings/v8/ScriptState.h b/WebCore/bindings/v8/ScriptState.h
index e71becb..5c5ce6c 100644
--- a/WebCore/bindings/v8/ScriptState.h
+++ b/WebCore/bindings/v8/ScriptState.h
@@ -38,9 +38,9 @@
namespace WebCore {
class DOMWrapperWorld;
+ class Frame;
class Node;
class Page;
- class Frame;
class ScriptState : public Noncopyable {
public:
diff --git a/WebCore/bindings/v8/ScriptValue.cpp b/WebCore/bindings/v8/ScriptValue.cpp
index af84e99..02d62db 100644..100755
--- a/WebCore/bindings/v8/ScriptValue.cpp
+++ b/WebCore/bindings/v8/ScriptValue.cpp
@@ -31,10 +31,24 @@
#include "config.h"
#include "ScriptValue.h"
+#include "ScriptScope.h"
+#include "SerializedScriptValue.h"
#include "V8Binding.h"
namespace WebCore {
+PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState)
+{
+ ScriptScope scope(scriptState);
+ return SerializedScriptValue::create(v8Value());
+}
+
+ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value)
+{
+ ScriptScope scope(scriptState);
+ return ScriptValue(value->deserialize());
+}
+
bool ScriptValue::getString(String& result) const
{
if (m_value.IsEmpty())
diff --git a/WebCore/bindings/v8/ScriptValue.h b/WebCore/bindings/v8/ScriptValue.h
index 6a70bd7..1713f80 100644
--- a/WebCore/bindings/v8/ScriptValue.h
+++ b/WebCore/bindings/v8/ScriptValue.h
@@ -35,6 +35,7 @@
#include "ScriptState.h"
#include <v8.h>
+#include <wtf/PassRefPtr.h>
#ifndef NDEBUG
#include "V8Proxy.h" // for register and unregister global handles.
@@ -42,6 +43,8 @@
namespace WebCore {
+class SerializedScriptValue;
+
class ScriptValue {
public:
ScriptValue() {}
@@ -121,6 +124,9 @@ public:
return m_value.IsEmpty();
}
+ PassRefPtr<SerializedScriptValue> serialize(ScriptState*);
+ static ScriptValue deserialize(ScriptState*, SerializedScriptValue*);
+
void clear()
{
if (m_value.IsEmpty())
diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp
index 4379230..34020be 100644
--- a/WebCore/bindings/v8/V8Binding.cpp
+++ b/WebCore/bindings/v8/V8Binding.cpp
@@ -437,9 +437,9 @@ v8::Persistent<v8::FunctionTemplate> createRawTemplate()
return v8::Persistent<v8::FunctionTemplate>::New(result);
}
-v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate>desc,
+v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate> desc,
const char *interfaceName,
- V8ClassIndex::V8WrapperType parentClassIndex,
+ v8::Persistent<v8::FunctionTemplate> parentClass,
int fieldCount,
const BatchedAttribute* attributes,
size_t attributeCount,
@@ -449,8 +449,8 @@ v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate>d
desc->SetClassName(v8::String::New(interfaceName));
v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
instance->SetInternalFieldCount(fieldCount);
- if (parentClassIndex)
- desc->Inherit(V8DOMWrapper::getTemplate(parentClassIndex));
+ if (!parentClass.IsEmpty())
+ desc->Inherit(parentClass);
if (attributeCount)
batchConfigureAttributes(instance, desc->PrototypeTemplate(),
attributes, attributeCount);
diff --git a/WebCore/bindings/v8/V8Binding.h b/WebCore/bindings/v8/V8Binding.h
index 439dfd7..0be0ebd 100644
--- a/WebCore/bindings/v8/V8Binding.h
+++ b/WebCore/bindings/v8/V8Binding.h
@@ -32,11 +32,11 @@
#define V8Binding_h
#include "AtomicString.h"
+#include "BindingElement.h"
#include "BindingSecurity.h"
#include "MathExtras.h"
#include "PlatformString.h"
#include "V8DOMWrapper.h"
-#include "V8Index.h"
#include <v8.h>
@@ -53,6 +53,7 @@ namespace WebCore {
typedef V8BindingDOMWindow DOMWindow;
};
typedef BindingSecurity<V8Binding> V8BindingSecurity;
+ typedef BindingElement<V8Binding> V8BindingElement;
enum ExternalMode {
Externalize,
@@ -160,8 +161,8 @@ namespace WebCore {
struct BatchedCallback;
v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate>,
- const char *interfaceName,
- V8ClassIndex::V8WrapperType parentClassIndex,
+ const char* interfaceName,
+ v8::Persistent<v8::FunctionTemplate> parentClass,
int fieldCount,
const BatchedAttribute*,
size_t attributeCount,
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
index 683fea5..02135bf 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -94,7 +94,7 @@ static Frame* getTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> da
Frame* target = 0;
switch (V8ClassIndex::FromInt(data->Int32Value())) {
case V8ClassIndex::DOMWINDOW: {
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
+ v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
if (window.IsEmpty())
return target;
@@ -196,7 +196,7 @@ void V8DOMWindowShell::clearForNavigation()
clearDocumentWrapperCache();
// Turn on access check on the old DOMWindow wrapper.
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, m_global);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), m_global);
ASSERT(!wrapper.IsEmpty());
wrapper->TurnOnAccessCheck();
@@ -391,12 +391,12 @@ bool V8DOMWindowShell::installDOMWindow(v8::Handle<v8::Context> context, DOMWind
return true;
}
-void V8DOMWindowShell::updateDocumentWrapper(v8::Handle<v8::Value> wrapper)
+void V8DOMWindowShell::updateDocumentWrapper(v8::Handle<v8::Object> wrapper)
{
clearDocumentWrapper();
ASSERT(m_document.IsEmpty());
- m_document = v8::Persistent<v8::Value>::New(wrapper);
+ m_document = v8::Persistent<v8::Object>::New(wrapper);
#ifndef NDEBUG
V8GCController::registerGlobalHandle(PROXY, this, m_document);
#endif
@@ -438,6 +438,7 @@ void V8DOMWindowShell::updateDocumentWrapperCache()
clearDocumentWrapperCache();
return;
}
+ ASSERT(documentWrapper->IsObject());
m_context->Global()->ForceSet(v8::String::New("document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
}
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.h b/WebCore/bindings/v8/V8DOMWindowShell.h
index 29dd517..5114f7a 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.h
+++ b/WebCore/bindings/v8/V8DOMWindowShell.h
@@ -31,7 +31,6 @@
#ifndef V8DOMWindowShell_h
#define V8DOMWindowShell_h
-#include "V8CustomBinding.h"
#include "V8Index.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -64,7 +63,7 @@ public:
static bool installDOMWindow(v8::Handle<v8::Context> context, DOMWindow*);
void initContextIfNeeded();
- void updateDocumentWrapper(v8::Handle<v8::Value> wrapper);
+ void updateDocumentWrapper(v8::Handle<v8::Object> wrapper);
void clearForNavigation();
void clearForClose();
@@ -114,7 +113,7 @@ private:
v8::Persistent<v8::Context> m_context;
v8::Persistent<v8::Object> m_global;
- v8::Persistent<v8::Value> m_document;
+ v8::Persistent<v8::Object> m_document;
};
} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index a715160..1605417 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -64,6 +64,8 @@
#include "V8StyleSheet.h"
#include "V8WebSocket.h"
#include "V8Worker.h"
+#include "V8WorkerContext.h"
+#include "V8XMLHttpRequest.h"
#include "WebGLArray.h"
#include "WebGLContextAttributes.h"
#include "WebGLUniformLocation.h"
@@ -164,20 +166,6 @@ void V8DOMWrapper::setJSWrapperForDOMNode(Node* node, v8::Persistent<v8::Object>
getDOMNodeMap().set(node, wrapper);
}
-v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8WrapperType type)
-{
- v8::Persistent<v8::FunctionTemplate>* cacheCell = V8ClassIndex::GetCache(type);
- if (!cacheCell->IsEmpty())
- return *cacheCell;
-
- // Not in the cache.
- FunctionTemplateFactory factory = V8ClassIndex::GetFactory(type);
- v8::Persistent<v8::FunctionTemplate> descriptor = factory();
-
- *cacheCell = descriptor;
- return descriptor;
-}
-
v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Value> objectPrototype)
{
// A DOM constructor is a function instance created from a DOM constructor
@@ -189,7 +177,7 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType
// The reason for 2) is that, in Safari, a DOM constructor is a normal JS
// object, but not a function. Hotmail relies on the fact that, in Safari,
// HTMLElement.__proto__ == Object.prototype.
- v8::Handle<v8::FunctionTemplate> functionTemplate = getTemplate(type);
+ v8::Handle<v8::FunctionTemplate> functionTemplate = V8ClassIndex::getTemplate(type);
// Getting the function might fail if we're running out of
// stack or memory.
v8::TryCatch tryCatch;
@@ -249,7 +237,7 @@ void V8DOMWrapper::setHiddenWindowReference(Frame* frame, const int internalInde
v8::Handle<v8::Object> global = context->Global();
// Look for real DOM wrapper.
- global = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, global);
+ global = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global);
ASSERT(!global.IsEmpty());
ASSERT(global->GetInternalField(internalIndex)->IsUndefined());
global->SetInternalField(internalIndex, jsObject);
@@ -279,6 +267,19 @@ PassRefPtr<NodeFilter> V8DOMWrapper::wrapNativeNodeFilter(v8::Handle<v8::Value>
return NodeFilter::create(condition);
}
+v8::Local<v8::Object> V8DOMWrapper::instantiateV8ObjectInWorkerContext(V8ClassIndex::V8WrapperType type, void* impl)
+{
+ WorkerContextExecutionProxy* workerContextProxy = WorkerContextExecutionProxy::retrieve();
+ if (!workerContextProxy)
+ return instantiateV8Object(0, type, impl);
+ v8::Local<v8::Object> instance = SafeAllocation::newInstance(getConstructor(type, workerContextProxy->workerContext()));
+ if (!instance.IsEmpty()) {
+ // Avoid setting the DOM wrapper for failed allocations.
+ setDOMWrapper(instance, V8ClassIndex::ToInt(type), impl);
+ }
+ return instance;
+}
+
v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType type, void* impl)
{
if (V8IsolatedContext::getEntered()) {
@@ -294,10 +295,8 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassI
if (proxy)
// FIXME: Fix this to work properly with isolated worlds (see above).
instance = proxy->windowShell()->createWrapperFromCache(type);
- else {
- v8::Local<v8::Function> function = getTemplate(type)->GetFunction();
- instance = SafeAllocation::newInstance(function);
- }
+ else
+ instance = SafeAllocation::newInstance(V8ClassIndex::getTemplate(type)->GetFunction());
if (!instance.IsEmpty()) {
// Avoid setting the DOM wrapper for failed allocations.
setDOMWrapper(instance, V8ClassIndex::ToInt(type), impl);
@@ -379,11 +378,17 @@ v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* ta
#if ENABLE(WORKERS)
if (Worker* worker = target->toWorker())
return toV8(worker);
+
+ if (DedicatedWorkerContext* workerContext = target->toDedicatedWorkerContext())
+ return toV8(workerContext);
#endif // WORKERS
#if ENABLE(SHARED_WORKERS)
if (SharedWorker* sharedWorker = target->toSharedWorker())
return toV8(sharedWorker);
+
+ if (SharedWorkerContext* sharedWorkerContext = target->toSharedWorkerContext())
+ return toV8(sharedWorkerContext);
#endif // SHARED_WORKERS
#if ENABLE(NOTIFICATIONS)
@@ -409,6 +414,9 @@ v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* ta
return wrapper;
}
+ if (XMLHttpRequest* xhr = target->toXMLHttpRequest())
+ return toV8(xhr);
+
// MessagePort is created within its JS counterpart
if (MessagePort* port = target->toMessagePort()) {
v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(port);
diff --git a/WebCore/bindings/v8/V8DOMWrapper.h b/WebCore/bindings/v8/V8DOMWrapper.h
index 51abff7..78e9ae2 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.h
+++ b/WebCore/bindings/v8/V8DOMWrapper.h
@@ -117,9 +117,9 @@ namespace WebCore {
object->SetInternalField(v8DOMWrapperTypeIndex, v8::Integer::New(type));
}
- static v8::Handle<v8::Object> lookupDOMWrapper(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Object> object)
+ static v8::Handle<v8::Object> lookupDOMWrapper(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Handle<v8::Object> object)
{
- return object.IsEmpty() ? object : object->FindInstanceInPrototypeChain(getTemplate(type));
+ return object.IsEmpty() ? object : object->FindInstanceInPrototypeChain(functionTemplate);
}
static V8ClassIndex::V8WrapperType domWrapperType(v8::Handle<v8::Object>);
@@ -169,7 +169,6 @@ namespace WebCore {
// Wrap JS node filter in C++.
static PassRefPtr<NodeFilter> wrapNativeNodeFilter(v8::Handle<v8::Value>);
- static v8::Persistent<v8::FunctionTemplate> getTemplate(V8ClassIndex::V8WrapperType);
static v8::Local<v8::Function> getConstructorForContext(V8ClassIndex::V8WrapperType, v8::Handle<v8::Context>);
static v8::Local<v8::Function> getConstructor(V8ClassIndex::V8WrapperType, v8::Handle<v8::Value> objectPrototype);
static v8::Local<v8::Function> getConstructor(V8ClassIndex::V8WrapperType, DOMWindow*);
@@ -193,6 +192,7 @@ namespace WebCore {
static void setHiddenWindowReference(Frame*, const int internalIndex, v8::Handle<v8::Object>);
static v8::Local<v8::Object> instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType type, void* impl);
+ static v8::Local<v8::Object> instantiateV8ObjectInWorkerContext(V8ClassIndex::V8WrapperType type, void* impl);
static v8::Handle<v8::Object> getWrapper(Node*);
};
diff --git a/WebCore/bindings/v8/V8Index.cpp b/WebCore/bindings/v8/V8Index.cpp
index b87e060..1053f19 100644
--- a/WebCore/bindings/v8/V8Index.cpp
+++ b/WebCore/bindings/v8/V8Index.cpp
@@ -476,34 +476,16 @@
namespace WebCore {
-FunctionTemplateFactory V8ClassIndex::GetFactory(V8WrapperType type)
+v8::Persistent<v8::FunctionTemplate> V8ClassIndex::getTemplate(V8WrapperType type)
{
switch (type) {
#define MAKE_CASE(type, name)\
- case V8ClassIndex::type: return V8##name::GetTemplate;
+ case V8ClassIndex::type: return V8##name::GetTemplate();
WRAPPER_TYPES(MAKE_CASE)
#undef MAKE_CASE
- default: return NULL;
- }
-}
-
-
-#define MAKE_CACHE(type, name)\
- static v8::Persistent<v8::FunctionTemplate> name##_cache_;
- ALL_WRAPPER_TYPES(MAKE_CACHE)
-#undef MAKE_CACHE
-
-
-v8::Persistent<v8::FunctionTemplate>* V8ClassIndex::GetCache(V8WrapperType type)
-{
- switch (type) {
-#define MAKE_CASE(type, name)\
- case V8ClassIndex::type: return &name##_cache_;
- ALL_WRAPPER_TYPES(MAKE_CASE)
-#undef MAKE_CASE
default:
- ASSERT(false);
- return NULL;
+ ASSERT_NOT_REACHED();
+ return v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
}
}
diff --git a/WebCore/bindings/v8/V8Index.h b/WebCore/bindings/v8/V8Index.h
index f7582f7..bd1c45c 100644
--- a/WebCore/bindings/v8/V8Index.h
+++ b/WebCore/bindings/v8/V8Index.h
@@ -39,8 +39,6 @@ static const int v8DOMWrapperTypeIndex = 0;
static const int v8DOMWrapperObjectIndex = 1;
static const int v8DefaultWrapperInternalFieldCount = 2;
-typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
-
#if ENABLE(DATAGRID)
#define DATAGRID_HTMLELEMENT_TYPES(V) \
V(HTMLDATAGRIDCELLELEMENT, HTMLDataGridCellElement) \
@@ -635,7 +633,7 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
V(SVGLENGTH, SVGLength) \
V(SVGPRESERVEASPECTRATIO, SVGPreserveAspectRatio) \
V(SVGTRANSFORM, SVGTransform) \
- V(SVGMATRIX, TransformationMatrix) \
+ V(SVGMATRIX, AffineTransform) \
V(SVGNUMBER, float) \
V(SVGPOINT, FloatPoint) \
V(SVGRECT, FloatRect)
@@ -691,12 +689,7 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
return static_cast<V8WrapperType>(v);
}
- // FIXME: Convert to getFactory after all the bindings are in one place.
- static FunctionTemplateFactory GetFactory(V8WrapperType type);
-
- // Returns a field to be used as cache for the template for the given type
- // FIXME: Convert to getCache after all the bindings are in one place.
- static v8::Persistent<v8::FunctionTemplate>* GetCache(V8WrapperType type);
+ static v8::Persistent<v8::FunctionTemplate> getTemplate(V8WrapperType type);
};
}
diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp
index 196972e..b873d5f 100644
--- a/WebCore/bindings/v8/V8NPObject.cpp
+++ b/WebCore/bindings/v8/V8NPObject.cpp
@@ -35,7 +35,6 @@
#include "HTMLPlugInElement.h"
#include "IdentifierRep.h"
#include "NPV8Object.h"
-#include "V8CustomBinding.h"
#include "V8DOMMap.h"
#include "V8HTMLAppletElement.h"
#include "V8HTMLEmbedElement.h"
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index b0a47b8..6e2d8b2 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -549,7 +549,7 @@ DOMWindow* V8Proxy::retrieveWindow(v8::Handle<v8::Context> context)
{
v8::Handle<v8::Object> global = context->Global();
ASSERT(!global.IsEmpty());
- global = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, global);
+ global = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), global);
ASSERT(!global.IsEmpty());
return V8DOMWindow::toNative(global);
}
diff --git a/WebCore/bindings/v8/V8Utilities.cpp b/WebCore/bindings/v8/V8Utilities.cpp
index fb1ecaa..c7314f1 100644
--- a/WebCore/bindings/v8/V8Utilities.cpp
+++ b/WebCore/bindings/v8/V8Utilities.cpp
@@ -37,7 +37,6 @@
#include "Frame.h"
#include "ScriptExecutionContext.h"
#include "ScriptState.h"
-#include "V8CustomBinding.h"
#include "V8Binding.h"
#include "V8Proxy.h"
#include "WorkerContext.h"
diff --git a/WebCore/bindings/v8/V8WorkerContextEventListener.cpp b/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
index e5356de..fa89ae6 100644
--- a/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
+++ b/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
@@ -34,8 +34,9 @@
#include "V8WorkerContextEventListener.h"
-#include "Event.h"
#include "V8Binding.h"
+#include "V8DOMWrapper.h"
+#include "V8Event.h"
#include "WorkerContext.h"
#include "WorkerContextExecutionProxy.h"
@@ -76,7 +77,7 @@ void V8WorkerContextEventListener::handleEvent(ScriptExecutionContext* context,
v8::Context::Scope scope(v8Context);
// Get the V8 wrapper for the event object.
- v8::Handle<v8::Value> jsEvent = WorkerContextExecutionProxy::convertEventToV8Object(event);
+ v8::Handle<v8::Value> jsEvent = toV8(event);
invokeEventHandler(context, event, jsEvent);
}
@@ -155,7 +156,7 @@ v8::Local<v8::Object> V8WorkerContextEventListener::getReceiverObject(ScriptExec
return listener;
EventTarget* target = event->currentTarget();
- v8::Handle<v8::Value> value = WorkerContextExecutionProxy::convertEventTargetToV8Object(target);
+ v8::Handle<v8::Value> value = V8DOMWrapper::convertEventTargetToV8Object(target);
if (value.IsEmpty())
return v8::Local<v8::Object>();
return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value));
diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
index ac677a2..e4b417e 100644
--- a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
+++ b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
@@ -107,7 +107,7 @@ WorkerContextExecutionProxy* WorkerContextExecutionProxy::retrieve()
return 0;
v8::Handle<v8::Context> context = v8::Context::GetCurrent();
v8::Handle<v8::Object> global = context->Global();
- global = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::WORKERCONTEXT, global);
+ global = V8DOMWrapper::lookupDOMWrapper(V8WorkerContext::GetTemplate(), global);
// Return 0 if the current executing context is not the worker context.
if (global.IsEmpty())
return 0;
@@ -176,195 +176,6 @@ void WorkerContextExecutionProxy::initContextIfNeeded()
globalObject->Set(implicitProtoString, jsWorkerContext);
}
-v8::Handle<v8::Value> WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::V8WrapperType type, void* impl)
-{
- if (!impl)
- return v8::Null();
-
- if (type == V8ClassIndex::DEDICATEDWORKERCONTEXT
-#if ENABLE(SHARED_WORKERS)
- || type == V8ClassIndex::SHAREDWORKERCONTEXT
-#endif
- )
- return convertWorkerContextToV8Object(static_cast<WorkerContext*>(impl));
-
- bool isActiveDomObject = false;
- switch (type) {
-#define MAKE_CASE(TYPE, NAME) case V8ClassIndex::TYPE:
- ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
- isActiveDomObject = true;
- break;
-#undef MAKE_CASE
- default:
- break;
- }
-
- if (isActiveDomObject) {
- v8::Persistent<v8::Object> result = getActiveDOMObjectMap().get(impl);
- if (!result.IsEmpty())
- return result;
-
- v8::Local<v8::Object> object = toV8(type, type, impl);
- switch (type) {
-#define MAKE_CASE(TYPE, NAME) \
- case V8ClassIndex::TYPE: static_cast<NAME*>(impl)->ref(); break;
- ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
-#undef MAKE_CASE
- default:
- ASSERT_NOT_REACHED();
- }
-
- result = v8::Persistent<v8::Object>::New(object);
- V8DOMWrapper::setJSWrapperForActiveDOMObject(impl, result);
- return result;
- }
-
- // Non DOM node
- v8::Persistent<v8::Object> result = getDOMObjectMap().get(impl);
- if (result.IsEmpty()) {
- v8::Local<v8::Object> object = toV8(type, type, impl);
- if (!object.IsEmpty()) {
- switch (type) {
- case V8ClassIndex::WORKERLOCATION:
- static_cast<WorkerLocation*>(impl)->ref();
- break;
- case V8ClassIndex::WORKERNAVIGATOR:
- static_cast<WorkerNavigator*>(impl)->ref();
- break;
-#if ENABLE(NOTIFICATIONS)
- case V8ClassIndex::NOTIFICATIONCENTER:
- static_cast<NotificationCenter*>(impl)->ref();
- break;
- case V8ClassIndex::NOTIFICATION:
- static_cast<Notification*>(impl)->ref();
- break;
-#endif
- case V8ClassIndex::DOMCOREEXCEPTION:
- static_cast<DOMCoreException*>(impl)->ref();
- break;
- case V8ClassIndex::RANGEEXCEPTION:
- static_cast<RangeException*>(impl)->ref();
- break;
- case V8ClassIndex::EVENTEXCEPTION:
- static_cast<EventException*>(impl)->ref();
- break;
- case V8ClassIndex::XMLHTTPREQUESTEXCEPTION:
- static_cast<XMLHttpRequestException*>(impl)->ref();
- break;
- default:
- ASSERT(false);
- }
- result = v8::Persistent<v8::Object>::New(object);
- V8DOMWrapper::setJSWrapperForDOMObject(impl, result);
- }
- }
- return result;
-}
-
-v8::Handle<v8::Value> WorkerContextExecutionProxy::convertEventToV8Object(Event* event)
-{
- if (!event)
- return v8::Null();
-
- v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(event);
- if (!wrapper.IsEmpty())
- return wrapper;
-
- V8ClassIndex::V8WrapperType type = V8ClassIndex::EVENT;
-
- if (event->isMessageEvent())
- type = V8ClassIndex::MESSAGEEVENT;
-
- v8::Handle<v8::Object> result = toV8(type, V8ClassIndex::EVENT, event);
- if (result.IsEmpty()) {
- // Instantiation failed. Avoid updating the DOM object map and return null which
- // is already handled by callers of this function in case the event is null.
- return v8::Null();
- }
-
- event->ref(); // fast ref
- V8DOMWrapper::setJSWrapperForDOMObject(event, v8::Persistent<v8::Object>::New(result));
-
- return result;
-}
-
-v8::Handle<v8::Value> WorkerContextExecutionProxy::convertEventTargetToV8Object(EventTarget* target)
-{
- if (!target)
- return v8::Null();
-
- DedicatedWorkerContext* workerContext = target->toDedicatedWorkerContext();
- if (workerContext)
- return convertWorkerContextToV8Object(workerContext);
-
-#if ENABLE(SHARED_WORKERS)
- SharedWorkerContext* sharedWorkerContext = target->toSharedWorkerContext();
- if (sharedWorkerContext)
- return convertWorkerContextToV8Object(sharedWorkerContext);
-#endif
-
- Worker* worker = target->toWorker();
- if (worker)
- return convertToV8Object(V8ClassIndex::WORKER, worker);
-
-#if ENABLE(SHARED_WORKERS)
- SharedWorker* sharedWorker = target->toSharedWorker();
- if (sharedWorker)
- return convertToV8Object(V8ClassIndex::SHAREDWORKER, sharedWorker);
-#endif
-
- XMLHttpRequest* xhr = target->toXMLHttpRequest();
- if (xhr)
- return convertToV8Object(V8ClassIndex::XMLHTTPREQUEST, xhr);
-
- MessagePort* mp = target->toMessagePort();
- if (mp)
- return convertToV8Object(V8ClassIndex::MESSAGEPORT, mp);
-
-#if ENABLE(WEB_SOCKETS)
- WebSocket* webSocket = target->toWebSocket();
- if (webSocket)
- return convertToV8Object(V8ClassIndex::WEBSOCKET, webSocket);
-#endif
-
-#if ENABLE(EVENTSOURCE)
- EventSource* eventSource = target->toEventSource();
- if (eventSource)
- return convertToV8Object(V8ClassIndex::EVENTSOURCE, eventSource);
-#endif
-
- ASSERT_NOT_REACHED();
- return v8::Handle<v8::Value>();
-}
-
-v8::Handle<v8::Value> WorkerContextExecutionProxy::convertWorkerContextToV8Object(WorkerContext* workerContext)
-{
- if (!workerContext)
- return v8::Null();
-
- v8::Handle<v8::Context> context = workerContext->script()->proxy()->context();
-
- v8::Handle<v8::Object> global = context->Global();
- ASSERT(!global.IsEmpty());
- return global;
-}
-
-v8::Local<v8::Object> WorkerContextExecutionProxy::toV8(V8ClassIndex::V8WrapperType descriptorType, V8ClassIndex::V8WrapperType cptrType, void* impl)
-{
- v8::Local<v8::Function> function;
- WorkerContextExecutionProxy* proxy = retrieve();
- if (proxy)
- function = V8DOMWrapper::getConstructor(descriptorType, proxy->workerContext());
- else
- function = V8DOMWrapper::getTemplate(descriptorType)->GetFunction();
-
- v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
- if (!instance.IsEmpty())
- // Avoid setting the DOM wrapper for failed allocations.
- V8DOMWrapper::setDOMWrapper(instance, V8ClassIndex::ToInt(cptrType), impl);
- return instance;
-}
-
bool WorkerContextExecutionProxy::forgetV8EventObject(Event* event)
{
if (getDOMObjectMap().contains(event)) {
diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.h b/WebCore/bindings/v8/WorkerContextExecutionProxy.h
index b5e6afb..67a472b 100644
--- a/WebCore/bindings/v8/WorkerContextExecutionProxy.h
+++ b/WebCore/bindings/v8/WorkerContextExecutionProxy.h
@@ -84,22 +84,6 @@ namespace WebCore {
// Returns WorkerContextExecutionProxy object of the currently executing context. 0 will be returned if the current executing context is not the worker context.
static WorkerContextExecutionProxy* retrieve();
- // We have to keep all these conversion functions here before WorkerContextExecutionProxy is refactor-ed.
- template<typename T>
- static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType type, PassRefPtr<T> impl)
- {
- return convertToV8Object(type, impl.get());
- }
- static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType, void* impl);
- static v8::Handle<v8::Value> convertEventToV8Object(Event*);
- static v8::Handle<v8::Value> convertEventTargetToV8Object(EventTarget*);
- static v8::Handle<v8::Value> convertWorkerContextToV8Object(WorkerContext*);
-
- static v8::Local<v8::Object> toV8(V8ClassIndex::V8WrapperType type, void* impl)
- {
- return toV8(type, type, impl);
- }
-
private:
void initV8IfNeeded();
void initContextIfNeeded();
@@ -108,8 +92,6 @@ namespace WebCore {
// Run an already compiled script.
v8::Local<v8::Value> runScript(v8::Handle<v8::Script>);
- static v8::Local<v8::Object> toV8(V8ClassIndex::V8WrapperType descriptorType, V8ClassIndex::V8WrapperType cptrType, void* impl);
-
static bool forgetV8EventObject(Event*);
static const int kWorkerMaxStackSize = 500 * 1024;
diff --git a/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp b/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp
index 6b8f195..e776438 100644
--- a/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8AbstractWorkerCustom.cpp
@@ -37,7 +37,6 @@
#include "ExceptionCode.h"
#include "ScriptExecutionContext.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContextExecutionProxy.h"
diff --git a/WebCore/bindings/v8/custom/V8AttrCustom.cpp b/WebCore/bindings/v8/custom/V8AttrCustom.cpp
index 7bec619..0da4ae4 100644
--- a/WebCore/bindings/v8/custom/V8AttrCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8AttrCustom.cpp
@@ -36,7 +36,6 @@
#include "ExceptionCode.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp b/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
index 25d141a..850ae14 100644
--- a/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
@@ -38,7 +38,6 @@
#include "EventTarget.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include <wtf/ASCIICType.h>
diff --git a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
index 70be193..9a05d72 100644
--- a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
@@ -41,7 +41,6 @@
#include "V8Binding.h"
#include "V8CanvasGradient.h"
#include "V8CanvasPattern.h"
-#include "V8CustomBinding.h"
#include "V8HTMLCanvasElement.h"
#include "V8HTMLImageElement.h"
#include "V8HTMLVideoElement.h"
diff --git a/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp b/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
index 5f0b4e3..aa2816c 100644
--- a/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
@@ -39,7 +39,6 @@
#include "Element.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Node.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp b/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp
index a5197f5..fc5c750 100644
--- a/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8CoordinatesCustom.cpp
@@ -28,7 +28,6 @@
#include "Coordinates.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h
index 0c96cb1..e69de29 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.h
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h
@@ -1,51 +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 V8CustomBinding_h
-#define V8CustomBinding_h
-
-#include "V8Index.h"
-#include <v8.h>
-
-namespace WebCore {
- class V8Custom {
- public:
-#define DECLARE_CALLBACK(NAME) static v8::Handle<v8::Value> v8##NAME##Callback(const v8::Arguments& args)
-#define USE_CALLBACK(NAME) V8Custom::v8##NAME##Callback
-
- DECLARE_CALLBACK(HTMLAudioElementConstructor);
- DECLARE_CALLBACK(HTMLImageElementConstructor);
- DECLARE_CALLBACK(HTMLOptionElementConstructor);
-
-#undef DECLARE_CALLBACK
- };
-} // namespace WebCore
-
-#endif // V8CustomBinding_h
diff --git a/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp b/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp
index a439432..61760b3 100644
--- a/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMApplicationCacheCustom.cpp
@@ -36,7 +36,6 @@
#include "ApplicationCacheHost.h"
#include "DOMApplicationCache.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Document.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
index ba6c738..9719837 100644
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -1,10 +1,10 @@
/*
* 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
@@ -14,7 +14,7 @@
* * 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
@@ -45,7 +45,6 @@
#include "MediaPlayer.h"
#include "Page.h"
#include "PlatformScreen.h"
-#include "RuntimeEnabledFeatures.h"
#include "ScheduledAction.h"
#include "ScriptSourceCode.h"
#include "SerializedScriptValue.h"
@@ -55,7 +54,6 @@
#include "V8Binding.h"
#include "V8BindingDOMWindow.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8CustomEventListener.h"
#include "V8HTMLCollection.h"
#include "V8MessagePortCustom.h"
@@ -96,9 +94,9 @@ v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singl
else {
v8::Handle<v8::Value> v8String = function->ToString();
- // Bail out if string conversion failed.
- if (v8String.IsEmpty())
- return v8::Undefined();
+ // Bail out if string conversion failed.
+ if (v8String.IsEmpty())
+ return v8::Undefined();
functionString = toWebCoreString(v8String);
}
@@ -173,7 +171,7 @@ static v8::Handle<v8::Value> convertBase64(const String& str, bool encode)
v8::Handle<v8::Value> V8DOMWindow::eventAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), info.This());
if (holder.IsEmpty())
return v8::Undefined();
@@ -194,7 +192,7 @@ v8::Handle<v8::Value> V8DOMWindow::eventAccessorGetter(v8::Local<v8::String> nam
void V8DOMWindow::eventAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), info.This());
if (holder.IsEmpty())
return;
@@ -229,7 +227,7 @@ void V8DOMWindow::openerAccessorSetter(v8::Local<v8::String> name, v8::Local<v8:
if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
return;
-
+
// Opener can be shadowed if it is in the same domain.
// Have a special handling of null value to behave
// like Firefox. See bug http://b/1224887 & http://b/791706.
@@ -255,85 +253,6 @@ v8::Handle<v8::Value> V8DOMWindow::AudioAccessorGetter(v8::Local<v8::String> nam
return V8DOMWrapper::getConstructor(V8ClassIndex::AUDIO, window);
}
-bool V8DOMWindow::AudioEnabled()
-{
- return MediaPlayer::isAvailable();
-}
-
-bool V8DOMWindow::HTMLMediaElementEnabled()
-{
- return MediaPlayer::isAvailable();
-}
-
-bool V8DOMWindow::HTMLAudioElementEnabled()
-{
- return MediaPlayer::isAvailable();
-}
-
-bool V8DOMWindow::HTMLVideoElementEnabled()
-{
- return MediaPlayer::isAvailable();
-}
-
-bool V8DOMWindow::MediaErrorEnabled()
-{
- return MediaPlayer::isAvailable();
-}
-
-#endif
-
-#if ENABLE(SHARED_WORKERS)
-bool V8DOMWindow::SharedWorkerEnabled()
-{
- return SharedWorkerRepository::isAvailable();
-}
-#endif
-
-#if ENABLE(WEB_SOCKETS)
-bool V8DOMWindow::WebSocketEnabled()
-{
- return WebSocket::isAvailable();
-}
-#endif
-
-#if ENABLE(DATABASE)
-bool V8DOMWindow::OpenDatabaseEnabled()
-{
- return Database::isAvailable();
-}
-#endif
-
-#if ENABLE(INDEXED_DATABASE)
-bool V8DOMWindow::IndexedDBEnabled()
-{
- return RuntimeEnabledFeatures::indexedDatabaseEnabled();
-}
-#endif
-
-#if ENABLE(DOM_STORAGE)
-bool V8DOMWindow::LocalStorageEnabled()
-{
- return RuntimeEnabledFeatures::localStorageEnabled();
-}
-
-bool V8DOMWindow::SessionStorageEnabled()
-{
- return RuntimeEnabledFeatures::sessionStorageEnabled();
-}
-#endif
-
-#if ENABLE(NOTIFICATIONS)
-bool V8DOMWindow::WebkitNotificationsEnabled()
-{
- return RuntimeEnabledFeatures::notificationsEnabled();
-}
-#endif
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-bool V8DOMWindow::ApplicationCacheEnabled()
-{
- return RuntimeEnabledFeatures::applicationCacheEnabled();
-}
#endif
v8::Handle<v8::Value> V8DOMWindow::ImageAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
@@ -490,7 +409,7 @@ v8::Handle<v8::Value> V8DOMWindow::btoaCallback(const v8::Arguments& args)
v8::Handle<v8::Value> V8DOMWindow::toStringCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.toString()");
- v8::Handle<v8::Object> domWrapper = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, args.This());
+ v8::Handle<v8::Object> domWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), args.This());
if (domWrapper.IsEmpty())
return args.This()->ObjectProtoToString();
return domWrapper->ObjectProtoToString();
@@ -596,7 +515,7 @@ v8::Handle<v8::Value> V8DOMWindow::showModalDialogCallback(const v8::Arguments&
// default here came from frame size of dialog in MacIE.
windowFeatures.height = WindowFeatures::floatFeature(features, "dialogheight", 100, screenRect.height(), 450);
windowFeatures.heightSet = true;
-
+
windowFeatures.x = WindowFeatures::floatFeature(features, "dialogleft", screenRect.x(), screenRect.right() - windowFeatures.width, -1);
windowFeatures.xSet = windowFeatures.x > 0;
windowFeatures.y = WindowFeatures::floatFeature(features, "dialogtop", screenRect.y(), screenRect.bottom() - windowFeatures.height, -1);
@@ -695,11 +614,11 @@ v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args)
if (topOrParent) {
if (!shouldAllowNavigation(frame))
return v8::Undefined();
-
+
String completedUrl;
if (!urlString.isEmpty())
completedUrl = completeURL(urlString);
-
+
if (!completedUrl.isEmpty() &&
(!protocolIsJavaScript(completedUrl) || ScriptController::isSafeScript(frame))) {
bool userGesture = processingUserGesture();
@@ -882,7 +801,7 @@ v8::Handle<v8::Value> V8DOMWindow::clearIntervalCallback(const v8::Arguments& ar
bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
{
ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::DOMWINDOW);
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
+ v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
if (window.IsEmpty())
return false; // the frame is gone.
@@ -908,7 +827,7 @@ bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::V
bool V8DOMWindow::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
{
ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::DOMWINDOW);
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
+ v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
if (window.IsEmpty())
return false;
@@ -944,7 +863,7 @@ v8::Handle<v8::Value> toV8(DOMWindow* window)
// necessarily the first global object associated with that DOMWindow.
v8::Handle<v8::Context> currentContext = v8::Context::GetCurrent();
v8::Handle<v8::Object> currentGlobal = currentContext->Global();
- v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, currentGlobal);
+ v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), currentGlobal);
if (!windowWrapper.IsEmpty()) {
if (V8DOMWindow::toNative(windowWrapper) == window)
return currentGlobal;
diff --git a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp b/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
index 58e5d01..3dad5c0 100644
--- a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp
@@ -33,7 +33,6 @@
#include "Document.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#if ENABLE(DATAGRID)
diff --git a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
index c83e1cc..abd6ff6 100644
--- a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
@@ -35,7 +35,6 @@
#include "Database.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8CustomSQLTransactionCallback.h"
#include "V8CustomSQLTransactionErrorCallback.h"
#include "V8CustomVoidCallback.h"
diff --git a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
index 7bf7e50..0199d67 100644
--- a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
@@ -155,7 +155,13 @@ v8::Handle<v8::Value> toV8(Document* impl, bool forceNewObject)
if (impl->isSVGDocument())
return toV8(static_cast<SVGDocument*>(impl), forceNewObject);
#endif
+<<<<<<< HEAD
v8::Handle<v8::Value> wrapper = V8Document::wrap(impl, forceNewObject);
+=======
+ v8::Handle<v8::Object> wrapper = V8Document::wrap(impl, forceNewObject);
+ if (wrapper.IsEmpty())
+ return wrapper;
+>>>>>>> webkit.org at r54731
if (!V8IsolatedContext::getEntered()) {
if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame()))
proxy->windowShell()->updateDocumentWrapper(wrapper);
diff --git a/WebCore/bindings/v8/custom/V8ElementCustom.cpp b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
index a81e081..86f134e 100644
--- a/WebCore/bindings/v8/custom/V8ElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8ElementCustom.cpp
@@ -43,7 +43,6 @@
#include "V8Attr.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8HTMLElement.h"
#include "V8Proxy.h"
#include "V8SVGElement.h"
@@ -59,11 +58,8 @@ v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args)
String name = toWebCoreString(args[0]);
String value = toWebCoreString(args[1]);
- if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, name, value))
- return v8::Undefined();
-
ExceptionCode ec = 0;
- element->setAttribute(name, value, ec);
+ V8BindingElement::setAttribute(V8BindingState::Only(), element, name, value, ec);
if (ec)
return throwError(ec);
@@ -79,11 +75,8 @@ v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& a
Attr* newAttr = V8Attr::toNative(v8::Handle<v8::Object>::Cast(args[0]));
Element* element = V8Element::toNative(args.Holder());
- if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, newAttr->name(), newAttr->value()))
- return v8::Undefined();
-
ExceptionCode ec = 0;
- RefPtr<Attr> result = element->setAttributeNode(newAttr, ec);
+ RefPtr<Attr> result = V8BindingElement::setAttributeNode(V8BindingState::Only(), element, newAttr, ec);
if (ec)
throwError(ec);
@@ -98,11 +91,8 @@ v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& arg
String qualifiedName = toWebCoreString(args[1]);
String value = toWebCoreString(args[2]);
- if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, qualifiedName, value))
- return v8::Undefined();
-
ExceptionCode ec = 0;
- element->setAttributeNS(namespaceURI, qualifiedName, value, ec);
+ V8BindingElement::setAttributeNS(V8BindingState::Only(), element, namespaceURI, qualifiedName, value, ec);
if (ec)
throwError(ec);
@@ -118,11 +108,8 @@ v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments&
Attr* newAttr = V8Attr::toNative(v8::Handle<v8::Object>::Cast(args[0]));
Element* element = V8Element::toNative(args.Holder());
- if (!V8BindingSecurity::allowSettingSrcToJavascriptURL(V8BindingState::Only(), element, newAttr->name(), newAttr->value()))
- return v8::Undefined();
-
ExceptionCode ec = 0;
- RefPtr<Attr> result = element->setAttributeNodeNS(newAttr, ec);
+ RefPtr<Attr> result = V8BindingElement::setAttributeNodeNS(V8BindingState::Only(), element, newAttr, ec);
if (ec)
throwError(ec);
diff --git a/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp b/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp
index 458c35d..793ffb6 100644
--- a/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8EventSourceConstructor.cpp
@@ -36,7 +36,6 @@
#include "EventSource.h"
#include "Frame.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContext.h"
diff --git a/WebCore/bindings/v8/custom/V8EventSourceCustom.cpp b/WebCore/bindings/v8/custom/V8EventSourceCustom.cpp
index e603549..a7f79db 100644
--- a/WebCore/bindings/v8/custom/V8EventSourceCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8EventSourceCustom.cpp
@@ -31,7 +31,6 @@
#include "EventSource.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
index 6bd9ff2..7173be1 100644
--- a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp
@@ -29,7 +29,6 @@
#include "Geolocation.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8CustomPositionCallback.h"
#include "V8CustomPositionErrorCallback.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
index 88b3a9d..58a85dc 100644
--- a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
@@ -34,7 +34,6 @@
#include "HTMLAllCollection.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8NamedNodesCollection.h"
#include "V8Node.h"
#include "V8NodeList.h"
diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
index 28b0a99..06c6c1d 100644
--- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
@@ -44,25 +44,7 @@
namespace WebCore {
-v8::Persistent<v8::FunctionTemplate> V8HTMLAudioElementConstructor::GetTemplate()
-{
- static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
- if (!cachedTemplate.IsEmpty())
- return cachedTemplate;
-
- v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(USE_CALLBACK(HTMLAudioElementConstructor));
-
- v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8HTMLAudioElement::internalFieldCount);
- result->SetClassName(v8::String::New("HTMLAudioElement"));
- result->Inherit(V8DOMWrapper::getTemplate(V8ClassIndex::HTMLAUDIOELEMENT));
-
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
- return cachedTemplate;
-}
-
-v8::Handle<v8::Value> V8Custom::v8HTMLAudioElementConstructorCallback(const v8::Arguments& args)
+static v8::Handle<v8::Value> v8HTMLAudioElementConstructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLAudioElement.Contructor");
@@ -88,10 +70,28 @@ v8::Handle<v8::Value> V8Custom::v8HTMLAudioElementConstructorCallback(const v8::
audio->scheduleLoad();
}
- V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), audio.get());
+ V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::AUDIO), audio.get());
audio->ref();
V8DOMWrapper::setJSWrapperForDOMNode(audio.get(), v8::Persistent<v8::Object>::New(args.Holder()));
return args.Holder();
}
+v8::Persistent<v8::FunctionTemplate> V8HTMLAudioElementConstructor::GetTemplate()
+{
+ static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
+ if (!cachedTemplate.IsEmpty())
+ return cachedTemplate;
+
+ v8::HandleScope scope;
+ v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLAudioElementConstructorCallback);
+
+ v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
+ instance->SetInternalFieldCount(V8HTMLAudioElement::internalFieldCount);
+ result->SetClassName(v8::String::New("HTMLAudioElement"));
+ result->Inherit(V8HTMLAudioElement::GetTemplate());
+
+ cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
+ return cachedTemplate;
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h
index ac4b46d..711f539 100755
--- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h
+++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h
@@ -36,10 +36,8 @@
namespace WebCore {
class V8HTMLAudioElementConstructor {
-private:
+public:
static v8::Persistent<v8::FunctionTemplate> GetTemplate();
-
- friend class V8ClassIndex;
};
}
diff --git a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
index 29ff6eb..a4a0c57 100644
--- a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
@@ -33,7 +33,6 @@
#include "HTMLCollection.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8HTMLAllCollection.h"
#include "V8NamedNodesCollection.h"
#include "V8Node.h"
diff --git a/WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp
index 0ef4150..d6918cf 100644
--- a/WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLDataGridElementCustom.cpp
@@ -33,7 +33,6 @@
#include "Document.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8DataGridDataSource.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
index 6478e07..86f2eb5 100644
--- a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
@@ -204,6 +204,8 @@ v8::Handle<v8::Value> toV8(HTMLDocument* impl, bool forceNewObject)
if (!impl)
return v8::Null();
v8::Handle<v8::Object> wrapper = V8HTMLDocument::wrap(impl, forceNewObject);
+ if (wrapper.IsEmpty())
+ return wrapper;
if (!V8IsolatedContext::getEntered()) {
if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame()))
proxy->windowShell()->updateDocumentWrapper(wrapper);
diff --git a/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
index fd831bf..d3de1dc 100644
--- a/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
@@ -35,7 +35,6 @@
#include "HTMLNames.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp
index 1949632..5f22400 100644
--- a/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLIFrameElementCustom.cpp
@@ -35,7 +35,6 @@
#include "HTMLNames.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
index 2c28fa5..1873188 100644
--- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
@@ -44,25 +44,7 @@
namespace WebCore {
-v8::Persistent<v8::FunctionTemplate> V8HTMLImageElementConstructor::GetTemplate()
-{
- static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
- if (!cachedTemplate.IsEmpty())
- return cachedTemplate;
-
- v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(USE_CALLBACK(HTMLImageElementConstructor));
-
- v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8HTMLImageElement::internalFieldCount);
- result->SetClassName(v8::String::New("HTMLImageElement"));
- result->Inherit(V8DOMWrapper::getTemplate(V8ClassIndex::HTMLIMAGEELEMENT));
-
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
- return cachedTemplate;
-}
-
-v8::Handle<v8::Value> V8Custom::v8HTMLImageElementConstructorCallback(const v8::Arguments& args)
+static v8::Handle<v8::Value> v8HTMLImageElementConstructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLImageElement.Contructor");
@@ -88,10 +70,28 @@ v8::Handle<v8::Value> V8Custom::v8HTMLImageElementConstructorCallback(const v8::
image->setHeight(toInt32(args[1]));
}
- V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), image.get());
+ V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::IMAGE), image.get());
image->ref();
V8DOMWrapper::setJSWrapperForDOMNode(image.get(), v8::Persistent<v8::Object>::New(args.Holder()));
return args.Holder();
}
+v8::Persistent<v8::FunctionTemplate> V8HTMLImageElementConstructor::GetTemplate()
+{
+ static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
+ if (!cachedTemplate.IsEmpty())
+ return cachedTemplate;
+
+ v8::HandleScope scope;
+ v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLImageElementConstructorCallback);
+
+ v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
+ instance->SetInternalFieldCount(V8HTMLImageElement::internalFieldCount);
+ result->SetClassName(v8::String::New("HTMLImageElement"));
+ result->Inherit(V8HTMLImageElement::GetTemplate());
+
+ cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
+ return cachedTemplate;
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h
index cdce0e0..19ee944 100755
--- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h
+++ b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h
@@ -35,12 +35,10 @@
namespace WebCore {
- class V8HTMLImageElementConstructor {
- private:
- static v8::Persistent<v8::FunctionTemplate> GetTemplate();
-
- friend class V8ClassIndex;
- };
+class V8HTMLImageElementConstructor {
+public:
+ static v8::Persistent<v8::FunctionTemplate> GetTemplate();
+};
}
diff --git a/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
index 78486b3..a9ac74c 100644
--- a/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
@@ -34,7 +34,6 @@
#include "HTMLInputElement.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
index 5325933..3113eb5 100644
--- a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
@@ -44,25 +44,7 @@
namespace WebCore {
-v8::Persistent<v8::FunctionTemplate> V8HTMLOptionElementConstructor::GetTemplate()
-{
- static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
- if (!cachedTemplate.IsEmpty())
- return cachedTemplate;
-
- v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(USE_CALLBACK(HTMLOptionElementConstructor));
-
- v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8HTMLOptionElement::internalFieldCount);
- result->SetClassName(v8::String::New("HTMLOptionElement"));
- result->Inherit(V8DOMWrapper::getTemplate(V8ClassIndex::HTMLOPTIONELEMENT));
-
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
- return cachedTemplate;
-}
-
-v8::Handle<v8::Value> V8Custom::v8HTMLOptionElementConstructorCallback(const v8::Arguments& args)
+static v8::Handle<v8::Value> v8HTMLOptionElementConstructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLOptionElement.Contructor");
@@ -104,10 +86,28 @@ v8::Handle<v8::Value> V8Custom::v8HTMLOptionElementConstructorCallback(const v8:
}
}
- V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::NODE), option.get());
+ V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::OPTION), option.get());
option->ref();
V8DOMWrapper::setJSWrapperForDOMNode(option.get(), v8::Persistent<v8::Object>::New(args.Holder()));
return args.Holder();
}
+v8::Persistent<v8::FunctionTemplate> V8HTMLOptionElementConstructor::GetTemplate()
+{
+ static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
+ if (!cachedTemplate.IsEmpty())
+ return cachedTemplate;
+
+ v8::HandleScope scope;
+ v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLOptionElementConstructorCallback);
+
+ v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
+ instance->SetInternalFieldCount(V8HTMLOptionElement::internalFieldCount);
+ result->SetClassName(v8::String::New("HTMLOptionElement"));
+ result->Inherit(V8HTMLOptionElement::GetTemplate());
+
+ cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
+ return cachedTemplate;
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h
index 70076a5..905a745 100755
--- a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h
+++ b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h
@@ -35,12 +35,10 @@
namespace WebCore {
- class V8HTMLOptionElementConstructor {
- private:
- static v8::Persistent<v8::FunctionTemplate> GetTemplate();
-
- friend class V8ClassIndex;
- };
+class V8HTMLOptionElementConstructor {
+public:
+ static v8::Persistent<v8::FunctionTemplate> GetTemplate();
+};
}
diff --git a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
index 261b5a8..1c114c5 100644
--- a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
@@ -33,7 +33,6 @@
#include "ScriptInstance.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8HTMLAppletElement.h"
#include "V8HTMLEmbedElement.h"
#include "V8HTMLObjectElement.h"
diff --git a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
index 5e9c7c8..6075ec5 100644
--- a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
@@ -36,7 +36,6 @@
#include "SerializedScriptValue.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8DOMWindow.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index ad4ed01..054f9ba 100644
--- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -39,12 +39,14 @@
#include "InspectorController.h"
#include "Node.h"
#include "Page.h"
+#include "SerializedScriptValue.h"
#include "V8Binding.h"
#include "V8Database.h"
#include "V8Node.h"
#include "V8Proxy.h"
#include "V8Storage.h"
+#include <wtf/RefPtr.h>
namespace WebCore {
@@ -58,7 +60,7 @@ static void WeakReferenceCallback(v8::Persistent<v8::Value> object, void* parame
static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(InjectedScriptHost* host)
{
V8ClassIndex::V8WrapperType descriptorType = V8ClassIndex::INJECTEDSCRIPTHOST;
- v8::Local<v8::Function> function = V8DOMWrapper::getTemplate(descriptorType)->GetFunction();
+ v8::Local<v8::Function> function = V8InjectedScriptHost::GetTemplate()->GetFunction();
if (function.IsEmpty()) {
// Return if allocation failed.
return v8::Local<v8::Object>();
@@ -194,6 +196,19 @@ v8::Handle<v8::Value> V8InjectedScriptHost::selectDOMStorageCallback(const v8::A
}
#endif
+v8::Handle<v8::Value> V8InjectedScriptHost::reportDidDispatchOnInjectedScriptCallback(const v8::Arguments& args)
+{
+ INC_STATS("InjectedScriptHost.reportDidDispatchOnInjectedScript()");
+ if (args.Length() < 3)
+ return v8::Undefined();
+ InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
+ int callId = args[0]->ToInt32()->Value();
+ RefPtr<SerializedScriptValue> result(SerializedScriptValue::create(args[1]));
+ bool isException = args[2]->ToBoolean()->Value();
+ host->reportDidDispatchOnInjectedScript(callId, result.get(), isException);
+ return v8::Undefined();
+}
+
InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScriptState)
{
v8::HandleScope handleScope;
diff --git a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp b/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
index df63bf1..b823034 100644
--- a/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
@@ -35,7 +35,6 @@
#include "InspectorFrontendHost.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
index 7c9c529..b5df601 100644
--- a/WebCore/bindings/v8/custom/V8LocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
@@ -41,7 +41,6 @@
#include "ScriptController.h"
#include "V8Binding.h"
#include "V8BindingState.h"
-#include "V8CustomBinding.h"
#include "V8CustomEventListener.h"
#include "V8DOMWindow.h"
#include "V8Location.h"
@@ -212,7 +211,7 @@ v8::Handle<v8::Value> V8Location::reloadAccessorGetter(v8::Local<v8::String> nam
{
INC_STATS("DOM.Location.reload._get");
static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::reloadCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8Location::GetTemplate(), info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
@@ -230,7 +229,7 @@ v8::Handle<v8::Value> V8Location::replaceAccessorGetter(v8::Local<v8::String> na
{
INC_STATS("DOM.Location.replace._get");
static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::replaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8Location::GetTemplate(), info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
@@ -249,7 +248,7 @@ v8::Handle<v8::Value> V8Location::assignAccessorGetter(v8::Local<v8::String> nam
INC_STATS("DOM.Location.assign._get");
static v8::Persistent<v8::FunctionTemplate> privateTemplate =
v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::assignCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
- v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::LOCATION, info.This());
+ v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8Location::GetTemplate(), info.This());
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
diff --git a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp b/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
index 9f2c080..d41a785 100644
--- a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
@@ -72,7 +72,7 @@ v8::Handle<v8::Value> V8MessageEvent::initMessageEventCallback(const v8::Argumen
DOMWindow* sourceArg = 0;
if (args[6]->IsObject()) {
v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(args[6]);
- v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, wrapper);
+ v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), wrapper);
if (!window.IsEmpty())
sourceArg = V8DOMWindow::toNative(window);
}
diff --git a/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp b/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
index cc70bc5..9890668 100644
--- a/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
@@ -34,7 +34,6 @@
#include "MessagePort.h"
#include "SerializedScriptValue.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8MessagePortCustom.h"
#include "V8MessagePort.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp b/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
index 828d1bc..863ce0e 100644
--- a/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp
@@ -1,10 +1,10 @@
/*
* 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:
- *
+ *
* * 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
@@ -14,7 +14,7 @@
* * 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
@@ -43,13 +43,6 @@
namespace WebCore {
-#if ENABLE(GEOLOCATION)
-bool V8Navigator::GeolocationEnabled()
-{
- return RuntimeEnabledFeatures::geolocationEnabled();
-}
-#endif
-
v8::Handle<v8::Value> toV8(Navigator* impl)
{
if (!impl)
diff --git a/WebCore/bindings/v8/custom/V8NodeCustom.cpp b/WebCore/bindings/v8/custom/V8NodeCustom.cpp
index 06489fd..7907283 100644
--- a/WebCore/bindings/v8/custom/V8NodeCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeCustom.cpp
@@ -39,7 +39,6 @@
#include "V8Binding.h"
#include "V8CDATASection.h"
#include "V8Comment.h"
-#include "V8CustomBinding.h"
#include "V8CustomEventListener.h"
#include "V8Document.h"
#include "V8DocumentFragment.h"
diff --git a/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp b/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp
index 032900c..7bb640b 100644
--- a/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeFilterCustom.cpp
@@ -35,7 +35,6 @@
#include "NodeFilter.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
index 5531b48..9c3ab45 100644
--- a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
@@ -43,7 +43,6 @@
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
namespace WebCore {
@@ -91,9 +90,6 @@ v8::Handle<v8::Value> V8NotificationCenter::createHTMLNotificationCallback(const
if (ec)
return throwError(ec);
- if (notificationCenter->context()->isWorkerContext())
- return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get());
-
return toV8(notification.get());
}
@@ -108,9 +104,6 @@ v8::Handle<v8::Value> V8NotificationCenter::createNotificationCallback(const v8:
if (ec)
return throwError(ec);
- if (notificationCenter->context()->isWorkerContext())
- return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get());
-
return toV8(notification.get());
}
diff --git a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp b/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
index ab58d1c..7c24ac8 100644
--- a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
@@ -35,7 +35,6 @@
#include "SQLResultSetRowList.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
index 98fbd9a..b7e7ff2 100644
--- a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
@@ -37,7 +37,6 @@
#include "Database.h"
#include "SQLValue.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8CustomSQLStatementCallback.h"
#include "V8CustomSQLStatementErrorCallback.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp
index 4cefc0e..558c03b 100644
--- a/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp
@@ -41,6 +41,8 @@ v8::Handle<v8::Value> toV8(SVGDocument* impl, bool forceNewObject)
if (!impl)
return v8::Null();
v8::Handle<v8::Object> wrapper = V8SVGDocument::wrap(impl, forceNewObject);
+ if (wrapper.IsEmpty())
+ return wrapper;
if (!V8IsolatedContext::getEntered()) {
if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame()))
proxy->windowShell()->updateDocumentWrapper(wrapper);
diff --git a/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp b/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp
index 23b5b06..56c37bd 100644
--- a/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGElementInstanceCustom.cpp
@@ -37,7 +37,6 @@
#include "SVGElementInstance.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8CustomEventListener.h"
#include "V8SVGPODTypeWrapper.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp b/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
index 129801d..0dae6af 100644
--- a/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp
@@ -35,7 +35,6 @@
#include "SVGLength.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8SVGPODTypeWrapper.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp b/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
index 0a75c9f..f310238 100644
--- a/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp
@@ -31,7 +31,7 @@
#include <config.h>
#if ENABLE(SVG)
-#include "TransformationMatrix.h"
+#include "AffineTransform.h"
#include "SVGException.h"
#include "V8Binding.h"
@@ -50,19 +50,19 @@ v8::Handle<v8::Value> V8SVGMatrix::multiplyCallback(const v8::Arguments& args)
if (!V8SVGMatrix::HasInstance(args[0]))
return throwError("secondMatrix argument was not a SVGMatrix");
- TransformationMatrix m1 = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(args.Holder());
- TransformationMatrix m2 = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(v8::Handle<v8::Object>::Cast(args[0]));
+ AffineTransform m1 = *V8SVGPODTypeWrapper<AffineTransform>::toNative(args.Holder());
+ AffineTransform m2 = *V8SVGPODTypeWrapper<AffineTransform>::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2));
+ RefPtr<V8SVGStaticPODTypeWrapper<AffineTransform> > wrapper = V8SVGStaticPODTypeWrapper<AffineTransform>::create(m1.multLeft(m2));
return toV8(wrapper.get());
}
v8::Handle<v8::Value> V8SVGMatrix::inverseCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.inverse()");
- TransformationMatrix matrix = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(args.Holder());
+ AffineTransform matrix = *V8SVGPODTypeWrapper<AffineTransform>::toNative(args.Holder());
ExceptionCode ec = 0;
- TransformationMatrix result = matrix.inverse();
+ AffineTransform result = matrix.inverse();
if (!matrix.isInvertible())
ec = SVGException::SVG_MATRIX_NOT_INVERTABLE;
@@ -72,18 +72,18 @@ v8::Handle<v8::Value> V8SVGMatrix::inverseCallback(const v8::Arguments& args)
return v8::Handle<v8::Value>();
}
- RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result);
+ RefPtr<V8SVGStaticPODTypeWrapper<AffineTransform> > wrapper = V8SVGStaticPODTypeWrapper<AffineTransform>::create(result);
return toV8(wrapper.get());
}
v8::Handle<v8::Value> V8SVGMatrix::rotateFromVectorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.rotateFromVector()");
- TransformationMatrix matrix = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(args.Holder());
+ AffineTransform matrix = *V8SVGPODTypeWrapper<AffineTransform>::toNative(args.Holder());
ExceptionCode ec = 0;
float x = toFloat(args[0]);
float y = toFloat(args[1]);
- TransformationMatrix result = matrix;
+ AffineTransform result = matrix;
result.rotateFromVector(x, y);
if (x == 0.0 || y == 0.0)
ec = SVGException::SVG_INVALID_VALUE_ERR;
@@ -93,7 +93,7 @@ v8::Handle<v8::Value> V8SVGMatrix::rotateFromVectorCallback(const v8::Arguments&
return v8::Handle<v8::Value>();
}
- RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result);
+ RefPtr<V8SVGStaticPODTypeWrapper<AffineTransform> > wrapper = V8SVGStaticPODTypeWrapper<AffineTransform>::create(result);
return toV8(wrapper.get());
}
diff --git a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp b/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
index 549de94..f69675a 100644
--- a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
@@ -37,7 +37,6 @@
#include "ExceptionCode.h"
#include "Frame.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContext.h"
diff --git a/WebCore/bindings/v8/custom/V8StorageCustom.cpp b/WebCore/bindings/v8/custom/V8StorageCustom.cpp
index ff3ac5e..70d8a09 100755
--- a/WebCore/bindings/v8/custom/V8StorageCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8StorageCustom.cpp
@@ -35,7 +35,6 @@
#include "Storage.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
index bc167c5..5b54563 100644
--- a/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
@@ -36,7 +36,6 @@
#include "V8Binding.h"
#include "V8WebGLArrayBuffer.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h b/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
index 6a702f5..beea8e6 100644
--- a/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
+++ b/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
@@ -36,7 +36,6 @@
#include "V8Binding.h"
#include "V8WebGLArrayBuffer.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
index 95f6879..dd6163a 100644
--- a/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLByteArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
index 5882450..3fb8865 100644
--- a/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLFloatArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
index 7e2f2ed..0141a0b 100644
--- a/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLIntArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
index 4cbccf5..5a2408e 100644
--- a/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLShortArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
index 962e390..5a30ace 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLUnsignedByteArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
index eb0b7cf..cefc60e 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLUnsignedIntArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
index 5f30de3..56e34b8 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
@@ -39,7 +39,6 @@
#include "V8WebGLArrayBuffer.h"
#include "V8WebGLArrayCustom.h"
#include "V8WebGLUnsignedShortArray.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
namespace WebCore {
diff --git a/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp b/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
index 4e0d575..58f810b 100755
--- a/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
@@ -32,7 +32,6 @@
#include "V8WebKitPoint.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8DOMWrapper.h"
#include "V8Index.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
index 9d54f8e..7677e27 100755
--- a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
@@ -35,10 +35,8 @@
#include "DOMTimer.h"
#include "ExceptionCode.h"
-#include "RuntimeEnabledFeatures.h"
#include "ScheduledAction.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "V8WorkerContextEventListener.h"
@@ -48,20 +46,6 @@
namespace WebCore {
-#if ENABLE(NOTIFICATIONS)
-bool V8WorkerContext::WebkitNotificationsEnabled()
-{
- return RuntimeEnabledFeatures::notificationsEnabled();
-}
-#endif
-
-#if ENABLE(WEB_SOCKETS)
-bool V8WorkerContext::WebSocketEnabled()
-{
- return WebSocket::isAvailable();
-}
-#endif
-
v8::Handle<v8::Value> SetTimeoutOrInterval(const v8::Arguments& args, bool singleShot)
{
WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
@@ -174,6 +158,16 @@ v8::Handle<v8::Value> V8WorkerContext::removeEventListenerCallback(const v8::Arg
return v8::Undefined();
}
+v8::Handle<v8::Value> toV8(WorkerContext* impl)
+{
+ if (!impl)
+ return v8::Null();
+
+ v8::Handle<v8::Object> global = impl->script()->proxy()->context()->Global();
+ ASSERT(!global.IsEmpty());
+ return global;
+}
+
} // namespace WebCore
#endif // ENABLE(WORKERS)
diff --git a/WebCore/bindings/v8/custom/V8WorkerCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
index ffca2a4..6b41246 100755
--- a/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
@@ -39,7 +39,6 @@
#include "Frame.h"
#include "SerializedScriptValue.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8MessagePortCustom.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
index e31e05f..f50248b 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
@@ -33,7 +33,6 @@
#include "Frame.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "WorkerContext.h"
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index d7cdcd1..d10c418 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -34,7 +34,6 @@
#include "Frame.h"
#include "V8Binding.h"
#include "V8Blob.h"
-#include "V8CustomBinding.h"
#include "V8Document.h"
#include "V8HTMLDocument.h"
#include "V8Proxy.h"
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp
index 0690189..c6c31bf 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestUploadCustom.cpp
@@ -33,7 +33,6 @@
#include "ExceptionCode.h"
#include "V8Binding.h"
-#include "V8CustomBinding.h"
#include "V8Proxy.h"
#include "V8Utilities.h"
#include "XMLHttpRequest.h"