Diff
Modified: trunk/LayoutTests/ChangeLog (185295 => 185296)
--- trunk/LayoutTests/ChangeLog 2015-06-06 22:55:41 UTC (rev 185295)
+++ trunk/LayoutTests/ChangeLog 2015-06-07 00:09:27 UTC (rev 185296)
@@ -1,3 +1,28 @@
+2015-06-06 Alexey Proskuryakov <[email protected]>
+
+ Clean up tests for blocking mixed content
+ https://bugs.webkit.org/show_bug.cgi?id=145718
+
+ Reviewed by Darin Adler.
+
+ Stop using timeouts, which were making the tests flaky.
+
+ * http/tests/xmlhttprequest/access-control-response-with-body.html: This wasn't even
+ a mixed content test, but the file was reused in one. I now made a separate helper
+ document, so this is just a regular test now, not another test's resource.
+
+ * http/tests/security/mixedContent/redirect-http-to-https-iframe-in-main-frame.html:
+ * http/tests/security/mixedContent/redirect-https-to-http-iframe-in-main-frame.html:
+ * http/tests/security/mixedContent/resources/frame-with-insecure-frame.html:
+ * http/tests/security/mixedContent/resources/frame-with-redirect-http-to-https-frame.html:
+ * http/tests/security/mixedContent/resources/frame-with-redirect-https-to-http-frame.html:
+ Refactored to not depend on timeouts.
+
+ * http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt:
+ * http/tests/security/mixedContent/insecure-xhr-in-main-frame.html:
+ * http/tests/security/mixedContent/resources/insecure-xhr-in-main-frame-window.html: Added.
+ This test still needs a timeout, because of a WebKit bug. I just made it much longer.
+
2015-06-06 Mark Lam <[email protected]>
Returned Exception* values need to be initialized to nullptr when no exceptions are thrown.
Modified: trunk/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt (185295 => 185296)
--- trunk/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt 2015-06-06 22:55:41 UTC (rev 185295)
+++ trunk/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt 2015-06-07 00:09:27 UTC (rev 185296)
@@ -1,3 +1,3 @@
-CONSOLE MESSAGE: line 26: [blocked] The page at https://127.0.0.1:8443/xmlhttprequest/access-control-response-with-body.html was not allowed to display insecure content from http://localhost:8000/xmlhttprequest/resources/access-control-allow-with-body.php.
+CONSOLE MESSAGE: line 28: [blocked] The page at https://127.0.0.1:8443/security/mixedContent/resources/insecure-xhr-in-main-frame-window.html was not allowed to display insecure content from http://127.0.0.1:8000/.
This test opens a HTTPS window that loads insecure data via XHR. We should trigger a mixed content callback because the main frame in the window is HTTPS but now has insecure data.
Modified: trunk/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame.html (185295 => 185296)
--- trunk/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame.html 2015-06-06 22:55:41 UTC (rev 185295)
+++ trunk/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame.html 2015-06-07 00:09:27 UTC (rev 185296)
@@ -8,20 +8,13 @@
testRunner.setCloseRemainingWindowsWhenComplete(true);
}
-window.addEventListener("message", function (e) {
- if (window.testRunner)
- testRunner.notifyDone();
- if (e.data == "done")
- throw "Should not load this"
-}, false);
-
</script>
<p>This test opens a HTTPS window that loads insecure data via XHR. We should
trigger a mixed content callback because the main frame in the window is HTTPS but
now has insecure data.</p>
<script>
_onload_ = function() {
- window.open("https://127.0.0.1:8443/xmlhttprequest/access-control-response-with-body.html");
+ window.open("https://127.0.0.1:8443/security/mixedContent/resources/insecure-xhr-in-main-frame-window.html");
}
</script>
</body>
Modified: trunk/LayoutTests/http/tests/security/mixedContent/redirect-http-to-https-iframe-in-main-frame.html (185295 => 185296)
--- trunk/LayoutTests/http/tests/security/mixedContent/redirect-http-to-https-iframe-in-main-frame.html 2015-06-06 22:55:41 UTC (rev 185295)
+++ trunk/LayoutTests/http/tests/security/mixedContent/redirect-http-to-https-iframe-in-main-frame.html 2015-06-07 00:09:27 UTC (rev 185296)
@@ -10,10 +10,10 @@
}
window.addEventListener("message", function (e) {
- if (window.testRunner)
- testRunner.notifyDone();
- if (e.data == "done")
- throw "should not have loaded insecure content"
+ if (e.data == "done")
+ alert("should not have loaded insecure content");
+ if (window.testRunner)
+ testRunner.notifyDone();
}, false);
</script>
Modified: trunk/LayoutTests/http/tests/security/mixedContent/redirect-https-to-http-iframe-in-main-frame.html (185295 => 185296)
--- trunk/LayoutTests/http/tests/security/mixedContent/redirect-https-to-http-iframe-in-main-frame.html 2015-06-06 22:55:41 UTC (rev 185295)
+++ trunk/LayoutTests/http/tests/security/mixedContent/redirect-https-to-http-iframe-in-main-frame.html 2015-06-07 00:09:27 UTC (rev 185296)
@@ -10,10 +10,10 @@
}
window.addEventListener("message", function (e) {
+ if (e.data == "done")
+ alert("should not have loaded insecure content");
if (window.testRunner)
testRunner.notifyDone()
- if (e.data == "done")
- throw "should not have loaded insecure content"
}, false);
</script>
Modified: trunk/LayoutTests/http/tests/security/mixedContent/resources/frame-with-insecure-frame.html (185295 => 185296)
--- trunk/LayoutTests/http/tests/security/mixedContent/resources/frame-with-insecure-frame.html 2015-06-06 22:55:41 UTC (rev 185295)
+++ trunk/LayoutTests/http/tests/security/mixedContent/resources/frame-with-insecure-frame.html 2015-06-07 00:09:27 UTC (rev 185296)
@@ -1,12 +1,11 @@
<script>
-function frameLoaded() {
- if (window.opener)
- window.opener.postMessage('done', '*');
+var frameDidLoad = false;
+
+_onload_ = function()
+{
+ if (window.opener)
+ window.opener.postMessage(frameDidLoad ? 'done' : 'blocked', '*');
}
-setTimeout(function(){
- if (window.opener)
- window.opener.postMessage('blocked', '*');
-}, 100)
</script>
-<iframe _onload_="frameLoaded()"
+<iframe _onload_="frameDidLoad = true"
src=""
Modified: trunk/LayoutTests/http/tests/security/mixedContent/resources/frame-with-redirect-http-to-https-frame.html (185295 => 185296)
--- trunk/LayoutTests/http/tests/security/mixedContent/resources/frame-with-redirect-http-to-https-frame.html 2015-06-06 22:55:41 UTC (rev 185295)
+++ trunk/LayoutTests/http/tests/security/mixedContent/resources/frame-with-redirect-http-to-https-frame.html 2015-06-07 00:09:27 UTC (rev 185296)
@@ -1,12 +1,11 @@
<script>
-function frameLoaded() {
- if (window.opener)
- window.opener.postMessage('done', '*');
+var frameDidLoad = false;
+
+_onload_ = function()
+{
+ if (window.opener)
+ window.opener.postMessage(frameDidLoad ? 'done' : 'blocked', '*');
}
-setTimeout(function(){
- if (window.opener)
- window.opener.postMessage('blocked', '*');
-}, 100)
</script>
-<iframe _onload_="frameLoaded()" _onerror_="frameLoaded()"
+<iframe _onload_="window.frameDidLoad = true"
src=""
Modified: trunk/LayoutTests/http/tests/security/mixedContent/resources/frame-with-redirect-https-to-http-frame.html (185295 => 185296)
--- trunk/LayoutTests/http/tests/security/mixedContent/resources/frame-with-redirect-https-to-http-frame.html 2015-06-06 22:55:41 UTC (rev 185295)
+++ trunk/LayoutTests/http/tests/security/mixedContent/resources/frame-with-redirect-https-to-http-frame.html 2015-06-07 00:09:27 UTC (rev 185296)
@@ -1,13 +1,12 @@
<script>
-function frameLoaded() {
- if (window.opener)
- window.opener.postMessage('done', '*');
+var frameDidLoad = false;
+
+_onload_ = function()
+{
+ if (window.opener)
+ window.opener.postMessage(frameDidLoad ? 'done' : 'blocked', '*');
}
-setTimeout(function(){
- if (window.opener)
- window.opener.postMessage('blocked', '*');
-}, 100)
</script>
-<iframe _onload_="frameLoaded()" _onerror_="frameLoaded()"
+<iframe _onload_="window.frameDidLoad = true"
src=""
Added: trunk/LayoutTests/http/tests/security/mixedContent/resources/insecure-xhr-in-main-frame-window.html (0 => 185296)
--- trunk/LayoutTests/http/tests/security/mixedContent/resources/insecure-xhr-in-main-frame-window.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/mixedContent/resources/insecure-xhr-in-main-frame-window.html 2015-06-07 00:09:27 UTC (rev 185296)
@@ -0,0 +1,33 @@
+<html>
+<body>
+<script>
+
+window._onload_ = function() {
+ var xhr = new XMLHttpRequest();
+ xhr._onload_ = function() {
+ alert("FAIL: load was not blocked");
+ if (window.testRunner)
+ testRunner.notifyDone();
+ };
+
+ // When XHR is blocked due to mixed content blocking, it just appears as if the load stalls,
+ // see https://bugs.webkit.org/show_bug.cgi?id=145717.
+ setTimeout(function() {
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 2000);
+
+ try {
+ xhr.open("GET", "http://127.0.0.1:8000/");
+ } catch (ex) {
+ // Firefox raises an exception, which is one way to make this detectable.
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+
+ xhr.send(null);
+};
+</script>
+
+</body>
+</html>
Modified: trunk/LayoutTests/http/tests/xmlhttprequest/access-control-response-with-body.html (185295 => 185296)
--- trunk/LayoutTests/http/tests/xmlhttprequest/access-control-response-with-body.html 2015-06-06 22:55:41 UTC (rev 185295)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/access-control-response-with-body.html 2015-06-07 00:09:27 UTC (rev 185296)
@@ -5,31 +5,25 @@
<div id=result>Running test...</div>
<script>
- if (window.testRunner) {
+if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
- }
+}
- window._onload_ = function() {
- var xhr = new XMLHttpRequest();
- xhr._onreadystatechange_=function() {
- if (xhr.readyState==4) {
- document.getElementById("result").innerHTML = (xhr.responseText == "echo") ? "PASS" : ("FAIL: " + xhr.responseText);
- if (window.testRunner)
+window._onload_ = function() {
+ var xhr = new XMLHttpRequest();
+ xhr._onload_=function() {
+ document.getElementById("result").innerHTML = (xhr.responseText == "echo") ? "PASS" : ("FAIL: " + xhr.responseText);
+ if (window.testRunner)
testRunner.notifyDone();
- }
- };
+ };
- xhr.open("GET","http://localhost:8000/xmlhttprequest/resources/access-control-allow-with-body.php");
- xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
- xhr.send(null);
- setTimeout(function(){
- if (window.testRunner)
- testRunner.notifyDone()
- }, 100)
- };
-
+ xhr.open("GET","http://localhost:8000/xmlhttprequest/resources/access-control-allow-with-body.php");
+ xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+ xhr.send(null);
+};
+
</script>
</body>