Allow specifying which plug-ins are supported
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Feb 2018 23:31:31 +0000 (23:31 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Feb 2018 23:31:31 +0000 (23:31 +0000)
commitc9a8c337bc5b22cf5f8790f558aa814a09fa6148
tree60700759a0a2067828e3b2b044000707bd542aaf
parent4fef6610ee6eb01d5938b1717bc1988d984dcdbe
Allow specifying which plug-ins are supported
https://bugs.webkit.org/show_bug.cgi?id=182748

Patch by Youenn Fablet <youenn@apple.com> on 2018-02-16
Reviewed by Chris Dumez.

Source/WebCore:

Tests: http/tests/plugins/nounsupported-plugin.html
       http/tests/plugins/supported-plugin-all-origin-visibility.html
       http/tests/plugins/supported-plugin-on-specific-origin.html
       http/tests/plugins/supported-plugin-origin-specific-visibility.html
       http/tests/plugins/unsupported-plugin-on-specific-origin.html
       plugins/unsupported-plugin.html

Added support for computing plugin web visibility with the added knowledge of supported plugins.
In case of a plugin failing to be created due to being unsupported, update the UI
to use mark the plugin as "Unexpected plug in".

Added internal API to retrieve the plug-in error description message.

* English.lproj/Localizable.strings:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::setReplacement):
* html/HTMLPlugInElement.h:
* loader/EmptyClients.cpp:
* platform/LocalizedStrings.cpp:
(WebCore::unsupportedPluginText):
* platform/LocalizedStrings.h:
* plugins/PluginData.cpp:
(WebCore::PluginData::initPlugins):
* plugins/PluginData.h:
(WebCore::decodePluginNames):
(WebCore::encodePluginNames):
(WebCore::SupportedPluginNames::decode):
(WebCore::SupportedPluginNames::encode const):
* plugins/PluginInfoProvider.h:
* rendering/RenderEmbeddedObject.cpp:
(WebCore::unavailablePluginReplacementText):
* rendering/RenderEmbeddedObject.h:
(WebCore::RenderEmbeddedObject::pluginReplacementTextIfUnavailable const):
* testing/Internals.cpp:
(WebCore::Internals::unavailablePluginReplacementText):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

Add a C and ObjC API to set which plug-ins are specified.
Plug-ins may be allowed by origin of the main page or for all origins.

If the API to set a supported plug-in is called, WebKit enters a mode
where it will block any plug-in that is not on the list.

The list of supported plug-ins is stored in UIProcess and sent to WebProcess.
This allows to compute the list of visible plug-ins according supported plugins.

PluginInfoStore is storing the list of supported plugins and can
answer whether a plug-in creation request is to be made unsupported or not.
It also creates the structure sent to WebProcess for computing plugin visibility.

Updated ArgumentCoders to accept modern HashSet decoders.

* Platform/IPC/ArgumentCoders.h:
* UIProcess/API/C/WKContext.cpp:
(WKContextAddSupportedPlugin):
(WKContextClearSupportedPlugins):
* UIProcess/API/C/WKContextPrivate.h:
* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _addSupportedPlugin:named:withMimeTypes:withExtensions:]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* UIProcess/Plugins/PluginInfoStore.cpp:
(WebKit::PluginInfoStore::isSupportedPlugin):
(WebKit::PluginInfoStore::SupportedPlugins::isSupported):
(WebKit::PluginInfoStore::SupportedPlugin::isSupported):
(WebKit::PluginInfoStore::supportedPluginNames):
(WebKit::PluginInfoStore::addSupportedPlugin):
* UIProcess/Plugins/PluginInfoStore.h:
(WebKit::PluginInfoStore::clearSupportedPlugins):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::findPlugin):
(WebKit::WebPageProxy::unavailablePluginButtonClicked):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::addSupportedPlugin):
(WebKit::WebProcessPool::clearSupportedPlugins):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getPlugins):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.messages.in:
* WebProcess/Plugins/WebPluginInfoProvider.cpp:
(WebKit::WebPluginInfoProvider::getPluginInfo):
(WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
(WebKit::WebPluginInfoProvider::populatePluginCache):
* WebProcess/Plugins/WebPluginInfoProvider.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::shouldUnavailablePluginMessageBeButton const):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin):
(WebKit::WebPage::canPluginHandleResponse):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebPluginInfoProvider.h:
* WebCoreSupport/WebPluginInfoProvider.mm:
(WebPluginInfoProvider::getPluginInfo):
(WebPluginInfoProvider::getWebVisiblePluginInfo):

