Changeset 24866 in webkit
- Timestamp:
- Aug 4, 2007 12:29:55 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r24864 r24866 1 2007-08-03 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Oliver 4 5 Fix for http://bugs.webkit.org/show_bug.cgi?id=14824 and <rdar://problem/5372989> 6 7 Two issues - 8 1 - The WebCore MIMEType registry was designed assuming the list of types would never change 9 That is false, as WebKit has API and SPI calls which directly mutate the MIMETypeRegistry 10 2 - DOMImplementation didn't consult the registry for any MIMEType that started with "text/", 11 instead maintaining it's own hard coded rules 12 13 * dom/DOMImplementation.cpp: 14 (WebCore::DOMImplementation::isTextMIMEType): For now, call through to the MIMETypeRegistry 15 until we decided a different fate for this function 16 17 * platform/MIMETypeRegistry.cpp: 18 (WebCore::initialiseSupportedNonImageMimeTypes): "SupportedNonImageMIMETypes" is really a misnomer for 19 "MIMETypes we should show as HTML" but that line has slowly been blurred since Tiger. In an attempt 20 to start to unblur it, remove "text/" and "text/plain" 21 (WebCore::MIMETypeRegistry::shouldTreatAsText): The decision is very close to the old DOMImplementation 22 method, except we don't automatically hand off "text/" types as true if they are in the set of supported 23 MIMETypes 24 (WebCore::MIMETypeRegistry::getSupportedImageMIMETypes): Non-const (can be changed!) 25 (WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes): Non-const (can be changed!) 26 (WebCore::MIMETypeRegistry::getSupportedNonImageMIMETypes): Non-const (can be changed!) 27 * platform/MIMETypeRegistry.h: 28 1 29 2007-08-03 Adele Peterson <adele@apple.com> 2 30 -
trunk/WebCore/dom/DOMImplementation.cpp
r24289 r24866 38 38 #include "ImageDocument.h" 39 39 #include "MediaList.h" 40 #include "MIMETypeRegistry.h" 40 41 #include "Page.h" 41 42 #include "PluginDocument.h" … … 330 331 bool DOMImplementation::isTextMIMEType(const String& mimeType) 331 332 { 332 if (mimeType == "application/x-javascript" || 333 (mimeType.startsWith("text/") && mimeType != "text/html" && 334 mimeType != "text/xml" && mimeType != "text/xsl")) 335 return true; 336 337 return false; 333 return MIMETypeRegistry::shouldTreatAsText(mimeType); 338 334 } 339 335 -
trunk/WebCore/platform/MIMETypeRegistry.cpp
r24418 r24866 113 113 "text/xml", 114 114 "text/xsl", 115 "text/plain",116 "text/",117 115 "application/x-javascript", 118 116 "application/xml", … … 187 185 } 188 186 189 const HashSet<String> &MIMETypeRegistry::getSupportedImageMIMETypes() 187 bool MIMETypeRegistry::shouldTreatAsText(const String& mimeType) 188 { 189 return mimeType == "application/x-javascript" || (mimeType.startsWith("text/") && !isSupportedNonImageMIMEType(mimeType)); 190 } 191 192 HashSet<String> &MIMETypeRegistry::getSupportedImageMIMETypes() 190 193 { 191 194 if (!supportedImageMIMETypes) … … 194 197 } 195 198 196 constHashSet<String> &MIMETypeRegistry::getSupportedImageResourceMIMETypes()199 HashSet<String> &MIMETypeRegistry::getSupportedImageResourceMIMETypes() 197 200 { 198 201 if (!supportedImageResourceMIMETypes) … … 201 204 } 202 205 203 constHashSet<String> &MIMETypeRegistry::getSupportedNonImageMIMETypes()206 HashSet<String> &MIMETypeRegistry::getSupportedNonImageMIMETypes() 204 207 { 205 208 if (!supportedNonImageMIMETypes) -
trunk/WebCore/platform/MIMETypeRegistry.h
r24418 r24866 55 55 // Check to see if a mime type is a valid Java applet mime type 56 56 static bool isJavaAppletMIMEType(const String& mimeType); 57 58 // Check to see if a mime type should be treated as text 59 // application/javascript is one that should be even though it doesn't start with text/ 60 // text/html is one that *shouldn't* be by default even though it *does* start with text/ 61 static bool shouldTreatAsText(const String& mimeType); 57 62 58 static constHashSet<String>& getSupportedImageMIMETypes();59 static constHashSet<String>& getSupportedImageResourceMIMETypes();60 static constHashSet<String>& getSupportedNonImageMIMETypes();63 static HashSet<String>& getSupportedImageMIMETypes(); 64 static HashSet<String>& getSupportedImageResourceMIMETypes(); 65 static HashSet<String>& getSupportedNonImageMIMETypes(); 61 66 }; 62 67 -
trunk/WebKit/ChangeLog
r24848 r24866 1 2007-08-03 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Oliver 4 5 Fix for http://bugs.webkit.org/show_bug.cgi?id=14824 and <rdar://problem/5372989> 6 7 When unregistering a MIMEType, remove it from the WebCore registry unconditionally 8 When registrying a MIMEType whose view class is WebHTMLView, add it to the WebCore registry 9 10 * WebView/WebView.mm: 11 (+[WebView _unregisterViewClassAndRepresentationClassForMIMEType:]): 12 (+[WebView _registerViewClass:representationClass:forURLScheme:]): 13 (+[WebView registerViewClass:representationClass:forMIMEType:]): 14 1 15 2007-08-03 Timothy Hatcher <timothy@apple.com> 2 16 -
trunk/WebKit/WebView/WebView.mm
r24827 r24866 104 104 #import <WebCore/HistoryItem.h> 105 105 #import <WebCore/Logging.h> 106 #import <WebCore/MIMETypeRegistry.h> 106 107 #import <WebCore/Page.h> 107 108 #import <WebCore/PageCache.h> … … 1100 1101 [[WebFrameView _viewTypesAllowImageTypeOmission:NO] removeObjectForKey:MIMEType]; 1101 1102 [[WebDataSource _repTypesAllowImageTypeOmission:NO] removeObjectForKey:MIMEType]; 1103 1104 // FIXME: We also need to maintain MIMEType registrations (which can be dynamically changed) 1105 // in the WebCore MIMEType registry. For now we're doing this in a safe, limited manner 1106 // to fix <INSERT RADAR HERE> - a future revamping of the entire system is neccesary for future robustness 1107 MIMETypeRegistry::getSupportedNonImageMIMETypes().remove(MIMEType); 1102 1108 } 1103 1109 … … 1107 1113 [self registerViewClass:viewClass representationClass:representationClass forMIMEType:MIMEType]; 1108 1114 1115 // FIXME: We also need to maintain MIMEType registrations (which can be dynamically changed) 1116 // in the WebCore MIMEType registry. For now we're doing this in a safe, limited manner 1117 // to fix <INSERT RADAR HERE> - a future revamping of the entire system is neccesary for future robustness 1118 if ([viewClass class] == [WebHTMLView class]) 1119 MIMETypeRegistry::getSupportedNonImageMIMETypes().add(MIMEType); 1120 1109 1121 // This is used to make _representationExistsForURLScheme faster. 1110 1122 // Without this set, we'd have to create the MIME type each time. … … 2489 2501 [[WebFrameView _viewTypesAllowImageTypeOmission:YES] setObject:viewClass forKey:MIMEType]; 2490 2502 [[WebDataSource _repTypesAllowImageTypeOmission:YES] setObject:representationClass forKey:MIMEType]; 2503 2504 // FIXME: We also need to maintain MIMEType registrations (which can be dynamically changed) 2505 // in the WebCore MIMEType registry. For now we're doing this in a safe, limited manner 2506 // to fix <INSERT RADAR HERE> - a future revamping of the entire system is neccesary for future robustness 2507 if ([viewClass class] == [WebHTMLView class]) 2508 MIMETypeRegistry::getSupportedNonImageMIMETypes().add(MIMEType); 2491 2509 } 2492 2510
Note: See TracChangeset
for help on using the changeset viewer.