Skip to content
Permalink
Browse files
2010-06-20 Anders Carlsson <andersca@apple.com>
        Reviewed by Sam Weinig.

        Remove -[WebBasePluginPackage bundle]
        https://bugs.webkit.org/show_bug.cgi?id=40892

        Add -[WebBasePluginPackage bundleIdentifier] and switch clients over to it.

        Move the supportsSnapshotting method over to the plug-in package.

        * Plugins/Hosted/NetscapePluginHostManager.mm:
        (WebKit::NetscapePluginHostManager::hostForPackage):
        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:WebCore::]):
        (-[WebBaseNetscapePluginView supportsSnapshotting]):
        * Plugins/WebBasePluginPackage.h:
        * Plugins/WebBasePluginPackage.mm:
        (-[WebBasePluginPackage isQuickTimePlugIn]):
        (-[WebBasePluginPackage isJavaPlugIn]):
        (-[WebBasePluginPackage WebCore::]):
        Call bundleIdentifier directly instead of asking the bundle
        * Plugins/WebNetscapePluginPackage.h:
        * Plugins/WebNetscapePluginPackage.mm:
        (-[WebNetscapePluginPackage supportsSnapshotting]):
        * Plugins/WebNetscapePluginView.mm:
        (-[WebNetscapePluginView setAttributeKeys:andValues:]):
        (-[WebNetscapePluginView _createPlugin]):
        * Plugins/WebPluginDatabase.mm:
        (checkCandidate):


Canonical link: https://commits.webkit.org/52520@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@61510 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Jun 20, 2010
1 parent 2f5aaec commit 564eab818f5e08c3d1f0f9951f1ac51b2b4e95f3
Showing 9 changed files with 72 additions and 32 deletions.
@@ -1,3 +1,34 @@
2010-06-20 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Remove -[WebBasePluginPackage bundle]
https://bugs.webkit.org/show_bug.cgi?id=40892

Add -[WebBasePluginPackage bundleIdentifier] and switch clients over to it.

Move the supportsSnapshotting method over to the plug-in package.

* Plugins/Hosted/NetscapePluginHostManager.mm:
(WebKit::NetscapePluginHostManager::hostForPackage):
* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:WebCore::]):
(-[WebBaseNetscapePluginView supportsSnapshotting]):
* Plugins/WebBasePluginPackage.h:
* Plugins/WebBasePluginPackage.mm:
(-[WebBasePluginPackage isQuickTimePlugIn]):
(-[WebBasePluginPackage isJavaPlugIn]):
(-[WebBasePluginPackage WebCore::]):
Call bundleIdentifier directly instead of asking the bundle
* Plugins/WebNetscapePluginPackage.h:
* Plugins/WebNetscapePluginPackage.mm:
(-[WebNetscapePluginPackage supportsSnapshotting]):
* Plugins/WebNetscapePluginView.mm:
(-[WebNetscapePluginView setAttributeKeys:andValues:]):
(-[WebNetscapePluginView _createPlugin]):
* Plugins/WebPluginDatabase.mm:
(checkCandidate):

2010-06-20 Anders Carlsson <andersca@apple.com>

Reviewed by Dan Bernstein.
@@ -93,7 +93,7 @@

// Since Flash NPObjects add methods dynamically, we don't want to cache when a property/method doesn't exist
// on an object because it could be added later.
bool shouldCacheMissingPropertiesAndMethods = ![[[package bundle] bundleIdentifier] isEqualToString:@"com.macromedia.Flash Player.plugin"];
bool shouldCacheMissingPropertiesAndMethods = [package bundleIdentifier] != "com.macromedia.Flash Player.plugin";

NetscapePluginHostProxy* hostProxy = new NetscapePluginHostProxy(clientPort, pluginHostPort, pluginHostPSN, shouldCacheMissingPropertiesAndMethods);

