Diff
Modified: trunk/Source/WebCore/ChangeLog (185293 => 185294)
--- trunk/Source/WebCore/ChangeLog 2015-06-06 20:01:09 UTC (rev 185293)
+++ trunk/Source/WebCore/ChangeLog 2015-06-06 21:22:18 UTC (rev 185294)
@@ -1,3 +1,16 @@
+2015-06-06 Anders Carlsson <[email protected]>
+
+ Remove support from getting plug-in information from Carbon resources
+ https://bugs.webkit.org/show_bug.cgi?id=145730
+
+ Reviewed by Dan Bernstein.
+
+ Remove a now unused function.
+
+ * platform/mac/WebCoreNSStringExtras.h:
+ * platform/mac/WebCoreNSStringExtras.mm:
+ (stringEncodingForResource): Deleted.
+
2015-06-06 Commit Queue <[email protected]>
Unreviewed, rolling out r185284.
Modified: trunk/Source/WebCore/platform/mac/WebCoreNSStringExtras.h (185293 => 185294)
--- trunk/Source/WebCore/platform/mac/WebCoreNSStringExtras.h 2015-06-06 20:01:09 UTC (rev 185293)
+++ trunk/Source/WebCore/platform/mac/WebCoreNSStringExtras.h 2015-06-06 21:22:18 UTC (rev 185294)
@@ -44,9 +44,6 @@
WEBCORE_EXPORT BOOL hasCaseInsensitivePrefix(NSString *, NSString *prefix);
WEBCORE_EXPORT BOOL hasCaseInsensitiveSubstring(NSString *, NSString *substring);
WEBCORE_EXPORT NSString *filenameByFixingIllegalCharacters(NSString *);
-#if !PLATFORM(IOS)
-WEBCORE_EXPORT CFStringEncoding stringEncodingForResource(Handle resource);
-#endif
WEBCORE_EXPORT NSString *preferredBundleLocalizationName();
NSString *canonicalLocaleName(NSString *);
Modified: trunk/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm (185293 => 185294)
--- trunk/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm 2015-06-06 20:01:09 UTC (rev 185293)
+++ trunk/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm 2015-06-06 21:22:18 UTC (rev 185294)
@@ -74,63 +74,6 @@
return filename;
}
-#if !PLATFORM(IOS)
-
-#if COMPILER(CLANG)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-#endif
-
-CFStringEncoding stringEncodingForResource(Handle resource)
-{
- short resRef = HomeResFile(resource);
- if (ResError() != noErr)
- return NSMacOSRomanStringEncoding;
-
- // Get the FSRef for the current resource file
- FSRef fref;
- OSStatus error = FSGetForkCBInfo(resRef, 0, NULL, NULL, NULL, &fref, NULL);
- if (error != noErr)
- return NSMacOSRomanStringEncoding;
-
- RetainPtr<CFURLRef> url = "" &fref));
- if (!url)
- return NSMacOSRomanStringEncoding;
-
- NSString *path = [(NSURL *)url.get() path];
-
- // Get the lproj directory name
- path = [path stringByDeletingLastPathComponent];
- if (!stringIsCaseInsensitiveEqualToString([path pathExtension], @"lproj"))
- return NSMacOSRomanStringEncoding;
-
- NSString *directoryName = [[path stringByDeletingPathExtension] lastPathComponent];
- RetainPtr<CFStringRef> locale = adoptCF(CFLocaleCreateCanonicalLocaleIdentifierFromString(NULL, (CFStringRef)directoryName));
- if (!locale)
- return NSMacOSRomanStringEncoding;
-
- LangCode lang;
- RegionCode region;
- error = LocaleStringToLangAndRegionCodes([(NSString *)locale.get() UTF8String], &lang, ®ion);
- if (error != noErr)
- return NSMacOSRomanStringEncoding;
-
- TextEncoding encoding;
- error = UpgradeScriptInfoToTextEncoding(kTextScriptDontCare, lang, region, NULL, &encoding);
- if (error != noErr)
- return NSMacOSRomanStringEncoding;
-
- return encoding;
-}
-
-#if COMPILER(CLANG)
-#pragma clang diagnostic pop
-#endif
-
-#endif // !PLATFORM(IOS)
-
-
-
NSString *preferredBundleLocalizationName()
{
// FIXME: Any use of this function to pass localizations to another
Modified: trunk/Source/WebKit/mac/ChangeLog (185293 => 185294)
--- trunk/Source/WebKit/mac/ChangeLog 2015-06-06 20:01:09 UTC (rev 185293)
+++ trunk/Source/WebKit/mac/ChangeLog 2015-06-06 21:22:18 UTC (rev 185294)
@@ -1,5 +1,24 @@
2015-06-06 Anders Carlsson <[email protected]>
+ Remove support from getting plug-in information from Carbon resources
+ https://bugs.webkit.org/show_bug.cgi?id=145730
+
+ Reviewed by Dan Bernstein.
+
+ No current plug-in versions use this feature, and both Chrome and Mozilla for
+ Mac stopped looking at Carbon resources years ago.
+
+ * Misc/WebKitNSStringExtras.h:
+ * Misc/WebKitNSStringExtras.mm:
+ (+[NSString _web_encodingForResource:]): Deleted.
+ * Plugins/WebBasePluginPackage.mm:
+ * Plugins/WebNetscapePluginPackage.mm:
+ (-[WebNetscapePluginPackage _initWithPath:]):
+ (-[WebNetscapePluginPackage stringForStringListID:andIndex:]): Deleted.
+ (-[WebNetscapePluginPackage getPluginInfoFromResources]): Deleted.
+
+2015-06-06 Anders Carlsson <[email protected]>
+
Remove now unused category methods
https://bugs.webkit.org/show_bug.cgi?id=145729
Modified: trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.h (185293 => 185294)
--- trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.h 2015-06-06 20:01:09 UTC (rev 185293)
+++ trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.h 2015-06-06 21:22:18 UTC (rev 185294)
@@ -50,10 +50,6 @@
- (NSString *)_web_stringByStrippingReturnCharacters;
-#if !TARGET_OS_IPHONE
-+ (NSStringEncoding)_web_encodingForResource:(Handle)resource;
-#endif
-
- (BOOL)_webkit_isCaseInsensitiveEqualToString:(NSString *)string;
- (BOOL)_webkit_hasCaseInsensitivePrefix:(NSString *)suffix;
- (BOOL)_webkit_hasCaseInsensitiveSuffix:(NSString *)suffix;
Modified: trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm (185293 => 185294)
--- trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm 2015-06-06 20:01:09 UTC (rev 185293)
+++ trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm 2015-06-06 21:22:18 UTC (rev 185294)
@@ -170,13 +170,6 @@
return newString;
}
-#if !PLATFORM(IOS)
-+ (NSStringEncoding)_web_encodingForResource:(Handle)resource
-{
- return CFStringConvertEncodingToNSStringEncoding(stringEncodingForResource(resource));
-}
-#endif
-
- (BOOL)_webkit_isCaseInsensitiveEqualToString:(NSString *)string
{
return stringIsCaseInsensitiveEqualToString(self, string);
Modified: trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm (185293 => 185294)
--- trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm 2015-06-06 20:01:09 UTC (rev 185293)
+++ trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm 2015-06-06 21:22:18 UTC (rev 185294)
@@ -33,7 +33,6 @@
#import "WebNetscapePluginPackage.h"
#import "WebPluginPackage.h"
#import "WebTypesInternal.h"
-#import <WebCore/WebCoreNSStringExtras.h>
#import <WebCore/WebCoreObjCExtras.h>
#import <algorithm>
#import <mach-o/arch.h>
Modified: trunk/Source/WebKit/mac/Plugins/WebNetscapePluginPackage.mm (185293 => 185294)
--- trunk/Source/WebKit/mac/Plugins/WebNetscapePluginPackage.mm 2015-06-06 20:01:09 UTC (rev 185293)
+++ trunk/Source/WebKit/mac/Plugins/WebNetscapePluginPackage.mm 2015-06-06 21:22:18 UTC (rev 185294)
@@ -45,10 +45,6 @@
using namespace WebCore;
-#define PluginNameOrDescriptionStringNumber 126
-#define MIMEDescriptionStringNumber 127
-#define MIMEListStringStringNumber 128
-
@interface WebNetscapePluginPackage (Internal)
- (void)_unloadWithShutdown:(BOOL)shutdown;
@end
@@ -65,101 +61,6 @@
CFBundleCloseBundleResourceMap(cfBundle.get(), resRef);
}
-#if COMPILER(CLANG)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-#endif
-
-- (NSString *)stringForStringListID:(SInt16)stringListID andIndex:(SInt16)index
-{
- // Get resource, and dereference the handle.
- Handle stringHandle = Get1Resource('STR#', stringListID);
- if (stringHandle == NULL) {
- return nil;
- }
- unsigned char *p = (unsigned char *)*stringHandle;
- if (!p)
- return nil;
-
- // Check the index against the length of the string list, then skip the length.
- if (index < 1 || index > *(SInt16 *)p)
- return nil;
- p += sizeof(SInt16);
-
- // Skip any strings that come before the one we are looking for.
- while (--index)
- p += 1 + *p;
-
- // Convert the one we found into an NSString.
- return [[[NSString alloc] initWithBytes:(p + 1) length:*p encoding:[NSString _web_encodingForResource:stringHandle]] autorelease];
-}
-
-- (BOOL)getPluginInfoFromResources
-{
- SInt16 resRef = [self openResourceFile];
- if (resRef == -1)
- return NO;
-
- UseResFile(resRef);
- if (ResError() != noErr)
- return NO;
-
- NSString *MIME, *extensionsList, *description;
- NSArray *extensions;
- unsigned i;
-
- for (i=1; 1; i+=2) {
- MIME = [[self stringForStringListID:MIMEListStringStringNumber
- andIndex:i] lowercaseString];
- if (!MIME)
- break;
-
- MimeClassInfo mimeClassInfo;
- mimeClassInfo.type = String(MIME).lower();
-
- extensionsList = [[self stringForStringListID:MIMEListStringStringNumber andIndex:i+1] lowercaseString];
- if (extensionsList) {
- extensions = [extensionsList componentsSeparatedByString:@","];
- for (NSUInteger j = 0; j < [extensions count]; ++j)
- mimeClassInfo.extensions.append((NSString *)[extensions objectAtIndex:j]);
- }
-
- description = [self stringForStringListID:MIMEDescriptionStringNumber
- andIndex:pluginInfo.mimes.size() + 1];
- mimeClassInfo.desc = description;
-
- pluginInfo.mimes.append(mimeClassInfo);
- }
-
- NSString *filename = [(NSString *)path lastPathComponent];
- pluginInfo.file = filename;
-
- description = [self stringForStringListID:PluginNameOrDescriptionStringNumber andIndex:1];
- if (!description)
- description = filename;
- pluginInfo.desc = description;
-
-
- NSString *theName = [self stringForStringListID:PluginNameOrDescriptionStringNumber andIndex:2];
- if (!theName)
- theName = filename;
- pluginInfo.name = theName;
-
- pluginInfo.isApplicationPlugin = false;
- pluginInfo.clientLoadPolicy = PluginLoadClientPolicyUndefined;
-#if PLATFORM(MAC)
- pluginInfo.bundleIdentifier = self.bundleIdentifier;
- pluginInfo.versionString = self.bundleVersion;
-#endif
-
- [self closeResourceFile:resRef];
-
- return YES;
-}
-#if COMPILER(CLANG)
-#pragma clang diagnostic pop
-#endif
-
- (BOOL)_initWithPath:(NSString *)pluginPath
{
resourceRef = -1;
@@ -196,7 +97,7 @@
#endif
- if (![self getPluginInfoFromPLists] && ![self getPluginInfoFromResources])
+ if (![self getPluginInfoFromPLists])
return NO;
return YES;
Modified: trunk/Source/WebKit2/ChangeLog (185293 => 185294)
--- trunk/Source/WebKit2/ChangeLog 2015-06-06 20:01:09 UTC (rev 185293)
+++ trunk/Source/WebKit2/ChangeLog 2015-06-06 21:22:18 UTC (rev 185294)
@@ -1,3 +1,21 @@
+2015-06-06 Anders Carlsson <[email protected]>
+
+ Remove support from getting plug-in information from Carbon resources
+ https://bugs.webkit.org/show_bug.cgi?id=145730
+
+ Reviewed by Dan Bernstein.
+
+ No current plug-in versions use this feature, and both Chrome and Mozilla for
+ Mac stopped looking at Carbon resources years ago.
+
+ * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
+ (WebKit::NetscapePluginModule::getPluginInfo):
+ (WebKit::ResourceMap::ResourceMap): Deleted.
+ (WebKit::ResourceMap::~ResourceMap): Deleted.
+ (WebKit::ResourceMap::isValid): Deleted.
+ (WebKit::getStringListResource): Deleted.
+ (WebKit::getPluginInfoFromCarbonResources): Deleted.
+
2015-06-05 Anders Carlsson <[email protected]>
Only allow plug-ins to create custom MIME property lists on older versions of OS X
Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm (185293 => 185294)
--- trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm 2015-06-06 20:01:09 UTC (rev 185293)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm 2015-06-06 21:22:18 UTC (rev 185294)
@@ -30,7 +30,6 @@
#import "PluginProcessProxy.h"
#import "PluginSandboxProfile.h"
-#import <WebCore/WebCoreNSStringExtras.h>
#import <wtf/HashSet.h>
#import <wtf/MainThread.h>
@@ -218,139 +217,6 @@
return true;
}
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-
-class ResourceMap {
-public:
- explicit ResourceMap(CFBundleRef bundle)
- : m_bundle(bundle)
- , m_currentResourceFile(CurResFile())
- , m_bundleResourceMap(CFBundleOpenBundleResourceMap(m_bundle))
- {
- UseResFile(m_bundleResourceMap);
- }
-
- ~ResourceMap()
- {
- // Close the resource map.
- CFBundleCloseBundleResourceMap(m_bundle, m_bundleResourceMap);
-
- // And restore the old resource.
- UseResFile(m_currentResourceFile);
- }
-
- bool isValid() const { return m_bundleResourceMap != -1; }
-
-private:
- CFBundleRef m_bundle;
- ResFileRefNum m_currentResourceFile;
- ResFileRefNum m_bundleResourceMap;
-};
-
-static bool getStringListResource(ResID resourceID, Vector<String>& stringList) {
- Handle stringListHandle = Get1Resource('STR#', resourceID);
- if (!stringListHandle || !*stringListHandle)
- return false;
-
- // Get the string list size.
- Size stringListSize = GetHandleSize(stringListHandle);
- if (stringListSize < static_cast<Size>(sizeof(UInt16)))
- return false;
-
- CFStringEncoding stringEncoding = stringEncodingForResource(stringListHandle);
-
- unsigned char* ptr = reinterpret_cast<unsigned char*>(*stringListHandle);
- unsigned char* end = ptr + stringListSize;
-
- // Get the number of strings in the string list.
- UInt16 numStrings = *reinterpret_cast<UInt16*>(ptr);
- ptr += sizeof(UInt16);
-
- for (UInt16 i = 0; i < numStrings; ++i) {
- // We're past the end of the string, bail.
- if (ptr >= end)
- return false;
-
- // Get the string length.
- unsigned char stringLength = *ptr++;
-
- RetainPtr<CFStringRef> cfString = adoptCF(CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, ptr, stringLength, stringEncoding, false, kCFAllocatorNull));
- if (!cfString.get())
- return false;
-
- stringList.append(cfString.get());
- ptr += stringLength;
- }
-
- if (ptr != end)
- return false;
-
- return true;
-}
-
-#pragma clang diagnostic pop
-
-static const ResID PluginNameOrDescriptionStringNumber = 126;
-static const ResID MIMEDescriptionStringNumber = 127;
-static const ResID MIMEListStringStringNumber = 128;
-
-static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginModuleInfo& plugin)
-{
- ASSERT(RunLoop::isMain());
-
- ResourceMap resourceMap(bundle);
- if (!resourceMap.isValid())
- return false;
-
- // Get the description and name string list.
- Vector<String> descriptionAndName;
- if (!getStringListResource(PluginNameOrDescriptionStringNumber, descriptionAndName))
- return false;
-
- // Get the MIME types and extensions string list. This list needs to be a multiple of two.
- Vector<String> mimeTypesAndExtensions;
- if (!getStringListResource(MIMEListStringStringNumber, mimeTypesAndExtensions))
- return false;
-
- if (mimeTypesAndExtensions.size() % 2)
- return false;
-
- // Now get the MIME type descriptions string list. This string list needs to be the same length as the number of MIME types.
- Vector<String> mimeTypeDescriptions;
- if (!getStringListResource(MIMEDescriptionStringNumber, mimeTypeDescriptions))
- return false;
-
- // Add all MIME types.
- for (size_t i = 0; i < mimeTypesAndExtensions.size() / 2; ++i) {
- MimeClassInfo mimeClassInfo;
-
- const String& mimeType = mimeTypesAndExtensions[i * 2];
- String description;
- if (i < mimeTypeDescriptions.size())
- description = mimeTypeDescriptions[i];
-
- mimeClassInfo.type = mimeType.lower();
- mimeClassInfo.desc = description;
-
- Vector<String> extensions;
- mimeTypesAndExtensions[i * 2 + 1].split(',', extensions);
-
- for (size_t i = 0; i < extensions.size(); ++i)
- mimeClassInfo.extensions.append(extensions[i].lower());
-
- plugin.info.mimes.append(mimeClassInfo);
- }
-
- // Set the description and name if they exist.
- if (descriptionAndName.size() > 0)
- plugin.info.desc = descriptionAndName[0];
- if (descriptionAndName.size() > 1)
- plugin.info.name = descriptionAndName[1];
-
- return true;
-}
-
bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
{
RetainPtr<CFURLRef> bundleURL = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false));
@@ -387,9 +253,7 @@
plugin.preferencePanePath = static_cast<CFStringRef>(preferencePathTypeRef);
}
- // Check that there's valid info for this plug-in.
- if (!getPluginInfoFromPropertyLists(bundle.get(), plugin) &&
- !getPluginInfoFromCarbonResources(bundle.get(), plugin))
+ if (!getPluginInfoFromPropertyLists(bundle.get(), plugin))
return false;
plugin.hasSandboxProfile = pluginHasSandboxProfile(plugin.bundleIdentifier);