Changeset 107256 in webkit


Ignore:
Timestamp:
Feb 9, 2012 9:31:07 AM (12 years ago)
Author:
mrowe@apple.com
Message:

REGRESSION (r104746): iframes load PDFs as media documents
<http://webkit.org/b/77079> / <rdar://problem/10757933>

Roll out r104746 since it completely broke support for loading PDF documents in subframes.

Reviewed by Adam Treat.

  • dom/DOMImplementation.cpp:

(WebCore::DOMImplementation::createDocument):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107251 r107256  
     12012-02-09  Mark Rowe  <mrowe@apple.com>
     2
     3        REGRESSION (r104746): iframes load PDFs as media documents
     4        <http://webkit.org/b/77079> / <rdar://problem/10757933>
     5
     6        Roll out r104746 since it completely broke support for loading PDF documents in subframes.
     7
     8        Reviewed by Adam Treat.
     9
     10        * dom/DOMImplementation.cpp:
     11        (WebCore::DOMImplementation::createDocument):
     12
    1132012-02-09  Andrey Kosyakov  <caseq@chromium.org>
    214
  • trunk/Source/WebCore/dom/DOMImplementation.cpp

    r104872 r107256  
    365365    if (type == "text/html")
    366366        return HTMLDocument::create(frame, url);
    367 
    368     // Plugins cannot take text/plain from us either.
    369     if (type == "text/plain")
    370         return TextDocument::create(frame, url);
    371 
    372367    if (type == "application/xhtml+xml")
    373368        return Document::createXHTML(frame, url);
    374369
    375370#if ENABLE(FTPDIR)
    376     // Plugins cannot take FTP from us either.
     371    // Plugins cannot take FTP from us either
    377372    if (type == "application/x-ftp-directory")
    378373        return FTPDirectoryDocument::create(frame, url);
    379374#endif
    380375
    381     // PDF is the only image type for which a plugin can override built-in support.
    382     if (Image::supportsType(type) && type != "application/pdf" && type != "text/pdf")
    383         return ImageDocument::create(frame, url);
    384 
    385 #if ENABLE(VIDEO)
    386      // Check to see if the type can be played by our MediaPlayer, if so create a MediaDocument as
    387      // this can not be taken by plugins either.
    388      if (MediaPlayer::supportsType(ContentType(type)))
    389          return MediaDocument::create(frame, url);
    390 #endif
    391 
    392     // The plugin database is initialized at this point if plugins are enabled
    393     // which is non-zero overhead.
    394376    PluginData* pluginData = 0;
    395377    if (frame && frame->page() && frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin))
    396378        pluginData = frame->page()->pluginData();
    397379
    398     // At this point anything that can be supported can be overridden by plugins.
    399     if (pluginData && pluginData->supportsMimeType(type))
     380    // PDF is one image type for which a plugin can override built-in support.
     381    // We do not want QuickTime to take over all image types, obviously.
     382    if ((type == "application/pdf" || type == "text/pdf") && pluginData && pluginData->supportsMimeType(type))
    400383        return PluginDocument::create(frame, url);
    401 
    402     // Handle PDF for instance if it was not handled by a plugin.
    403384    if (Image::supportsType(type))
    404385        return ImageDocument::create(frame, url);
    405386
    406     // Handle a text document was not handled by a plugin.
     387#if ENABLE(VIDEO)
     388     // Check to see if the type can be played by our MediaPlayer, if so create a MediaDocument
     389     if (MediaPlayer::supportsType(ContentType(type)))
     390         return MediaDocument::create(frame, url);
     391#endif
     392
     393    // Everything else except text/plain can be overridden by plugins. In particular, Adobe SVG Viewer should be used for SVG, if installed.
     394    // Disallowing plug-ins to use text/plain prevents plug-ins from hijacking a fundamental type that the browser is expected to handle,
     395    // and also serves as an optimization to prevent loading the plug-in database in the common case.
     396    if (type != "text/plain" && pluginData && pluginData->supportsMimeType(type))
     397        return PluginDocument::create(frame, url);
    407398    if (isTextMIMEType(type))
    408399        return TextDocument::create(frame, url);
Note: See TracChangeset for help on using the changeset viewer.