[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
mitz at apple.com
mitz at apple.com
Tue Jan 5 23:41:12 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 2aee82cf5757764263986ff629c4d7154eacdfe1
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 3 00:22:38 2009 +0000
Fixed <rdar://problem/7254127> WebKit can load plug-ins even when
plug-ins are disabled
Reviewed by Anders Carlsson.
Ensure that the shared WebPluginDatabase is not instantiated if no
WebViews are used that have plug-ins enabled.
* DefaultDelegates/WebDefaultPolicyDelegate.m:
(-[WebDefaultPolicyDelegate webView:decidePolicyForMIMEType:request:frame:decisionListener:]):
Call -[WebView _canShowMIMEType:] on the WebView instead of calling the
class method.
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::canShowMIMEType): Ditto.
(WebFrameLoaderClient::transitionToCommittedForNewPage): Call
-[WebFrameView _viewClassForMIMEType:] on the WebView instead of calling
the class method.
(WebFrameLoaderClient::objectContentType): Ditto.
* WebView/WebDataSource.mm:
(+[WebDataSource _representationClassForMIMEType:allowingPlugins:]):
Added the allowPlugins parameter, which is passed through to
+[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:].
(-[WebDataSource _makeRepresentation]): Pass an allowPlugins value
based on the WebView’s preferences.
* WebView/WebFrameView.mm:
(-[WebFrameView _makeDocumentViewForDataSource:]): Call
-[WebFrameView _viewClassForMIMEType:] instead of calling the class
method.
(+[WebFrameView _viewClassForMIMEType:allowingPlugins:]): Added the
allowPlugins parameter, which is passed through to
+[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:].
(-[WebFrameView _viewClassForMIMEType:]): Added. Passes an allowPlugins
value based on the WebView’s preferences.
* WebView/WebFrameViewInternal.h:
* WebView/WebView.mm:
(+[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:]):
Added the allowPlugins parameter. If false, skip the instantiation of
the shared WebPluginDatabase.
(-[WebView _viewClass:andRepresentationClass:forMIMEType:]): Pass an
allowPlugins value based on the WebView’s preferences.
(+[WebView _canShowMIMEType:allowingPlugins:]): Passes allowPlugins to
+_viewClass:andRepresentationClass:forMIMEType:allowingPlugins:.
(+[WebView canShowMIMEType:]): Changed to pass YES to
+_canShowMIMEType:allowingPlugins:.
(-[WebView _canShowMIMEType:]): Added. Passes an allowPlugins value
based on the WebView’s preferences.
(-[WebView _pluginForMIMEType:]): Return nil if plug-ins are disabled.
(-[WebView _pluginForExtension:]): Ditto.
(-[WebView _isMIMETypeRegisteredAsPlugin:]): Return NO if plug-ins are
disabled.
* WebView/WebViewInternal.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 2853bf9..e7e9daa 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,61 @@
+2009-12-02 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Fixed <rdar://problem/7254127> WebKit can load plug-ins even when
+ plug-ins are disabled
+
+ Ensure that the shared WebPluginDatabase is not instantiated if no
+ WebViews are used that have plug-ins enabled.
+
+ * DefaultDelegates/WebDefaultPolicyDelegate.m:
+ (-[WebDefaultPolicyDelegate webView:decidePolicyForMIMEType:request:frame:decisionListener:]):
+ Call -[WebView _canShowMIMEType:] on the WebView instead of calling the
+ class method.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::canShowMIMEType): Ditto.
+ (WebFrameLoaderClient::transitionToCommittedForNewPage): Call
+ -[WebFrameView _viewClassForMIMEType:] on the WebView instead of calling
+ the class method.
+ (WebFrameLoaderClient::objectContentType): Ditto.
+
+ * WebView/WebDataSource.mm:
+ (+[WebDataSource _representationClassForMIMEType:allowingPlugins:]):
+ Added the allowPlugins parameter, which is passed through to
+ +[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:].
+ (-[WebDataSource _makeRepresentation]): Pass an allowPlugins value
+ based on the WebView’s preferences.
+
+ * WebView/WebFrameView.mm:
+ (-[WebFrameView _makeDocumentViewForDataSource:]): Call
+ -[WebFrameView _viewClassForMIMEType:] instead of calling the class
+ method.
+ (+[WebFrameView _viewClassForMIMEType:allowingPlugins:]): Added the
+ allowPlugins parameter, which is passed through to
+ +[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:].
+ (-[WebFrameView _viewClassForMIMEType:]): Added. Passes an allowPlugins
+ value based on the WebView’s preferences.
+
+ * WebView/WebFrameViewInternal.h:
+ * WebView/WebView.mm:
+ (+[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:]):
+ Added the allowPlugins parameter. If false, skip the instantiation of
+ the shared WebPluginDatabase.
+ (-[WebView _viewClass:andRepresentationClass:forMIMEType:]): Pass an
+ allowPlugins value based on the WebView’s preferences.
+ (+[WebView _canShowMIMEType:allowingPlugins:]): Passes allowPlugins to
+ +_viewClass:andRepresentationClass:forMIMEType:allowingPlugins:.
+ (+[WebView canShowMIMEType:]): Changed to pass YES to
+ +_canShowMIMEType:allowingPlugins:.
+ (-[WebView _canShowMIMEType:]): Added. Passes an allowPlugins value
+ based on the WebView’s preferences.
+ (-[WebView _pluginForMIMEType:]): Return nil if plug-ins are disabled.
+ (-[WebView _pluginForExtension:]): Ditto.
+ (-[WebView _isMIMETypeRegisteredAsPlugin:]): Return NO if plug-ins are
+ disabled.
+ * WebView/WebViewInternal.h:
+
2009-12-02 Timothy Hatcher <timothy at apple.com>
Fixes a crash when scrolling a frame that goes away mid-scroll.
diff --git a/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m b/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m
index c832993..6de2792 100644
--- a/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m
+++ b/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m
@@ -66,11 +66,11 @@ static WebDefaultPolicyDelegate *sharedDelegate = nil;
BOOL isDirectory = NO;
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:[[request URL] path] isDirectory:&isDirectory];
- if (exists && !isDirectory && [WebView canShowMIMEType:type])
+ if (exists && !isDirectory && [wv _canShowMIMEType:type])
[listener use];
else
[listener ignore];
- } else if ([WebView canShowMIMEType:type])
+ } else if ([wv _canShowMIMEType:type])
[listener use];
else
[listener ignore];
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index b3aa1ce..06fa2e5 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -953,7 +953,7 @@ bool WebFrameLoaderClient::canHandleRequest(const ResourceRequest& request) cons
bool WebFrameLoaderClient::canShowMIMEType(const String& MIMEType) const
{
- return [WebView canShowMIMEType:MIMEType];
+ return [getWebView(m_webFrame.get()) _canShowMIMEType:MIMEType];
}
bool WebFrameLoaderClient::representationExistsForURLScheme(const String& URLScheme) const
@@ -1117,7 +1117,7 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage()
if (usesDocumentViews) {
// FIXME (Viewless): I assume we want the equivalent of this optimization for viewless mode too.
- bool willProduceHTMLView = [[WebFrameView class] _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
+ bool willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
bool canSkipCreation = core(m_webFrame.get())->loader()->committingFirstRealLoad() && willProduceHTMLView;
if (canSkipCreation) {
[[m_webFrame->_private->webFrameView documentView] setDataSource:dataSource];
@@ -1365,7 +1365,7 @@ ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const
return ObjectContentOtherPlugin;
}
- if ([WebFrameView _viewClassForMIMEType:type])
+ if ([m_webFrame->_private->webFrameView _viewClassForMIMEType:type])
return ObjectContentFrame;
return ObjectContentNone;
diff --git a/WebKit/mac/WebView/WebDataSource.mm b/WebKit/mac/WebView/WebDataSource.mm
index b83139d..ecd89f7 100644
--- a/WebKit/mac/WebView/WebDataSource.mm
+++ b/WebKit/mac/WebView/WebDataSource.mm
@@ -140,10 +140,10 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
}
}
-+ (Class)_representationClassForMIMEType:(NSString *)MIMEType
++ (Class)_representationClassForMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins
{
Class repClass;
- return [WebView _viewClass:nil andRepresentationClass:&repClass forMIMEType:MIMEType] ? repClass : nil;
+ return [WebView _viewClass:nil andRepresentationClass:&repClass forMIMEType:MIMEType allowingPlugins:allowPlugins] ? repClass : nil;
}
@end
@@ -340,7 +340,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
- (void)_makeRepresentation
{
- Class repClass = [[self class] _representationClassForMIMEType:[self _responseMIMEType]];
+ Class repClass = [[self class] _representationClassForMIMEType:[self _responseMIMEType] allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]];
// Check if the data source was already bound?
if (![[self representation] isKindOfClass:repClass]) {
diff --git a/WebKit/mac/WebView/WebFrameView.mm b/WebKit/mac/WebView/WebFrameView.mm
index 8ddaa95..4638418 100644
--- a/WebKit/mac/WebView/WebFrameView.mm
+++ b/WebKit/mac/WebView/WebFrameView.mm
@@ -156,7 +156,7 @@ enum {
NSString* MIMEType = [dataSource _responseMIMEType];
if (!MIMEType)
MIMEType = @"text/html";
- Class viewClass = [[self class] _viewClassForMIMEType:MIMEType];
+ Class viewClass = [self _viewClassForMIMEType:MIMEType];
NSView <WebDocumentView> *documentView;
if (viewClass) {
// If the dataSource's representation has already been created, and it is also the
@@ -244,10 +244,15 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
return [[[self _viewTypesAllowImageTypeOmission:YES] _webkit_objectForMIMEType:MIMEType] isSubclassOfClass:[WebHTMLView class]];
}
-+ (Class)_viewClassForMIMEType:(NSString *)MIMEType
++ (Class)_viewClassForMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins
{
Class viewClass;
- return [WebView _viewClass:&viewClass andRepresentationClass:nil forMIMEType:MIMEType] ? viewClass : nil;
+ return [WebView _viewClass:&viewClass andRepresentationClass:nil forMIMEType:MIMEType allowingPlugins:allowPlugins] ? viewClass : nil;
+}
+
+- (Class)_viewClassForMIMEType:(NSString *)MIMEType
+{
+ return [[self class] _viewClassForMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]];
}
- (void)_install
diff --git a/WebKit/mac/WebView/WebFrameViewInternal.h b/WebKit/mac/WebView/WebFrameViewInternal.h
index 726b62e..9d7fd80 100644
--- a/WebKit/mac/WebView/WebFrameViewInternal.h
+++ b/WebKit/mac/WebView/WebFrameViewInternal.h
@@ -39,7 +39,8 @@
- (void)_setWebFrame:(WebFrame *)webFrame;
- (float)_verticalPageScrollDistance;
+ (NSMutableDictionary *)_viewTypesAllowImageTypeOmission:(BOOL)allowImageTypeOmission;
-+ (Class)_viewClassForMIMEType:(NSString *)MIMEType;
+- (Class)_viewClassForMIMEType:(NSString *)MIMEType;
++ (Class)_viewClassForMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins;
+ (BOOL)_canShowMIMETypeAsHTML:(NSString *)MIMEType;
- (WebDynamicScrollBarsView *)_scrollView;
- (void)_install;
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 68208f6..14297b0 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -822,13 +822,13 @@ static bool runningTigerMail()
return uniqueExtensions;
}
-+ (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType
++ (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins
{
MIMEType = [MIMEType lowercaseString];
Class viewClass = [[WebFrameView _viewTypesAllowImageTypeOmission:YES] _webkit_objectForMIMEType:MIMEType];
Class repClass = [[WebDataSource _repTypesAllowImageTypeOmission:YES] _webkit_objectForMIMEType:MIMEType];
- if (!viewClass || !repClass || [[WebPDFView supportedMIMETypes] containsObject:MIMEType]) {
+ if (allowPlugins && (!viewClass || !repClass || [[WebPDFView supportedMIMETypes] containsObject:MIMEType])) {
// Our optimization to avoid loading the plug-in DB and image types for the HTML case failed.
// Load the plug-in DB allowing plug-ins to install types.
[WebPluginDatabase sharedDatabase];
@@ -857,7 +857,7 @@ static bool runningTigerMail()
- (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType
{
- if ([[self class] _viewClass:vClass andRepresentationClass:rClass forMIMEType:MIMEType])
+ if ([[self class] _viewClass:vClass andRepresentationClass:rClass forMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]])
return YES;
if (_private->pluginDatabase) {
@@ -2379,13 +2379,26 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
PageGroup::closeLocalStorage();
}
++ (BOOL)_canShowMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins
+{
+ return [self _viewClass:nil andRepresentationClass:nil forMIMEType:MIMEType allowingPlugins:allowPlugins];
+}
+
+ (BOOL)canShowMIMEType:(NSString *)MIMEType
{
- return [self _viewClass:nil andRepresentationClass:nil forMIMEType:MIMEType];
+ return [self _canShowMIMEType:MIMEType allowingPlugins:YES];
+}
+
+- (BOOL)_canShowMIMEType:(NSString *)MIMEType
+{
+ return [[self class] _canShowMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]];
}
- (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType
{
+ if (![_private->preferences arePlugInsEnabled])
+ return nil;
+
WebBasePluginPackage *pluginPackage = [[WebPluginDatabase sharedDatabase] pluginForMIMEType:MIMEType];
if (pluginPackage)
return pluginPackage;
@@ -2398,6 +2411,9 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
- (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension
{
+ if (![_private->preferences arePlugInsEnabled])
+ return nil;
+
WebBasePluginPackage *pluginPackage = [[WebPluginDatabase sharedDatabase] pluginForExtension:extension];
if (pluginPackage)
return pluginPackage;
@@ -2429,6 +2445,9 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
- (BOOL)_isMIMETypeRegisteredAsPlugin:(NSString *)MIMEType
{
+ if (![_private->preferences arePlugInsEnabled])
+ return NO;
+
if ([[WebPluginDatabase sharedDatabase] isMIMETypeRegistered:MIMEType])
return YES;
diff --git a/WebKit/mac/WebView/WebViewInternal.h b/WebKit/mac/WebView/WebViewInternal.h
index 0665831..3b1195d 100644
--- a/WebKit/mac/WebView/WebViewInternal.h
+++ b/WebKit/mac/WebView/WebViewInternal.h
@@ -115,8 +115,10 @@ namespace WebCore {
- (void)_pushPerformingProgrammaticFocus;
- (void)_popPerformingProgrammaticFocus;
- (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame;
-+ (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
++ (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins;
- (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
++ (BOOL)_canShowMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins;
+- (BOOL)_canShowMIMEType:(NSString *)MIMEType;
+ (NSString *)_MIMETypeForFile:(NSString *)path;
- (WebDownload *)_downloadURL:(NSURL *)URL;
+ (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list