Title: [104746] trunk/Source/WebCore
- Revision
- 104746
- Author
- [email protected]
- Date
- 2012-01-11 14:13:24 -0800 (Wed, 11 Jan 2012)
Log Message
https://bugs.webkit.org/show_bug.cgi?id=76088
The common case of content type = text/plain is not optimized and the plugin database is initialized instead
In the dom/DOMImplementation.cpp file you can find the comment that text/plain is
optimized so that the plugin database is not loaded. Unfortunately, this has been
regressed since the patch for http://bugs.webkit.org/show_bug.cgi?id=16815 which
refactored a bunch of the plugin code. Now, the plugin database is initialized
before we handle text/plain. This line in DOMImplementation.cpp triggers
the plugin initialization:
pluginData = frame->page()->pluginData();
The case of image types != PDF and the case of HTML5 video content type are also
not optimized to be handled before plugin initialization.
The solution is to refactor so all of these content types are handled before
we initialize the plugin database.
Patch by Adam Treat <[email protected]> on 2012-01-11
Reviewed by Adam Treat.
* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createDocument):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (104745 => 104746)
--- trunk/Source/WebCore/ChangeLog 2012-01-11 22:10:18 UTC (rev 104745)
+++ trunk/Source/WebCore/ChangeLog 2012-01-11 22:13:24 UTC (rev 104746)
@@ -1,3 +1,28 @@
+2012-01-11 Adam Treat <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=76088
+ The common case of content type = text/plain is not optimized and the plugin database is initialized instead
+
+ In the dom/DOMImplementation.cpp file you can find the comment that text/plain is
+ optimized so that the plugin database is not loaded. Unfortunately, this has been
+ regressed since the patch for http://bugs.webkit.org/show_bug.cgi?id=16815 which
+ refactored a bunch of the plugin code. Now, the plugin database is initialized
+ before we handle text/plain. This line in DOMImplementation.cpp triggers
+ the plugin initialization:
+
+ pluginData = frame->page()->pluginData();
+
+ The case of image types != PDF and the case of HTML5 video content type are also
+ not optimized to be handled before plugin initialization.
+
+ The solution is to refactor so all of these content types are handled before
+ we initialize the plugin database.
+
+ Reviewed by Adam Treat.
+
+ * dom/DOMImplementation.cpp:
+ (WebCore::DOMImplementation::createDocument):
+
2012-01-11 Alexandre Elias <[email protected]>
[chromium] Make Skia canvas opaque for root layer tiles
Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (104745 => 104746)
--- trunk/Source/WebCore/dom/DOMImplementation.cpp 2012-01-11 22:10:18 UTC (rev 104745)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp 2012-01-11 22:13:24 UTC (rev 104746)
@@ -318,37 +318,46 @@
// 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();
- // 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))
+ // At this point anything that can be supported can be overridden by plugins.
+ if (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);
-#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);
+ // Handle a text document was not handled by a plugin.
if (isTextMIMEType(type))
return TextDocument::create(frame, url);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes