summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac/Plugins')
-rw-r--r--WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h8
-rw-r--r--WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm39
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h3
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm60
-rw-r--r--WebKit/mac/Plugins/Hosted/ProxyInstance.mm26
-rw-r--r--WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm5
-rw-r--r--WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs6
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm10
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.h6
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.mm48
-rw-r--r--WebKit/mac/Plugins/WebNetscapePluginView.mm8
-rw-r--r--WebKit/mac/Plugins/WebPluginContainerCheck.mm3
12 files changed, 173 insertions, 49 deletions
diff --git a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h
index 72e845b..946c8ac 100644
--- a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h
+++ b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.h
@@ -43,7 +43,7 @@ namespace WebCore {
namespace WebKit {
class NetscapePluginInstanceProxy;
-
+
class HostedNetscapePluginStream : public RefCounted<HostedNetscapePluginStream>
, private WebCore::NetscapePlugInStreamLoaderClient {
public:
@@ -55,9 +55,11 @@ public:
{
return adoptRef(new HostedNetscapePluginStream(instance, frameLoader));
}
-
+
+ ~HostedNetscapePluginStream();
+
uint32_t streamID() const { return m_streamID; }
-
+
void startStreamWithResponse(NSURLResponse *response);
void didReceiveData(WebCore::NetscapePlugInStreamLoader*, const char* bytes, int length);
void didFinishLoading(WebCore::NetscapePlugInStreamLoader*);
diff --git a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm
index 63e18a0..5c25ef7 100644
--- a/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm
+++ b/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm
@@ -39,12 +39,18 @@
#import <WebCore/DocumentLoader.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
+#import <WebCore/SecurityOrigin.h>
#import <WebCore/WebCoreURLResponse.h>
+#import <wtf/RefCountedLeakCounter.h>
using namespace WebCore;
namespace WebKit {
+#ifndef NDEBUG
+static WTF::RefCountedLeakCounter hostedNetscapePluginStreamCounter("HostedNetscapePluginStream");
+#endif
+
HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstanceProxy* instance, uint32_t streamID, NSURLRequest *request)
: m_instance(instance)
, m_streamID(streamID)
@@ -53,8 +59,12 @@ HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstancePro
, m_requestURL([request URL])
, m_frameLoader(0)
{
- if (core([instance->pluginView() webFrame])->loader()->shouldHideReferrer([request URL], core([instance->pluginView() webFrame])->loader()->outgoingReferrer()))
+ if (SecurityOrigin::shouldHideReferrer([request URL], core([instance->pluginView() webFrame])->loader()->outgoingReferrer()))
[m_request.get() _web_setHTTPReferrer:nil];
+
+#ifndef NDEBUG
+ hostedNetscapePluginStreamCounter.increment();
+#endif
}
HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstanceProxy* instance, WebCore::FrameLoader* frameLoader)
@@ -63,6 +73,16 @@ HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstancePro
, m_isTerminated(false)
, m_frameLoader(frameLoader)
{
+#ifndef NDEBUG
+ hostedNetscapePluginStreamCounter.increment();
+#endif
+}
+
+HostedNetscapePluginStream::~HostedNetscapePluginStream()
+{
+#ifndef NDEBUG
+ hostedNetscapePluginStreamCounter.decrement();
+#endif
}
void HostedNetscapePluginStream::startStreamWithResponse(NSURLResponse *response)
@@ -178,8 +198,9 @@ void HostedNetscapePluginStream::didFail(WebCore::NetscapePlugInStreamLoader*, c
{
if (NetscapePluginHostProxy* hostProxy = m_instance->hostProxy())
_WKPHStreamDidFail(hostProxy->port(), m_instance->pluginID(), m_streamID, reasonForError(error));
+ m_instance->disconnectStream(this);
}
-
+
bool HostedNetscapePluginStream::wantsAllStreams() const
{
// FIXME: Implement.
@@ -218,17 +239,17 @@ void HostedNetscapePluginStream::cancelLoad(NSError *error)
ASSERT(!m_loader);
DocumentLoader* documentLoader = m_frameLoader->activeDocumentLoader();
- ASSERT(documentLoader);
-
- if (documentLoader->isLoadingMainResource())
+ if (documentLoader && documentLoader->isLoadingMainResource())
documentLoader->cancelMainResourceLoad(error);
return;
}
-
- if (!m_loader->isDone())
+
+ if (!m_loader->isDone()) {
+ // Cancelling the load will disconnect the stream so there's no need to do it explicitly.
m_loader->cancel(error);
- m_instance->disconnectStream(this);
-}
+ } else
+ m_instance->disconnectStream(this);
+}
NSError *HostedNetscapePluginStream::pluginCancelledConnectionError() const
{
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
index 1841afd..280f161 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
@@ -162,6 +162,8 @@ public:
void resolveURL(const char* url, const char* target, data_t& resolvedURLData, mach_msg_type_number_t& resolvedURLLength);
+ void didDraw();
+
// Reply structs
struct Reply {
enum Type {
@@ -307,6 +309,7 @@ private:
bool m_shouldStopSoon;
uint32_t m_currentRequestID;
bool m_inDestroy;
+ bool m_pluginIsWaitingForDraw;
RefPtr<HostedNetscapePluginStream> m_manualStream;
};
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index c01ae92..21f35e2 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -33,30 +33,32 @@
#import "WebDataSourceInternal.h"
#import "WebFrameInternal.h"
#import "WebHostedNetscapePluginView.h"
+#import "WebKitNSStringExtras.h"
#import "WebNSDataExtras.h"
#import "WebNSURLExtras.h"
-#import "WebKitNSStringExtras.h"
#import "WebPluginRequest.h"
-#import "WebViewInternal.h"
#import "WebUIDelegate.h"
#import "WebUIDelegatePrivate.h"
-
-#import <mach/mach.h>
-#import <WebCore/CookieJar.h>
+#import "WebViewInternal.h"
+#import <JavaScriptCore/JSLock.h>
+#import <JavaScriptCore/PropertyNameArray.h>
#import <WebCore/CString.h>
+#import <WebCore/CookieJar.h>
#import <WebCore/DocumentLoader.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
#import <WebCore/FrameTree.h>
#import <WebCore/KURL.h>
-#import <WebCore/npruntime_impl.h>
-#import <WebCore/runtime_object.h>
+#import <WebCore/SecurityOrigin.h>
#import <WebCore/ScriptController.h>
#import <WebCore/ScriptValue.h>
+#import <WebCore/StringSourceProvider.h>
+#import <WebCore/npruntime_impl.h>
+#import <WebCore/runtime_object.h>
#import <WebKitSystemInterface.h>
-#import <runtime/JSLock.h>
-#import <runtime/PropertyNameArray.h>
+#import <mach/mach.h>
#import <utility>
+#import <wtf/RefCountedLeakCounter.h>
extern "C" {
#import "WebKitPluginClientServer.h"
@@ -94,6 +96,10 @@ private:
static uint32_t pluginIDCounter;
+#ifndef NDEBUG
+static WTF::RefCountedLeakCounter netscapePluginInstanceProxyCounter("NetscapePluginInstanceProxy");
+#endif
+
NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy* pluginHostProxy, WebHostedNetscapePluginView *pluginView, bool fullFramePlugin)
: m_pluginHostProxy(pluginHostProxy)
, m_pluginView(pluginView)
@@ -108,6 +114,7 @@ NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy
, m_shouldStopSoon(false)
, m_currentRequestID(0)
, m_inDestroy(false)
+ , m_pluginIsWaitingForDraw(false)
{
ASSERT(m_pluginView);
@@ -123,6 +130,10 @@ NetscapePluginInstanceProxy::NetscapePluginInstanceProxy(NetscapePluginHostProxy
} while (pluginHostProxy->pluginInstance(m_pluginID) || !m_pluginID);
pluginHostProxy->addPluginInstance(this);
+
+#ifndef NDEBUG
+ netscapePluginInstanceProxyCounter.increment();
+#endif
}
NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy()
@@ -131,6 +142,10 @@ NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy()
m_pluginID = 0;
deleteAllValues(m_replies);
+
+#ifndef NDEBUG
+ netscapePluginInstanceProxyCounter.decrement();
+#endif
}
void NetscapePluginInstanceProxy::resize(NSRect size, NSRect clipRect, bool sync)
@@ -178,6 +193,7 @@ void NetscapePluginInstanceProxy::cleanup()
(*it)->invalidate();
m_pluginView = nil;
+ m_manualStream = 0;
}
void NetscapePluginInstanceProxy::invalidate()
@@ -583,7 +599,7 @@ NPError NetscapePluginInstanceProxy::loadRequest(NSURLRequest *request, const ch
return NPERR_GENERIC_ERROR;
}
} else {
- if (!FrameLoader::canLoad(URL, String(), core([m_pluginView webFrame])->document()))
+ if (!SecurityOrigin::canLoad(URL, String(), core([m_pluginView webFrame])->document()))
return NPERR_GENERIC_ERROR;
}
@@ -1032,22 +1048,22 @@ bool NetscapePluginInstanceProxy::enumerate(uint32_t objectID, data_t& resultDat
PropertyNameArray propertyNames(exec);
object->getPropertyNames(exec, propertyNames);
-
- NSMutableArray *array = [[NSMutableArray alloc] init];
+
+ RetainPtr<NSMutableArray*> array(AdoptNS, [[NSMutableArray alloc] init]);
for (unsigned i = 0; i < propertyNames.size(); i++) {
uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(propertyNames[i].ustring().UTF8String().c_str()));
- [array addObject:[NSNumber numberWithLongLong:methodName]];
+ [array.get() addObject:[NSNumber numberWithLongLong:methodName]];
}
- NSData *data = [NSPropertyListSerialization dataFromPropertyList:array format:NSPropertyListBinaryFormat_v1_0 errorDescription:0];
+ NSData *data = [NSPropertyListSerialization dataFromPropertyList:array.get() format:NSPropertyListBinaryFormat_v1_0 errorDescription:0];
ASSERT(data);
-
+
resultLength = [data length];
mig_allocate(reinterpret_cast<vm_address_t*>(&resultData), resultLength);
-
+
memcpy(resultData, [data bytes], resultLength);
-
+
exec->clearException();
return true;
@@ -1271,9 +1287,19 @@ void NetscapePluginInstanceProxy::invalidateRect(double x, double y, double widt
{
ASSERT(m_pluginView);
+ m_pluginIsWaitingForDraw = true;
[m_pluginView invalidatePluginContentRect:NSMakeRect(x, y, width, height)];
}
+void NetscapePluginInstanceProxy::didDraw()
+{
+ if (!m_pluginIsWaitingForDraw)
+ return;
+
+ m_pluginIsWaitingForDraw = false;
+ _WKPHPluginInstanceDidDraw(m_pluginHostProxy->port(), m_pluginID);
+}
+
bool NetscapePluginInstanceProxy::getCookies(data_t urlData, mach_msg_type_number_t urlLength, data_t& cookiesData, mach_msg_type_number_t& cookiesLength)
{
ASSERT(m_pluginView);
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
index 75bc639..0b3a32f 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
+++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
@@ -136,6 +136,9 @@ JSC::Bindings::Class *ProxyInstance::getClass() const
JSValue ProxyInstance::invoke(JSC::ExecState* exec, InvokeType type, uint64_t identifier, const JSC::ArgList& args)
{
+ if (!m_instanceProxy)
+ return jsUndefined();
+
RetainPtr<NSData*> arguments(m_instanceProxy->marshalValues(exec, args));
uint32_t requestID = m_instanceProxy->nextRequestID();
@@ -162,6 +165,9 @@ JSValue ProxyInstance::invokeMethod(ExecState* exec, const MethodList& methodLis
bool ProxyInstance::supportsInvokeDefaultMethod() const
{
+ if (!m_instanceProxy)
+ return false;
+
uint32_t requestID = m_instanceProxy->nextRequestID();
if (_WKPHNPObjectHasInvokeDefaultMethod(m_instanceProxy->hostProxy()->port(),
@@ -183,6 +189,9 @@ JSValue ProxyInstance::invokeDefaultMethod(ExecState* exec, const ArgList& args)
bool ProxyInstance::supportsConstruct() const
{
+ if (!m_instanceProxy)
+ return false;
+
uint32_t requestID = m_instanceProxy->nextRequestID();
if (_WKPHNPObjectHasConstructMethod(m_instanceProxy->hostProxy()->port(),
@@ -236,6 +245,9 @@ JSValue ProxyInstance::valueOf(ExecState* exec) const
void ProxyInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray)
{
+ if (!m_instanceProxy)
+ return;
+
uint32_t requestID = m_instanceProxy->nextRequestID();
if (_WKPHNPObjectEnumerate(m_instanceProxy->hostProxy()->port(), m_instanceProxy->pluginID(), requestID, m_objectID) != KERN_SUCCESS)
@@ -266,6 +278,9 @@ void ProxyInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArr
MethodList ProxyInstance::methodsNamed(const Identifier& identifier)
{
+ if (!m_instanceProxy)
+ return MethodList();
+
// If we already have an entry in the map, use it.
MethodMap::iterator existingMapEntry = m_methods.find(identifier.ustring().rep());
if (existingMapEntry != m_methods.end()) {
@@ -303,6 +318,9 @@ MethodList ProxyInstance::methodsNamed(const Identifier& identifier)
Field* ProxyInstance::fieldNamed(const Identifier& identifier)
{
+ if (!m_instanceProxy)
+ return 0;
+
// If we already have an entry in the map, use it.
FieldMap::iterator existingMapEntry = m_fields.find(identifier.ustring().rep());
if (existingMapEntry != m_fields.end())
@@ -332,6 +350,9 @@ Field* ProxyInstance::fieldNamed(const Identifier& identifier)
JSC::JSValue ProxyInstance::fieldValue(ExecState* exec, const Field* field) const
{
+ if (!m_instanceProxy)
+ return jsUndefined();
+
uint64_t serverIdentifier = static_cast<const ProxyField*>(field)->serverIdentifier();
uint32_t requestID = m_instanceProxy->nextRequestID();
@@ -349,6 +370,9 @@ JSC::JSValue ProxyInstance::fieldValue(ExecState* exec, const Field* field) cons
void ProxyInstance::setFieldValue(ExecState* exec, const Field* field, JSValue value) const
{
+ if (m_instanceProxy)
+ return;
+
uint64_t serverIdentifier = static_cast<const ProxyField*>(field)->serverIdentifier();
uint32_t requestID = m_instanceProxy->nextRequestID();
@@ -368,6 +392,8 @@ void ProxyInstance::setFieldValue(ExecState* exec, const Field* field, JSValue v
void ProxyInstance::invalidate()
{
+ ASSERT(m_instanceProxy);
+
if (NetscapePluginHostProxy* hostProxy = m_instanceProxy->hostProxy())
_WKPHNPObjectRelease(hostProxy->port(),
m_instanceProxy->pluginID(), m_objectID);
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
index 0cce014..34a2211 100644
--- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
@@ -330,9 +330,10 @@ extern "C" {
{
if (_proxy) {
if (_softwareRenderer) {
- if ([NSGraphicsContext currentContextDrawingToScreen])
+ if ([NSGraphicsContext currentContextDrawingToScreen]) {
WKSoftwareCARendererRender(_softwareRenderer, (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort], NSRectToCGRect(rect));
- else
+ _proxy->didDraw();
+ } else
_proxy->print(reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), [self bounds].size.width, [self bounds].size.height);
}
diff --git a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
index 41d7498..04edf64 100644
--- a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
+++ b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
@@ -220,7 +220,7 @@ simpleroutine PHNPObjectEnumerate(pluginHostPort :mach_port_t;
pluginID :uint32_t;
requestID :uint32_t;
objectID :uint32_t);
-
+
// Replies
simpleroutine PHBooleanReply(clientPort :mach_port_t;
@@ -233,3 +233,7 @@ simpleroutine PHBooleanAndDataReply(pluginHostPort :mach_port_t;
requestID :uint32_t;
returnValue :boolean_t;
result :data_t);
+
+simpleroutine PHPluginInstanceDidDraw(pluginHostPort :mach_port_t;
+ pluginID :uint32_t);
+
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm
index a5a8a2d..232a6c4 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm
@@ -42,6 +42,7 @@
#import <WebCore/DocumentLoader.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
+#import <WebCore/SecurityOrigin.h>
#import <WebCore/WebCoreObjCExtras.h>
#import <WebCore/WebCoreURLResponse.h>
#import <WebKitSystemInterface.h>
@@ -49,6 +50,7 @@
#import <wtf/StdLibExtras.h>
using namespace WebCore;
+using namespace std;
#define WEB_REASON_NONE -1
@@ -159,7 +161,7 @@ WebNetscapePluginStream::WebNetscapePluginStream(NSURLRequest *request, NPP plug
WebNetscapePluginView *view = (WebNetscapePluginView *)plugin->ndata;
// This check has already been done by the plug-in view.
- ASSERT(FrameLoader::canLoad([request URL], String(), core([view webFrame])->document()));
+ ASSERT(SecurityOrigin::canLoad([request URL], String(), core([view webFrame])->document()));
ASSERT([request URL]);
ASSERT(plugin);
@@ -168,7 +170,7 @@ WebNetscapePluginStream::WebNetscapePluginStream(NSURLRequest *request, NPP plug
streams().add(&m_stream, plugin);
- if (core([view webFrame])->loader()->shouldHideReferrer([request URL], core([view webFrame])->loader()->outgoingReferrer()))
+ if (SecurityOrigin::shouldHideReferrer([request URL], core([view webFrame])->loader()->outgoingReferrer()))
[m_request.get() _web_setHTTPReferrer:nil];
}
@@ -522,7 +524,7 @@ void WebNetscapePluginStream::deliverData()
m_deliverDataTimer.startOneShot(0);
break;
} else {
- deliveryBytes = MIN(deliveryBytes, totalBytes - totalBytesDelivered);
+ deliveryBytes = min(deliveryBytes, totalBytes - totalBytesDelivered);
NSData *subdata = [m_deliveryData.get() subdataWithRange:NSMakeRange(totalBytesDelivered, deliveryBytes)];
PluginStopDeferrer deferrer(m_pluginView.get());
deliveryBytes = m_pluginFuncs->write(m_plugin, &m_stream, m_offset, [subdata length], (void *)[subdata bytes]);
@@ -531,7 +533,7 @@ void WebNetscapePluginStream::deliverData()
cancelLoadAndDestroyStreamWithError(pluginCancelledConnectionError());
return;
}
- deliveryBytes = MIN((unsigned)deliveryBytes, [subdata length]);
+ deliveryBytes = min<int32>(deliveryBytes, [subdata length]);
m_offset += deliveryBytes;
totalBytesDelivered += deliveryBytes;
LOG(Plugins, "NPP_Write responseURL=%@ bytes=%d total-delivered=%d/%d", m_responseURL.get(), deliveryBytes, m_offset, m_stream.end);
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
index a9fb188..bd05ebe 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
@@ -31,6 +31,7 @@
#import "WebNetscapePluginPackage.h"
#import "WebPluginContainerCheck.h"
+#import <wtf/OwnPtr.h>
#import <wtf/PassRefPtr.h>
#import <wtf/RefPtr.h>
#import <wtf/RetainPtr.h>
@@ -45,6 +46,8 @@ namespace WebCore {
class HTMLPlugInElement;
}
+class WebHaltablePlugin;
+
@interface WebBaseNetscapePluginView : NSView
{
RetainPtr<WebNetscapePluginPackage> _pluginPackage;
@@ -65,6 +68,8 @@ namespace WebCore {
RetainPtr<NSURL> _baseURL;
RetainPtr<NSURL> _sourceURL;
+ OwnPtr<WebHaltablePlugin> _haltable;
+
NSTrackingRectTag _trackingTag;
}
@@ -101,6 +106,7 @@ namespace WebCore {
- (void)startTimers;
- (void)restartTimers;
+- (void)start;
- (void)stop;
- (void)addWindowObservers;
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
index 1345fc3..e730419 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
@@ -43,13 +43,17 @@
#import <WebCore/WebCoreObjCExtras.h>
#import <WebCore/AuthenticationMac.h>
+#import <WebCore/Credential.h>
+#import <WebCore/CredentialStorage.h>
#import <WebCore/CString.h>
#import <WebCore/Document.h>
#import <WebCore/Element.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
#import <WebCore/HTMLPlugInElement.h>
+#import <WebCore/HaltablePlugin.h>
#import <WebCore/Page.h>
+#import <WebCore/ProtectionSpace.h>
#import <WebCore/RenderView.h>
#import <WebKit/DOMPrivate.h>
#import <runtime/InitializeThreading.h>
@@ -60,6 +64,21 @@
using namespace WebCore;
+class WebHaltablePlugin : public HaltablePlugin {
+public:
+ WebHaltablePlugin(WebBaseNetscapePluginView* view)
+ : m_view(view)
+ {
+ }
+
+private:
+ virtual void halt() { [m_view stop]; }
+ virtual void restart() { [m_view start]; }
+ virtual Node* node() const { return [m_view element]; }
+
+ WebBaseNetscapePluginView* m_view;
+};
+
@implementation WebBaseNetscapePluginView
+ (void)initialize
@@ -111,7 +130,7 @@ using namespace WebCore;
_mode = NP_EMBED;
_loadManually = loadManually;
-
+ _haltable = new WebHaltablePlugin(self);
return self;
}
@@ -388,10 +407,13 @@ using namespace WebCore;
}
_isStarted = YES;
+ page->didStartPlugin(_haltable.get());
+
[[self webView] addPluginInstanceView:self];
-
- [self updateAndSetWindow];
-
+
+ if ([self currentWindow])
+ [self updateAndSetWindow];
+
if ([self window]) {
[self addWindowObservers];
if ([[self window] isKeyWindow]) {
@@ -414,6 +436,11 @@ using namespace WebCore;
if (!_isStarted)
return;
+
+ if (Frame* frame = core([self webFrame])) {
+ if (Page* page = frame->page())
+ page->didStopPlugin(_haltable.get());
+ }
_isStarted = NO;
@@ -478,11 +505,16 @@ using namespace WebCore;
selector:@selector(preferencesHaveChanged:)
name:WebPreferencesChangedNotification
object:nil];
-
+
// View moved to an actual window. Start it if not already started.
[self start];
- [self restartTimers];
- [self addWindowObservers];
+
+ // Starting the plug-in can result in it removing itself from the window so we need to ensure that we're still in
+ // place before doing anything that requires a window.
+ if ([self window]) {
+ [self restartTimers];
+ [self addWindowObservers];
+ }
} else if ([[self webView] hostWindow]) {
// View moved out of an actual window, but still has a host window.
// Call setWindow to explicitly "clip out" the plug-in from sight.
@@ -868,7 +900,7 @@ bool getAuthenticationInfo(const char* protocolStr, const char* hostStr, int32_t
RetainPtr<NSURLProtectionSpace> protectionSpace(AdoptNS, [[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:authenticationMethod]);
- NSURLCredential *credential = WebCoreCredentialStorage::get(protectionSpace.get());
+ NSURLCredential *credential = mac(CredentialStorage::get(core(protectionSpace.get())));
if (!credential)
credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace.get()];
if (!credential)
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm
index 24c5944..5debb97 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -69,6 +69,7 @@
#import <WebCore/Page.h>
#import <WebCore/PluginMainThreadScheduler.h>
#import <WebCore/ScriptController.h>
+#import <WebCore/SecurityOrigin.h>
#import <WebCore/SoftLinking.h>
#import <WebCore/WebCoreObjCExtras.h>
#import <WebCore/WebCoreURLResponse.h>
@@ -78,13 +79,12 @@
#import <wtf/Assertions.h>
#import <objc/objc-runtime.h>
-using std::max;
-
#define LoginWindowDidSwitchFromUserNotification @"WebLoginWindowDidSwitchFromUserNotification"
#define LoginWindowDidSwitchToUserNotification @"WebLoginWindowDidSwitchToUserNotification"
using namespace WebCore;
using namespace WebKit;
+using namespace std;
static inline bool isDrawingModelQuickDraw(NPDrawingModel drawingModel)
{
@@ -1683,7 +1683,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
return NPERR_INVALID_PARAM;
}
} else {
- if (!FrameLoader::canLoad(URL, String(), core([self webFrame])->document()))
+ if (!SecurityOrigin::canLoad(URL, String(), core([self webFrame])->document()))
return NPERR_GENERIC_ERROR;
}
@@ -1794,7 +1794,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
NSString *contentLength = [header objectForKey:@"Content-Length"];
if (contentLength != nil)
- dataLength = MIN((unsigned)[contentLength intValue], dataLength);
+ dataLength = min<unsigned>([contentLength intValue], dataLength);
[header removeObjectForKey:@"Content-Length"];
if ([header count] > 0) {
diff --git a/WebKit/mac/Plugins/WebPluginContainerCheck.mm b/WebKit/mac/Plugins/WebPluginContainerCheck.mm
index 2180b02..5609d80 100644
--- a/WebKit/mac/Plugins/WebPluginContainerCheck.mm
+++ b/WebKit/mac/Plugins/WebPluginContainerCheck.mm
@@ -40,6 +40,7 @@
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
#import <WebCore/FrameLoaderTypes.h>
+#import <WebCore/SecurityOrigin.h>
#import <wtf/Assertions.h>
#import <objc/objc-runtime.h>
@@ -98,7 +99,7 @@ using namespace WebCore;
{
Frame* coreFrame = core([_controller webFrame]);
ASSERT(coreFrame);
- if (!coreFrame->loader()->canLoad([_request URL], String(), coreFrame->document())) {
+ if (!SecurityOrigin::canLoad([_request URL], String(), coreFrame->document())) {
[self _continueWithPolicy:PolicyIgnore];
return YES;
}