Changeset 51617 in webkit
- Timestamp:
- Dec 2, 2009 4:22:38 PM (14 years ago)
- Location:
- trunk/WebKit/mac
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/mac/ChangeLog
r51616 r51617 1 2009-12-02 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Anders Carlsson. 4 5 Fixed <rdar://problem/7254127> WebKit can load plug-ins even when 6 plug-ins are disabled 7 8 Ensure that the shared WebPluginDatabase is not instantiated if no 9 WebViews are used that have plug-ins enabled. 10 11 * DefaultDelegates/WebDefaultPolicyDelegate.m: 12 (-[WebDefaultPolicyDelegate webView:decidePolicyForMIMEType:request:frame:decisionListener:]): 13 Call -[WebView _canShowMIMEType:] on the WebView instead of calling the 14 class method. 15 16 * WebCoreSupport/WebFrameLoaderClient.mm: 17 (WebFrameLoaderClient::canShowMIMEType): Ditto. 18 (WebFrameLoaderClient::transitionToCommittedForNewPage): Call 19 -[WebFrameView _viewClassForMIMEType:] on the WebView instead of calling 20 the class method. 21 (WebFrameLoaderClient::objectContentType): Ditto. 22 23 * WebView/WebDataSource.mm: 24 (+[WebDataSource _representationClassForMIMEType:allowingPlugins:]): 25 Added the allowPlugins parameter, which is passed through to 26 +[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:]. 27 (-[WebDataSource _makeRepresentation]): Pass an allowPlugins value 28 based on the WebView’s preferences. 29 30 * WebView/WebFrameView.mm: 31 (-[WebFrameView _makeDocumentViewForDataSource:]): Call 32 -[WebFrameView _viewClassForMIMEType:] instead of calling the class 33 method. 34 (+[WebFrameView _viewClassForMIMEType:allowingPlugins:]): Added the 35 allowPlugins parameter, which is passed through to 36 +[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:]. 37 (-[WebFrameView _viewClassForMIMEType:]): Added. Passes an allowPlugins 38 value based on the WebView’s preferences. 39 40 * WebView/WebFrameViewInternal.h: 41 * WebView/WebView.mm: 42 (+[WebView _viewClass:andRepresentationClass:forMIMEType:allowingPlugins:]): 43 Added the allowPlugins parameter. If false, skip the instantiation of 44 the shared WebPluginDatabase. 45 (-[WebView _viewClass:andRepresentationClass:forMIMEType:]): Pass an 46 allowPlugins value based on the WebView’s preferences. 47 (+[WebView _canShowMIMEType:allowingPlugins:]): Passes allowPlugins to 48 +_viewClass:andRepresentationClass:forMIMEType:allowingPlugins:. 49 (+[WebView canShowMIMEType:]): Changed to pass YES to 50 +_canShowMIMEType:allowingPlugins:. 51 (-[WebView _canShowMIMEType:]): Added. Passes an allowPlugins value 52 based on the WebView’s preferences. 53 (-[WebView _pluginForMIMEType:]): Return nil if plug-ins are disabled. 54 (-[WebView _pluginForExtension:]): Ditto. 55 (-[WebView _isMIMETypeRegisteredAsPlugin:]): Return NO if plug-ins are 56 disabled. 57 * WebView/WebViewInternal.h: 58 1 59 2009-12-02 Timothy Hatcher <timothy@apple.com> 2 60 -
trunk/WebKit/mac/DefaultDelegates/WebDefaultPolicyDelegate.m
r36880 r51617 67 67 BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:[[request URL] path] isDirectory:&isDirectory]; 68 68 69 if (exists && !isDirectory && [ WebViewcanShowMIMEType:type])69 if (exists && !isDirectory && [wv _canShowMIMEType:type]) 70 70 [listener use]; 71 71 else 72 72 [listener ignore]; 73 } else if ([ WebViewcanShowMIMEType:type])73 } else if ([wv _canShowMIMEType:type]) 74 74 [listener use]; 75 75 else -
trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
r51562 r51617 954 954 bool WebFrameLoaderClient::canShowMIMEType(const String& MIMEType) const 955 955 { 956 return [ WebViewcanShowMIMEType:MIMEType];956 return [getWebView(m_webFrame.get()) _canShowMIMEType:MIMEType]; 957 957 } 958 958 … … 1118 1118 if (usesDocumentViews) { 1119 1119 // FIXME (Viewless): I assume we want the equivalent of this optimization for viewless mode too. 1120 bool willProduceHTMLView = [ [WebFrameView class]_viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];1120 bool willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class]; 1121 1121 bool canSkipCreation = core(m_webFrame.get())->loader()->committingFirstRealLoad() && willProduceHTMLView; 1122 1122 if (canSkipCreation) { … … 1366 1366 } 1367 1367 1368 if ([ WebFrameView _viewClassForMIMEType:type])1368 if ([m_webFrame->_private->webFrameView _viewClassForMIMEType:type]) 1369 1369 return ObjectContentFrame; 1370 1370 -
trunk/WebKit/mac/WebView/WebDataSource.mm
r46786 r51617 141 141 } 142 142 143 + (Class)_representationClassForMIMEType:(NSString *)MIMEType 143 + (Class)_representationClassForMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins 144 144 { 145 145 Class repClass; 146 return [WebView _viewClass:nil andRepresentationClass:&repClass forMIMEType:MIMEType ] ? repClass : nil;146 return [WebView _viewClass:nil andRepresentationClass:&repClass forMIMEType:MIMEType allowingPlugins:allowPlugins] ? repClass : nil; 147 147 } 148 148 @end … … 341 341 - (void)_makeRepresentation 342 342 { 343 Class repClass = [[self class] _representationClassForMIMEType:[self _responseMIMEType] ];343 Class repClass = [[self class] _representationClassForMIMEType:[self _responseMIMEType] allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]]; 344 344 345 345 // Check if the data source was already bound? -
trunk/WebKit/mac/WebView/WebFrameView.mm
r50665 r51617 157 157 if (!MIMEType) 158 158 MIMEType = @"text/html"; 159 Class viewClass = [ [self class]_viewClassForMIMEType:MIMEType];159 Class viewClass = [self _viewClassForMIMEType:MIMEType]; 160 160 NSView <WebDocumentView> *documentView; 161 161 if (viewClass) { … … 245 245 } 246 246 247 + (Class)_viewClassForMIMEType:(NSString *)MIMEType 247 + (Class)_viewClassForMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins 248 248 { 249 249 Class viewClass; 250 return [WebView _viewClass:&viewClass andRepresentationClass:nil forMIMEType:MIMEType] ? viewClass : nil; 250 return [WebView _viewClass:&viewClass andRepresentationClass:nil forMIMEType:MIMEType allowingPlugins:allowPlugins] ? viewClass : nil; 251 } 252 253 - (Class)_viewClassForMIMEType:(NSString *)MIMEType 254 { 255 return [[self class] _viewClassForMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]]; 251 256 } 252 257 -
trunk/WebKit/mac/WebView/WebFrameViewInternal.h
r37371 r51617 40 40 - (float)_verticalPageScrollDistance; 41 41 + (NSMutableDictionary *)_viewTypesAllowImageTypeOmission:(BOOL)allowImageTypeOmission; 42 + (Class)_viewClassForMIMEType:(NSString *)MIMEType; 42 - (Class)_viewClassForMIMEType:(NSString *)MIMEType; 43 + (Class)_viewClassForMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins; 43 44 + (BOOL)_canShowMIMETypeAsHTML:(NSString *)MIMEType; 44 45 - (WebDynamicScrollBarsView *)_scrollView; -
trunk/WebKit/mac/WebView/WebView.mm
r51562 r51617 823 823 } 824 824 825 + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType 825 + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins 826 826 { 827 827 MIMEType = [MIMEType lowercaseString]; … … 829 829 Class repClass = [[WebDataSource _repTypesAllowImageTypeOmission:YES] _webkit_objectForMIMEType:MIMEType]; 830 830 831 if ( !viewClass || !repClass || [[WebPDFView supportedMIMETypes] containsObject:MIMEType]) {831 if (allowPlugins && (!viewClass || !repClass || [[WebPDFView supportedMIMETypes] containsObject:MIMEType])) { 832 832 // Our optimization to avoid loading the plug-in DB and image types for the HTML case failed. 833 833 // Load the plug-in DB allowing plug-ins to install types. … … 858 858 - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType 859 859 { 860 if ([[self class] _viewClass:vClass andRepresentationClass:rClass forMIMEType:MIMEType ])860 if ([[self class] _viewClass:vClass andRepresentationClass:rClass forMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]]) 861 861 return YES; 862 862 … … 2380 2380 } 2381 2381 2382 + (BOOL)_canShowMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins 2383 { 2384 return [self _viewClass:nil andRepresentationClass:nil forMIMEType:MIMEType allowingPlugins:allowPlugins]; 2385 } 2386 2382 2387 + (BOOL)canShowMIMEType:(NSString *)MIMEType 2383 2388 { 2384 return [self _viewClass:nil andRepresentationClass:nil forMIMEType:MIMEType]; 2389 return [self _canShowMIMEType:MIMEType allowingPlugins:YES]; 2390 } 2391 2392 - (BOOL)_canShowMIMEType:(NSString *)MIMEType 2393 { 2394 return [[self class] _canShowMIMEType:MIMEType allowingPlugins:[[[self _webView] preferences] arePlugInsEnabled]]; 2385 2395 } 2386 2396 2387 2397 - (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType 2388 2398 { 2399 if (![_private->preferences arePlugInsEnabled]) 2400 return nil; 2401 2389 2402 WebBasePluginPackage *pluginPackage = [[WebPluginDatabase sharedDatabase] pluginForMIMEType:MIMEType]; 2390 2403 if (pluginPackage) … … 2399 2412 - (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension 2400 2413 { 2414 if (![_private->preferences arePlugInsEnabled]) 2415 return nil; 2416 2401 2417 WebBasePluginPackage *pluginPackage = [[WebPluginDatabase sharedDatabase] pluginForExtension:extension]; 2402 2418 if (pluginPackage) … … 2430 2446 - (BOOL)_isMIMETypeRegisteredAsPlugin:(NSString *)MIMEType 2431 2447 { 2448 if (![_private->preferences arePlugInsEnabled]) 2449 return NO; 2450 2432 2451 if ([[WebPluginDatabase sharedDatabase] isMIMETypeRegistered:MIMEType]) 2433 2452 return YES; -
trunk/WebKit/mac/WebView/WebViewInternal.h
r51562 r51617 116 116 - (void)_popPerformingProgrammaticFocus; 117 117 - (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame; 118 + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType ;118 + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins; 119 119 - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType; 120 + (BOOL)_canShowMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins; 121 - (BOOL)_canShowMIMEType:(NSString *)MIMEType; 120 122 + (NSString *)_MIMETypeForFile:(NSString *)path; 121 123 - (WebDownload *)_downloadURL:(NSURL *)URL;
Note: See TracChangeset
for help on using the changeset viewer.