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

        Change some WebPluginDabase ivars to use WebCore::String instead of NSString.
        https://bugs.webkit.org/show_bug.cgi?id=40869

        Re-land r61459, with extra null-checks in WebFrameLoaderClient.

        * Plugins/Hosted/NetscapePluginHostManager.mm:
        (WebKit::NetscapePluginHostManager::spawnPluginHost):
        * Plugins/WebBasePluginPackage.h:
        * Plugins/WebBasePluginPackage.mm:
        (-[WebBasePluginPackage initWithPath:]):
        (-[WebBasePluginPackage getPluginInfoFromPLists]):
        (-[WebBasePluginPackage dealloc]):
        (-[WebBasePluginPackage name]):
        (-[WebBasePluginPackage path]):
        (-[WebBasePluginPackage filename]):
        (-[WebBasePluginPackage pluginDescription]):
        (-[WebBasePluginPackage description]):
        (-[WebBasePluginPackage isJavaPlugIn]):
        * Plugins/WebNetscapePluginPackage.mm:
        (-[WebNetscapePluginPackage getPluginInfoFromResources]):
        (-[WebNetscapePluginPackage _tryLoad]):
        (-[WebNetscapePluginPackage _unloadWithShutdown:]):
        * Plugins/WebPluginPackage.mm:
        (-[WebPluginPackage load]):
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::createPlugin):


Canonical link: https://commits.webkit.org/52519@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@61509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Jun 20, 2010
1 parent 9f1e261 commit 2f5aaec67306b9b80b67bd6934912eb3d1b720f9
Showing 7 changed files with 65 additions and 53 deletions.
@@ -1,3 +1,34 @@
2010-06-20 Anders Carlsson <andersca@apple.com>

Reviewed by Dan Bernstein.

Change some WebPluginDabase ivars to use WebCore::String instead of NSString.
https://bugs.webkit.org/show_bug.cgi?id=40869

Re-land r61459, with extra null-checks in WebFrameLoaderClient.

* Plugins/Hosted/NetscapePluginHostManager.mm:
(WebKit::NetscapePluginHostManager::spawnPluginHost):
* Plugins/WebBasePluginPackage.h:
* Plugins/WebBasePluginPackage.mm:
(-[WebBasePluginPackage initWithPath:]):
(-[WebBasePluginPackage getPluginInfoFromPLists]):
(-[WebBasePluginPackage dealloc]):
(-[WebBasePluginPackage name]):
(-[WebBasePluginPackage path]):
(-[WebBasePluginPackage filename]):
(-[WebBasePluginPackage pluginDescription]):
(-[WebBasePluginPackage description]):
(-[WebBasePluginPackage isJavaPlugIn]):
* Plugins/WebNetscapePluginPackage.mm:
(-[WebNetscapePluginPackage getPluginInfoFromResources]):
(-[WebNetscapePluginPackage _tryLoad]):
(-[WebNetscapePluginPackage _unloadWithShutdown:]):
* Plugins/WebPluginPackage.mm:
(-[WebPluginPackage load]):
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::createPlugin):

2010-06-18 Adam Barth <abarth@webkit.org>

Unreviewed, rolling out r61459.
@@ -156,7 +156,7 @@

NSDictionary *hostProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
visibleName, @"visibleName",
[package path], @"bundlePath",
(NSString *)[package path], @"bundlePath",
nil];

data = [NSPropertyListSerialization dataFromPropertyList:hostProperties format:NSPropertyListBinaryFormat_v1_0 errorDescription:nil];
@@ -26,6 +26,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#import <WebCore/PluginData.h>

#if ENABLE(NETSCAPE_PLUGIN_API)
#import <WebKit/npfunctions.h>
#else
@@ -54,9 +56,9 @@ typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void);
{
NSMutableSet *pluginDatabases;

NSString *name;
NSString *path;
NSString *pluginDescription;
WebCore::String name;
WebCore::String path;
WebCore::String pluginDescription;

NSBundle *bundle;
CFBundleRef cfBundle;
@@ -76,10 +78,10 @@ typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void);
- (BOOL)load;
- (void)unload;

- (NSString *)name;
- (NSString *)path;
- (NSString *)filename;
- (NSString *)pluginDescription;
- (WebCore::String)filename;
- (const WebCore::String&)name;
- (const WebCore::String&)path;
- (const WebCore::String&)pluginDescription;
- (NSBundle *)bundle;

- (BOOL)supportsExtension:(NSString *)extension;
@@ -91,9 +93,6 @@ typedef void (*BP_CreatePluginMIMETypesPreferencesFuncPtr)(void);
- (NSString *)MIMETypeForExtension:(NSString *)extension;
- (NSArray *)extensionsForMIMEType:(NSString *)MIMEType;

- (void)setName:(NSString *)theName;
- (void)setPath:(NSString *)thePath;
- (void)setPluginDescription:(NSString *)description;
- (void)setMIMEToDescriptionDictionary:(NSDictionary *)MIMEToDescriptionDictionary;
- (void)setMIMEToExtensionsDictionary:(NSDictionary *)MIMEToExtensionsDictionary;

@@ -47,7 +47,6 @@
#import <mach-o/fat.h>
#import <mach-o/loader.h>


#define JavaCocoaPluginIdentifier @"com.apple.JavaPluginCocoa"
#define JavaCarbonPluginIdentifier @"com.apple.JavaAppletPlugin"
#define JavaCFMPluginFilename @"Java Applet Plugin Enabler"
@@ -59,6 +58,8 @@ @interface NSArray (WebPluginExtensions)
- (NSArray *)_web_lowercaseStrings;
@end;

using namespace WebCore;

@implementation WebBasePluginPackage

+ (void)initialize
@@ -122,7 +123,7 @@ - (id)initWithPath:(NSString *)pluginPath
if (!(self = [super init]))
return nil;

path = [pathByResolvingSymlinksAndAliases(pluginPath) copy];
path = pathByResolvingSymlinksAndAliases(pluginPath);
bundle = [[NSBundle alloc] initWithPath:path];
#ifndef __ppc__
// 32-bit PowerPC is the only platform where non-bundled CFM plugins are supported
@@ -233,12 +234,12 @@ - (BOOL)getPluginInfoFromPLists
NSString *theName = [bundle objectForInfoDictionaryKey:WebPluginNameKey];
if (!theName)
theName = filename;
[self setName:theName];
name = theName;

description = [bundle objectForInfoDictionaryKey:WebPluginDescriptionKey];
if (!description)
description = filename;
[self setPluginDescription:description];
pluginDescription = description;

return YES;
}
@@ -256,10 +257,6 @@ - (void)dealloc
ASSERT(!pluginDatabases || [pluginDatabases count] == 0);
[pluginDatabases release];

[name release];
[path release];
[pluginDescription release];

[MIMEToDescription release];
[MIMEToExtensions release];
[extensionToMIME release];
@@ -283,22 +280,22 @@ - (void)finalize
[super finalize];
}

- (NSString *)name
- (const String&)name
{
return name;
}

- (NSString *)path
- (const String&)path
{
return path;
}

- (NSString *)filename
- (String)filename
{
return [path lastPathComponent];
return [(NSString *)path lastPathComponent];
}

- (NSString *)pluginDescription
- (const String&)pluginDescription
{
return pluginDescription;
}
@@ -338,24 +335,6 @@ - (NSBundle *)bundle
return bundle;
}

- (void)setName:(NSString *)theName
{
[name release];
name = [theName retain];
}

- (void)setPath:(NSString *)thePath
{
[path release];
path = [thePath retain];
}

- (void)setPluginDescription:(NSString *)description
{
[pluginDescription release];
pluginDescription = [description retain];
}

- (void)setMIMEToDescriptionDictionary:(NSDictionary *)MIMEToDescriptionDictionary
{
[MIMEToDescription release];
@@ -388,7 +367,7 @@ - (void)setMIMEToExtensionsDictionary:(NSDictionary *)MIMEToExtensionsDictionary
- (NSString *)description
{
return [NSString stringWithFormat:@"name: %@\npath: %@\nmimeTypes:\n%@\npluginDescription:%@",
name, path, [MIMEToExtensions description], [MIMEToDescription description], pluginDescription];
(NSString *)name, (NSString *)path, [MIMEToExtensions description], [MIMEToDescription description], (NSString *)pluginDescription];
}

- (BOOL)isQuickTimePlugIn
@@ -403,7 +382,7 @@ - (BOOL)isJavaPlugIn
NSString *bundleIdentifier = [[self bundle] bundleIdentifier];
return [bundleIdentifier _webkit_isCaseInsensitiveEqualToString:JavaCocoaPluginIdentifier] ||
[bundleIdentifier _webkit_isCaseInsensitiveEqualToString:JavaCarbonPluginIdentifier] ||
[[path lastPathComponent] _webkit_isCaseInsensitiveEqualToString:JavaCFMPluginFilename];
[(NSString *)[self filename] _webkit_isCaseInsensitiveEqualToString:JavaCFMPluginFilename];
}

