Keep track of plug-in snapshots clicked by user
https://bugs.webkit.org/show_bug.cgi?id=103206
<rdar://problem/12746483>

Reviewed by Anders Carlsson.

Source/WebCore:

* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): Initially the hash is
unknown. Set to 0. Move the check for whether to snapshot the plugin into the
new function subframeLoaderWillLoadPlugIn.
(WebCore::HTMLPlugInImageElement::userDidClickSnapshot): Rename
setPendingClickEvent to userDidClickSnapshot. In addition to holding onto the
click event used to activate the plug-in, the function now also tells the plug-in
client to add the origin hash as an auto-start origin.
(WebCore::HTMLPlugInImageElement::subframeLoaderWillLoadPlugIn): Calculate the
hash based on the provided URL, which is the URL the plug-in will load. Extend
the check that used to be in the constructor to see if the plug-in should not
automatically load, including checking the plug-in size and whether the hash
is an auto-start origin.
* html/HTMLPlugInImageElement.h: Rename setPendingClickEvent to userDidClickSnapshot
and add a variable for the origin hash.

* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::requestPlugin): When the loader is about to load the
plug-in, pass the URL to the element, so that it can calculate the hash.

* page/Page.cpp:
(WebCore::Page::Page): Take the plugInClient from the page clients.
(WebCore::Page::~Page): If the client exists, tell it that the page is being
destroyed.
(WebCore::Page::PageClients::PageClients): Initialize this optional client to
null.
* page/Page.h: Add PlugInClient to page clients.
(PageClients): Add PlugInClient variable.
(WebCore::Page::plugInClient):
* page/PlugInClient.h: Added.

* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::handleEvent): Call the renamed function
userDidClickSnapshot().
(WebCore::RenderSnapshottedPlugIn::layout): Move the check of the plug-in size
to subframeLoaderWillLoadPlugIn.

Add PlugInClient.h.
* GNUmakefile.list.am:
* Target.pri:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:

Source/WebKit2:

Create a new provider class for the web context that maintains a mapping of the plug-in origins
allowed to auto-start for a specific page origin.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Create and set WebPlugInClient.

Implement WebCore::PlugInClient.
* WebProcess/WebCoreSupport/WebPlugInClient.cpp: Added.
(WebKit::WebPlugInClient::WebPlugInClient):
(WebKit::WebPlugInClient::~WebPlugInClient):
(WebKit::WebPlugInClient::pageDestroyed):
(WebKit::WebPlugInClient::isAutoStartOrigin): Forward to WebProcess.
(WebKit::WebPlugInClient::addAutoStartOrigin): Forward to WebProcess.
* WebProcess/WebCoreSupport/WebPlugInClient.h: Added.

* WebProcess/WebProcess.cpp: Maintains a copy of the hash set.
(WebKit::WebProcess::isPlugInAutoStartOrigin): Look for the hash in the set.
(WebKit::WebProcess::addPlugInAutoStartOrigin): Tell the UI process to add the hash for the page.
(WebKit::WebProcess::didAddPlugInAutoStartOrigin): Add the hash to the cached set.
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in: Add DidAddPlugInAutoStartOrigin.

Add the auto-start provider.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext): Initialize the provider.
(WebKit::WebContext::addPlugInAutoStartOriginHash): Forward to the provider.
* UIProcess/WebContext.h:
* UIProcess/WebContext.messages.in: Add AddPlugInAutoStartOriginHash.

The provider class maintains a map of page domains to hashes, and a set of all the hashes.
The latter will be used to initialize new web processes without having to crawl through the
whole map.
* UIProcess/Plugins/PlugInAutoStartProvider.cpp: Added.
(WebKit::PlugInAutoStartProvider::PlugInAutoStartProvider):
(WebKit::PlugInAutoStartProvider::addAutoStartOrigin): Add the origin to the map and set. Tell
all processes to add the origin to their local copies.
* UIProcess/Plugins/PlugInAutoStartProvider.h: Added.

Add PlugInAutoStartProvider and WebPlugInClient.
* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebKit2.xcodeproj/project.pbxproj:
* win/WebKit2.vcproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@137230 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Temporarily disable video-media-source-seek.html & video-media-source-state-changes.html
https://bugs.webkit.org/show_bug.cgi?id=104584

Reviewed by Dirk Pranke.

Changes in Chromium needed for Bug 104581 and Bug 104583 will break these tests so they are
being temporarily disabled until the Chromium & WebKit changes are both landed.

* platform/chromium/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@137231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Expand flakiness of move-by-line-001.html.
Unreviewed gardening.

* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@137232 268f45cc-cd09-0410-ab3c-d52691b4dbfc