cwzwarich@webkit.org | 78200f5 | 2009-03-19 07:55:59 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
cdumez@apple.com | 1249ed4 | 2016-08-29 19:37:01 +0000 | [diff] [blame] | 3 | <script src="/js-test-resources/js-test-pre.js"></script> |
cwzwarich@webkit.org | 78200f5 | 2009-03-19 07:55:59 +0000 | [diff] [blame] | 4 | <script src="resources/cross-frame-access.js"></script> |
| 5 | <script> |
cdumez@apple.com | 1249ed4 | 2016-08-29 19:37:01 +0000 | [diff] [blame] | 6 | jsTestIsAsync = true; |
| 7 | |
cwzwarich@webkit.org | 78200f5 | 2009-03-19 07:55:59 +0000 | [diff] [blame] | 8 | window.onload = function() |
| 9 | { |
rniwa@webkit.org | fc37722 | 2012-06-13 09:19:30 +0000 | [diff] [blame] | 10 | if (window.testRunner) { |
cwzwarich@webkit.org | 78200f5 | 2009-03-19 07:55:59 +0000 | [diff] [blame] | 11 | setTimeout(pollForTest, 1); |
| 12 | } else { |
| 13 | log("To run the test, click the button below when the opened window finishes loading."); |
| 14 | var button = document.createElement("button"); |
| 15 | button.appendChild(document.createTextNode("Run Test")); |
| 16 | button.onclick = runTest; |
| 17 | document.body.appendChild(button); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | pollForTest = function() |
| 22 | { |
rniwa@webkit.org | fc37722 | 2012-06-13 09:19:30 +0000 | [diff] [blame] | 23 | if (!testRunner.globalFlag) { |
cwzwarich@webkit.org | 78200f5 | 2009-03-19 07:55:59 +0000 | [diff] [blame] | 24 | setTimeout(pollForTest, 1); |
| 25 | return; |
| 26 | } |
| 27 | runTest(); |
cdumez@apple.com | 1249ed4 | 2016-08-29 19:37:01 +0000 | [diff] [blame] | 28 | finishJSTest(); |
cwzwarich@webkit.org | 78200f5 | 2009-03-19 07:55:59 +0000 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | function getCustomProperty(o) |
| 32 | { |
| 33 | return o.customProperty; |
| 34 | } |
| 35 | |
| 36 | runTest = function() |
| 37 | { |
| 38 | window.targetWindow = frames[0]; |
| 39 | |
cdumez@apple.com | 1249ed4 | 2016-08-29 19:37:01 +0000 | [diff] [blame] | 40 | shouldThrowErrorName("getCustomProperty(targetWindow)", "SecurityError"); |
| 41 | shouldThrowErrorName("getCustomProperty(targetWindow)", "SecurityError"); |
| 42 | shouldThrowErrorName("getCustomProperty(targetWindow)", "SecurityError"); |
cwzwarich@webkit.org | 78200f5 | 2009-03-19 07:55:59 +0000 | [diff] [blame] | 43 | } |
| 44 | </script> |
| 45 | </head> |
| 46 | <body> |
| 47 | <p>This test checks that caching of property accesses doesn't allow for illegal cross-frame access of a custom property. It also checks for an assertion failure that once occurred in this situation.</p> |
| 48 | <iframe src="http://localhost:8000/security/resources/cross-frame-access-get-custom-property-cached-iframe.html" style=""></iframe> |
| 49 | <pre id="console"></pre> |
cdumez@apple.com | 1249ed4 | 2016-08-29 19:37:01 +0000 | [diff] [blame] | 50 | <script src="/js-test-resources/js-test-post.js"></script> |
cwzwarich@webkit.org | 78200f5 | 2009-03-19 07:55:59 +0000 | [diff] [blame] | 51 | </body> |
| 52 | </html> |