static inline void swapIntsInHeader(uint8_t* bytes, unsigned length)
@@ -189,13 +189,13 @@ - (BOOL)getPluginInfoFromResources
description = [self stringForStringListID:PluginNameOrDescriptionStringNumber andIndex:1];
if (!description)
description = filename;
[self setPluginDescription:description];
pluginDescription = description;


NSString *theName = [self stringForStringListID:PluginNameOrDescriptionStringNumber andIndex:2];
if (!theName)
theName = filename;
[self setName:theName];
name = theName;

[self closeResourceFile:resRef];

@@ -352,7 +352,7 @@ - (BOOL)_tryLoad
CFAbsoluteTime currentTime;
CFAbsoluteTime duration;
#endif
LOG(Plugins, "%f Load timing started for: %@", start, [self name]);
LOG(Plugins, "%f Load timing started for: %@", start, (NSString *)[self name]);

if (isLoaded)
return YES;
@@ -625,9 +625,9 @@ - (BOOL)_tryLoad
pluginVersion = pluginFuncs.version;

if (pluginFuncs.javaClass)
LOG(LiveConnect, "%@: mach-o entry point for NPP_GetJavaClass = %p", [self name], pluginFuncs.javaClass);
LOG(LiveConnect, "%@: mach-o entry point for NPP_GetJavaClass = %p", (NSString *)[self name], pluginFuncs.javaClass);
else
LOG(LiveConnect, "%@: no entry point for NPP_GetJavaClass", [self name]);
LOG(LiveConnect, "%@: no entry point for NPP_GetJavaClass", (NSString *)[self name]);

#ifdef SUPPORT_CFM
}
@@ -736,7 +736,7 @@ - (void)_unloadWithShutdown:(BOOL)shutdown
if (!isLoaded)
return;

LOG(Plugins, "Unloading %@...", name);
LOG(Plugins, "Unloading %@...", (NSString *)name);

// Cannot unload a plug-in package while an instance is still using it
if (instanceCount > 0) {
@@ -94,7 +94,7 @@ - (BOOL)load

#if !LOG_DISABLED
CFAbsoluteTime duration = CFAbsoluteTimeGetCurrent() - start;
LOG(Plugins, "principalClass took %f seconds for: %@", duration, [self name]);
LOG(Plugins, "principalClass took %f seconds for: %@", duration, (NSString *)[self name]);
#endif
return [super load];
}
@@ -1631,8 +1631,10 @@ virtual void handleEvent(Event* event)
KURL pluginPageURL = document->completeURL(deprecatedParseURL(parameterValue(paramNames, paramValues, "pluginspage")));
if (!pluginPageURL.protocolInHTTPFamily())
pluginPageURL = KURL();
NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage name] : nil;

NSError *error = [[NSError alloc] _initWithPluginErrorCode:errorCode
contentURL:pluginURL pluginPageURL:pluginPageURL pluginName:[pluginPackage name] MIMEType:MIMEType];
contentURL:pluginURL pluginPageURL:pluginPageURL pluginName:pluginName MIMEType:MIMEType];
CallResourceLoadDelegate(implementations->plugInFailedWithErrorFunc, [m_webFrame.get() webView],
@selector(webView:plugInFailedWithError:dataSource:), error, [m_webFrame.get() _dataSource]);
[error release];
@@ -1721,7 +1723,8 @@ virtual void handleEvent(Event* event)
if (!view) {
WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(getWebView(m_webFrame.get()));
if (implementations->plugInFailedWithErrorFunc) {
NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorJavaUnavailable contentURL:nil pluginPageURL:nil pluginName:[pluginPackage name] MIMEType:MIMEType];
NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage name] : nil;
NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorJavaUnavailable contentURL:nil pluginPageURL:nil pluginName:pluginName MIMEType:MIMEType];
CallResourceLoadDelegate(implementations->plugInFailedWithErrorFunc, [m_webFrame.get() webView],
@selector(webView:plugInFailedWithError:dataSource:), error, [m_webFrame.get() _dataSource]);
[error release];

0 comments on commit 2f5aaec

Please sign in to comment.