Commit 4df7b531 authored by andersca@apple.com's avatar andersca@apple.com

2009-04-28 Anders Carlsson <andersca@apple.com>

        Reviewed by Kevin Decker and Darin Adler.

        Fix <rdar://problem/6836132>.
        
        * Plugins/Hosted/NetscapePluginHostProxy.mm:
        (WKPCCheckIfAllowedToLoadURL):
        Call the instance proxy.
        
        (WKPCCancelCheckIfAllowedToLoadURL):
        Ditto.
        
        * Plugins/Hosted/NetscapePluginInstanceProxy.h:
        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
        (WebKit::NetscapePluginInstanceProxy::NetscapePluginInstanceProxy):
        Initialize the check ID counter.
        
        (WebKit::NetscapePluginInstanceProxy::checkIfAllowedToLoadURL):
        Create a WebPluginContainerCheck, add it to the map, and start it.
        
        (WebKit::NetscapePluginInstanceProxy::cancelCheckIfAllowedToLoadURL):
        Remove the check from the map.
        
        (WebKit::NetscapePluginInstanceProxy::checkIfAllowedToLoadURLResult):
        Call the WKPH MIG callback.
        
        * Plugins/Hosted/WebHostedNetscapePluginView.h:
        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
        (-[WebHostedNetscapePluginView _webPluginContainerCancelCheckIfAllowedToLoadRequest:]):
        Call the instance proxy.
        
        (-[WebHostedNetscapePluginView _containerCheckResult:contextInfo:]):
        Ditto.
        
        * Plugins/Hosted/WebKitPluginClient.defs:
        * Plugins/Hosted/WebKitPluginHost.defs:
        Add MIG declarations.



git-svn-id: svn://svn.chromium.org/blink/trunk@42965 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ae4051fd
2009-04-28 Anders Carlsson <andersca@apple.com>
Reviewed by Kevin Decker and Darin Adler.
Fix <rdar://problem/6836132>.
* Plugins/Hosted/NetscapePluginHostProxy.mm:
(WKPCCheckIfAllowedToLoadURL):
Call the instance proxy.
(WKPCCancelCheckIfAllowedToLoadURL):
Ditto.
* Plugins/Hosted/NetscapePluginInstanceProxy.h:
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::NetscapePluginInstanceProxy):
Initialize the check ID counter.
(WebKit::NetscapePluginInstanceProxy::checkIfAllowedToLoadURL):
Create a WebPluginContainerCheck, add it to the map, and start it.
(WebKit::NetscapePluginInstanceProxy::cancelCheckIfAllowedToLoadURL):
Remove the check from the map.
(WebKit::NetscapePluginInstanceProxy::checkIfAllowedToLoadURLResult):
Call the WKPH MIG callback.
* Plugins/Hosted/WebHostedNetscapePluginView.h:
* Plugins/Hosted/WebHostedNetscapePluginView.mm:
(-[WebHostedNetscapePluginView _webPluginContainerCancelCheckIfAllowedToLoadRequest:]):
Call the instance proxy.
(-[WebHostedNetscapePluginView _containerCheckResult:contextInfo:]):
Ditto.
* Plugins/Hosted/WebKitPluginClient.defs:
* Plugins/Hosted/WebKitPluginHost.defs:
Add MIG declarations.
2009-04-28 Dan Bernstein <mitz@apple.com> 2009-04-28 Dan Bernstein <mitz@apple.com>
Reviewed by John Sullivan. Reviewed by John Sullivan.
......
...@@ -956,5 +956,36 @@ kern_return_t WKPCConvertPoint(mach_port_t clientPort, uint32_t pluginID, ...@@ -956,5 +956,36 @@ kern_return_t WKPCConvertPoint(mach_port_t clientPort, uint32_t pluginID,
return KERN_SUCCESS; return KERN_SUCCESS;
} }
kern_return_t WKPCCheckIfAllowedToLoadURL(mach_port_t clientPort, uint32_t pluginID, data_t urlData, mach_msg_type_number_t urlLength,
data_t targetData, mach_msg_type_number_t targetLength, uint32_t *checkID)
{
DataDeallocator urlDeallocator(urlData, urlLength);
DataDeallocator targetDeallocator(targetData, targetLength);
NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);
if (!hostProxy)
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
if (!instanceProxy)
return KERN_FAILURE;
*checkID = instanceProxy->checkIfAllowedToLoadURL(urlData, targetData);
return KERN_SUCCESS;
}
kern_return_t WKPCCancelCheckIfAllowedToLoadURL(mach_port_t clientPort, uint32_t pluginID, uint32_t checkID)
{
NetscapePluginHostProxy* hostProxy = pluginProxyMap().get(clientPort);
if (!hostProxy)
return KERN_FAILURE;
NetscapePluginInstanceProxy* instanceProxy = hostProxy->pluginInstance(pluginID);
if (!instanceProxy)
return KERN_FAILURE;
instanceProxy->cancelCheckIfAllowedToLoadURL(checkID);
return KERN_SUCCESS;
}
#endif // USE(PLUGIN_HOST_PROCESS) #endif // USE(PLUGIN_HOST_PROCESS)
...@@ -155,6 +155,11 @@ public: ...@@ -155,6 +155,11 @@ public:
uint32_t nextRequestID(); uint32_t nextRequestID();
uint32_t checkIfAllowedToLoadURL(const char* url, const char* target);
void cancelCheckIfAllowedToLoadURL(uint32_t checkID);
void checkIfAllowedToLoadURLResult(uint32_t checkID, bool allowed);
// Reply structs // Reply structs
struct Reply { struct Reply {
enum Type { enum Type {
...@@ -293,6 +298,10 @@ private: ...@@ -293,6 +298,10 @@ private:
typedef HashSet<ProxyInstance*> ProxyInstanceSet; typedef HashSet<ProxyInstance*> ProxyInstanceSet;
ProxyInstanceSet m_instances; ProxyInstanceSet m_instances;
uint32_t m_urlCheckCounter;
typedef HashMap<uint32_t, RetainPtr<id> > URLCheckMap;
URLCheckMap m_urlChecks;
unsigned m_pluginFunctionCallDepth; unsigned m_pluginFunctionCallDepth;
bool m_shouldStopSoon; bool m_shouldStopSoon;
......
...@@ -103,6 +103,7 @@ NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy ...@@ -103,6 +103,7 @@ NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy
, m_useSoftwareRenderer(false) , m_useSoftwareRenderer(false)
, m_waitingForReply(false) , m_waitingForReply(false)
, m_objectIDCounter(0) , m_objectIDCounter(0)
, m_urlCheckCounter(0)
, m_pluginFunctionCallDepth(0) , m_pluginFunctionCallDepth(0)
, m_shouldStopSoon(false) , m_shouldStopSoon(false)
, m_currentRequestID(0) , m_currentRequestID(0)
...@@ -1359,6 +1360,48 @@ bool NetscapePluginInstanceProxy::convertPoint(double sourceX, double sourceY, N ...@@ -1359,6 +1360,48 @@ bool NetscapePluginInstanceProxy::convertPoint(double sourceX, double sourceY, N
return [m_pluginView convertFromX:sourceX andY:sourceY space:sourceSpace toX:&destX andY:&destY space:destSpace]; return [m_pluginView convertFromX:sourceX andY:sourceY space:sourceSpace toX:&destX andY:&destY space:destSpace];
} }
uint32_t NetscapePluginInstanceProxy::checkIfAllowedToLoadURL(const char* url, const char* target)
{
uint32_t checkID;
// Assign a check ID
do {
checkID = ++m_urlCheckCounter;
} while (m_urlChecks.contains(checkID) || !m_urlCheckCounter);
NSString *frameName = target ? [NSString stringWithCString:target encoding:NSISOLatin1StringEncoding] : nil;
NSNumber *contextInfo = [[NSNumber alloc] initWithUnsignedInt:checkID];
WebPluginContainerCheck *check = [WebPluginContainerCheck checkWithRequest:[m_pluginView requestWithURLCString:url]
target:frameName
resultObject:m_pluginView
selector:@selector(_containerCheckResult:contextInfo:)
controller:m_pluginView
contextInfo:contextInfo];
[contextInfo release];
m_urlChecks.set(checkID, check);
[check start];
return checkID;
}
void NetscapePluginInstanceProxy::cancelCheckIfAllowedToLoadURL(uint32_t checkID)
{
URLCheckMap::iterator it = m_urlChecks.find(checkID);
if (it == m_urlChecks.end())
return;
WebPluginContainerCheck *check = it->second.get();
[check cancel];
m_urlChecks.remove(it);
}
void NetscapePluginInstanceProxy::checkIfAllowedToLoadURLResult(uint32_t checkID, bool allowed)
{
_WKPHCheckIfAllowedToLoadURLResult(m_pluginHostProxy->port(), m_pluginID, checkID, allowed);
}
} // namespace WebKit } // namespace WebKit
#endif // USE(PLUGIN_HOST_PROCESS) #endif // USE(PLUGIN_HOST_PROCESS)
...@@ -35,7 +35,7 @@ namespace WebKit { ...@@ -35,7 +35,7 @@ namespace WebKit {
class NetscapePluginInstanceProxy; class NetscapePluginInstanceProxy;
} }
@interface WebHostedNetscapePluginView : WebBaseNetscapePluginView<WebPluginManualLoader> @interface WebHostedNetscapePluginView : WebBaseNetscapePluginView<WebPluginManualLoader, WebPluginContainerCheckController>
{ {
RetainPtr<NSArray> _attributeKeys; RetainPtr<NSArray> _attributeKeys;
RetainPtr<NSArray> _attributeValues; RetainPtr<NSArray> _attributeValues;
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#import <CoreFoundation/CoreFoundation.h> #import <CoreFoundation/CoreFoundation.h>
#import <WebCore/Frame.h> #import <WebCore/Frame.h>
#import <WebCore/FrameLoaderTypes.h>
#import <WebCore/HTMLPlugInElement.h> #import <WebCore/HTMLPlugInElement.h>
#import <WebCore/runtime.h> #import <WebCore/runtime.h>
#import <WebCore/runtime_root.h> #import <WebCore/runtime_root.h>
...@@ -45,6 +46,7 @@ ...@@ -45,6 +46,7 @@
#import <runtime/InitializeThreading.h> #import <runtime/InitializeThreading.h>
#import <wtf/Assertions.h> #import <wtf/Assertions.h>
using namespace WebCore;
using namespace WebKit; using namespace WebKit;
extern "C" { extern "C" {
...@@ -405,6 +407,30 @@ extern "C" { ...@@ -405,6 +407,30 @@ extern "C" {
manualStream->didFinishLoading(0); manualStream->didFinishLoading(0);
} }
- (void)_webPluginContainerCancelCheckIfAllowedToLoadRequest:(id)webPluginContainerCheck
{
ASSERT([webPluginContainerCheck isKindOfClass:[WebPluginContainerCheck class]]);
id contextInfo = [webPluginContainerCheck contextInfo];
ASSERT(contextInfo && [contextInfo isKindOfClass:[NSNumber class]]);
if (!_proxy)
return;
uint32_t checkID = [(NSNumber *)contextInfo unsignedIntValue];
_proxy->cancelCheckIfAllowedToLoadURL(checkID);
}
- (void)_containerCheckResult:(PolicyAction)policy contextInfo:(id)contextInfo
{
ASSERT([contextInfo isKindOfClass:[NSNumber class]]);
if (!_proxy)
return;
uint32_t checkID = [(NSNumber *)contextInfo unsignedIntValue];
_proxy->checkIfAllowedToLoadURLResult(checkID, (policy == PolicyUse));
}
@end @end
#endif #endif
...@@ -190,6 +190,16 @@ simpleroutine PCSetMenuBarVisible(clientPort :mach_port_t; ...@@ -190,6 +190,16 @@ simpleroutine PCSetMenuBarVisible(clientPort :mach_port_t;
simpleroutine PCSetModal(clientPort :mach_port_t; simpleroutine PCSetModal(clientPort :mach_port_t;
modal :boolean_t); modal :boolean_t);
routine PCCheckIfAllowedToLoadURL(clientPort :mach_port_t;
pluginID :uint32_t;
url :data_t;
target :data_t;
out checkID :uint32_t);
simpleroutine PCCancelCheckIfAllowedToLoadURL(clientPort :mach_port_t;
pluginID :uint32_t;
checkID :uint32_t);
// Replies // Replies
simpleroutine PCInstantiatePluginReply(clientPort :mach_port_t; simpleroutine PCInstantiatePluginReply(clientPort :mach_port_t;
pluginID :uint32_t; pluginID :uint32_t;
......
...@@ -129,6 +129,10 @@ simpleroutine PHDestroyPluginInstance(pluginHostPort :mach_port_t; ...@@ -129,6 +129,10 @@ simpleroutine PHDestroyPluginInstance(pluginHostPort :mach_port_t;
pluginID :uint32_t; pluginID :uint32_t;
requestID :uint32_t); requestID :uint32_t);
simpleroutine PHCheckIfAllowedToLoadURLResult(clientPort :mach_port_t;
pluginID :uint32_t;
checkID :uint32_t;
result :boolean_t);
// Streams // Streams
simpleroutine PHStartStream(pluginHostPort :mach_port_t; simpleroutine PHStartStream(pluginHostPort :mach_port_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment