Diff
Modified: trunk/LayoutTests/ChangeLog (136526 => 136527)
--- trunk/LayoutTests/ChangeLog 2012-12-04 18:28:32 UTC (rev 136526)
+++ trunk/LayoutTests/ChangeLog 2012-12-04 18:34:27 UTC (rev 136527)
@@ -1,3 +1,19 @@
+2012-12-04 Mike West <[email protected]>
+
+ Log to console when forms and popups are blocked by 'sandbox'.
+ https://bugs.webkit.org/show_bug.cgi?id=103615
+
+ Reviewed by Adam Barth.
+
+ * fast/frames/sandboxed-iframe-attribute-parsing-expected.txt:
+ * fast/frames/sandboxed-iframe-forms-dynamic-expected.txt:
+ * fast/frames/sandboxed-iframe-forms-expected.txt:
+ * fast/frames/sandboxed-iframe-navigation-top-by-name-denied-expected.txt:
+ * fast/frames/sandboxed-iframe-navigation-windowopen-expected.txt:
+ * http/tests/security/no-popup-from-sandbox.html:
+ * http/tests/security/popup-allowed-by-sandbox-is-sandboxed.html:
+ Updating effected tests with new console warnings.
+
2012-12-04 Emil A Eklund <[email protected]>
Unreviewed chromium rebaseline for r136508.
Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-expected.txt (136526 => 136527)
--- trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-expected.txt 2012-12-04 18:28:32 UTC (rev 136526)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-expected.txt 2012-12-04 18:34:27 UTC (rev 136527)
@@ -6,6 +6,11 @@
CONSOLE MESSAGE: line 147: Error while parsing the 'sandbox' attribute: 'allowScripts' is an invalid sandbox flag.
CONSOLE MESSAGE: line 151: Error while parsing the 'sandbox' attribute: 'aallow-scripts' is an invalid sandbox flag.
CONSOLE MESSAGE: line 155: Error while parsing the 'sandbox' attribute: 'allow-scriptss' is an invalid sandbox flag.
+CONSOLE MESSAGE: Blocked form submission to '_javascript_:top.disallowedFormSubmitted();' because the form's frame is sandboxed and the 'allow-forms' permission is not set.
+CONSOLE MESSAGE: Blocked form submission to '_javascript_:top.disallowedFormSubmitted();' because the form's frame is sandboxed and the 'allow-forms' permission is not set.
+CONSOLE MESSAGE: Blocked form submission to '_javascript_:top.disallowedFormSubmitted();' because the form's frame is sandboxed and the 'allow-forms' permission is not set.
+CONSOLE MESSAGE: Blocked form submission to '_javascript_:top.disallowedFormSubmitted();' because the form's frame is sandboxed and the 'allow-forms' permission is not set.
+CONSOLE MESSAGE: Blocked form submission to '_javascript_:top.disallowedFormSubmitted();' because the form's frame is sandboxed and the 'allow-forms' permission is not set.
This test case verifies the parsing of the iframe sandbox attribute. Two sets of iframes are used: one where scripting is allowed, and another one where it is disallowed. The test verifies that the allowed frames execute scripts (but other sandboxed properties still apply -- specifically, forms are disabled), and the disallowed ones do not. If successful the test prints "PASS".
Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-forms-dynamic-expected.txt (136526 => 136527)
--- trunk/LayoutTests/fast/frames/sandboxed-iframe-forms-dynamic-expected.txt 2012-12-04 18:28:32 UTC (rev 136526)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-forms-dynamic-expected.txt 2012-12-04 18:34:27 UTC (rev 136527)
@@ -1,2 +1,3 @@
+CONSOLE MESSAGE: Blocked form submission to '_javascript_:window.top.disallowedFormSubmitted();' because the form's frame is sandboxed and the 'allow-forms' permission is not set.
PASS
Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-forms-expected.txt (136526 => 136527)
--- trunk/LayoutTests/fast/frames/sandboxed-iframe-forms-expected.txt 2012-12-04 18:28:32 UTC (rev 136526)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-forms-expected.txt 2012-12-04 18:34:27 UTC (rev 136527)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: Blocked form submission to '_javascript_:window.top.disallowedFormSubmitted();' because the form's frame is sandboxed and the 'allow-forms' permission is not set.
This test runs five IFrames with forms allowed, one IFrame with forms disallowed, then five more IFrames with forms allowed. If ten form submissions are made, and the disallowed submission is not one of them, we consider the test to have passed. This test will print "PASS" on success.
Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-navigation-top-by-name-denied-expected.txt (136526 => 136527)
--- trunk/LayoutTests/fast/frames/sandboxed-iframe-navigation-top-by-name-denied-expected.txt 2012-12-04 18:28:32 UTC (rev 136526)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-navigation-top-by-name-denied-expected.txt 2012-12-04 18:34:27 UTC (rev 136527)
@@ -1,9 +1,11 @@
CONSOLE MESSAGE: Unsafe _javascript_ attempt to initiate a navigation change for frame with URL navigate-top-by-name-to-fail.html.
+CONSOLE MESSAGE: Blocked opening 'fail-and-notify-done.html' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.
CONSOLE MESSAGE: Unsafe _javascript_ attempt to initiate a navigation change for frame with URL navigate-top-by-name-to-fail.html.
CONSOLE MESSAGE: Unsafe _javascript_ attempt to initiate a navigation change for frame with URL navigate-top-by-name-to-fail.html.
+CONSOLE MESSAGE: Blocked opening 'fail-and-notify-done.html' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.
ALERT: PASS
This test verifies that a sandboxed IFrame cannot navigate the top-level frame without allow-top-navigation. This test passes if the navigation does not occur.
Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-navigation-windowopen-expected.txt (136526 => 136527)
--- trunk/LayoutTests/fast/frames/sandboxed-iframe-navigation-windowopen-expected.txt 2012-12-04 18:28:32 UTC (rev 136526)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-navigation-windowopen-expected.txt 2012-12-04 18:34:27 UTC (rev 136527)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: Blocked opening '_javascript_: opener.parent.windowOpened(opener);' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.
Verifies that a sandboxed IFrame cannot open new windows using window.open(). Expect ten windows to be opened, but the sandboxed IFrame not to be the opener of any of them.
This test will print "PASS" on success.
Modified: trunk/LayoutTests/http/tests/security/no-popup-from-sandbox-expected.txt (136526 => 136527)
--- trunk/LayoutTests/http/tests/security/no-popup-from-sandbox-expected.txt 2012-12-04 18:28:32 UTC (rev 136526)
+++ trunk/LayoutTests/http/tests/security/no-popup-from-sandbox-expected.txt 2012-12-04 18:34:27 UTC (rev 136527)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: Blocked opening 'about:blank' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.
ALERT: PASS
To run this test outside of DumpRenderTree, please disable your popup blocker!
Modified: trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed-expected.txt (136526 => 136527)
--- trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed-expected.txt 2012-12-04 18:28:32 UTC (rev 136526)
+++ trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed-expected.txt 2012-12-04 18:34:27 UTC (rev 136527)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: Blocked form submission to '_javascript_:alert(/FAIL/)' because the form's frame is sandboxed and the 'allow-forms' permission is not set.
To run this test outside of DumpRenderTree, please disable your popup blocker!
If you change this test, please be sure to change popup-allowed-by-sandbox-is-sandboxed-control.html as well!
Modified: trunk/Source/WebCore/ChangeLog (136526 => 136527)
--- trunk/Source/WebCore/ChangeLog 2012-12-04 18:28:32 UTC (rev 136526)
+++ trunk/Source/WebCore/ChangeLog 2012-12-04 18:34:27 UTC (rev 136527)
@@ -1,3 +1,21 @@
+2012-12-04 Mike West <[email protected]>
+
+ Log to console when forms and popups are blocked by 'sandbox'.
+ https://bugs.webkit.org/show_bug.cgi?id=103615
+
+ Reviewed by Adam Barth.
+
+ Adds two console messages to cover form submissions blocked by a
+ sandboxed frame lacking the 'allow-forms' permission, and window
+ creation blocked by a sandboxed frame lacking the 'allow-popups'
+ permission.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::submitForm):
+ Log a warning when form submission is blocked by sandboxing flags.
+ (WebCore::createWindow):
+ Log a warning when window.open is blocked due to sandboxing flags.
+
2012-12-04 Kentaro Hara <[email protected]>
[V8] Make v8::Null(isolate) faster by caching the value in V8 bindings
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (136526 => 136527)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2012-12-04 18:28:32 UTC (rev 136526)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2012-12-04 18:34:27 UTC (rev 136527)
@@ -333,8 +333,11 @@
if (submission->action().isEmpty())
return;
- if (isDocumentSandboxed(m_frame, SandboxForms))
+ if (isDocumentSandboxed(m_frame, SandboxForms)) {
+ // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
+ m_frame->document()->addConsoleMessage(HTMLMessageSource, LogMessageType, ErrorMessageLevel, "Blocked form submission to '" + submission->action().string() + "' because the form's frame is sandboxed and the 'allow-forms' permission is not set.");
return;
+ }
if (protocolIsJavaScript(submission->action())) {
if (!m_frame->document()->contentSecurityPolicy()->allowFormAction(KURL(submission->action())))
@@ -3289,8 +3292,11 @@
}
// Sandboxed frames cannot open new auxiliary browsing contexts.
- if (isDocumentSandboxed(openerFrame, SandboxPopups))
+ if (isDocumentSandboxed(openerFrame, SandboxPopups)) {
+ // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
+ openerFrame->document()->addConsoleMessage(HTMLMessageSource, LogMessageType, ErrorMessageLevel, "Blocked opening '" + request.resourceRequest().url().string() + "' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.");
return 0;
+ }
// FIXME: Setting the referrer should be the caller's responsibility.
FrameLoadRequest requestWithReferrer = request;