summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/Plugins/Hosted
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac/Plugins/Hosted')
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm105
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h5
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm25
-rw-r--r--WebKit/mac/Plugins/Hosted/ProxyInstance.mm5
-rw-r--r--WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm16
-rw-r--r--WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs15
6 files changed, 106 insertions, 65 deletions
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
index 0e6c9a3..c5beb07 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
@@ -39,6 +39,7 @@
#import <WebCore/Frame.h>
#import <WebCore/IdentifierRep.h>
#import <WebCore/ScriptController.h>
+#import <string>
extern "C" {
#import "WebKitPluginHost.h"
@@ -568,10 +569,8 @@ kern_return_t WKPCEvaluate(mach_port_t clientPort, uint32_t pluginID, uint32_t r
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
@@ -625,18 +624,14 @@ kern_return_t WKPCInvoke(mach_port_t clientPort, uint32_t pluginID, uint32_t req
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
- if (!IdentifierRep::isValid(identifier)) {
- _WKPHBooleanAndDataReply(hostProxy->port(), instanceProxy->pluginID(), requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!IdentifierRep::isValid(identifier))
+ return KERN_FAILURE;
Identifier methodNameIdentifier = identifierFromIdentifierRep(identifier);
@@ -661,10 +656,8 @@ kern_return_t WKPCInvokeDefault(mach_port_t clientPort, uint32_t pluginID, uint3
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
@@ -707,16 +700,12 @@ kern_return_t WKPCGetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
- if (!IdentifierRep::isValid(identifier)) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!IdentifierRep::isValid(identifier))
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
@@ -737,7 +726,7 @@ kern_return_t WKPCGetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_
return KERN_SUCCESS;
}
-kern_return_t WKPCSetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID, uint64_t serverIdentifier, data_t valueData, mach_msg_type_number_t valueLength, boolean_t* returnValue)
+kern_return_t WKPCSetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t requestID, uint32_t objectID, uint64_t serverIdentifier, data_t valueData, mach_msg_type_number_t valueLength)
{
DataDeallocator deallocator(valueData, valueLength);
@@ -753,18 +742,21 @@ kern_return_t WKPCSetProperty(mach_port_t clientPort, uint32_t pluginID, uint32_
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
if (!IdentifierRep::isValid(identifier))
- *returnValue = false;
-
+ return KERN_FAILURE;
+
+ bool result;
if (identifier->isString()) {
Identifier propertyNameIdentifier = identifierFromIdentifierRep(identifier);
- *returnValue = instanceProxy->setProperty(objectID, propertyNameIdentifier, valueData, valueLength);
+ result = instanceProxy->setProperty(objectID, propertyNameIdentifier, valueData, valueLength);
} else
- *returnValue = instanceProxy->setProperty(objectID, identifier->number(), valueData, valueLength);
-
+ result = instanceProxy->setProperty(objectID, identifier->number(), valueData, valueLength);
+
+ _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), requestID, result);
+
return KERN_SUCCESS;
}
-kern_return_t WKPCRemoveProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t objectID, uint64_t serverIdentifier, boolean_t* returnValue)
+kern_return_t WKPCRemoveProperty(mach_port_t clientPort, uint32_t pluginID, uint32_t requestID, uint32_t objectID, uint64_t serverIdentifier)
{
NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);
if (!hostProxy)
@@ -779,13 +771,16 @@ kern_return_t WKPCRemoveProperty(mach_port_t clientPort, uint32_t pluginID, uint
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
if (!IdentifierRep::isValid(identifier))
return KERN_FAILURE;
-
+
+ bool result;
if (identifier->isString()) {
Identifier propertyNameIdentifier = identifierFromIdentifierRep(identifier);
- *returnValue = instanceProxy->removeProperty(objectID, propertyNameIdentifier);
+ result = instanceProxy->removeProperty(objectID, propertyNameIdentifier);
} else
- *returnValue = instanceProxy->removeProperty(objectID, identifier->number());
-
+ result = instanceProxy->removeProperty(objectID, identifier->number());
+
+ _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), requestID, result);
+
return KERN_SUCCESS;
}
@@ -796,18 +791,14 @@ kern_return_t WKPCHasProperty(mach_port_t clientPort, uint32_t pluginID, uint32_
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanReply(hostProxy->port(), pluginID, requestID, false);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
- if (!IdentifierRep::isValid(identifier)) {
- _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), requestID, false);
- return KERN_SUCCESS;
- }
+ if (!IdentifierRep::isValid(identifier))
+ return KERN_FAILURE;
boolean_t returnValue;
if (identifier->isString()) {
@@ -828,18 +819,14 @@ kern_return_t WKPCHasMethod(mach_port_t clientPort, uint32_t pluginID, uint32_t
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanReply(hostProxy->port(), pluginID, requestID, false);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
PluginDestroyDeferrer deferrer(instanceProxy);
IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>(serverIdentifier);
- if (!IdentifierRep::isValid(identifier)) {
- _WKPHBooleanReply(hostProxy->port(), instanceProxy->pluginID(), requestID, false);
- return KERN_SUCCESS;
- }
+ if (!IdentifierRep::isValid(identifier))
+ return KERN_FAILURE;
Identifier methodNameIdentifier = identifierFromIdentifierRep(identifier);
boolean_t returnValue = instanceProxy->hasMethod(objectID, methodNameIdentifier);
@@ -880,10 +867,8 @@ kern_return_t WKPCEnumerate(mach_port_t clientPort, uint32_t pluginID, uint32_t
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
- if (!instanceProxy) {
- _WKPHBooleanAndDataReply(hostProxy->port(), pluginID, requestID, false, 0, 0);
- return KERN_SUCCESS;
- }
+ if (!instanceProxy)
+ return KERN_FAILURE;
data_t resultData = 0;
mach_msg_type_number_t resultLength = 0;
@@ -1149,4 +1134,14 @@ kern_return_t WKPCRunSyncOpenPanel(mach_port_t clientPort, data_t panelData, mac
}
#endif // !defined(BUILDING_ON_SNOW_LEOPARD)
+kern_return_t WKPCSetException(mach_port_t clientPort, data_t message, mach_msg_type_number_t messageCnt)
+{
+ DataDeallocator deallocator(message, messageCnt);
+
+ string str(message, messageCnt);
+ NetscapePluginInstanceProxy::setGlobalException(str.c_str());
+
+ return KERN_SUCCESS;
+}
+
#endif // USE(PLUGIN_HOST_PROCESS)
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
index 2ef6b02..76981a4 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
@@ -140,7 +140,7 @@ public:
data_t& usernameData, mach_msg_type_number_t& usernameLength, data_t& passwordData, mach_msg_type_number_t& passwordLength);
bool convertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
double& destX, double& destY, NPCoordinateSpace destSpace);
-
+
PassRefPtr<JSC::Bindings::Instance> createBindingsInstance(PassRefPtr<JSC::Bindings::RootObject>);
RetainPtr<NSData *> marshalValues(JSC::ExecState*, const JSC::ArgList& args);
void marshalValue(JSC::ExecState*, JSC::JSValue value, data_t& resultData, mach_msg_type_number_t& resultLength);
@@ -167,6 +167,9 @@ public:
void didDraw();
void privateBrowsingModeDidChange(bool isPrivateBrowsingEnabled);
+ static void setGlobalException(const WebCore::String&);
+ static void moveGlobalExceptionToExecState(JSC::ExecState*);
+
// Reply structs
struct Reply {
enum Type {
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index e4fe1d2..c09e3ea 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -40,6 +40,7 @@
#import "WebUIDelegate.h"
#import "WebUIDelegatePrivate.h"
#import "WebViewInternal.h"
+#import <JavaScriptCore/Error.h>
#import <JavaScriptCore/JSLock.h>
#import <JavaScriptCore/PropertyNameArray.h>
#import <WebCore/CString.h>
@@ -1492,6 +1493,30 @@ void NetscapePluginInstanceProxy::privateBrowsingModeDidChange(bool isPrivateBro
_WKPHPluginInstancePrivateBrowsingModeDidChange(m_pluginHostProxy->port(), m_pluginID, isPrivateBrowsingEnabled);
}
+static String& globalExceptionString()
+{
+ DEFINE_STATIC_LOCAL(String, exceptionString, ());
+ return exceptionString;
+}
+
+void NetscapePluginInstanceProxy::setGlobalException(const String& exception)
+{
+ globalExceptionString() = exception;
+}
+
+void NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(ExecState* exec)
+{
+ if (globalExceptionString().isNull())
+ return;
+
+ {
+ JSLock lock(SilenceAssertionsOnly);
+ throwError(exec, GeneralError, globalExceptionString());
+ }
+
+ globalExceptionString() = UString();
+}
+
} // namespace WebKit
#endif // USE(PLUGIN_HOST_PROCESS)
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
index 1af2ef8..1587ad0 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
+++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
@@ -147,6 +147,7 @@ JSValue ProxyInstance::invoke(JSC::ExecState* exec, InvokeType type, uint64_t id
return jsUndefined();
auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
+ NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
if (!reply.get() || !reply->m_returnValue)
return jsUndefined();
@@ -253,7 +254,7 @@ void ProxyInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArr
return;
auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
-
+ NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
if (!reply.get() || !reply->m_returnValue)
return;
@@ -361,6 +362,7 @@ JSC::JSValue ProxyInstance::fieldValue(ExecState* exec, const Field* field) cons
return jsUndefined();
auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
+ NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
if (!reply.get() || !reply->m_returnValue)
return jsUndefined();
@@ -387,6 +389,7 @@ void ProxyInstance::setFieldValue(ExecState* exec, const Field* field, JSValue v
return;
auto_ptr<NetscapePluginInstanceProxy::BooleanReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanReply>(requestID);
+ NetscapePluginInstanceProxy::moveGlobalExceptionToExecState(exec);
}
void ProxyInstance::invalidate()
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
index 9baa328..42f0877 100644
--- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
@@ -161,12 +161,24 @@ extern "C" {
// Use AppKit to convert view coordinates to NSWindow coordinates.
NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil];
- NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil];
+ NSRect visibleRectInWindow;
+
+ // Core Animation plug-ins need to be updated (with a 0,0,0,0 clipRect) when
+ // moved to a background tab. We don't do this for Core Graphics plug-ins as
+ // older versions of Flash have historical WebKit-specific code that isn't
+ // compatible with this behavior.
+ BOOL shouldClipOutPlugin = _pluginLayer && [self shouldClipOutPlugin];
+ if (!shouldClipOutPlugin)
+ visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil];
+ else
+ visibleRectInWindow = NSZeroRect;
// Flip Y to convert NSWindow coordinates to top-left-based window coordinates.
float borderViewHeight = [[self currentWindow] frame].size.height;
boundsInWindow.origin.y = borderViewHeight - NSMaxY(boundsInWindow);
- visibleRectInWindow.origin.y = borderViewHeight - NSMaxY(visibleRectInWindow);
+
+ if (!shouldClipOutPlugin)
+ visibleRectInWindow.origin.y = borderViewHeight - NSMaxY(visibleRectInWindow);
BOOL sizeChanged = !NSEqualSizes(_previousSize, boundsInWindow.size);
_previousSize = boundsInWindow.size;
diff --git a/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs b/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs
index 0cf4005..58a7996 100644
--- a/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs
+++ b/WebKit/mac/Plugins/Hosted/WebKitPluginClient.defs
@@ -149,18 +149,18 @@ simpleroutine PCGetProperty(clientPort :mach_port_t;
objectID :uint32_t;
propertyNameIdentifier :uint64_t);
-routine PCSetProperty(clientPort :mach_port_t;
+simpleroutine PCSetProperty(clientPort :mach_port_t;
pluginID :uint32_t;
+ requestID :uint32_t;
objectID :uint32_t;
propertyNameIdentifier :uint64_t;
- value :data_t;
- out returnValue :boolean_t);
+ value :data_t);
-routine PCRemoveProperty(clientPort :mach_port_t;
+simpleroutine PCRemoveProperty(clientPort :mach_port_t;
pluginID :uint32_t;
+ requestID :uint32_t;
objectID :uint32_t;
- propertyNameIdentifier :uint64_t;
- out returnValue :boolean_t);
+ propertyNameIdentifier :uint64_t);
simpleroutine PCHasProperty(clientPort :mach_port_t;
pluginID :uint32_t;
@@ -236,3 +236,6 @@ simpleroutine PCRunSyncOpenPanel(clientPort :mach_port_t;
simpleroutine PCSetFullScreenWindowIsShowing(clientPort :mach_port_t;
isShowing :boolean_t);
+
+simpleroutine PCSetException(clientPort :mach_port_t;
+ message :data_t);