@@ -146,7 +146,7 @@ - (id)initWithFrame:(NSRect)frame
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
// Enable "kiosk mode" when instantiating the QT plug-in inside of Dashboard. See <rdar://problem/6878105>
if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.dashboard.client"] &&
[[[_pluginPackage.get() bundle] bundleIdentifier] isEqualToString:@"com.apple.QuickTime Plugin.plugin"]) {
[_pluginPackage.get() bundleIdentifier] == "com.apple.QuickTime Plugin.plugin") {
RetainPtr<NSMutableArray> mutableKeys(AdoptNS, [keys mutableCopy]);
RetainPtr<NSMutableArray> mutableValues(AdoptNS, [values mutableCopy]);

@@ -578,20 +578,7 @@ - (BOOL)inFlatteningPaint

- (BOOL)supportsSnapshotting
{
NSBundle *pluginBundle = [_pluginPackage.get() bundle];
if (![[pluginBundle bundleIdentifier] isEqualToString:@"com.macromedia.Flash Player.plugin"])
return YES;

// Flash has a bogus Info.plist entry for CFBundleVersionString, so use CFBundleShortVersionString.
NSString *versionString = [pluginBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];

static const NSString *flash10dotOnePrefix = @"10.1";
if (![versionString hasPrefix:flash10dotOnePrefix])
return YES;

// Some prerelease versions of Flash 10.1 crash when sent a drawRect event using the CA drawing model: <rdar://problem/7739922>
static const CFStringRef knownGoodFlash10dot1Release = CFSTR("10.1.53.60");
return CFStringCompare((CFStringRef)versionString, knownGoodFlash10dot1Release, kCFCompareNumerically) != kCFCompareLessThan;
return [_pluginPackage.get() supportsSnapshotting];
}

- (BOOL)hasBeenHalted
@@ -82,7 +82,8 @@ typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void);
- (const WebCore::String&)name;
- (const WebCore::String&)path;
- (const WebCore::String&)pluginDescription;
- (NSBundle *)bundle;

- (WebCore::String)bundleIdentifier;

- (BOOL)supportsExtension:(NSString *)extension;
- (BOOL)supportsMIMEType:(NSString *)MIMEType;
@@ -47,12 +47,12 @@
#import <mach-o/fat.h>
#import <mach-o/loader.h>

#define JavaCocoaPluginIdentifier @"com.apple.JavaPluginCocoa"
#define JavaCarbonPluginIdentifier @"com.apple.JavaAppletPlugin"
#define JavaCocoaPluginIdentifier "com.apple.JavaPluginCocoa"
#define JavaCarbonPluginIdentifier "com.apple.JavaAppletPlugin"
#define JavaCFMPluginFilename @"Java Applet Plugin Enabler"

#define QuickTimeCarbonPluginIdentifier @"com.apple.QuickTime Plugin.plugin"
#define QuickTimeCocoaPluginIdentifier @"com.apple.quicktime.webplugin"
#define QuickTimeCarbonPluginIdentifier "com.apple.QuickTime Plugin.plugin"
#define QuickTimeCocoaPluginIdentifier "com.apple.quicktime.webplugin"

@interface NSArray (WebPluginExtensions)
- (NSArray *)_web_lowercaseStrings;
@@ -372,16 +372,14 @@ - (NSString *)description

- (BOOL)isQuickTimePlugIn
{
NSString *bundleIdentifier = [[self bundle] bundleIdentifier];
return [bundleIdentifier _webkit_isCaseInsensitiveEqualToString:QuickTimeCarbonPluginIdentifier] ||
[bundleIdentifier _webkit_isCaseInsensitiveEqualToString:QuickTimeCocoaPluginIdentifier];
const String& bundleIdentifier = [self bundleIdentifier];
return bundleIdentifier == QuickTimeCocoaPluginIdentifier || bundleIdentifier == QuickTimeCocoaPluginIdentifier;
}

- (BOOL)isJavaPlugIn
{
NSString *bundleIdentifier = [[self bundle] bundleIdentifier];
return [bundleIdentifier _webkit_isCaseInsensitiveEqualToString:JavaCocoaPluginIdentifier] ||
[bundleIdentifier _webkit_isCaseInsensitiveEqualToString:JavaCarbonPluginIdentifier] ||
const String& bundleIdentifier = [self bundleIdentifier];
return bundleIdentifier == JavaCocoaPluginIdentifier || bundleIdentifier == JavaCarbonPluginIdentifier ||
[(NSString *)[self filename] _webkit_isCaseInsensitiveEqualToString:JavaCFMPluginFilename];
}

