Chromium Code Reviews| Index: LayoutTests/http/tests/security/javascriptURL/javascriptURL-execution-context-frame-location-htmldom-uncaught.html |
| diff --git a/LayoutTests/http/tests/security/javascriptURL/javascriptURL-execution-context-frame-location-htmldom-uncaught.html b/LayoutTests/http/tests/security/javascriptURL/javascriptURL-execution-context-frame-location-htmldom-uncaught.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..aa7e5a9532c7d78ab3d6a54c371ec3c41e62b10b |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/security/javascriptURL/javascriptURL-execution-context-frame-location-htmldom-uncaught.html |
| @@ -0,0 +1,40 @@ |
| +<html> |
| +<head> |
| + <script> |
| + if (window.testRunner) { |
|
arv (Not doing code reviews)
2013/08/14 13:43:03
Can you just use js-test-pre/post instead?
Use mkwst_at_chromium.org plz.
2013/08/14 13:57:21
Not without modifying it to support a document wit
|
| + testRunner.dumpAsText(); |
| + testRunner.dumpChildFramesAsText(); |
| + testRunner.waitUntilDone(); |
| + } |
| + |
| + window.addEventListener('message', function() { |
| + runTest(); |
| + if (window.testRunner) |
| + testRunner.notifyDone(); |
| + }); |
| + |
| + window.onerror = function (msg) { |
| + var jsErrorMessage = 'Uncaught SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a cross-origin frame.'; |
| + if (msg == jsErrorMessage) |
| + console.log("PASS: Exception was '" + msg + "'."); |
| + else |
| + console.log("FAIL: Exception should have been '" + jsErrorMessage + "', was '" + msg + "'."); |
| + |
| + if (window.testRunner) |
| + setTimeout(testRunner.notifyDone.bind(testRunner), 0); |
| + |
| + return false; // Don't handle the exception to ensure it shows up in the console. |
| + }; |
| + |
| + runTest = function() |
|
arv (Not doing code reviews)
2013/08/14 13:43:03
function runTest() {
Use mkwst_at_chromium.org plz.
2013/08/14 13:57:21
Done.
|
| + { |
| + var frame = document.getElementById('aFrame'); |
| + frame.location = 'javascript:"FAIL: this should not have been loaded."'; |
| + } |
| + </script> |
| +</head> |
| +<frameset rows="10%,*"> |
| + <frame id='main' src="data:text/html,<p>This test passes as long as the onerror handler logs PASS to the console, and the uncaught exception reported to the console has unsanitized detail.</p>"> |
| + <frame id='aFrame' src='http://localhost:8000/security/resources/cross-frame-iframe.html'> |
| +</frameset> |
| +</html> |