Diff
Modified: trunk/LayoutTests/ChangeLog (208474 => 208475)
--- trunk/LayoutTests/ChangeLog 2016-11-09 21:16:44 UTC (rev 208474)
+++ trunk/LayoutTests/ChangeLog 2016-11-09 21:17:45 UTC (rev 208475)
@@ -1,3 +1,46 @@
+2016-11-09 Daniel Bates <[email protected]>
+
+ Add test infrastructure and tests for existing HTTP 0.9 sandbox machinery
+ https://bugs.webkit.org/show_bug.cgi?id=164389
+ <rdar://problem/29101072>
+
+ Reviewed by Alex Christensen.
+
+ Add tests for the existing HTTP 0.9 sandbox machinery. Until we fix <https://bugs.webkit.org/show_bug.cgi?id=164387>,
+ these tests can only be run singly (i.e. pass --run-singly to run-webkit-tests). So, we skip
+ these tests to avoid test failures when run-webkit-tests runs in parallel mode (the default
+ mode and the mode used on the buildbots).
+
+ * TestExpectations:
+ * http/tests/security/http-0.9/default-port-plugin-blocked-expected.txt: Added.
+ * http/tests/security/http-0.9/default-port-plugin-blocked.html: Added.
+ * http/tests/security/http-0.9/default-port-script-blocked-expected.txt: Added.
+ * http/tests/security/http-0.9/default-port-script-blocked.html: Added.
+ * http/tests/security/http-0.9/iframe-blocked-expected.txt: Added.
+ * http/tests/security/http-0.9/iframe-blocked.html: Added.
+ * http/tests/security/http-0.9/image-blocked-expected.txt: Added.
+ * http/tests/security/http-0.9/image-blocked.html: Added.
+ * http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-expected.txt: Added.
+ * http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test-expected.html: Added.
+ * http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html: Added.
+ * http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html: Added.
+ * http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked-expected.txt: Added.
+ * http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html: Added.
+ * http/tests/security/http-0.9/resources/blue-square.png: Added.
+ * http/tests/security/http-0.9/resources/nph-alert-fail.pl: Added.
+ * http/tests/security/http-0.9/resources/nph-fail.pl: Added.
+ * http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-default-port-page-allowed.pl: Added.
+ * http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-page-blocked.pl: Added.
+ * http/tests/security/http-0.9/resources/nph-image.pl: Added.
+ * http/tests/security/http-0.9/resources/nph-load-plugin-fail.pl: Added.
+ * http/tests/security/http-0.9/resources/nph-worker-fail.pl: Added.
+ * http/tests/security/http-0.9/worker-connect-src-blocked-expected.txt: Added.
+ * http/tests/security/http-0.9/worker-connect-src-blocked.html: Added.
+ * http/tests/security/http-0.9/worker-importScripts-blocked-expected.txt: Added.
+ * http/tests/security/http-0.9/worker-importScripts-blocked.html: Added.
+ * http/tests/security/http-0.9/xhr-asynchronous-blocked-expected.txt: Added.
+ * http/tests/security/http-0.9/xhr-asynchronous-blocked.html: Added.
+
2016-11-09 Wenson Hsieh <[email protected]>
When editing IME, `compositionend` events should fire after input events
Modified: trunk/LayoutTests/TestExpectations (208474 => 208475)
--- trunk/LayoutTests/TestExpectations 2016-11-09 21:16:44 UTC (rev 208474)
+++ trunk/LayoutTests/TestExpectations 2016-11-09 21:17:45 UTC (rev 208475)
@@ -66,6 +66,9 @@
# Only iOS has selection UI drawn by UIKit
editing/selection/character-granularity-rect.html [ Skip ]
+# Until we fix webkit.org/b/164387 these tests will only pass when run singly (i.e. pass --run-singly to run-webkit-tests).
+webkit.org/b/164387 http/tests/security/http-0.9 [ Skip ]
+
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific tests.
#//////////////////////////////////////////////////////////////////////////////////////////
Added: trunk/LayoutTests/http/tests/security/http-0.9/default-port-plugin-blocked-expected.txt (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/default-port-plugin-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/default-port-plugin-blocked-expected.txt 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,11 @@
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-load-plugin-fail.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-load-plugin-fail.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-load-plugin-fail.pl' because it is using HTTP/0.9.
+This tests that loading of a plugin is blocked in a HTTP 0.9 response served over port 80. This test PASSED if you see content in the iframe below. Otherwise, it FAILED.
+
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+Plugin did not load.
Added: trunk/LayoutTests/http/tests/security/http-0.9/default-port-plugin-blocked.html (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/default-port-plugin-blocked.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/default-port-plugin-blocked.html 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.dumpChildFramesAsText();
+ if (window.internals)
+ internals.registerDefaultPortForProtocol(8000, "http");
+}
+</script>
+</head>
+<body>
+<p id="description">This tests that loading of a plugin is blocked in a HTTP 0.9 response served over port 80. This test PASSED if you see content in the iframe below. Otherwise, it FAILED.</p>
+<iframe src=""
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/http-0.9/default-port-script-blocked-expected.txt (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/default-port-script-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/default-port-script-blocked-expected.txt 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,12 @@
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-alert-fail.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-alert-fail.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-alert-fail.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Blocked script execution in 'http://127.0.0.1:8000/security/http-0.9/resources/nph-alert-fail.pl' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
+This tests that _javascript_ is blocked in a HTTP 0.9 response served over port 80. This test PASSED if you see content in the iframe below and do not see a _javascript_ alert. Otherwise, it FAILED. This page and its subresources must be served over port 80 to run this test by hand.
+
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+This content should be visible, but script should not execute.
Added: trunk/LayoutTests/http/tests/security/http-0.9/default-port-script-blocked.html (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/default-port-script-blocked.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/default-port-script-blocked.html 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.dumpChildFramesAsText();
+ if (window.internals)
+ internals.registerDefaultPortForProtocol(8000, "http");
+}
+</script>
+</head>
+<body>
+<p id="description">This tests that _javascript_ is blocked in a HTTP 0.9 response served over port 80. This test PASSED if you see content in the iframe below and do not see a _javascript_ alert. Otherwise, it FAILED. This page and its subresources must be served over port 80 to run this test by hand.</p>
+<iframe src=""
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/http-0.9/iframe-blocked-expected.txt (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/iframe-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/iframe-blocked-expected.txt 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,8 @@
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-fail.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Stopped document load from 'http://127.0.0.1:8000/security/http-0.9/resources/nph-fail.pl' because it is using HTTP/0.9 on a non-default port.
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+
Added: trunk/LayoutTests/http/tests/security/http-0.9/iframe-blocked.html (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/iframe-blocked.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/iframe-blocked.html 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.dumpChildFramesAsText();
+}
+</script>
+</head>
+<body>
+<iframe src=""
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/http-0.9/image-blocked-expected.txt (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/image-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/image-blocked-expected.txt 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-image.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Cancelled resource load from 'http://127.0.0.1:8000/security/http-0.9/resources/nph-image.pl' because it is using HTTP/0.9 and the document was loaded with a different HTTP version.
+ALERT: PASS
+
Added: trunk/LayoutTests/http/tests/security/http-0.9/image-blocked.html (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/image-blocked.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/image-blocked.html 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+</head>
+<body>
+<img src="" _onload_="alert('FAIL')" _onerror_="alert('PASS')">
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-expected.txt (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-expected.txt 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,11 @@
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-image-on-HTTP-0.9-default-port-page-allowed.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-image-on-HTTP-0.9-default-port-page-allowed.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-image-on-HTTP-0.9-default-port-page-allowed.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-image.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-image.pl' because it is using HTTP/0.9.
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+
Added: trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test-expected.html (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test-expected.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test-expected.html 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+<iframe srcdoc='<img src=""
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.internals)
+ internals.registerDefaultPortForProtocol(8000, "http");
+</script>
+</head>
+<body>
+<iframe src=""
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.dumpChildFramesAsText();
+ if (window.internals)
+ internals.registerDefaultPortForProtocol(8000, "http");
+}
+</script>
+</head>
+<body>
+<iframe src=""
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked-expected.txt (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked-expected.txt 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,11 @@
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-image-on-HTTP-0.9-page-blocked.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-image-on-HTTP-0.9-page-blocked.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-image-on-HTTP-0.9-page-blocked.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8080/security/http-0.9/resources/nph-image.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Cancelled resource load from 'http://127.0.0.1:8080/security/http-0.9/resources/nph-image.pl' because it is using HTTP/0.9 on a non-default port.
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+
Added: trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.dumpChildFramesAsText();
+ if (window.internals)
+ internals.registerDefaultPortForProtocol(8000, "http");
+}
+</script>
+</head>
+<body>
+<iframe src=""
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/http-0.9/resources/blue-square.png
(Binary files differ)
Index: trunk/LayoutTests/http/tests/security/http-0.9/resources/blue-square.png
===================================================================
--- trunk/LayoutTests/http/tests/security/http-0.9/resources/blue-square.png 2016-11-09 21:16:44 UTC (rev 208474)
+++ trunk/LayoutTests/http/tests/security/http-0.9/resources/blue-square.png 2016-11-09 21:17:45 UTC (rev 208475)
Property changes on: trunk/LayoutTests/http/tests/security/http-0.9/resources/blue-square.png
___________________________________________________________________
Added: svn:mime-type
+image/png
\ No newline at end of property
Added: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-alert-fail.pl (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-alert-fail.pl (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-alert-fail.pl 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+# This script relies on its nph- filename to invoke the CGI non-parsed-header facility.
+
+print <<'EOF';
+<!DOCTYPE html>
+<html>
+<body>
+<p>This content should be visible, but script should not execute.</p>
+<script>alert("FAIL")</script>
+</body>
+</html>
+EOF
Property changes on: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-alert-fail.pl
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Added: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-fail.pl (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-fail.pl (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-fail.pl 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,5 @@
+#!/usr/bin/perl
+# This script relies on its nph- filename to invoke the CGI non-parsed-header facility.
+
+# We emit two newline characters to signal the end of a text/plain response without HTTP headers.
+print "FAIL\n\n";
Property changes on: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-fail.pl
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Added: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-default-port-page-allowed.pl (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-default-port-page-allowed.pl (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-default-port-page-allowed.pl 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+# This script relies on its nph- filename to invoke the CGI non-parsed-header facility.
+
+print <<'EOF';
+<!DOCTYPE html>
+<html>
+<body>
+<img src=""
+</body>
+</html>
+EOF
Property changes on: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-default-port-page-allowed.pl
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Added: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-page-blocked.pl (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-page-blocked.pl (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-page-blocked.pl 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+# This script relies on its nph- filename to invoke the CGI non-parsed-header facility.
+
+print <<'EOF';
+<!DOCTYPE html>
+<html>
+<body>
+<img src=""
+</body>
+</html>
+EOF
Property changes on: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-page-blocked.pl
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Added: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image.pl (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image.pl (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image.pl 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+# This script relies on its nph- filename to invoke the CGI non-parsed-header facility.
+
+use strict;
+use warnings;
+
+use MIME::Base64;
+
+my $blueSquare = <<'EOF';
+iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQMAAABKLAcXAAAAFmlUWHRYTUw6Y29tLmFkb2JlLnht
+cAAAAAAAaEZ+GgAAAAZQTFRFAAD/AAAAe2K/PgAAABl0RVh0U29mdHdhcmUAR3JhcGhpY0NvbnZl
+cnRlcjVdSO4AAAA1SURBVHicYmCgK2Ckr3VogJ8GKgcTIDd0h6ZvRzIY2Hw0sACf35nI1Ecd20kA
+AAAAAP//AwDMaQA2EUO6XAAAAABJRU5ErkJggg==
+EOF
+$blueSquare =~ s/\n//g;
+
+print decode_base64($blueSquare);
Property changes on: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-image.pl
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Added: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-load-plugin-fail.pl (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-load-plugin-fail.pl (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-load-plugin-fail.pl 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+# This script relies on its nph- filename to invoke the CGI non-parsed-header facility.
+
+print <<'EOF';
+<!DOCTYPE html>
+<html>
+<body>
+<embed type="application/x-webkit-test-netscape">Plugin did not load.</embed>
+</body>
+</html>
+EOF
Property changes on: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-load-plugin-fail.pl
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Added: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-worker-fail.pl (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-worker-fail.pl (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-worker-fail.pl 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,5 @@
+#!/usr/bin/perl
+# This script relies on its nph- filename to invoke the CGI non-parsed-header facility.
+
+# We emit two newline characters to signal the end of the response without HTTP headers.
+print "postMessage('FAIL');\n\n";
Property changes on: trunk/LayoutTests/http/tests/security/http-0.9/resources/nph-worker-fail.pl
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Added: trunk/LayoutTests/http/tests/security/http-0.9/worker-connect-src-blocked-expected.txt (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/worker-connect-src-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/worker-connect-src-blocked-expected.txt 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-worker-fail.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Cancelled resource load from 'http://127.0.0.1:8000/security/http-0.9/resources/nph-worker-fail.pl' because it is using HTTP/0.9 and the document was loaded with a different HTTP version.
+ALERT: PASS
+
Added: trunk/LayoutTests/http/tests/security/http-0.9/worker-connect-src-blocked.html (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/worker-connect-src-blocked.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/worker-connect-src-blocked.html 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+</script>
+</head>
+<body>
+<script>
+var worker = new Worker("resources/nph-worker-fail.pl");
+worker._onmessage_ = () => { alertAndDone("FAIL"); }
+worker._onerror_ = () => { alertAndDone("PASS"); }
+
+function alertAndDone(message)
+{
+ alert(message);
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/http-0.9/worker-importScripts-blocked-expected.txt (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/worker-importScripts-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/worker-importScripts-blocked-expected.txt 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-worker-fail.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Cancelled resource load from 'http://127.0.0.1:8000/security/http-0.9/resources/nph-worker-fail.pl' because it is using HTTP/0.9 and the document was loaded with a different HTTP version.
+ALERT: PASS
+
Added: trunk/LayoutTests/http/tests/security/http-0.9/worker-importScripts-blocked.html (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/worker-importScripts-blocked.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/worker-importScripts-blocked.html 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+</script>
+</head>
+<body>
+<script>
+var script = [
+ 'try {',
+ ' importScripts("http://127.0.0.1:8000/security/http-0.9/resources/nph-worker-fail.pl");',
+ '} catch (e) {',
+ ' postMessage("PASS");',
+ '}',
+].join("\n");
+
+var worker = new Worker(window.URL.createObjectURL(new Blob([script])));
+worker._onmessage_ = (messageEvent) => { alertAndDone(messageEvent.data); }
+
+function alertAndDone(message)
+{
+ alert(message);
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/http-0.9/xhr-asynchronous-blocked-expected.txt (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/xhr-asynchronous-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/xhr-asynchronous-blocked-expected.txt 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: Sandboxing 'http://127.0.0.1:8000/security/http-0.9/resources/nph-fail.pl' because it is using HTTP/0.9.
+CONSOLE MESSAGE: Cancelled resource load from 'http://127.0.0.1:8000/security/http-0.9/resources/nph-fail.pl' because it is using HTTP/0.9 and the document was loaded with a different HTTP version.
+ALERT: PASS
+
Added: trunk/LayoutTests/http/tests/security/http-0.9/xhr-asynchronous-blocked.html (0 => 208475)
--- trunk/LayoutTests/http/tests/security/http-0.9/xhr-asynchronous-blocked.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/http-0.9/xhr-asynchronous-blocked.html 2016-11-09 21:17:45 UTC (rev 208475)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+</script>
+</head>
+<body>
+<script>
+const isAsynchronous = true;
+var xhr = new XMLHttpRequest;
+xhr.open("GET", "resources/nph-fail.pl", isAsynchronous);
+xhr._onload_ = () => { alertAndDone("FAIL"); }
+xhr._onerror_ = () => {
+ // FIXME: Assert that a specific error occurred.
+ alertAndDone("PASS");
+}
+xhr.send();
+
+function alertAndDone(message)
+{
+ alert(message);
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (208474 => 208475)
--- trunk/Source/WebCore/ChangeLog 2016-11-09 21:16:44 UTC (rev 208474)
+++ trunk/Source/WebCore/ChangeLog 2016-11-09 21:17:45 UTC (rev 208475)
@@ -1,3 +1,49 @@
+2016-11-09 Daniel Bates <[email protected]>
+
+ Add test infrastructure and tests for existing HTTP 0.9 sandbox machinery
+ https://bugs.webkit.org/show_bug.cgi?id=164389
+ <rdar://problem/29101072>
+
+ Reviewed by Alex Christensen.
+
+ Add test infrastructure to support registering an arbitrary port as the default port
+ for a protocol. The behavior of various machinery, including the HTTP 0.9 machinery,
+ can be effected by whether the resource request was made using the default port for
+ the protocol. We expose window.internals.registerDefaultPortForProtocol() to allow
+ a test to override the default port associated with a protocol so as to support
+ testing these code paths using the existing port 8000 server started by run-webkit-httpd.
+ Without window.internals.registerDefaultPortForProtocol() we would need to teach
+ run-webkit-httpd to run a web server on port 80, which requires superuser privileges
+ (since it is a privileged port number) and is more likely to interfere with an
+ existing web server setup.
+
+ Tests: http/tests/security/http-0.9/default-port-plugin-blocked.html
+ http/tests/security/http-0.9/default-port-script-blocked.html
+ http/tests/security/http-0.9/iframe-blocked.html
+ http/tests/security/http-0.9/image-blocked.html
+ http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html
+ http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html
+ http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html
+ http/tests/security/http-0.9/worker-connect-src-blocked.html
+ http/tests/security/http-0.9/worker-importScripts-blocked.html
+ http/tests/security/http-0.9/xhr-asynchronous-blocked.html
+
+ * platform/URL.cpp:
+ (WebCore::defaultPortForProtocolMapForTesting): Added.
+ (WebCore::registerDefaultPortForProtocolForTesting): Adds the specified (protocol, port) to the
+ mapping used for testing.
+ (WebCore::clearDefaultPortForProtocolMapForTesting): Clears the protocol to default port testing map.
+ We call this function from Internals::resetToConsistentState() so that the mapping is cleared between
+ test runs.
+ (WebCore::defaultPortForProtocol): Modified to check the protocol to default port map for testing
+ before consulting URLParser::defaultPortForProtocol().
+ * platform/URL.h:
+ * testing/Internals.cpp:
+ (WebCore::Internals::resetToConsistentState): Clear the default port mapping used for testing.
+ (WebCore::Internals::registerDefaultPortForProtocol): Added.
+ * testing/Internals.h:
+ * testing/Internals.idl: Added declaration for registerDefaultPortForProtocol().
+
2016-11-09 Sam Weinig <[email protected]>
[WebIDL] Add proper parsing for Promises
Modified: trunk/Source/WebCore/platform/URL.cpp (208474 => 208475)
--- trunk/Source/WebCore/platform/URL.cpp 2016-11-09 21:16:44 UTC (rev 208474)
+++ trunk/Source/WebCore/platform/URL.cpp 2016-11-09 21:17:45 UTC (rev 208475)
@@ -800,8 +800,29 @@
#endif
+using DefaultPortForProtocolMapForTesting = HashMap<String, uint16_t>;
+static DefaultPortForProtocolMapForTesting& defaultPortForProtocolMapForTesting()
+{
+ static NeverDestroyed<DefaultPortForProtocolMapForTesting> defaultPortForProtocolMap;
+ return defaultPortForProtocolMap;
+}
+
+void registerDefaultPortForProtocolForTesting(uint16_t port, const String& protocol)
+{
+ defaultPortForProtocolMapForTesting().add(protocol, port);
+}
+
+void clearDefaultPortForProtocolMapForTesting()
+{
+ defaultPortForProtocolMapForTesting().clear();
+}
+
Optional<uint16_t> defaultPortForProtocol(StringView protocol)
{
+ const auto& defaultPortForProtocolMap = defaultPortForProtocolMapForTesting();
+ auto iterator = defaultPortForProtocolMap.find(protocol.toStringWithoutCopying());
+ if (iterator != defaultPortForProtocolMap.end())
+ return iterator->value;
return URLParser::defaultPortForProtocol(protocol);
}
Modified: trunk/Source/WebCore/platform/URL.h (208474 => 208475)
--- trunk/Source/WebCore/platform/URL.h 2016-11-09 21:16:44 UTC (rev 208474)
+++ trunk/Source/WebCore/platform/URL.h 2016-11-09 21:17:45 UTC (rev 208475)
@@ -315,6 +315,9 @@
WEBCORE_EXPORT bool isDefaultPortForProtocol(uint16_t port, StringView protocol);
WEBCORE_EXPORT bool portAllowed(const URL&); // Blacklist ports that should never be used for Web resources.
+WEBCORE_EXPORT void registerDefaultPortForProtocolForTesting(uint16_t port, const String& protocol);
+WEBCORE_EXPORT void clearDefaultPortForProtocolMapForTesting();
+
bool isValidProtocol(const String&);
String mimeTypeFromDataURL(const String& url);
Modified: trunk/Source/WebCore/testing/Internals.cpp (208474 => 208475)
--- trunk/Source/WebCore/testing/Internals.cpp 2016-11-09 21:16:44 UTC (rev 208474)
+++ trunk/Source/WebCore/testing/Internals.cpp 2016-11-09 21:17:45 UTC (rev 208475)
@@ -375,6 +375,7 @@
#endif
}
+ WebCore::clearDefaultPortForProtocolMapForTesting();
WebCore::overrideUserPreferredLanguages(Vector<String>());
WebCore::Settings::setUsesOverlayScrollbars(false);
WebCore::Settings::setUsesMockScrollAnimator(false);
@@ -2170,6 +2171,11 @@
SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(scheme);
}
+void Internals::registerDefaultPortForProtocol(unsigned short port, const String& protocol)
+{
+ registerDefaultPortForProtocolForTesting(port, protocol);
+}
+
Ref<MallocStatistics> Internals::mallocStatistics() const
{
return MallocStatistics::create();
Modified: trunk/Source/WebCore/testing/Internals.h (208474 => 208475)
--- trunk/Source/WebCore/testing/Internals.h 2016-11-09 21:16:44 UTC (rev 208474)
+++ trunk/Source/WebCore/testing/Internals.h 2016-11-09 21:17:45 UTC (rev 208475)
@@ -314,6 +314,8 @@
void registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme);
void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const String& scheme);
+ void registerDefaultPortForProtocol(unsigned short port, const String& protocol);
+
Ref<MallocStatistics> mallocStatistics() const;
Ref<TypeConversions> typeConversions() const;
Ref<MemoryInfo> memoryInfo() const;
Modified: trunk/Source/WebCore/testing/Internals.idl (208474 => 208475)
--- trunk/Source/WebCore/testing/Internals.idl 2016-11-09 21:16:44 UTC (rev 208474)
+++ trunk/Source/WebCore/testing/Internals.idl 2016-11-09 21:17:45 UTC (rev 208475)
@@ -304,6 +304,8 @@
void registerURLSchemeAsBypassingContentSecurityPolicy(DOMString scheme);
void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(DOMString scheme);
+ void registerDefaultPortForProtocol(unsigned short port, DOMString scheme);
+
MallocStatistics mallocStatistics();
TypeConversions typeConversions();
MemoryInfo memoryInfo();