CSP reports for blocked 'data:' URLs should report the scheme only.
https://bugs.webkit.org/show_bug.cgi?id=109429

Reviewed by Adam Barth.

Source/WebCore:

https://dvcs.w3.org/hg/content-security-policy/rev/001dc8e8bcc3 changed
the CSP 1.1 spec to require that blocked URLs that don't refer to
generally resolvable schemes (e.g. 'data:', 'javascript:', etc.) be
stripped down to their scheme in violation reports.

Test: http/tests/security/contentSecurityPolicy/report-blocked-data-uri.html

* page/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::reportViolation):
    If the blocked URL is a web-resolvable scheme, apply the current
    stripping logic to it, otherwise, strip it to the scheme only.
* platform/KURL.h:
(KURL):
    Move KURL::isHierarchical() out into KURL's public API.

LayoutTests:

* http/tests/security/contentSecurityPolicy/report-blocked-data-uri-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/report-blocked-data-uri.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142506 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: Source/WebCore: Snapshotted plug-in should use shadow root
https://bugs.webkit.org/show_bug.cgi?id=108284

Reviewed by Simon Fraser.

Take three - relanding after rollout in r142400 that was caused by a global
selector interfering with CSS Instrumentation in the Inspector.

A snapshotted plugin needs to indicate to the user that it can be clicked
to be restarted. Previously this was done with an image that had embedded
text. Instead, we now use an internal shadow root to embed some markup that
will display instructions that can be localised.

The UA stylesheet for plug-ins provides a default styling for the label, which
can be overridden by ports.

In the process, RenderSnapshottedPlugIn no longer inherits from RenderEmbeddedObject,
since it is only responsible for drawing a paused plug-in. The snapshot creation
can work with the default renderer, but a shadow root requires something like
RenderBlock in order to draw its children. We swap from one renderer to another when
necessary either by creating the shadow root or by explicitly detaching and attaching
the plugin element.

Unfortunately this is difficult to test, because the snapshotting requires
time to execute, and also a PluginView to be instantiated.

* css/plugIns.css:
(object::-webkit-snapshotted-plugin-content): New rules for a default label style.

* platform/LocalizedStrings.cpp: Make sure all ports have plugin strings, now it is called.
* platform/LocalizedStrings.h:
* platform/blackberry/LocalizedStringsBlackBerry.cpp:
* platform/chromium/LocalizedStringsChromium.cpp:
* platform/efl/LocalizedStringsEfl.cpp:
* platform/gtk/LocalizedStringsGtk.cpp:
* platform/qt/LocalizedStringsQt.cpp:

* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::defaultEventHandler): Take into account the fact
that RenderSnapshottedPlugIn no longer is an embedded object.

* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): New default values in constructor.
(WebCore::HTMLPlugInElement::defaultEventHandler): Make sure to call base class.
(WebCore::HTMLPlugInElement::willRecalcStyle): No need to reattach if we're a snapshot.
(WebCore::HTMLPlugInImageElement::createRenderer): If we're showing a snapshot, create such
    a renderer, otherwise use the typical plug-in path.
(WebCore::HTMLPlugInImageElement::updateSnapshot): Keep a record of the snapshot, since we'll
    need to give it to the renderer.
(WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): Build a subtree that will display a label.
* html/HTMLPlugInImageElement.h:
(HTMLPlugInImageElement): New member variable to record the snapshot image and whether the label
    should show immediately.
(WebCore::HTMLPlugInImageElement::swapRendererTimerFired): The callback function triggered when we need
    to swap to the Shadow Root.
(WebCore::HTMLPlugInImageElement::userDidClickSnapshot): The user has tapped on the snapshot so the plugin
    in being recreated. Make sure we reattach so that a plugin renderer will be created.
(WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): Make sure we set the right
    displayState for snapshots.
* html/HTMLPlugInImageElement.h:
(HTMLPlugInImageElement): The new methods listed above.
(WebCore::HTMLPlugInImageElement::setShouldShowSnapshotLabelAutomatically): Indicates whether or not
    a snapshot should be immediately labeled.

* page/ChromeClient.h: No need for plugInStartLabelImage any more.

* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::RenderSnapshottedPlugIn): New inheritance.
(WebCore::RenderSnapshottedPlugIn::paint): If we're in the background paint phase, render the snapshot image.
(WebCore::RenderSnapshottedPlugIn::paintSnapshotImage): Rename.
(WebCore::RenderSnapshottedPlugIn::paintSnapshot): Rename.
(WebCore::RenderSnapshottedPlugIn::paintSnapshotWithLabel): Rename. No need for label sizes.
(WebCore::RenderSnapshottedPlugIn::getCursor):
(WebCore::RenderSnapshottedPlugIn::handleEvent): The renderer doesn't restart the plug-in any more. Tell the element and it will do it.
* rendering/RenderSnapshottedPlugIn.h:
(RenderSnapshottedPlugIn): New inheritance. Some method renaming.

Source/WebKit2: Snapshotted plug-in should use shadow root
https://bugs.webkit.org/show_bug.cgi?id=108284

Reviewed by Simon Fraser.

Take three of this commit - after rollout in r142400 and r142405.
We no longer have any need for plugInStartLabelImage.

* WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: Remove plugInStartLabelImage.
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: Ditto.
* WebProcess/WebCoreSupport/WebChromeClient.cpp: Ditto.
* WebProcess/WebCoreSupport/WebChromeClient.h: Ditto.

Tools: Remove use of plugInStartLabelImage
https://bugs.webkit.org/show_bug.cgi?id=108273

Reviewed by Simon Fraser.

Take two - after rollout in r142405.
Removed plugInStartLabelImage entry from client structure.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):

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