Blocking a plugin via CSP should result in one (and only one) console message.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Aug 2012 19:14:10 +0000 (19:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Aug 2012 19:14:10 +0000 (19:14 +0000)
commit0330d1748983b7274ba4a2158b441dd59af0f9fc
treedc5faa7c7e469b8423926cf99665ae50bf10e8b0
parent05cfaf7f6e0fc78276362439fb12a0fcb7abc001
Blocking a plugin via CSP should result in one (and only one) console message.
https://bugs.webkit.org/show_bug.cgi?id=92649

Patch by Mike West <mkwst@chromium.org> on 2012-08-03
Reviewed by Adam Barth.

Source/WebCore:

Currently, blocking a plugin via Content Security Policy results in some
leakage of console log messages between tests. I'm unclear as to the
root cause, but the symptoms exhibited include
`SubframeLoader::requestPlugin` being called multiple times for a single
element, which in turn causes multiple console logs to be sent. These
messages tend to appear in the subsequent test, making the
`http/test/security/contentSecurityPolicy/object-src-*` set of tests
flakey indeed.

This patch addresses the issue by marking elements' plugins as
unavailable when they're blocked by CSP. No new tests have been added:
this patch should simply make the current tests actually pass.

* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::requestPlugin):
    We check the CSP status in `SubframeLoader::loadPlugin`, which is
    called at the end of this function. Checking CSP status in both
    locations is redundant.
(WebCore::SubframeLoader::loadPlugin):
    If the plugin is blocked by CSP, tell the element's embedded object
    renderer that the plugin is unavailable.
* platform/LocalizedStrings.cpp:
(WebCore::blockedPluginByContentSecurityPolicyText):
(WebCore):
* platform/LocalizedStrings.h:
(WebCore):
* platform/blackberry/LocalizedStringsBlackBerry.cpp:
(WebCore::blockedPluginByContentSecurityPolicyText):
(WebCore):
* platform/efl/LocalizedStringsEfl.cpp:
(WebCore::blockedPluginByContentSecurityPolicyText):
(WebCore):
* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::blockedPluginByContentSecurityPolicyText):
(WebCore):
* platform/qt/LocalizedStringsQt.cpp:
(WebCore::blockedPluginByContentSecurityPolicyText):
(WebCore):
* rendering/RenderEmbeddedObject.cpp:
(WebCore::unavailablePluginReplacementText):
* rendering/RenderEmbeddedObject.h:
    Return appropriate text when the plugin is blocked by CSP.

Source/WebKit/chromium:

* src/LocalizedStrings.cpp:
(WebCore::blockedPluginByContentSecurityPolicyText):
(WebCore):
    Adding a stub for the newly added string.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124636 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/SubframeLoader.cpp
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/LocalizedStrings.h
Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp
Source/WebCore/platform/efl/LocalizedStringsEfl.cpp
Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp
Source/WebCore/platform/qt/LocalizedStringsQt.cpp
Source/WebCore/rendering/RenderEmbeddedObject.cpp
Source/WebCore/rendering/RenderEmbeddedObject.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/LocalizedStrings.cpp