dino@apple.com | 39e0139 | 2015-10-13 21:46:10 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
| 3 | <script> |
| 4 | var results = null; |
| 5 | |
| 6 | function run() { |
| 7 | results = document.getElementById("results"); |
| 8 | window.addEventListener("deviceorientation", handleDeviceOrientation, false); |
| 9 | } |
| 10 | |
| 11 | function handleDeviceOrientation(event) { |
| 12 | results.textContent = "Saw event in the main frame - this is ok"; |
| 13 | window.removeEventListener("deviceorientation", handleDeviceOrientation); |
| 14 | } |
| 15 | |
| 16 | window.addEventListener("load", run, false); |
| 17 | </script> |
| 18 | </head> |
| 19 | <body> |
| 20 | <p>This tests that deviceorientation events are not dispatched in different origin iframes.</p> |
| 21 | <p><b>REMEMBER TO CHANGE THE SRC OF THE IFRAME TO BE CROSS-ORIGIN</b></p> |
| 22 | <p>We should be able to detect the event in the main page, but not in the frame.</p> |
| 23 | <p id="results">Main page has not seen event.</p> |
| 24 | <iframe id="frameA" src="http://127.0.0.1/device-orientation-child-frame.html"></iframe> |
| 25 | </body> |
| 26 | </html> |