Source/WebKitLegacy/win:

* WebCoreSupport/WebPluginInfoProvider.cpp:
(WebPluginInfoProvider::getPluginInfo):
* WebCoreSupport/WebPluginInfoProvider.h:

Tools:

Add support for a test runner API to specificy supported plug-ins.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setPluginsAsUnsupported):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
(WTR::TestController::setPluginsAsUnsupported):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

LayoutTests:

* http/tests/plugins/nounsupported-plugin-expected.txt: Added.
* http/tests/plugins/nounsupported-plugin.html: Added.
* http/tests/plugins/supported-plugin-all-origin-visibility-expected.txt: Added.
* http/tests/plugins/supported-plugin-all-origin-visibility.html: Added.
* http/tests/plugins/supported-plugin-on-specific-origin-expected.txt: Added.
* http/tests/plugins/supported-plugin-on-specific-origin.html: Added.
* http/tests/plugins/supported-plugin-origin-specific-visibility-expected.txt: Added.
* http/tests/plugins/supported-plugin-origin-specific-visibility.html: Added.
* http/tests/plugins/unsupported-plugin-on-specific-origin-expected.txt: Added.
* http/tests/plugins/unsupported-plugin-on-specific-origin.html: Added.
* plugins/unsupported-plugin-expected.txt: Added.
* plugins/unsupported-plugin.html: Added.
* platform/ios-wk1/TestExpectations:
* platform/mac-wk1/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
65 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/plugins/nounsupported-plugin-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/plugins/nounsupported-plugin.html [new file with mode: 0644]
LayoutTests/http/tests/plugins/supported-plugin-all-origin-visibility-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/plugins/supported-plugin-all-origin-visibility.html [new file with mode: 0644]
LayoutTests/http/tests/plugins/supported-plugin-on-specific-origin-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/plugins/supported-plugin-on-specific-origin.html [new file with mode: 0644]
LayoutTests/http/tests/plugins/supported-plugin-origin-specific-visibility-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/plugins/supported-plugin-origin-specific-visibility.html [new file with mode: 0644]
LayoutTests/http/tests/plugins/unsupported-plugin-on-specific-origin-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/plugins/unsupported-plugin-on-specific-origin.html [new file with mode: 0644]
LayoutTests/platform/ios-wk1/TestExpectations
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/plugins/unsupported-plugin-expected.txt [new file with mode: 0644]
LayoutTests/plugins/unsupported-plugin.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/Localizable.strings
Source/WebCore/PAL/pal/SessionID.h
Source/WebCore/html/HTMLPlugInElement.cpp
Source/WebCore/html/HTMLPlugInElement.h
Source/WebCore/loader/EmptyClients.cpp
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/LocalizedStrings.h
Source/WebCore/plugins/PluginData.cpp
Source/WebCore/plugins/PluginData.h
Source/WebCore/plugins/PluginInfoProvider.h
Source/WebCore/rendering/RenderEmbeddedObject.cpp
Source/WebCore/rendering/RenderEmbeddedObject.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit/ChangeLog
Source/WebKit/Platform/IPC/ArgumentCoders.h
Source/WebKit/Scripts/webkit/messages.py
Source/WebKit/UIProcess/API/C/WKContext.cpp
Source/WebKit/UIProcess/API/C/WKContextPrivate.h
Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp
Source/WebKit/UIProcess/Plugins/PluginInfoStore.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessProxy.h
Source/WebKit/UIProcess/WebProcessProxy.messages.in
Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp
Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.h
Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.cpp
Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp