diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
commit | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch) | |
tree | b34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Source/WebCore/dom/DOMImplementation.cpp | |
parent | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff) | |
download | qtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz |
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Source/WebCore/dom/DOMImplementation.cpp')
-rw-r--r-- | Source/WebCore/dom/DOMImplementation.cpp | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/Source/WebCore/dom/DOMImplementation.cpp b/Source/WebCore/dom/DOMImplementation.cpp index 33104097e..ae6d3665c 100644 --- a/Source/WebCore/dom/DOMImplementation.cpp +++ b/Source/WebCore/dom/DOMImplementation.cpp @@ -364,46 +364,37 @@ PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame // Plugins cannot take HTML and XHTML from us, and we don't even need to initialize the plugin database for those. if (type == "text/html") return HTMLDocument::create(frame, url); - - // Plugins cannot take text/plain from us either. - if (type == "text/plain") - return TextDocument::create(frame, url); - if (type == "application/xhtml+xml") return Document::createXHTML(frame, url); #if ENABLE(FTPDIR) - // Plugins cannot take FTP from us either. + // Plugins cannot take FTP from us either if (type == "application/x-ftp-directory") return FTPDirectoryDocument::create(frame, url); #endif - // PDF is the only image type for which a plugin can override built-in support. - if (Image::supportsType(type) && type != "application/pdf" && type != "text/pdf") - return ImageDocument::create(frame, url); - -#if ENABLE(VIDEO) - // Check to see if the type can be played by our MediaPlayer, if so create a MediaDocument as - // this can not be taken by plugins either. - if (MediaPlayer::supportsType(ContentType(type))) - return MediaDocument::create(frame, url); -#endif - - // The plugin database is initialized at this point if plugins are enabled - // which is non-zero overhead. PluginData* pluginData = 0; if (frame && frame->page() && frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin)) pluginData = frame->page()->pluginData(); - // At this point anything that can be supported can be overridden by plugins. - if (pluginData && pluginData->supportsMimeType(type)) + // PDF is one image type for which a plugin can override built-in support. + // We do not want QuickTime to take over all image types, obviously. + if ((type == "application/pdf" || type == "text/pdf") && pluginData && pluginData->supportsMimeType(type)) return PluginDocument::create(frame, url); - - // Handle PDF for instance if it was not handled by a plugin. if (Image::supportsType(type)) return ImageDocument::create(frame, url); - // Handle a text document was not handled by a plugin. +#if ENABLE(VIDEO) + // Check to see if the type can be played by our MediaPlayer, if so create a MediaDocument + if (MediaPlayer::supportsType(ContentType(type))) + return MediaDocument::create(frame, url); +#endif + + // Everything else except text/plain can be overridden by plugins. In particular, Adobe SVG Viewer should be used for SVG, if installed. + // Disallowing plug-ins to use text/plain prevents plug-ins from hijacking a fundamental type that the browser is expected to handle, + // and also serves as an optimization to prevent loading the plug-in database in the common case. + if (type != "text/plain" && pluginData && pluginData->supportsMimeType(type)) + return PluginDocument::create(frame, url); if (isTextMIMEType(type)) return TextDocument::create(frame, url); |