summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac/Plugins')
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h2
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm3
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm3
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h1
-rw-r--r--WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm48
-rw-r--r--WebKit/mac/Plugins/Hosted/ProxyInstance.mm2
-rw-r--r--WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm14
-rw-r--r--WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs4
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.h8
-rw-r--r--WebKit/mac/Plugins/WebBaseNetscapePluginView.mm92
-rw-r--r--WebKit/mac/Plugins/WebNetscapePluginView.mm28
11 files changed, 166 insertions, 39 deletions
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
index a1d9bad..9e29062 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
@@ -43,7 +43,7 @@ class NetscapePluginHostManager {
public:
static NetscapePluginHostManager& shared();
- PassRefPtr<NetscapePluginInstanceProxy> instantiatePlugin(WebNetscapePluginPackage *, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame);
+ PassRefPtr<NetscapePluginInstanceProxy> instantiatePlugin(WebNetscapePluginPackage *, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled);
void pluginHostDied(NetscapePluginHostProxy*);
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
index 4aa290a..6b36a6d 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
@@ -211,7 +211,7 @@ void NetscapePluginHostManager::pluginHostDied(NetscapePluginHostProxy* pluginHo
}
}
-PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin(WebNetscapePluginPackage *pluginPackage, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame)
+PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin(WebNetscapePluginPackage *pluginPackage, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled)
{
NetscapePluginHostProxy* hostProxy = hostForPackage(pluginPackage);
if (!hostProxy)
@@ -235,6 +235,7 @@ PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePl
[properties.get() setObject:[sourceURL absoluteString] forKey:@"sourceURL"];
[properties.get() setObject:[NSNumber numberWithBool:fullFrame] forKey:@"fullFrame"];
+ [properties.get() setObject:[NSNumber numberWithBool:isPrivateBrowsingEnabled] forKey:@"privateBrowsingEnabled"];
NSData *data = [NSPropertyListSerialization dataFromPropertyList:properties.get() format:NSPropertyListBinaryFormat_v1_0 errorDescription:nil];
ASSERT(data);
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
index e8874cd..970f5f5 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
@@ -187,7 +187,8 @@ NetscapePluginInstanceProxy* NetscapePluginHostProxy::pluginInstance(uint32_t pl
void NetscapePluginHostProxy::deadNameNotificationCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
{
- ASSERT(msg && static_cast<mach_msg_header_t*>(msg)->msgh_id == MACH_NOTIFY_DEAD_NAME);
+ ASSERT(msg);
+ ASSERT(static_cast<mach_msg_header_t*>(msg)->msgh_id == MACH_NOTIFY_DEAD_NAME);
static_cast<NetscapePluginHostProxy*>(info)->pluginHostDied();
}
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
index 280f161..c950ab7 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
@@ -163,6 +163,7 @@ public:
void resolveURL(const char* url, const char* target, data_t& resolvedURLData, mach_msg_type_number_t& resolvedURLLength);
void didDraw();
+ void privateBrowsingModeDidChange(bool isPrivateBrowsingEnabled);
// Reply structs
struct Reply {
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index 21f35e2..4ae0220 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -575,9 +575,10 @@ NPError NetscapePluginInstanceProxy::loadRequest(NSURLRequest *request, const ch
return NPERR_INVALID_URL;
// Don't allow requests to be loaded when the document loader is stopping all loaders.
- if ([[m_pluginView dataSource] _documentLoader]->isStopping())
+ DocumentLoader* documentLoader = [[m_pluginView dataSource] _documentLoader];
+ if (!documentLoader || documentLoader->isStopping())
return NPERR_GENERIC_ERROR;
-
+
NSString *target = nil;
if (cTarget) {
// Find the frame given the target string.
@@ -587,7 +588,7 @@ NPError NetscapePluginInstanceProxy::loadRequest(NSURLRequest *request, const ch
// don't let a plugin start any loads if it is no longer part of a document that is being
// displayed unless the loads are in the same frame as the plugin.
- if ([[m_pluginView dataSource] _documentLoader] != core([m_pluginView webFrame])->loader()->activeDocumentLoader() &&
+ if (documentLoader != core([m_pluginView webFrame])->loader()->activeDocumentLoader() &&
(!cTarget || [frame findFrameNamed:target] != frame)) {
return NPERR_GENERIC_ERROR;
}
@@ -665,7 +666,7 @@ bool NetscapePluginInstanceProxy::getWindowNPObject(uint32_t& objectID)
if (!frame->script()->isEnabled())
objectID = 0;
else
- objectID = idForObject(frame->script()->windowShell()->window());
+ objectID = idForObject(frame->script()->windowShell(pluginWorld())->window());
return true;
}
@@ -703,7 +704,7 @@ bool NetscapePluginInstanceProxy::evaluate(uint32_t objectID, const String& scri
JSLock lock(SilenceAssertionsOnly);
- ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject();
+ ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject(pluginWorld());
ExecState* exec = globalObject->globalExec();
bool oldAllowPopups = frame->script()->allowPopupsFromPlugin();
@@ -744,7 +745,7 @@ bool NetscapePluginInstanceProxy::invoke(uint32_t objectID, const Identifier& me
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
JSLock lock(SilenceAssertionsOnly);
JSValue function = object->get(exec, methodName);
CallData callData;
@@ -755,7 +756,7 @@ bool NetscapePluginInstanceProxy::invoke(uint32_t objectID, const Identifier& me
MarkedArgumentBuffer argList;
demarshalValues(exec, argumentsData, argumentsLength, argList);
- ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject();
+ ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject(pluginWorld());
globalObject->globalData()->timeoutChecker.start();
JSValue value = call(exec, function, callType, callData, object, argList);
globalObject->globalData()->timeoutChecker.stop();
@@ -778,7 +779,7 @@ bool NetscapePluginInstanceProxy::invokeDefault(uint32_t objectID, data_t argume
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
JSLock lock(SilenceAssertionsOnly);
CallData callData;
CallType callType = object->getCallData(callData);
@@ -788,7 +789,7 @@ bool NetscapePluginInstanceProxy::invokeDefault(uint32_t objectID, data_t argume
MarkedArgumentBuffer argList;
demarshalValues(exec, argumentsData, argumentsLength, argList);
- ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject();
+ ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject(pluginWorld());
globalObject->globalData()->timeoutChecker.start();
JSValue value = call(exec, object, callType, callData, object, argList);
globalObject->globalData()->timeoutChecker.stop();
@@ -811,7 +812,7 @@ bool NetscapePluginInstanceProxy::construct(uint32_t objectID, data_t argumentsD
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
JSLock lock(SilenceAssertionsOnly);
ConstructData constructData;
@@ -822,7 +823,7 @@ bool NetscapePluginInstanceProxy::construct(uint32_t objectID, data_t argumentsD
MarkedArgumentBuffer argList;
demarshalValues(exec, argumentsData, argumentsLength, argList);
- ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject();
+ ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject(pluginWorld());
globalObject->globalData()->timeoutChecker.start();
JSValue value = JSC::construct(exec, object, constructType, constructData, argList);
globalObject->globalData()->timeoutChecker.stop();
@@ -845,7 +846,7 @@ bool NetscapePluginInstanceProxy::getProperty(uint32_t objectID, const Identifie
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
JSLock lock(SilenceAssertionsOnly);
JSValue value = object->get(exec, propertyName);
@@ -864,7 +865,7 @@ bool NetscapePluginInstanceProxy::getProperty(uint32_t objectID, unsigned proper
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
JSLock lock(SilenceAssertionsOnly);
JSValue value = object->get(exec, propertyName);
@@ -886,7 +887,7 @@ bool NetscapePluginInstanceProxy::setProperty(uint32_t objectID, const Identifie
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
JSLock lock(SilenceAssertionsOnly);
JSValue value = demarshalValue(exec, valueData, valueLength);
@@ -910,7 +911,7 @@ bool NetscapePluginInstanceProxy::setProperty(uint32_t objectID, unsigned proper
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
JSLock lock(SilenceAssertionsOnly);
JSValue value = demarshalValue(exec, valueData, valueLength);
@@ -933,7 +934,7 @@ bool NetscapePluginInstanceProxy::removeProperty(uint32_t objectID, const Identi
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
if (!object->hasProperty(exec, propertyName)) {
exec->clearException();
return false;
@@ -958,7 +959,7 @@ bool NetscapePluginInstanceProxy::removeProperty(uint32_t objectID, unsigned pro
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
if (!object->hasProperty(exec, propertyName)) {
exec->clearException();
return false;
@@ -983,7 +984,7 @@ bool NetscapePluginInstanceProxy::hasProperty(uint32_t objectID, const Identifie
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
bool result = object->hasProperty(exec, propertyName);
exec->clearException();
@@ -1003,7 +1004,7 @@ bool NetscapePluginInstanceProxy::hasProperty(uint32_t objectID, unsigned proper
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
bool result = object->hasProperty(exec, propertyName);
exec->clearException();
@@ -1023,7 +1024,7 @@ bool NetscapePluginInstanceProxy::hasMethod(uint32_t objectID, const Identifier&
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
JSLock lock(SilenceAssertionsOnly);
JSValue func = object->get(exec, methodName);
exec->clearException();
@@ -1043,7 +1044,7 @@ bool NetscapePluginInstanceProxy::enumerate(uint32_t objectID, data_t& resultDat
if (!frame)
return false;
- ExecState* exec = frame->script()->globalObject()->globalExec();
+ ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
JSLock lock(SilenceAssertionsOnly);
PropertyNameArray propertyNames(exec);
@@ -1442,6 +1443,11 @@ void NetscapePluginInstanceProxy::resolveURL(const char* url, const char* target
memcpy(resolvedURLData, resolvedURL.data(), resolvedURLLength);
}
+void NetscapePluginInstanceProxy::privateBrowsingModeDidChange(bool isPrivateBrowsingEnabled)
+{
+ _WKPHPluginInstancePrivateBrowsingModeDidChange(m_pluginHostProxy->port(), m_pluginID, isPrivateBrowsingEnabled);
+}
+
} // namespace WebKit
#endif // USE(PLUGIN_HOST_PROCESS)
diff --git a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
index 0b3a32f..6be3953 100644
--- a/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
+++ b/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
@@ -370,7 +370,7 @@ JSC::JSValue ProxyInstance::fieldValue(ExecState* exec, const Field* field) cons
void ProxyInstance::setFieldValue(ExecState* exec, const Field* field, JSValue value) const
{
- if (m_instanceProxy)
+ if (!m_instanceProxy)
return;
uint64_t serverIdentifier = static_cast<const ProxyField*>(field)->serverIdentifier();
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
index 34a2211..8de2aa6 100644
--- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
@@ -90,7 +90,8 @@ extern "C" {
- (void)setAttributeKeys:(NSArray *)keys andValues:(NSArray *)values
{
- ASSERT(!_attributeKeys && !_attributeValues);
+ ASSERT(!_attributeKeys);
+ ASSERT(!_attributeValues);
_attributeKeys.adoptNS([keys copy]);
_attributeValues.adoptNS([values copy]);
@@ -102,7 +103,8 @@ extern "C" {
NSString *userAgent = [[self webView] userAgentForURL:_baseURL.get()];
- _proxy = NetscapePluginHostManager::shared().instantiatePlugin(_pluginPackage.get(), self, _MIMEType.get(), _attributeKeys.get(), _attributeValues.get(), userAgent, _sourceURL.get(), _mode == NP_FULL);
+ _proxy = NetscapePluginHostManager::shared().instantiatePlugin(_pluginPackage.get(), self, _MIMEType.get(), _attributeKeys.get(), _attributeValues.get(), userAgent, _sourceURL.get(),
+ _mode == NP_FULL, _isPrivateBrowsingEnabled);
if (!_proxy)
return NO;
@@ -128,6 +130,12 @@ extern "C" {
[newLayer addSublayer:_pluginLayer.get()];
}
+- (void)privateBrowsingModeDidChange
+{
+ if (_proxy)
+ _proxy->privateBrowsingModeDidChange(_isPrivateBrowsingEnabled);
+}
+
- (void)loadStream
{
}
@@ -414,7 +422,7 @@ extern "C" {
ASSERT([webPluginContainerCheck isKindOfClass:[WebPluginContainerCheck class]]);
id contextInfo = [webPluginContainerCheck contextInfo];
- ASSERT(contextInfo && [contextInfo isKindOfClass:[NSNumber class]]);
+ ASSERT([contextInfo isKindOfClass:[NSNumber class]]);
if (!_proxy)
return;
diff --git a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
index 04edf64..9882bb5 100644
--- a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
+++ b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
@@ -236,4 +236,8 @@ simpleroutine PHBooleanAndDataReply(pluginHostPort :mach_port_t;
simpleroutine PHPluginInstanceDidDraw(pluginHostPort :mach_port_t;
pluginID :uint32_t);
+simpleroutine PHPluginInstancePrivateBrowsingModeDidChange(pluginHostPort :mach_port_t;
+ pluginID :uint32_t;
+ privateBrowsingEnabled :boolean_t);
+
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
index bd05ebe..246fcf1 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
@@ -62,6 +62,9 @@ class WebHaltablePlugin;
BOOL _isStarted;
BOOL _hasFocus;
BOOL _isCompletelyObscured;
+ BOOL _isPrivateBrowsingEnabled;
+ BOOL _isHalted;
+ BOOL _hasBeenHalted;
RefPtr<WebCore::HTMLPlugInElement> _element;
RetainPtr<NSString> _MIMEType;
@@ -109,6 +112,11 @@ class WebHaltablePlugin;
- (void)start;
- (void)stop;
+- (void)halt;
+- (void)resumeFromHalt;
+- (BOOL)isHalted;
+- (BOOL)hasBeenHalted;
+
- (void)addWindowObservers;
- (void)removeWindowObservers;
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
index e730419..0b4d56a 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
@@ -43,6 +43,7 @@
#import <WebCore/WebCoreObjCExtras.h>
#import <WebCore/AuthenticationMac.h>
+#import <WebCore/BitmapImage.h>
#import <WebCore/Credential.h>
#import <WebCore/CredentialStorage.h>
#import <WebCore/CString.h>
@@ -55,6 +56,7 @@
#import <WebCore/Page.h>
#import <WebCore/ProtectionSpace.h>
#import <WebCore/RenderView.h>
+#import <WebCore/RenderWidget.h>
#import <WebKit/DOMPrivate.h>
#import <runtime/InitializeThreading.h>
#import <wtf/Assertions.h>
@@ -72,13 +74,28 @@ public:
}
private:
- virtual void halt() { [m_view stop]; }
- virtual void restart() { [m_view start]; }
- virtual Node* node() const { return [m_view element]; }
+ virtual void halt();
+ virtual void restart();
+ virtual Node* node() const;
WebBaseNetscapePluginView* m_view;
};
+void WebHaltablePlugin::halt()
+{
+ [m_view halt];
+}
+
+void WebHaltablePlugin::restart()
+{
+ [m_view resumeFromHalt];
+}
+
+Node* WebHaltablePlugin::node() const
+{
+ return [m_view element];
+}
+
@implementation WebBaseNetscapePluginView
+ (void)initialize
@@ -243,6 +260,10 @@ private:
ASSERT_NOT_REACHED();
}
+- (void)privateBrowsingModeDidChange
+{
+}
+
- (void)removeTrackingRect
{
if (_trackingTag) {
@@ -455,6 +476,51 @@ private:
[self destroyPlugin];
}
+- (void)halt
+{
+ ASSERT(!_isHalted);
+ ASSERT(_isStarted);
+ Element *element = [self element];
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ CGImageRef cgImage = CGImageRetain([core([self webFrame])->nodeImage(element) CGImageForProposedRect:nil context:nil hints:nil]);
+#else
+ RetainPtr<CGImageSourceRef> imageRef(AdoptCF, CGImageSourceCreateWithData((CFDataRef)[core([self webFrame])->nodeImage(element) TIFFRepresentation], 0));
+ CGImageRef cgImage = CGImageSourceCreateImageAtIndex(imageRef.get(), 0, 0);
+#endif
+ ASSERT(cgImage);
+
+ // BitmapImage will release the passed in CGImage on destruction.
+ RefPtr<Image> nodeImage = BitmapImage::create(cgImage);
+ ASSERT(element->renderer());
+ toRenderWidget(element->renderer())->showSubstituteImage(nodeImage);
+ [self stop];
+ _isHalted = YES;
+ _hasBeenHalted = YES;
+}
+
+- (void)resumeFromHalt
+{
+ ASSERT(_isHalted);
+ ASSERT(!_isStarted);
+ [self start];
+
+ if (_isStarted)
+ _isHalted = NO;
+
+ ASSERT([self element]->renderer());
+ toRenderWidget([self element]->renderer())->showSubstituteImage(0);
+}
+
+- (BOOL)isHalted
+{
+ return _isHalted;
+}
+
+- (BOOL)hasBeenHalted
+{
+ return _hasBeenHalted;
+}
+
- (void)viewWillMoveToWindow:(NSWindow *)newWindow
{
// We must remove the tracking rect before we move to the new window.
@@ -506,6 +572,8 @@ private:
name:WebPreferencesChangedNotification
object:nil];
+ _isPrivateBrowsingEnabled = [[[self webView] preferences] privateBrowsingEnabled];
+
// View moved to an actual window. Start it if not already started.
[self start];
@@ -586,9 +654,12 @@ private:
- (void)preferencesHaveChanged:(NSNotification *)notification
{
WebPreferences *preferences = [[self webView] preferences];
- BOOL arePlugInsEnabled = [preferences arePlugInsEnabled];
+
+ if ([notification object] != preferences)
+ return;
- if ([notification object] == preferences && _isStarted != arePlugInsEnabled) {
+ BOOL arePlugInsEnabled = [preferences arePlugInsEnabled];
+ if (_isStarted != arePlugInsEnabled) {
if (arePlugInsEnabled) {
if ([self currentWindow]) {
[self start];
@@ -598,6 +669,12 @@ private:
[self invalidatePluginContentRect:[self bounds]];
}
}
+
+ BOOL isPrivateBrowsingEnabled = [preferences privateBrowsingEnabled];
+ if (isPrivateBrowsingEnabled != _isPrivateBrowsingEnabled) {
+ _isPrivateBrowsingEnabled = isPrivateBrowsingEnabled;
+ [self privateBrowsingModeDidChange];
+ }
}
- (void)renewGState
@@ -640,13 +717,12 @@ private:
- (WebDataSource *)dataSource
{
- WebFrame *webFrame = kit(_element->document()->frame());
- return [webFrame _dataSource];
+ return [[self webFrame] _dataSource];
}
- (WebFrame *)webFrame
{
- return [[self dataSource] webFrame];
+ return kit(_element->document()->frame());
}
- (WebView *)webView
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm
index 5debb97..135d45a 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -402,7 +402,8 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
QDErr err = NewGWorldFromPtr(&newOffscreenGWorld,
getQDPixelFormatForBitmapContext(currentContext), &offscreenBounds, 0, 0, 0,
static_cast<char*>(offscreenData), CGBitmapContextGetBytesPerRow(currentContext));
- ASSERT(newOffscreenGWorld && !err);
+ ASSERT(newOffscreenGWorld);
+ ASSERT(!err);
if (!err) {
if (offscreenGWorld)
DisposeGWorld(offscreenGWorld);
@@ -838,6 +839,21 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
_eventHandler->syntheticKeyDownWithCommandModifier(keyCode, character);
}
+- (void)privateBrowsingModeDidChange
+{
+ if (!_isStarted)
+ return;
+
+ NPBool value = _isPrivateBrowsingEnabled;
+
+ [self willCallPlugInFunction];
+ {
+ JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly);
+ [_pluginPackage.get() pluginFuncs]->setvalue(plugin, NPNVprivateModeBool, &value);
+ }
+ [self didCallPlugInFunction];
+}
+
#pragma mark WEB_NETSCAPE_PLUGIN
- (BOOL)isNewWindowEqualToOldWindow
@@ -1271,7 +1287,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
{
ASSERT([webPluginContainerCheck isKindOfClass:[WebPluginContainerCheck class]]);
WebPluginContainerCheck *check = (WebPluginContainerCheck *)webPluginContainerCheck;
- ASSERT([check contextInfo] && [[check contextInfo] isKindOfClass:[WebNetscapeContainerCheckContextInfo class]]);
+ ASSERT([[check contextInfo] isKindOfClass:[WebNetscapeContainerCheckContextInfo class]]);
[self cancelCheckIfAllowedToLoadURL:[[check contextInfo] checkRequestID]];
}
@@ -2022,13 +2038,19 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
return NPERR_NO_ERROR;
}
#endif /* NP_NO_CARBON */
-
+
case NPNVsupportsCocoaBool:
{
*(NPBool *)value = TRUE;
return NPERR_NO_ERROR;
}
+ case NPNVprivateModeBool:
+ {
+ *(NPBool *)value = _isPrivateBrowsingEnabled;
+ return NPERR_NO_ERROR;
+ }
+
case WKNVBrowserContainerCheckFuncs:
{
*(WKNBrowserContainerCheckFuncs **)value = browserContainerCheckFuncs();