Changeset 61581 in webkit
- Timestamp:
- Jun 21, 2010 2:40:34 PM (14 years ago)
- Location:
- trunk/WebKit/mac
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/mac/ChangeLog
r61574 r61581 1 2010-06-21 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 More WebBasePluginPackage cleanup 6 https://bugs.webkit.org/show_bug.cgi?id=40944 7 8 * Plugins/Hosted/HostedNetscapePluginStream.mm: 9 (WebKit::HostedNetscapePluginStream::pluginCancelledConnectionError): 10 * Plugins/Hosted/NetscapePluginHostManager.mm: 11 (WebKit::NetscapePluginHostManager::spawnPluginHost): 12 * Plugins/WebBaseNetscapePluginStream.mm: 13 (WebNetscapePluginStream::pluginCancelledConnectionError): 14 * Plugins/WebBaseNetscapePluginView.mm: 15 (WebHaltablePlugin::pluginName): 16 * Plugins/WebBasePluginPackage.h: 17 * Plugins/WebBasePluginPackage.mm: 18 (-[WebBasePluginPackage initWithPath:]): 19 (-[WebBasePluginPackage _objectForInfoDictionaryKey:]): 20 (-[WebBasePluginPackage getPluginInfoFromPLists]): 21 (-[WebBasePluginPackage load]): 22 (-[WebBasePluginPackage dealloc]): 23 (-[WebBasePluginPackage finalize]): 24 (-[WebBasePluginPackage pluginInfo]): 25 (-[WebBasePluginPackage supportsExtension:]): 26 (-[WebBasePluginPackage supportsMIMEType:WebCore::]): 27 (-[WebBasePluginPackage MIMETypeForExtension:]): 28 (-[WebBasePluginPackage isJavaPlugIn]): 29 (-[WebBasePluginPackage versionNumber]): 30 (-[WebBasePluginPackage WebCore::]): 31 * Plugins/WebNetscapePluginPackage.mm: 32 (-[WebNetscapePluginPackage openResourceFile]): 33 (-[WebNetscapePluginPackage closeResourceFile:]): 34 (-[WebNetscapePluginPackage getPluginInfoFromResources]): 35 (-[WebNetscapePluginPackage _initWithPath:]): 36 (-[WebNetscapePluginPackage _applyDjVuWorkaround]): 37 (-[WebNetscapePluginPackage _tryLoad]): 38 (-[WebNetscapePluginPackage supportsSnapshotting]): 39 (-[WebNetscapePluginPackage _unloadWithShutdown:]): 40 * Plugins/WebPluginDatabase.mm: 41 (-[WebPluginDatabase refresh]): 42 (-[WebPluginDatabase _removePlugin:]): 43 * Plugins/WebPluginPackage.mm: 44 (-[WebPluginPackage initWithPath:]): 45 (-[WebPluginPackage load]): 46 * WebCoreSupport/WebFrameLoaderClient.mm: 47 (WebFrameLoaderClient::createPlugin): 48 * WebCoreSupport/WebPlatformStrategies.mm: 49 (WebPlatformStrategies::getPluginInfo): 50 1 51 2010-06-21 Anders Carlsson <andersca@apple.com> 2 52 -
trunk/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm
r52619 r61581 257 257 contentURL:m_responseURL ? m_responseURL.get() : m_requestURL.get() 258 258 pluginPageURL:nil 259 pluginName:[[m_instance->pluginView() pluginPackage] name]259 pluginName:[[m_instance->pluginView() pluginPackage] pluginInfo].name 260 260 MIMEType:m_mimeType.get()] autorelease]; 261 261 } -
trunk/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
r61562 r61581 153 153 "visible name of the plug-in host process. The first argument is the plug-in name " 154 154 "and the second argument is the application name."), 155 [ [package filename]stringByDeletingPathExtension], [[NSProcessInfo processInfo] processName]];155 [(NSString *)[package pluginInfo].file stringByDeletingPathExtension], [[NSProcessInfo processInfo] processName]]; 156 156 157 157 NSDictionary *hostProperties = [[NSDictionary alloc] initWithObjectsAndKeys: -
trunk/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm
r58610 r61581 105 105 contentURL:m_responseURL ? m_responseURL.get() : m_requestURL.get() 106 106 pluginPageURL:nil 107 pluginName:[[m_pluginView.get() pluginPackage] name]107 pluginName:[[m_pluginView.get() pluginPackage] pluginInfo].name 108 108 MIMEType:m_mimeType.get()] autorelease]; 109 109 } -
trunk/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
r61562 r61581 109 109 String WebHaltablePlugin::pluginName() const 110 110 { 111 return [[m_view pluginPackage] name];111 return [[m_view pluginPackage] pluginInfo].name; 112 112 } 113 113 -
trunk/WebKit/mac/Plugins/WebBasePluginPackage.h
r61558 r61581 28 28 29 29 #import <WebCore/PluginData.h> 30 #import <wtf/RetainPtr.h> 30 31 31 32 #if ENABLE(NETSCAPE_PLUGIN_API) … … 57 58 NSMutableSet *pluginDatabases; 58 59 59 WebCore::String name;60 60 WebCore::String path; 61 WebCore:: String pluginDescription;61 WebCore::PluginInfo pluginInfo; 62 62 63 Vector<WebCore::MimeClassInfo> mimeTypes; 64 65 CFBundleRef cfBundle; 63 RetainPtr<CFBundleRef> cfBundle; 66 64 67 65 BP_CreatePluginMIMETypesPreferencesFuncPtr BP_CreatePluginMIMETypesPreferences; … … 76 74 - (void)unload; 77 75 78 - (WebCore::String)filename;79 - (const WebCore::String&)name;80 76 - (const WebCore::String&)path; 81 - (const WebCore::String&)pluginDescription;82 77 83 - (const Vector<WebCore::MimeClassInfo>&)mimeTypes;78 - (const WebCore::PluginInfo&)pluginInfo; 84 79 85 80 - (WebCore::String)bundleIdentifier; -
trunk/WebKit/mac/Plugins/WebBasePluginPackage.mm
r61558 r61581 51 51 #define JavaCocoaPluginIdentifier "com.apple.JavaPluginCocoa" 52 52 #define JavaCarbonPluginIdentifier "com.apple.JavaAppletPlugin" 53 #define JavaCFMPluginFilename @"Java Applet Plugin Enabler"53 #define JavaCFMPluginFilename "Java Applet Plugin Enabler" 54 54 55 55 #define QuickTimeCarbonPluginIdentifier "com.apple.QuickTime Plugin.plugin" … … 127 127 128 128 path = pathByResolvingSymlinksAndAliases(pluginPath); 129 cfBundle = CFBundleCreate(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:path]);129 cfBundle.adoptCF(CFBundleCreate(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:path])); 130 130 131 131 #ifndef __ppc__ … … 171 171 - (id)_objectForInfoDictionaryKey:(NSString *)key 172 172 { 173 CFDictionaryRef bundleInfoDictionary = CFBundleGetInfoDictionary(cfBundle );173 CFDictionaryRef bundleInfoDictionary = CFBundleGetInfoDictionary(cfBundle.get()); 174 174 if (!bundleInfoDictionary) 175 175 return nil; … … 234 234 mimeClassInfo.desc = description; 235 235 236 mimeTypes.append(mimeClassInfo);236 pluginInfo.mimes.append(mimeClassInfo); 237 237 if (!description) 238 238 description = @""; 239 239 } 240 240 241 NSString *filename = [self filename]; 241 NSString *filename = [(NSString *)path lastPathComponent]; 242 pluginInfo.file = filename; 242 243 243 244 NSString *theName = [self _objectForInfoDictionaryKey:WebPluginNameKey]; 244 245 if (!theName) 245 246 theName = filename; 246 name = theName;247 pluginInfo.name = theName; 247 248 248 249 description = [self _objectForInfoDictionaryKey:WebPluginDescriptionKey]; 249 250 if (!description) 250 251 description = filename; 251 plugin Description= description;252 pluginInfo.desc = description; 252 253 253 254 return YES; … … 257 258 { 258 259 if (cfBundle && !BP_CreatePluginMIMETypesPreferences) 259 BP_CreatePluginMIMETypesPreferences = (BP_CreatePluginMIMETypesPreferencesFuncPtr)CFBundleGetFunctionPointerForName(cfBundle , CFSTR("BP_CreatePluginMIMETypesPreferences"));260 BP_CreatePluginMIMETypesPreferences = (BP_CreatePluginMIMETypesPreferencesFuncPtr)CFBundleGetFunctionPointerForName(cfBundle.get(), CFSTR("BP_CreatePluginMIMETypesPreferences")); 260 261 261 262 return YES; … … 266 267 ASSERT(!pluginDatabases || [pluginDatabases count] == 0); 267 268 [pluginDatabases release]; 268 269 if (cfBundle)270 CFRelease(cfBundle);271 269 272 270 [super dealloc]; … … 279 277 [pluginDatabases release]; 280 278 281 if (cfBundle)282 CFRelease(cfBundle);283 284 279 [super finalize]; 285 280 } 286 281 287 - (const String&)name288 {289 return name;290 }291 292 282 - (const String&)path 293 283 { … … 295 285 } 296 286 297 - (String)filename 298 { 299 return [(NSString *)path lastPathComponent]; 300 } 301 302 - (const String&)pluginDescription 303 { 304 return pluginDescription; 305 } 306 307 - (const Vector<WebCore::MimeClassInfo>&)mimeTypes 308 { 309 return mimeTypes; 287 - (const PluginInfo&)pluginInfo 288 { 289 return pluginInfo; 310 290 } 311 291 … … 314 294 ASSERT(extension.lower() == extension); 315 295 316 for (size_t i = 0; i < mimeTypes.size(); ++i) {317 const Vector<String>& extensions = mimeTypes[i].extensions;296 for (size_t i = 0; i < pluginInfo.mimes.size(); ++i) { 297 const Vector<String>& extensions = pluginInfo.mimes[i].extensions; 318 298 319 299 if (find(extensions.begin(), extensions.end(), extension) != extensions.end()) … … 328 308 ASSERT(mimeType.lower() == mimeType); 329 309 330 for (size_t i = 0; i < mimeTypes.size(); ++i) {331 if ( mimeTypes[i].type == mimeType)310 for (size_t i = 0; i < pluginInfo.mimes.size(); ++i) { 311 if (pluginInfo.mimes[i].type == mimeType) 332 312 return YES; 333 313 } … … 340 320 ASSERT(extension.lower() == extension); 341 321 342 for (size_t i = 0; i < mimeTypes.size(); ++i) {343 const MimeClassInfo& mimeClassInfo = mimeTypes[i];322 for (size_t i = 0; i < pluginInfo.mimes.size(); ++i) { 323 const MimeClassInfo& mimeClassInfo = pluginInfo.mimes[i]; 344 324 const Vector<String>& extensions = mimeClassInfo.extensions; 345 325 … … 361 341 const String& bundleIdentifier = [self bundleIdentifier]; 362 342 return bundleIdentifier == JavaCocoaPluginIdentifier || bundleIdentifier == JavaCarbonPluginIdentifier || 363 [(NSString *)[self filename] _webkit_isCaseInsensitiveEqualToString:JavaCFMPluginFilename];343 equalIgnoringCase(pluginInfo.file, JavaCFMPluginFilename); 364 344 } 365 345 … … 446 426 { 447 427 // CFBundleGetVersionNumber doesn't work with all possible versioning schemes, but we think for now it's good enough for us. 448 return CFBundleGetVersionNumber(cfBundle );428 return CFBundleGetVersionNumber(cfBundle.get()); 449 429 } 450 430 … … 468 448 - (WebCore::String)bundleIdentifier 469 449 { 470 return CFBundleGetIdentifier(cfBundle );450 return CFBundleGetIdentifier(cfBundle.get()); 471 451 } 472 452 -
trunk/WebKit/mac/Plugins/WebNetscapePluginPackage.mm
r61574 r61581 108 108 #endif 109 109 110 return CFBundleOpenBundleResourceMap(cfBundle );110 return CFBundleOpenBundleResourceMap(cfBundle.get()); 111 111 } 112 112 … … 120 120 #endif 121 121 122 CFBundleCloseBundleResourceMap(cfBundle , resRef);122 CFBundleCloseBundleResourceMap(cfBundle.get(), resRef); 123 123 } 124 124 … … 178 178 179 179 description = [self stringForStringListID:MIMEDescriptionStringNumber 180 andIndex: mimeTypes.size()];180 andIndex:pluginInfo.mimes.size()]; 181 181 mimeClassInfo.desc = description; 182 182 183 mimeTypes.append(mimeClassInfo); 184 } 185 186 NSString *filename = [self filename]; 183 pluginInfo.mimes.append(mimeClassInfo); 184 } 185 186 NSString *filename = [(NSString *)path lastPathComponent]; 187 pluginInfo.file = filename; 187 188 188 189 description = [self stringForStringListID:PluginNameOrDescriptionStringNumber andIndex:1]; 189 190 if (!description) 190 191 description = filename; 191 plugin Description= description;192 pluginInfo.desc = description; 192 193 193 194 … … 195 196 if (!theName) 196 197 theName = filename; 197 name = theName;198 pluginInfo.name = theName; 198 199 199 200 [self closeResourceFile:resRef]; … … 210 211 if (cfBundle) { 211 212 // Bundle 212 CFBundleGetPackageInfo(cfBundle , &type, NULL);213 CFBundleGetPackageInfo(cfBundle.get(), &type, NULL); 213 214 #ifdef SUPPORT_CFM 214 215 isBundle = YES; … … 231 232 // Check if the executable is Mach-O or CFM. 232 233 if (cfBundle) { 233 RetainPtr<CFURLRef> executableURL(AdoptCF, CFBundleCopyExecutableURL(cfBundle ));234 RetainPtr<CFURLRef> executableURL(AdoptCF, CFBundleCopyExecutableURL(cfBundle.get())); 234 235 if (!executableURL) 235 236 return NO; … … 249 250 250 251 #if USE(PLUGIN_HOST_PROCESS) 251 RetainPtr<CFArrayRef> archs(AdoptCF, CFBundleCopyExecutableArchitectures(cfBundle ));252 RetainPtr<CFArrayRef> archs(AdoptCF, CFBundleCopyExecutableArchitectures(cfBundle.get())); 252 253 253 254 if ([(NSArray *)archs.get() containsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureX86_64]]) … … 326 327 return; 327 328 328 if ([ (NSString *)CFBundleGetIdentifier(cfBundle) isEqualToString:@"com.lizardtech.NPDjVu"]) {329 if ([self bundleIdentifier] == "com.lizardtech.NPDjVu") { 329 330 // The DjVu plug-in will crash copying the vtable if it's too big so we cap it to 330 331 // what the plug-in expects here. … … 355 356 CFAbsoluteTime duration; 356 357 #endif 357 LOG(Plugins, "%f Load timing started for: %@", start, (NSString *)[self name]);358 LOG(Plugins, "%f Load timing started for: %@", start, (NSString *)[self pluginInfo].name); 358 359 359 360 if (isLoaded) … … 363 364 if (isBundle) { 364 365 #endif 365 if (!CFBundleLoadExecutable(cfBundle ))366 if (!CFBundleLoadExecutable(cfBundle.get())) 366 367 return NO; 367 368 #if !LOG_DISABLED … … 379 380 } else { 380 381 #endif 381 NP_Initialize = (NP_InitializeFuncPtr)CFBundleGetFunctionPointerForName(cfBundle , CFSTR("NP_Initialize"));382 NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)CFBundleGetFunctionPointerForName(cfBundle , CFSTR("NP_GetEntryPoints"));383 NP_Shutdown = (NPP_ShutdownProcPtr)CFBundleGetFunctionPointerForName(cfBundle , CFSTR("NP_Shutdown"));382 NP_Initialize = (NP_InitializeFuncPtr)CFBundleGetFunctionPointerForName(cfBundle.get(), CFSTR("NP_Initialize")); 383 NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)CFBundleGetFunctionPointerForName(cfBundle.get(), CFSTR("NP_GetEntryPoints")); 384 NP_Shutdown = (NPP_ShutdownProcPtr)CFBundleGetFunctionPointerForName(cfBundle.get(), CFSTR("NP_Shutdown")); 384 385 if (!NP_Initialize || !NP_GetEntryPoints || !NP_Shutdown) 385 386 return NO; … … 628 629 629 630 if (pluginFuncs.javaClass) 630 LOG(LiveConnect, "%@: mach-o entry point for NPP_GetJavaClass = %p", (NSString *)[self name], pluginFuncs.javaClass);631 LOG(LiveConnect, "%@: mach-o entry point for NPP_GetJavaClass = %p", (NSString *)[self pluginInfo].name, pluginFuncs.javaClass); 631 632 else 632 LOG(LiveConnect, "%@: no entry point for NPP_GetJavaClass", (NSString *)[self name]);633 LOG(LiveConnect, "%@: no entry point for NPP_GetJavaClass", (NSString *)[self pluginInfo].name); 633 634 634 635 #ifdef SUPPORT_CFM … … 699 700 700 701 // Flash has a bogus Info.plist entry for CFBundleVersionString, so use CFBundleShortVersionString. 701 NSString *versionString = (NSString *)CFDictionaryGetValue(CFBundleGetInfoDictionary(cfBundle ), CFSTR("CFBundleShortVersionString"));702 NSString *versionString = (NSString *)CFDictionaryGetValue(CFBundleGetInfoDictionary(cfBundle.get()), CFSTR("CFBundleShortVersionString")); 702 703 703 704 if (![versionString hasPrefix:@"10.1"]) … … 755 756 return; 756 757 757 LOG(Plugins, "Unloading %@...", (NSString *) name);758 LOG(Plugins, "Unloading %@...", (NSString *)pluginInfo.name); 758 759 759 760 // Cannot unload a plug-in package while an instance is still using it -
trunk/WebKit/mac/Plugins/WebPluginDatabase.mm
r61525 r61581 308 308 pluginEnumerator = [plugins objectEnumerator]; 309 309 while ((plugin = [pluginEnumerator nextObject])) { 310 const Vector<MimeClassInfo>& mimeTypes = [plugin mimeTypes];311 for (size_t i = 0; i < mimeTypes.size(); ++i)312 [MIMETypes addObject: mimeTypes[i].type];310 const PluginInfo& pluginInfo = [plugin pluginInfo]; 311 for (size_t i = 0; i < pluginInfo.mimes.size(); ++i) 312 [MIMETypes addObject:pluginInfo.mimes[i].type]; 313 313 } 314 314 … … 445 445 446 446 // Unregister plug-in's MIME type registrations 447 const Vector<MimeClassInfo>& mimeTypes = [plugin mimeTypes];448 for (size_t i = 0; i < mimeTypes.size(); ++i) {449 NSString *MIMEType = mimeTypes[i].type;447 const PluginInfo& pluginInfo = [plugin pluginInfo]; 448 for (size_t i = 0; i < pluginInfo.mimes.size(); ++i) { 449 NSString *MIMEType = pluginInfo.mimes[i].type; 450 450 451 451 if ([registeredMIMETypes containsObject:MIMEType]) { -
trunk/WebKit/mac/Plugins/WebPluginPackage.mm
r61519 r61581 55 55 if (![[pluginPath pathExtension] _webkit_isCaseInsensitiveEqualToString:@"webplugin"]) { 56 56 UInt32 type = 0; 57 CFBundleGetPackageInfo(cfBundle , &type, NULL);57 CFBundleGetPackageInfo(cfBundle.get(), &type, NULL); 58 58 if (type != FOUR_CHAR_CODE('WBPL')) { 59 59 [self release]; … … 104 104 #if !LOG_DISABLED 105 105 CFAbsoluteTime duration = CFAbsoluteTimeGetCurrent() - start; 106 LOG(Plugins, "principalClass took %f seconds for: %@", duration, (NSString *)[self name]);106 LOG(Plugins, "principalClass took %f seconds for: %@", duration, (NSString *)[self pluginInfo].name); 107 107 #endif 108 108 return [super load]; -
trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
r61568 r61581 1633 1633 if (!pluginPageURL.protocolInHTTPFamily()) 1634 1634 pluginPageURL = KURL(); 1635 NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage name]: nil;1635 NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage pluginInfo].name : nil; 1636 1636 1637 1637 NSError *error = [[NSError alloc] _initWithPluginErrorCode:errorCode … … 1725 1725 WebResourceDelegateImplementationCache* implementations = WebViewGetResourceLoadDelegateImplementations(getWebView(m_webFrame.get())); 1726 1726 if (implementations->plugInFailedWithErrorFunc) { 1727 NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage name]: nil;1727 NSString *pluginName = pluginPackage ? (NSString *)[pluginPackage pluginInfo].name : nil; 1728 1728 NSError *error = [[NSError alloc] _initWithPluginErrorCode:WebKitErrorJavaUnavailable contentURL:nil pluginPageURL:nil pluginName:pluginName MIMEType:MIMEType]; 1729 1729 CallResourceLoadDelegate(implementations->plugInFailedWithErrorFunc, [m_webFrame.get() webView], -
trunk/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
r61522 r61581 65 65 NSArray* pluginsArray = [[WebPluginDatabase sharedDatabase] plugins]; 66 66 for (unsigned int i = 0; i < [pluginsArray count]; ++i) { 67 PluginInfo pluginInfo;67 WebPluginPackage *plugin = [pluginsArray objectAtIndex:i]; 68 68 69 WebPluginPackage *plugin = [pluginsArray objectAtIndex:i]; 70 71 pluginInfo.name = [plugin name]; 72 pluginInfo.file = [plugin filename]; 73 pluginInfo.desc = [plugin pluginDescription]; 74 pluginInfo.mimes = [plugin mimeTypes]; 75 76 plugins.append(pluginInfo); 69 plugins.append([plugin pluginInfo]); 77 70 } 78 71
Note: See TracChangeset
for help on using the changeset viewer.