Commit a7013e94 authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

Fix http/tests/xmlhttprequest/origin-whitelisting* tests with site isolation

Rather than propagating the values set by testRunner.addOriginAccessWhtielistEntry,
have the iframe used by the tests call it. Specify which test case to perform
by creating the iframe with a different src hash component

Bug: 585188
Change-Id: I04c1f647306c3e5675b641b47858aff1d25bfd07
Reviewed-on: https://chromium-review.googlesource.com/c/1354504Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Commit-Queue: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612679}
parent 3763198a
...@@ -132,10 +132,6 @@ crbug.com/887140 hdr/video-canvas-alpha.html [ Failure ] ...@@ -132,10 +132,6 @@ crbug.com/887140 hdr/video-canvas-alpha.html [ Failure ]
# Tests temporarily disabled with Site Isolation - test issues or test harness # Tests temporarily disabled with Site Isolation - test issues or test harness
# issues (e.g. missing OOPIF support in the test harness). # issues (e.g. missing OOPIF support in the test harness).
# TODO(lukasza, alexmos): Burn down this list. # TODO(lukasza, alexmos): Burn down this list.
crbug.com/585188 http/tests/xmlhttprequest/origin-whitelisting-all.html [ Failure ]
crbug.com/585188 http/tests/xmlhttprequest/origin-whitelisting-ip-addresses.html [ Failure ]
crbug.com/585188 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-whitelisting-all.html [ Failure ]
crbug.com/585188 virtual/outofblink-cors/http/tests/xmlhttprequest/origin-whitelisting-ip-addresses.html [ Failure ]
crbug.com/606594 http/tests/local/serviceworker/fetch-request-body-file.html [ Skip ] crbug.com/606594 http/tests/local/serviceworker/fetch-request-body-file.html [ Skip ]
crbug.com/645641 external/wpt/html/syntax/parsing/html5lib_tests19.html [ Crash Failure ] crbug.com/645641 external/wpt/html/syntax/parsing/html5lib_tests19.html [ Crash Failure ]
crbug.com/650348 http/tests/webaudio/autoplay-crossorigin.html [ Timeout ] crbug.com/650348 http/tests/webaudio/autoplay-crossorigin.html [ Timeout ]
......
...@@ -1017,16 +1017,6 @@ ...@@ -1017,16 +1017,6 @@
"base": "http/tests/webaudio/autoplay-crossorigin.html", "base": "http/tests/webaudio/autoplay-crossorigin.html",
"args": ["--disable-site-isolation-trials"] "args": ["--disable-site-isolation-trials"]
}, },
{
"prefix": "not-site-per-process",
"base": "http/tests/xmlhttprequest/origin-whitelisting-all.html",
"args": ["--disable-site-isolation-trials"]
},
{
"prefix": "not-site-per-process",
"base": "http/tests/xmlhttprequest/origin-whitelisting-ip-addresses.html",
"args": ["--disable-site-isolation-trials"]
},
{ {
"prefix": "transferable-streams", "prefix": "transferable-streams",
"base": "http/tests/streams/transferable", "base": "http/tests/streams/transferable",
......
CONSOLE WARNING: line 20: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
Tests the special case of whitelisting all origins. Tests the special case of whitelisting all origins.
Testing: http://localhost:8000/xmlhttprequest/resources/get.txt (sync) Testing: http://localhost:8000/xmlhttprequest/resources/get.txt (sync)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
testRunner.dumpAsText(); testRunner.dumpAsText();
testRunner.waitUntilDone(); testRunner.waitUntilDone();
testRunner.addOriginAccessAllowListEntry("http://127.0.0.1:8000", "http", "", true); testRunner.addOriginAccessAllowListEntry("http://127.0.0.1:8000", "http", "", true);
testRunner.addOriginAccessAllowListEntry("http://localhost:8000", "http", "", true); testRunner.setDumpConsoleMessages(false);
function log(message) function log(message)
{ {
...@@ -43,7 +43,7 @@ function testIPAddress() ...@@ -43,7 +43,7 @@ function testIPAddress()
{ {
var iframe = document.createElement("iframe"); var iframe = document.createElement("iframe");
document.body.appendChild(iframe); document.body.appendChild(iframe);
iframe.src = "http://localhost:8000/xmlhttprequest/resources/origin-whitelisting-ip-address-test.html"; iframe.src = "http://localhost:8000/xmlhttprequest/resources/origin-whitelisting-ip-address-test.html#all";
window.addEventListener("message", function(e) { window.addEventListener("message", function(e) {
if (e.data == "DONE") if (e.data == "DONE")
testRunner.notifyDone(); testRunner.notifyDone();
......
CONSOLE WARNING: line 14: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. CONSOLE WARNING: line 24: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
Tests origin whitelisting with IP addresses. Tests origin whitelisting with IP addresses.
Testing: http://127.0.0.1:8000/xmlhttprequest/resources/get.txt (sync) Testing: http://127.0.0.1:8000/xmlhttprequest/resources/get.txt (sync)
......
CONSOLE WARNING: line 14: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. CONSOLE WARNING: line 24: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
CONSOLE ERROR: line 16: Access to XMLHttpRequest at 'http://127.0.0.1:8000/xmlhttprequest/resources/get.txt' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. CONSOLE ERROR: line 26: Access to XMLHttpRequest at 'http://127.0.0.1:8000/xmlhttprequest/resources/get.txt' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
CONSOLE ERROR: Access to XMLHttpRequest at 'http://127.0.0.1:8000/xmlhttprequest/resources/get.txt' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. CONSOLE ERROR: Access to XMLHttpRequest at 'http://127.0.0.1:8000/xmlhttprequest/resources/get.txt' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Specifying that an IP address should match subdomains doesn't make sense. This test verifies that it doesn't do anything. Specifying that an IP address should match subdomains doesn't make sense. This test verifies that it doesn't do anything.
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<script> <script>
testRunner.dumpAsText(); testRunner.dumpAsText();
testRunner.waitUntilDone(); testRunner.waitUntilDone();
testRunner.addOriginAccessAllowListEntry("http://localhost:8000", "http", "*.0.0.1", true);
function log(message) function log(message)
{ {
...@@ -12,7 +11,7 @@ function log(message) ...@@ -12,7 +11,7 @@ function log(message)
var iframe = document.createElement("iframe"); var iframe = document.createElement("iframe");
document.body.appendChild(iframe); document.body.appendChild(iframe);
iframe.src = "http://localhost:8000/xmlhttprequest/resources/origin-whitelisting-ip-address-test.html"; iframe.src = "http://localhost:8000/xmlhttprequest/resources/origin-whitelisting-ip-address-test.html#subdomains";
window.addEventListener("message", function(e) { window.addEventListener("message", function(e) {
if (e.data == "DONE") if (e.data == "DONE")
testRunner.notifyDone(); testRunner.notifyDone();
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<script> <script>
testRunner.dumpAsText(); testRunner.dumpAsText();
testRunner.waitUntilDone(); testRunner.waitUntilDone();
testRunner.addOriginAccessAllowListEntry("http://localhost:8000", "http", "127.0.0.1", false);
function log(message) function log(message)
{ {
......
<p>Tests origin whitelisting to an IP address.</p> <p>Tests origin whitelisting to an IP address.</p>
<p>Intended to be run in an iframe. Notifies success/failure via postMessage().</p> <p>Intended to be run in an iframe. Notifies success/failure via postMessage().</p>
<p>The specific case to test is determined based on location.hash.
<pre id="console"></pre> <pre id="console"></pre>
<script> <script>
...@@ -8,6 +9,15 @@ function log(message) ...@@ -8,6 +9,15 @@ function log(message)
window.parent.postMessage(message, "http://127.0.0.1:8000"); window.parent.postMessage(message, "http://127.0.0.1:8000");
} }
if (window.testRunner) {
if (location.hash == "#all")
testRunner.addOriginAccessAllowListEntry("http://localhost:8000", "http", "", true);
else if (location.hash == "#subdomains")
testRunner.addOriginAccessAllowListEntry("http://localhost:8000", "http", "*.0.0.1", true);
else
testRunner.addOriginAccessAllowListEntry("http://localhost:8000", "http", "127.0.0.1", false);
}
var url = "http://127.0.0.1:8000/xmlhttprequest/resources/get.txt"; var url = "http://127.0.0.1:8000/xmlhttprequest/resources/get.txt";
log("Testing: " + url + " (sync)"); log("Testing: " + url + " (sync)");
var req = new XMLHttpRequest(); var req = new XMLHttpRequest();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment