summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/js
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-08-04 11:41:34 +0100
committerSteve Block <steveblock@google.com>2010-08-09 12:04:44 +0100
commitdb14019a23d96bc8a444b6576a5da8bd1cfbc8b0 (patch)
tree9f793c5b0f5e1f2aca8247158920e2c4bf962bbf /WebCore/bindings/js
parentbf916837aa84f1e4b00e6ed6268516c2acd27545 (diff)
downloadexternal_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.zip
external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.gz
external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.bz2
Merge WebKit at r64523 : Initial merge by git.
Change-Id: Ibb796c6802e757b1d9b40f58205cfbe4da95fcd4
Diffstat (limited to 'WebCore/bindings/js')
-rw-r--r--WebCore/bindings/js/JSCustomVoidCallback.cpp5
-rw-r--r--WebCore/bindings/js/JSIDBAnyCustom.cpp16
-rw-r--r--WebCore/bindings/js/JSPluginElementFunctions.cpp74
3 files changed, 73 insertions, 22 deletions
diff --git a/WebCore/bindings/js/JSCustomVoidCallback.cpp b/WebCore/bindings/js/JSCustomVoidCallback.cpp
index d5c4ac3..96b5412 100644
--- a/WebCore/bindings/js/JSCustomVoidCallback.cpp
+++ b/WebCore/bindings/js/JSCustomVoidCallback.cpp
@@ -48,7 +48,10 @@ JSCustomVoidCallback::JSCustomVoidCallback(JSObject* callback, JSDOMGlobalObject
JSCustomVoidCallback::~JSCustomVoidCallback()
{
- m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data));
+ if (m_scriptExecutionContext->isContextThread())
+ delete m_data;
+ else
+ m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data));
#ifndef NDEBUG
m_data = 0;
#endif
diff --git a/WebCore/bindings/js/JSIDBAnyCustom.cpp b/WebCore/bindings/js/JSIDBAnyCustom.cpp
index b7c845e..92f725a 100644
--- a/WebCore/bindings/js/JSIDBAnyCustom.cpp
+++ b/WebCore/bindings/js/JSIDBAnyCustom.cpp
@@ -33,15 +33,15 @@
#include "IDBAny.h"
#include "IDBDatabaseRequest.h"
-#include "IDBIndexRequest.h"
+#include "IDBFactory.h"
+#include "IDBIndex.h"
#include "IDBKey.h"
#include "IDBObjectStoreRequest.h"
-#include "IndexedDatabaseRequest.h"
#include "JSIDBDatabaseRequest.h"
-#include "JSIDBIndexRequest.h"
+#include "JSIDBFactory.h"
+#include "JSIDBIndex.h"
#include "JSIDBKey.h"
#include "JSIDBObjectStoreRequest.h"
-#include "JSIndexedDatabaseRequest.h"
#include "SerializedScriptValue.h"
using namespace JSC;
@@ -60,14 +60,14 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, IDBAny* idbAny)
return jsNull();
case IDBAny::IDBDatabaseRequestType:
return toJS(exec, globalObject, idbAny->idbDatabaseRequest());
- case IDBAny::IDBIndexRequestType:
- return toJS(exec, globalObject, idbAny->idbIndexRequest());
+ case IDBAny::IDBIndexType:
+ return toJS(exec, globalObject, idbAny->idbIndex());
case IDBAny::IDBKeyType:
return toJS(exec, globalObject, idbAny->idbKey());
case IDBAny::IDBObjectStoreRequestType:
return toJS(exec, globalObject, idbAny->idbObjectStoreRequest());
- case IDBAny::IndexedDatabaseRequestType:
- return toJS(exec, globalObject, idbAny->indexedDatabaseRequest());
+ case IDBAny::IDBFactoryType:
+ return toJS(exec, globalObject, idbAny->idbFactory());
case IDBAny::SerializedScriptValueType:
return idbAny->serializedScriptValue()->deserialize(exec, globalObject);
}
diff --git a/WebCore/bindings/js/JSPluginElementFunctions.cpp b/WebCore/bindings/js/JSPluginElementFunctions.cpp
index cf43e91..893b967 100644
--- a/WebCore/bindings/js/JSPluginElementFunctions.cpp
+++ b/WebCore/bindings/js/JSPluginElementFunctions.cpp
@@ -35,12 +35,18 @@ using namespace HTMLNames;
// Runtime object support code for JSHTMLAppletElement, JSHTMLEmbedElement and JSHTMLObjectElement.
+static inline bool isPluginElement(Node* node)
+{
+ return node->hasTagName(objectTag) || node->hasTagName(embedTag) || node->hasTagName(appletTag);
+}
+
Instance* pluginInstance(Node* node)
{
if (!node)
return 0;
- if (!(node->hasTagName(objectTag) || node->hasTagName(embedTag) || node->hasTagName(appletTag)))
+ if (!isPluginElement(node))
return 0;
+
HTMLPlugInElement* plugInElement = static_cast<HTMLPlugInElement*>(node);
// The plugin element holds an owning reference, so we don't have to.
Instance* instance = plugInElement->getInstance().get();
@@ -49,22 +55,40 @@ Instance* pluginInstance(Node* node)
return instance;
}
+static JSObject* pluginScriptObjectFromPluginViewBase(HTMLPlugInElement* pluginElement, JSGlobalObject* globalObject)
+{
+ Widget* pluginWidget = pluginElement->pluginWidget();
+ if (!pluginWidget)
+ return 0;
+
+ if (!pluginWidget->isPluginViewBase())
+ return 0;
+
+ PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>(pluginWidget);
+ return pluginViewBase->scriptObject(globalObject);
+}
+
+static JSObject* pluginScriptObjectFromPluginViewBase(JSHTMLElement* jsHTMLElement)
+{
+ HTMLElement* element = jsHTMLElement->impl();
+ if (!isPluginElement(element))
+ return 0;
+
+ HTMLPlugInElement* pluginElement = static_cast<HTMLPlugInElement*>(element);
+ return pluginScriptObjectFromPluginViewBase(pluginElement, jsHTMLElement->globalObject());
+}
+
JSObject* pluginScriptObject(ExecState* exec, JSHTMLElement* jsHTMLElement)
{
HTMLElement* element = jsHTMLElement->impl();
- if (!(element->hasTagName(objectTag) || element->hasTagName(embedTag) || element->hasTagName(appletTag)))
+ if (!isPluginElement(element))
return 0;
HTMLPlugInElement* pluginElement = static_cast<HTMLPlugInElement*>(element);
// First, see if we can ask the plug-in view for its script object.
- if (Widget* pluginWidget = pluginElement->pluginWidget()) {
- if (pluginWidget->isPluginViewBase()) {
- PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>(pluginWidget);
- if (JSObject* scriptObject = pluginViewBase->scriptObject(exec, jsHTMLElement->globalObject()))
- return scriptObject;
- }
- }
+ if (JSObject* scriptObject = pluginScriptObjectFromPluginViewBase(pluginElement, jsHTMLElement->globalObject()))
+ return scriptObject;
// Otherwise, fall back to getting the object from the instance.
@@ -127,15 +151,39 @@ bool runtimeObjectCustomPut(ExecState* exec, const Identifier& propertyName, JSV
static EncodedJSValue JSC_HOST_CALL callPlugin(ExecState* exec)
{
- Instance* instance = pluginInstance(static_cast<JSHTMLElement*>(exec->callee())->impl());
- instance->begin();
- JSValue result = instance->invokeDefaultMethod(exec);
- instance->end();
+ JSHTMLElement* element = static_cast<JSHTMLElement*>(exec->callee());
+
+ // Get the plug-in script object.
+ JSObject* scriptObject = pluginScriptObject(exec, element);
+ ASSERT(scriptObject);
+
+ size_t argumentCount = exec->argumentCount();
+ MarkedArgumentBuffer argumentList;
+ for (size_t i = 0; i < argumentCount; i++)
+ argumentList.append(exec->argument(i));
+
+ CallData callData;
+ CallType callType = getCallData(scriptObject, callData);
+ ASSERT(callType == CallTypeHost);
+
+ // Call the object.
+ JSValue result = call(exec, scriptObject, callType, callData, exec->hostThisValue(), argumentList);
return JSValue::encode(result);
}
CallType runtimeObjectGetCallData(JSHTMLElement* element, CallData& callData)
{
+ // First, ask the plug-in view base for its runtime object.
+ if (JSObject* scriptObject = pluginScriptObjectFromPluginViewBase(element)) {
+ CallData scriptObjectCallData;
+
+ if (scriptObject->getCallData(scriptObjectCallData) == CallTypeNone)
+ return CallTypeNone;
+
+ callData.native.function = callPlugin;
+ return CallTypeHost;
+ }
+
Instance* instance = pluginInstance(element->impl());
if (!instance || !instance->supportsInvokeDefaultMethod())
return CallTypeNone;