I think this change is wrong. We should just pass the mime type along with the allowPlugins call and let the client decide what to do instead of teaching WebCore about some client-level concept.
Adam On Mon, Mar 29, 2010 at 1:16 PM, Alexey Proskuryakov <[email protected]> wrote: > > What is an "application plugin" outside of Qt context? This change will make > all port authors scratch their heads trying to understand what they want to > return from isApplicationPluginMIMEType(). > I think that this should be more obviously Qt-specific. > - WBR, Alexey Proskuryakov > On 27.03.2010, at 5:46, [email protected] wrote: > > [email protected] 05:46:35 -0700 (Sat, 27 > Mar 2010) > > Log Message > > 2010-03-26 Robert Hogan <[email protected]> > > Reviewed by Simon Hausmann. > > Allow plugins implemented by the application, such as mimetype > 'x-qt-plugin', > when pluginsEnabled is false. > > The purpose of disabling plugins is to prevent the execution of > third-party code > that may be untrustworthy. Qt plugins are implemented by the client > rather than > loaded from an external source, so the client should have the > opportunity to > consider them separately from other plugins. > > Add a function MimeTypeRegistry::isApplicationPluginMIMEType() that > WebKit > uses in conjunction with arePluginsEnabled() to determine if it > should attempt > to load a plugin. If isApplicationPluginMIMEType() returns true, > WebKit will load > the plugin even if arePluginsEnabled() is false. > > Currently, only Qt has application-implemented plugins: these use > the mimetype > 'x-qt-plugin' and 'x-qt-styled-widget'. This patch permits Qt > clients' > reimplementation of QWebPage::createPlugin() to decide whether or > not > to create a Qt plugin, even when arePluginsEnabled is false. > > For all platforms apart from Qt, isApplicationPluginMIMEType() > returns false. > > https://bugs.webkit.org/show_bug.cgi?id=32196 > > Test: plugins/application-plugin-plugins-disabled.html > > * loader/FrameLoader.cpp: > (WebCore::FrameLoader::requestObject): > * platform/MIMETypeRegistry.h: > * platform/brew/MIMETypeRegistryBrew.cpp: > (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > * platform/chromium/MIMETypeRegistryChromium.cpp: > (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > * platform/gtk/MIMETypeRegistryGtk.cpp: > (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > * platform/haiku/MIMETypeRegistryHaiku.cpp: > (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > * platform/mac/MIMETypeRegistryMac.mm: > (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > * platform/qt/MIMETypeRegistryQt.cpp: > (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > * platform/win/MIMETypeRegistryWin.cpp: > (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > * platform/wince/MIMETypeRegistryWince.cpp: > (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > * platform/wx/MimeTypeRegistryWx.cpp: > (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > > 2010-03-26 Robert Hogan <[email protected]> > > Reviewed by Simon Hausmann. > > Allow plugins implemented by the application, such as mimetype > 'x-qt-plugin', > when pluginsEnabled is false. > > For all platforms apart from Qt, isApplicationPluginMIMEType() > returns false. > > https://bugs.webkit.org/show_bug.cgi?id=32196 > > * > platform/qt/plugins/application-plugin-plugins-disabled-expected.txt: Added. > * plugins/application-plugin-plugins-disabled-expected.txt: Added. > * plugins/application-plugin-plugins-disabled.html: Added. > > 2010-03-26 Robert Hogan <[email protected]> > > Reviewed by Simon Hausmann. > > Allow plugins implemented by the application, such as mimetype > 'x-qt-plugin', > when pluginsEnabled is false. > > Add support for LayoutTestController.WebKitPluginsEnabled > > https://bugs.webkit.org/show_bug.cgi?id=32196 > > * DumpRenderTree/gtk/DumpRenderTree.cpp: > (resetDefaultsToConsistentValues): > * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: > (copyWebSettingKey): > * DumpRenderTree/qt/DumpRenderTreeQt.cpp: > (WebCore::WebPage::resetSettings): > * DumpRenderTree/qt/LayoutTestControllerQt.cpp: > (LayoutTestController::overridePreference): > > Modified Paths > > trunk/LayoutTests/ChangeLog > trunk/WebCore/ChangeLog > trunk/WebCore/loader/FrameLoader.cpp > trunk/WebCore/platform/MIMETypeRegistry.h > trunk/WebCore/platform/brew/MIMETypeRegistryBrew.cpp > trunk/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp > trunk/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp > trunk/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp > trunk/WebCore/platform/mac/MIMETypeRegistryMac.mm > trunk/WebCore/platform/qt/MIMETypeRegistryQt.cpp > trunk/WebCore/platform/win/MIMETypeRegistryWin.cpp > trunk/WebCore/platform/wince/MIMETypeRegistryWince.cpp > trunk/WebCore/platform/wx/MimeTypeRegistryWx.cpp > trunk/WebKitTools/ChangeLog > trunk/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp > trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp > trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp > trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp > > Diff > > Modified: trunk/LayoutTests/ChangeLog (56660 => 56661) > > --- trunk/LayoutTests/ChangeLog 2010-03-27 12:36:03 UTC (rev 56660) > +++ trunk/LayoutTests/ChangeLog 2010-03-27 12:46:35 UTC (rev 56661) > @@ -1,3 +1,18 @@ > +2010-03-26 Robert Hogan <[email protected]> > + > + Reviewed by Simon Hausmann. > + > + Allow plugins implemented by the application, such as mimetype > 'x-qt-plugin', > + when pluginsEnabled is false. > + > + For all platforms apart from Qt, isApplicationPluginMIMEType() > returns false. > + > + https://bugs.webkit.org/show_bug.cgi?id=32196 > + > + * > platform/qt/plugins/application-plugin-plugins-disabled-expected.txt: Added. > + * plugins/application-plugin-plugins-disabled-expected.txt: Added. > + * plugins/application-plugin-plugins-disabled.html: Added. > + > 2010-03-27 Yael Aharon <[email protected]> > > Unreviewed. > > Modified: trunk/WebCore/ChangeLog (56660 => 56661) > > --- trunk/WebCore/ChangeLog 2010-03-27 12:36:03 UTC (rev 56660) > +++ trunk/WebCore/ChangeLog 2010-03-27 12:46:35 UTC (rev 56661) > @@ -1,3 +1,53 @@ > +2010-03-26 Robert Hogan <[email protected]> > + > + Reviewed by Simon Hausmann. > + > + Allow plugins implemented by the application, such as mimetype > 'x-qt-plugin', > + when pluginsEnabled is false. > + > + The purpose of disabling plugins is to prevent the execution of > third-party code > + that may be untrustworthy. Qt plugins are implemented by the client > rather than > + loaded from an external source, so the client should have the > opportunity to > + consider them separately from other plugins. > + > + Add a function MimeTypeRegistry::isApplicationPluginMIMEType() that > WebKit > + uses in conjunction with arePluginsEnabled() to determine if it > should attempt > + to load a plugin. If isApplicationPluginMIMEType() returns true, > WebKit will load > + the plugin even if arePluginsEnabled() is false. > + > + Currently, only Qt has application-implemented plugins: these use > the mimetype > + 'x-qt-plugin' and 'x-qt-styled-widget'. This patch permits Qt > clients' > + reimplementation of QWebPage::createPlugin() to decide whether or > not > + to create a Qt plugin, even when arePluginsEnabled is false. > + > + For all platforms apart from Qt, isApplicationPluginMIMEType() > returns false. > + > + https://bugs.webkit.org/show_bug.cgi?id=32196 > + > + Test: plugins/application-plugin-plugins-disabled.html > + > + * loader/FrameLoader.cpp: > + (WebCore::FrameLoader::requestObject): > + * platform/MIMETypeRegistry.h: > + * platform/brew/MIMETypeRegistryBrew.cpp: > + (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > + * platform/chromium/MIMETypeRegistryChromium.cpp: > + (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > + * platform/gtk/MIMETypeRegistryGtk.cpp: > + (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > + * platform/haiku/MIMETypeRegistryHaiku.cpp: > + (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > + * platform/mac/MIMETypeRegistryMac.mm: > + (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > + * platform/qt/MIMETypeRegistryQt.cpp: > + (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > + * platform/win/MIMETypeRegistryWin.cpp: > + (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > + * platform/wince/MIMETypeRegistryWince.cpp: > + (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > + * platform/wx/MimeTypeRegistryWx.cpp: > + (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType): > + > 2010-03-27 Dan Bernstein <[email protected]> > > Reviewed by Mark Rowe. > > Modified: trunk/WebCore/loader/FrameLoader.cpp (56660 => 56661) > > --- trunk/WebCore/loader/FrameLoader.cpp 2010-03-27 12:36:03 UTC (rev > 56660) > +++ trunk/WebCore/loader/FrameLoader.cpp 2010-03-27 12:46:35 UTC (rev > 56661) > @@ -1285,6 +1285,10 @@ > if (shouldUsePlugin(completedURL, mimeType, > renderer->hasFallbackContent(), useFallback)) { > Settings* settings = m_frame->settings(); > if (!allowPlugins(AboutToInstantiatePlugin) > + // Application plugins are plugins implemented by the user > agent, for example Qt plugins, > + // as opposed to third-party code such as flash. The user > agent decides whether or not they are > + // permitted, rather than WebKit. > + && !MIMETypeRegistry::isApplicationPluginMIMEType(mimeType) > || (!settings->isJavaEnabled() && > MIMETypeRegistry::isJavaAppletMIMEType(mimeType))) > return false; > if (isDocumentSandboxed(SandboxPlugins)) > > Modified: trunk/WebCore/platform/MIMETypeRegistry.h (56660 => 56661) > > --- trunk/WebCore/platform/MIMETypeRegistry.h 2010-03-27 12:36:03 UTC (rev > 56660) > +++ trunk/WebCore/platform/MIMETypeRegistry.h 2010-03-27 12:46:35 UTC (rev > 56661) > @@ -67,6 +67,10 @@ > // Check to see if a mime type is a valid Java applet mime type > static bool isJavaAppletMIMEType(const String& mimeType); > > + // Check to see if a mime type is a plugin implemented by the > + // browser (e.g. a Qt Plugin). > + static bool isApplicationPluginMIMEType(const String& mimeType); > + > static HashSet<String>& getSupportedImageMIMETypes(); > static HashSet<String>& getSupportedImageResourceMIMETypes(); > static HashSet<String>& getSupportedImageMIMETypesForEncoding(); > > Modified: trunk/WebCore/platform/brew/MIMETypeRegistryBrew.cpp (56660 => > 56661) > > --- trunk/WebCore/platform/brew/MIMETypeRegistryBrew.cpp 2010-03-27 > 12:36:03 > UTC (rev 56660) > +++ trunk/WebCore/platform/brew/MIMETypeRegistryBrew.cpp 2010-03-27 > 12:46:35 > UTC (rev 56661) > @@ -76,5 +76,10 @@ > return "text/plain"; > } > > +bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&) > +{ > + return false; > +} > + > } // namespace WebCore > > > Modified: trunk/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp > (56660 => 56661) > > --- trunk/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp > 2010-03-27 > 12:36:03 UTC (rev 56660) > +++ trunk/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp > 2010-03-27 > 12:46:35 UTC (rev 56661) > @@ -130,6 +130,11 @@ > return String(); > } > > +bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&) > +{ > + return false; > +} > + > static HashSet<String>& dummyHashSet() > { > ASSERT_NOT_REACHED(); > > Modified: trunk/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp (56660 => > 56661) > > --- trunk/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp 2010-03-27 > 12:36:03 > UTC (rev 56660) > +++ trunk/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp 2010-03-27 > 12:46:35 > UTC (rev 56661) > @@ -73,4 +73,9 @@ > return String(); > } > > +bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&) > +{ > + return false; > } > + > +} > > Modified: trunk/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp (56660 => > 56661) > > --- trunk/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp 2010-03-27 > 12:36:03 UTC (rev 56660) > +++ trunk/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp 2010-03-27 > 12:46:35 UTC (rev 56661) > @@ -71,5 +71,10 @@ > // unknown, let's just assume plain text > return "text/plain"; > } > + > +bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&) > +{ > + return false; > +} > } // namespace WebCore > > > Modified: trunk/WebCore/platform/mac/MIMETypeRegistryMac.mm (56660 => 56661) > > --- trunk/WebCore/platform/mac/MIMETypeRegistryMac.mm 2010-03-27 12:36:03 > UTC (rev 56660) > +++ trunk/WebCore/platform/mac/MIMETypeRegistryMac.mm 2010-03-27 12:46:35 > UTC (rev 56661) > @@ -56,4 +56,9 @@ > return wkGetPreferredExtensionForMIMEType(type); > } > > +bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&) > +{ > + return false; > } > + > +} > > Modified: trunk/WebCore/platform/qt/MIMETypeRegistryQt.cpp (56660 => 56661) > > --- trunk/WebCore/platform/qt/MIMETypeRegistryQt.cpp 2010-03-27 12:36:03 UTC > (rev 56660) > +++ trunk/WebCore/platform/qt/MIMETypeRegistryQt.cpp 2010-03-27 12:46:35 UTC > (rev 56661) > @@ -82,4 +82,10 @@ > return "application/octet-stream"; > } > > +bool MIMETypeRegistry::isApplicationPluginMIMEType(const String& mimeType) > +{ > + return mimeType.startsWith("application/x-qt-plugin", false) > + || mimeType.startsWith("application/x-qt-styled-widget", false); > } > + > +} > > Modified: trunk/WebCore/platform/win/MIMETypeRegistryWin.cpp (56660 => > 56661) > > --- trunk/WebCore/platform/win/MIMETypeRegistryWin.cpp 2010-03-27 > 12:36:03 > UTC (rev 56660) > +++ trunk/WebCore/platform/win/MIMETypeRegistryWin.cpp 2010-03-27 > 12:46:35 > UTC (rev 56661) > @@ -103,4 +103,9 @@ > return result; > } > > +bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&) > +{ > + return false; > } > + > +} > > Modified: trunk/WebCore/platform/wince/MIMETypeRegistryWince.cpp (56660 => > 56661) > > --- trunk/WebCore/platform/wince/MIMETypeRegistryWince.cpp 2010-03-27 > 12:36:03 UTC (rev 56660) > +++ trunk/WebCore/platform/wince/MIMETypeRegistryWince.cpp 2010-03-27 > 12:46:35 UTC (rev 56661) > @@ -133,4 +133,9 @@ > return result.isEmpty() ? "unknown/unknown" : result; > } > > +bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&) > +{ > + return false; > } > + > +} > > Modified: trunk/WebCore/platform/wx/MimeTypeRegistryWx.cpp (56660 => 56661) > > --- trunk/WebCore/platform/wx/MimeTypeRegistryWx.cpp 2010-03-27 12:36:03 UTC > (rev 56660) > +++ trunk/WebCore/platform/wx/MimeTypeRegistryWx.cpp 2010-03-27 12:46:35 UTC > (rev 56661) > @@ -70,4 +70,9 @@ > return "text/plain"; > } > > +bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&) > +{ > + return false; > } > + > +} > > Modified: trunk/WebKitTools/ChangeLog (56660 => 56661) > > --- trunk/WebKitTools/ChangeLog 2010-03-27 12:36:03 UTC (rev 56660) > +++ trunk/WebKitTools/ChangeLog 2010-03-27 12:46:35 UTC (rev 56661) > @@ -1,3 +1,23 @@ > +2010-03-26 Robert Hogan <[email protected]> > + > + Reviewed by Simon Hausmann. > + > + Allow plugins implemented by the application, such as mimetype > 'x-qt-plugin', > + when pluginsEnabled is false. > + > + Add support for LayoutTestController.WebKitPluginsEnabled > + > + https://bugs.webkit.org/show_bug.cgi?id=32196 > + > + * DumpRenderTree/gtk/DumpRenderTree.cpp: > + (resetDefaultsToConsistentValues): > + * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: > + (copyWebSettingKey): > + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: > + (WebCore::WebPage::resetSettings): > + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: > + (LayoutTestController::overridePreference): > + > 2010-03-26 Adam Barth <[email protected]> > > Reviewed by Eric Seidel. > > Modified: trunk/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp (56660 => > 56661) > > --- trunk/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp 2010-03-27 > 12:36:03 UTC (rev 56660) > +++ trunk/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp 2010-03-27 > 12:46:35 UTC (rev 56661) > @@ -341,6 +341,7 @@ > "enable-page-cache", FALSE, > "auto-resize-window", TRUE, > "enable-java-applet", FALSE, > + "enable-plugins", TRUE, > NULL); > > webkit_web_frame_clear_main_frame_name(mainFrame); > > Modified: trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp > (56660 => 56661) > > --- > trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp > 2010-03-27 > 12:36:03 UTC (rev 56660) > +++ > trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp > 2010-03-27 > 12:46:35 UTC (rev 56661) > @@ -66,12 +66,13 @@ > > if (!keyTable) { > // If you add a pref here, make sure you reset the value in > - // DumpRenderTree::resetWebViewToConsistentStateBeforeTesting. > + // DumpRenderTree::resetDefaultsToConsistentValues. > keyTable = g_hash_table_new(g_str_hash, g_str_equal); > g_hash_table_insert(keyTable, g_strdup("WebKitJavaScriptEnabled"), > g_strdup("enable-scripts")); > g_hash_table_insert(keyTable, g_strdup("WebKitDefaultFontSize"), > g_strdup("default-font-size")); > g_hash_table_insert(keyTable, > g_strdup("WebKitEnableCaretBrowsing"), g_strdup("enable-caret-browsing")); > g_hash_table_insert(keyTable, > g_strdup("WebKitUsesPageCachePreferenceKey"), > g_strdup("enable-page-cache")); > + g_hash_table_insert(keyTable, g_strdup("WebKitPluginsEnabled"), > g_strdup("enable-plugins")); > } > > return g_strdup(static_cast<gchar*>(g_hash_table_lookup(keyTable, > preferenceKey))); > > Modified: trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp (56660 => > 56661) > > --- trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp 2010-03-27 > 12:36:03 UTC (rev 56660) > +++ trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp 2010-03-27 > 12:46:35 UTC (rev 56661) > @@ -188,6 +188,8 @@ > settings()->resetAttribute(QWebSettings::LinksIncludedInFocusChain); > > settings()->resetAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); > > settings()->resetAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); > + settings()->resetAttribute(QWebSettings::PluginsEnabled); > + > m_drt->layoutTestController()->setCaretBrowsingEnabled(false); > m_drt->layoutTestController()->setFrameSetFlatteningEnabled(false); > > > Modified: trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp > (56660 => 56661) > > --- > trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp > 2010-03-27 > 12:36:03 UTC (rev 56660) > +++ > trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp > 2010-03-27 > 12:46:35 UTC (rev 56661) > @@ -478,6 +478,8 @@ > QWebSettings::setMaximumPagesInCache(value.toInt()); > else if (name == "WebKitEnableCaretBrowsing") > setCaretBrowsingEnabled(value.toBool()); > + else if (name == "WebKitPluginsEnabled") > + settings->setAttribute(QWebSettings::PluginsEnabled, > value.toBool()); > else > printf("ERROR: LayoutTestController::overridePreference() does not > support the '%s' preference\n", > name.toLatin1().data()); > > _______________________________________________ > webkit-changes mailing list > [email protected] > http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes > > > > _______________________________________________ > webkit-dev mailing list > [email protected] > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > > _______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