@@ -487,6 +485,11 @@ - (void)wasRemovedFromPluginDatabase:(WebPluginDatabase *)database
[pluginDatabases removeObject:database];
}

- (WebCore::String)bundleIdentifier
{
return CFBundleGetIdentifier(cfBundle);
}

@end

@implementation NSArray (WebPluginExtensions)
@@ -77,6 +77,8 @@ typedef enum {
- (WebExecutableType)executableType;
- (NPPluginFuncs *)pluginFuncs;

- (BOOL)supportsSnapshotting;

#if USE(PLUGIN_HOST_PROCESS)
- (cpu_type_t)pluginHostArchitecture;
#endif
@@ -689,6 +689,22 @@ - (void)close
[self _unloadWithShutdown:YES];
}


- (BOOL)supportsSnapshotting
{
if ([self bundleIdentifier] != "com.macromedia.Flash Player.plugin")
return YES;

// Flash has a bogus Info.plist entry for CFBundleVersionString, so use CFBundleShortVersionString.
NSString *versionString = (NSString *)CFDictionaryGetValue(CFBundleGetInfoDictionary(cfBundle), CFSTR("CFBundleShortVersionString"));

if (![versionString hasPrefix:@"10.1"])
return YES;

// Some prerelease versions of Flash 10.1 crash when sent a drawRect event using the CA drawing model: <rdar://problem/7739922>
return CFStringCompare((CFStringRef)versionString, CFSTR("10.1.53.60"), kCFCompareNumerically) != kCFCompareLessThan;
}

@end

#ifdef SUPPORT_CFM
@@ -1234,7 +1234,7 @@ - (void)setAttributeKeys:(NSArray *)keys andValues:(NSArray *)values
cValues = (char **)malloc([values count] * sizeof(char *));
}

BOOL isWMP = [[[_pluginPackage.get() bundle] bundleIdentifier] isEqualToString:@"com.microsoft.WMP.defaultplugin"];
BOOL isWMP = [_pluginPackage.get() bundleIdentifier] == "com.microsoft.WMP.defaultplugin";

unsigned i;
unsigned count = [keys count];
@@ -2370,9 +2370,9 @@ - (NPError)_createPlugin
ASSERT(pluginFunctionCallDepth == 0);

PluginMainThreadScheduler::scheduler().registerPlugin(plugin);
_isFlash = [[[_pluginPackage.get() bundle] bundleIdentifier] isEqualToString:@"com.macromedia.Flash Player.plugin"];
_isSilverlight = [[[_pluginPackage.get() bundle] bundleIdentifier] isEqualToString:@"com.microsoft.SilverlightPlugin"];

_isFlash = [_pluginPackage.get() bundleIdentifier] == "com.macromedia.Flash Player.plugin";
_isSilverlight = [_pluginPackage.get() bundleIdentifier] == "com.microsoft.SilverlightPlugin";

[[self class] setCurrentPluginView:self];
NPError npErr = [_pluginPackage.get() pluginFuncs]->newp((char *)[_MIMEType.get() cString], plugin, _mode, argsCount, cAttributes, cValues, NULL);
@@ -82,7 +82,7 @@ static void checkCandidate(WebBasePluginPackage **currentPlugin, WebBasePluginPa
return;
}

if ([[[*currentPlugin bundle] bundleIdentifier] isEqualToString:[[*candidatePlugin bundle] bundleIdentifier]] && [*candidatePlugin versionNumber] > [*currentPlugin versionNumber])
if ([*currentPlugin bundleIdentifier] == [*candidatePlugin bundleIdentifier] && [*candidatePlugin versionNumber] > [*currentPlugin versionNumber])
*currentPlugin = *candidatePlugin;
}

0 comments on commit 564eab8

Please sign in to comment.