Changeset 24869 in webkit


Ignore:
Timestamp:
Aug 4, 2007 7:06:22 PM (17 years ago)
Author:
ddkilzer
Message:

WebCore:

Reviewed by Oliver.

The supportedNonImageMimeTypes list is used to determine which MIME types may be viewed
within the web browser (e.g., plug-ins add their own MIME types to the list during
initialization), so we must add "text/plain" and "text/" back to the list. Since
this change would then break DOMImplementation::isTextMIMEType(), that method was reverted
to its original form and MIMETypeRegistry::shouldTreatAsText() was removed.

  • dom/DOMImplementation.cpp: (WebCore::DOMImplementation::isTextMIMEType): Revert to previous version.
  • platform/MIMETypeRegistry.cpp: (WebCore::initialiseSupportedNonImageMimeTypes): Added back "text/plain" and "text/" to the list. (WebCore::MIMETypeRegistry::shouldTreatAsText): Removed.
  • platform/MIMETypeRegistry.h:
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r24866 r24869  
     12007-08-04  David Kilzer  <ddkilzer@webkit.org>
     2
     3        Reviewed by Oliver.
     4
     5        - fix for http://bugs.webkit.org/show_bug.cgi?id=14882
     6          <rdar://problem/5386550> REGRESSION (r24866): text/plain documents are always downloaded
     7
     8        The supportedNonImageMimeTypes list is used to determine which MIME types may be viewed
     9        within the web browser (e.g., plug-ins add their own MIME types to the list during
     10        initialization), so we must add "text/plain" and "text/" back to the list.  Since
     11        this change would then break DOMImplementation::isTextMIMEType(), that method was reverted
     12        to its original form and MIMETypeRegistry::shouldTreatAsText() was removed.
     13
     14        * dom/DOMImplementation.cpp:
     15        (WebCore::DOMImplementation::isTextMIMEType): Revert to previous version.
     16        * platform/MIMETypeRegistry.cpp:
     17        (WebCore::initialiseSupportedNonImageMimeTypes): Added back "text/plain" and "text/" to the list.
     18        (WebCore::MIMETypeRegistry::shouldTreatAsText): Removed.
     19        * platform/MIMETypeRegistry.h:
     20
    1212007-08-03  Brady Eidson  <beidson@apple.com>
    222
  • trunk/WebCore/dom/DOMImplementation.cpp

    r24866 r24869  
    3838#include "ImageDocument.h"
    3939#include "MediaList.h"
    40 #include "MIMETypeRegistry.h"
    4140#include "Page.h"
    4241#include "PluginDocument.h"
     
    331330bool DOMImplementation::isTextMIMEType(const String& mimeType)
    332331{
    333     return MIMETypeRegistry::shouldTreatAsText(mimeType);
     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;
    334338}
    335339
  • trunk/WebCore/platform/MIMETypeRegistry.cpp

    r24866 r24869  
    113113      "text/xml",
    114114      "text/xsl",
     115      "text/plain",
     116      "text/",
    115117      "application/x-javascript",
    116118      "application/xml",
     
    185187}
    186188
    187 bool MIMETypeRegistry::shouldTreatAsText(const String& mimeType)
    188 {
    189     return mimeType == "application/x-javascript" || (mimeType.startsWith("text/") && !isSupportedNonImageMIMEType(mimeType));
    190 }
    191 
    192189HashSet<String> &MIMETypeRegistry::getSupportedImageMIMETypes()
    193190{
  • trunk/WebCore/platform/MIMETypeRegistry.h

    r24866 r24869  
    5656    static bool isJavaAppletMIMEType(const String& mimeType);
    5757   
    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);
    62 
    6358    static HashSet<String>& getSupportedImageMIMETypes();
    6459    static HashSet<String>& getSupportedImageResourceMIMETypes();
Note: See TracChangeset for help on using the changeset viewer.