- Revision
- 136305
- Author
- [email protected]
- Date
- 2012-11-30 22:53:25 -0800 (Fri, 30 Nov 2012)
Log Message
CSP 1.1: Make the CSP_NEXT flag runtime enabled.
https://bugs.webkit.org/show_bug.cgi?id=103652
Reviewed by Adam Barth.
Source/WebCore:
Content Security Policy 1.1 continues to live behind the CSP_NEXT flag,
this patch adds another layer on top of that in order to enable runtime
decisions about whether it should be active.
* bindings/generic/RuntimeEnabledFeatures.cpp:
(WebCore):
* bindings/generic/RuntimeEnabledFeatures.h:
(RuntimeEnabledFeatures):
(WebCore::RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnabled):
(WebCore::RuntimeEnabledFeatures::setExperimentalContentSecurityPolicyFeaturesEnabled):
Adds methods in order to correctly handle enabling and disabling
CSP 1.1 features.
* dom/Document.idl:
Gate the 'document.securityPolicy' object on the runtime flag.
* page/ContentSecurityPolicy.cpp:
(WebCore::CSPDirectiveList::addDirective):
Check that experimental features are runtime enabled before
processing 1.1 directives.
(WebCore::ContentSecurityPolicy::experimentalFeaturesEnabled):
(WebCore):
* page/ContentSecurityPolicy.h:
Adds a new method which checks against the runtime flag to determine
whether CSP 1.1 features are enabled.
Source/WebKit/chromium:
The CSP_NEXT flag continues to be enabled on the Chromium port, but this
patch now locks the features away behind the securityPolicy runtime
flag.
* public/WebRuntimeFeatures.h:
(WebRuntimeFeatures):
* src/WebRuntimeFeatures.cpp:
(WebKit::WebRuntimeFeatures::enableExperimentalContentSecurityPolicyFeatures):
(WebKit):
(WebKit::WebRuntimeFeatures::isExperimentalContentSecurityPolicyFeaturesEnabled):
Adds the feature to WebRuntimeFeatures so it can be toggled from
inside Chromium.
Tools:
Ensures that the new SecurityPolicy runtime flag is enabled for Chromium's tests.
* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::TestShell):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (136304 => 136305)
--- trunk/Source/WebCore/ChangeLog 2012-12-01 06:18:59 UTC (rev 136304)
+++ trunk/Source/WebCore/ChangeLog 2012-12-01 06:53:25 UTC (rev 136305)
@@ -1,3 +1,34 @@
+2012-11-30 Mike West <[email protected]>
+
+ CSP 1.1: Make the CSP_NEXT flag runtime enabled.
+ https://bugs.webkit.org/show_bug.cgi?id=103652
+
+ Reviewed by Adam Barth.
+
+ Content Security Policy 1.1 continues to live behind the CSP_NEXT flag,
+ this patch adds another layer on top of that in order to enable runtime
+ decisions about whether it should be active.
+
+ * bindings/generic/RuntimeEnabledFeatures.cpp:
+ (WebCore):
+ * bindings/generic/RuntimeEnabledFeatures.h:
+ (RuntimeEnabledFeatures):
+ (WebCore::RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnabled):
+ (WebCore::RuntimeEnabledFeatures::setExperimentalContentSecurityPolicyFeaturesEnabled):
+ Adds methods in order to correctly handle enabling and disabling
+ CSP 1.1 features.
+ * dom/Document.idl:
+ Gate the 'document.securityPolicy' object on the runtime flag.
+ * page/ContentSecurityPolicy.cpp:
+ (WebCore::CSPDirectiveList::addDirective):
+ Check that experimental features are runtime enabled before
+ processing 1.1 directives.
+ (WebCore::ContentSecurityPolicy::experimentalFeaturesEnabled):
+ (WebCore):
+ * page/ContentSecurityPolicy.h:
+ Adds a new method which checks against the runtime flag to determine
+ whether CSP 1.1 features are enabled.
+
2012-11-30 Simon Fraser <[email protected]>
Avoid calling into NSUserDefaults every time we start a scroll
Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp (136304 => 136305)
--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp 2012-12-01 06:18:59 UTC (rev 136304)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp 2012-12-01 06:53:25 UTC (rev 136305)
@@ -229,4 +229,8 @@
bool RuntimeEnabledFeatures::isRequestAutocompleteEnabled = false;
#endif
+#if ENABLE(CSP_NEXT)
+bool RuntimeEnabledFeatures::areExperimentalContentSecurityPolicyFeaturesEnabled = false;
+#endif
+
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h (136304 => 136305)
--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h 2012-12-01 06:18:59 UTC (rev 136304)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h 2012-12-01 06:53:25 UTC (rev 136305)
@@ -255,6 +255,11 @@
static void setDialogElementEnabled(bool isEnabled) { isDialogElementEnabled = isEnabled; }
#endif
+#if ENABLE(CSP_NEXT)
+ static bool experimentalContentSecurityPolicyFeaturesEnabled() { return areExperimentalContentSecurityPolicyFeaturesEnabled; }
+ static void setExperimentalContentSecurityPolicyFeaturesEnabled(bool isEnabled) { areExperimentalContentSecurityPolicyFeaturesEnabled = isEnabled; }
+#endif
+
static bool langAttributeAwareFormControlUIEnabled() { return isLangAttributeAwareFormControlUIEnabled; }
// The lang attribute support is incomplete and should only be turned on for tests.
static void setLangAttributeAwareFormControlUIEnabled(bool isEnabled) { isLangAttributeAwareFormControlUIEnabled = isEnabled; }
@@ -365,6 +370,10 @@
#if ENABLE(REQUEST_AUTOCOMPLETE)
static bool isRequestAutocompleteEnabled;
#endif
+
+#if ENABLE(CSP_NEXT)
+ static bool areExperimentalContentSecurityPolicyFeaturesEnabled;
+#endif
};
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/Document.idl (136304 => 136305)
--- trunk/Source/WebCore/dom/Document.idl 2012-12-01 06:18:59 UTC (rev 136304)
+++ trunk/Source/WebCore/dom/Document.idl 2012-12-01 06:53:25 UTC (rev 136305)
@@ -366,7 +366,7 @@
[Conditional=PAGE_VISIBILITY_API] readonly attribute boolean webkitHidden;
// Security Policy API: http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#script-interfaces
- [Conditional=CSP_NEXT] readonly attribute DOMSecurityPolicy securityPolicy;
+ [Conditional=CSP_NEXT, V8EnabledAtRuntime=experimentalContentSecurityPolicyFeatures] readonly attribute DOMSecurityPolicy securityPolicy;
};
Modified: trunk/Source/WebCore/page/ContentSecurityPolicy.cpp (136304 => 136305)
--- trunk/Source/WebCore/page/ContentSecurityPolicy.cpp 2012-12-01 06:18:59 UTC (rev 136304)
+++ trunk/Source/WebCore/page/ContentSecurityPolicy.cpp 2012-12-01 06:53:25 UTC (rev 136305)
@@ -37,6 +37,7 @@
#include "InspectorValues.h"
#include "KURL.h"
#include "PingLoader.h"
+#include "RuntimeEnabledFeatures.h"
#include "SchemeRegistry.h"
#include "ScriptCallStack.h"
#include "ScriptCallStackFactory.h"
@@ -1313,7 +1314,7 @@
else if (equalIgnoringCase(name, reportURI))
parseReportURI(name, value);
#if ENABLE(CSP_NEXT)
- else if (m_experimental) {
+ else if (m_experimental && m_policy->experimentalFeaturesEnabled()) {
if (equalIgnoringCase(name, formAction))
setCSPDirective<SourceListDirective>(name, value, m_formAction);
else if (equalIgnoringCase(name, pluginTypes))
@@ -1710,4 +1711,13 @@
InspectorInstrumentation::scriptExecutionBlockedByCSP(m_scriptExecutionContext, directiveText);
}
+bool ContentSecurityPolicy::experimentalFeaturesEnabled() const
+{
+#if ENABLE(CSP_NEXT)
+ return RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnabled();
+#else
+ return false;
+#endif
}
+
+}
Modified: trunk/Source/WebCore/page/ContentSecurityPolicy.h (136304 => 136305)
--- trunk/Source/WebCore/page/ContentSecurityPolicy.h 2012-12-01 06:18:59 UTC (rev 136304)
+++ trunk/Source/WebCore/page/ContentSecurityPolicy.h 2012-12-01 06:53:25 UTC (rev 136305)
@@ -120,6 +120,8 @@
void enforceSandboxFlags(SandboxFlags) const;
String evalDisabledErrorMessage() const;
+ bool experimentalFeaturesEnabled() const;
+
private:
explicit ContentSecurityPolicy(ScriptExecutionContext*);
Modified: trunk/Source/WebKit/chromium/ChangeLog (136304 => 136305)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-12-01 06:18:59 UTC (rev 136304)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-12-01 06:53:25 UTC (rev 136305)
@@ -1,3 +1,23 @@
+2012-11-30 Mike West <[email protected]>
+
+ CSP 1.1: Make the CSP_NEXT flag runtime enabled.
+ https://bugs.webkit.org/show_bug.cgi?id=103652
+
+ Reviewed by Adam Barth.
+
+ The CSP_NEXT flag continues to be enabled on the Chromium port, but this
+ patch now locks the features away behind the securityPolicy runtime
+ flag.
+
+ * public/WebRuntimeFeatures.h:
+ (WebRuntimeFeatures):
+ * src/WebRuntimeFeatures.cpp:
+ (WebKit::WebRuntimeFeatures::enableExperimentalContentSecurityPolicyFeatures):
+ (WebKit):
+ (WebKit::WebRuntimeFeatures::isExperimentalContentSecurityPolicyFeaturesEnabled):
+ Adds the feature to WebRuntimeFeatures so it can be toggled from
+ inside Chromium.
+
2012-11-30 Stephen White <[email protected]>
[Chromium] Suppress the new separable mask blurs in skia until the tests can be rebaselined.
Modified: trunk/Source/WebKit/chromium/public/WebRuntimeFeatures.h (136304 => 136305)
--- trunk/Source/WebKit/chromium/public/WebRuntimeFeatures.h 2012-12-01 06:18:59 UTC (rev 136304)
+++ trunk/Source/WebKit/chromium/public/WebRuntimeFeatures.h 2012-12-01 06:53:25 UTC (rev 136305)
@@ -160,6 +160,8 @@
WEBKIT_EXPORT static void enableCSSRegions(bool);
WEBKIT_EXPORT static bool isCSSRegionsEnabled();
+ WEBKIT_EXPORT static void enableExperimentalContentSecurityPolicyFeatures(bool);
+ WEBKIT_EXPORT static bool isExperimentalContentSecurityPolicyFeaturesEnabled();
private:
WebRuntimeFeatures();
};
Modified: trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp (136304 => 136305)
--- trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp 2012-12-01 06:18:59 UTC (rev 136304)
+++ trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp 2012-12-01 06:53:25 UTC (rev 136305)
@@ -611,6 +611,24 @@
#endif
}
+void WebRuntimeFeatures::enableExperimentalContentSecurityPolicyFeatures(bool enable)
+{
+#if ENABLE(CSP_NEXT)
+ RuntimeEnabledFeatures::setExperimentalContentSecurityPolicyFeaturesEnabled(enable);
+#else
+ UNUSED_PARAM(enable);
+#endif
+}
+
+bool WebRuntimeFeatures::isExperimentalContentSecurityPolicyFeaturesEnabled()
+{
+#if ENABLE(CSP_NEXT)
+ return RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnabled();
+#else
+ return false;
+#endif
+}
+
void WebRuntimeFeatures::enableCSSExclusions(bool enable)
{
RuntimeEnabledFeatures::setCSSExclusionsEnabled(enable);
Modified: trunk/Tools/ChangeLog (136304 => 136305)
--- trunk/Tools/ChangeLog 2012-12-01 06:18:59 UTC (rev 136304)
+++ trunk/Tools/ChangeLog 2012-12-01 06:53:25 UTC (rev 136305)
@@ -1,3 +1,15 @@
+2012-11-30 Mike West <[email protected]>
+
+ CSP 1.1: Make the CSP_NEXT flag runtime enabled.
+ https://bugs.webkit.org/show_bug.cgi?id=103652
+
+ Reviewed by Adam Barth.
+
+ Ensures that the new SecurityPolicy runtime flag is enabled for Chromium's tests.
+
+ * DumpRenderTree/chromium/TestShell.cpp:
+ (TestShell::TestShell):
+
2012-11-30 Roger Fong <[email protected]>
Unreviewed. Removed temporary debugging change from DRT (r136300).
Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.cpp (136304 => 136305)
--- trunk/Tools/DumpRenderTree/chromium/TestShell.cpp 2012-12-01 06:18:59 UTC (rev 136304)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.cpp 2012-12-01 06:53:25 UTC (rev 136305)
@@ -148,6 +148,7 @@
WebRuntimeFeatures::enableStyleScoped(true);
WebRuntimeFeatures::enableScriptedSpeech(true);
WebRuntimeFeatures::enableRequestAutocomplete(true);
+ WebRuntimeFeatures::enableExperimentalContentSecurityPolicyFeatures(true);
// 30 second is the same as the value in Mac DRT.
// If we use a value smaller than the timeout value of