Title: [107256] trunk/Source/WebCore
Revision
107256
Author
[email protected]
Date
2012-02-09 09:31:07 -0800 (Thu, 09 Feb 2012)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107255 => 107256)


--- trunk/Source/WebCore/ChangeLog	2012-02-09 17:25:53 UTC (rev 107255)
+++ trunk/Source/WebCore/ChangeLog	2012-02-09 17:31:07 UTC (rev 107256)
@@ -1,3 +1,15 @@
+2012-02-09  Mark Rowe  <[email protected]>
+
+        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):
+
 2012-02-09  Andrey Kosyakov  <[email protected]>
 
         Web Inspector: [refactoring] take _showShortEvents out of timeline calculator

Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (107255 => 107256)


--- trunk/Source/WebCore/dom/DOMImplementation.cpp	2012-02-09 17:25:53 UTC (rev 107255)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp	2012-02-09 17:31:07 UTC (rev 107256)
@@ -364,46 +364,37 @@
     // 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);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to