Scripting MIME Types application/ecmascript, application/javascript not viewable
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Jan 2008 06:59:10 +0000 (06:59 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Jan 2008 06:59:10 +0000 (06:59 +0000)
commitbcaabf67bc92d46802398ce25a63a32a605d2bd7
tree68704759151fb016f7e2f950875532313f982e78
parent1d8c9c9243ae88019f17987b99aa4203ccb47557
    Scripting MIME Types application/ecmascript, application/javascript not viewable
        <http://bugs.webkit.org/show_bug.cgi?id=11063>

        Reviewed by Darin.

        This patch consolidates the list of acceptable MIME types for JavaScript
        source into the MIMETypeRegistry class, and replaces checks for these
        types with a call to MIMETypeRegistry::isSupportedJavaScriptMIMEType().

        No tests added since viewing JavaScript source is not testable.

        * dom/DOMImplementation.cpp:
        (WebCore::DOMImplementation::isTextMIMEType): Use
        MIMETypeRegistry::isSupportedJavaScriptMIMEType() instead of a single
        hard-coded MIME type, "application/x-javascript".

        * html/HTMLScriptElement.cpp:
        (WebCore::HTMLScriptElement::shouldExecuteAsJavaScript): Moved list of
        JavaScript MIME types from here to
        MIMETypeRegistry::initialiseSupportedJavaScriptMIMETypes().

        * platform/MIMETypeRegistry.cpp:
        (WebCore::initialiseSupportedJavaScriptMIMETypes): Added. List of
        MIME types came from HTMLScriptElement::shouldExecuteAsJavaScript().
        (WebCore::initialiseSupportedNonImageMimeTypes): Remove single
        hard-coded MIME type, "application/x-javascript", from the list.
        (WebCore::initialiseMIMETypeRegistry): Initialise
        supportedJavaScriptMIMETypes, then pre-populate supportedNonImageMIMETypes
        with values in supportedJavaScriptMIMETypes.
        (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType): Added.

        * platform/MIMETypeRegistry.h: Added isSupportedJavaScriptMIMEType().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore/ChangeLog
WebCore/dom/DOMImplementation.cpp
WebCore/html/HTMLScriptElement.cpp
WebCore/platform/MIMETypeRegistry.cpp
WebCore/platform/MIMETypeRegistry.h