Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="/js-test-resources/js-test.js"></script> | |
|
bokan
2017/01/19 20:05:39
testharness.js is now the preferred choice for Lay
kenrb
2017/01/19 21:36:20
Acknowledged, will update.
| |
| 3 <iframe id="target-iframe1" src="http://localhost:8080/misc/resources/cross-orig in-subframe-for-scrolling.html" style="height: 100px; width: 100px; overflow-y: scroll; position: absolute; left: 50px; top: 50px"></iframe> | |
| 4 <iframe id="target-iframe2" src="http://localhost:8080/misc/resources/cross-orig in-subframe-for-scrolling.html" style="height: 100px; width: 100px; overflow-y: scroll; position: absolute; left: 50px; top: 200px"></iframe> | |
|
bokan
2017/01/19 20:05:39
Question: what makes these iframes OOPIFs? What's
kenrb
2017/01/19 21:36:20
We get a different origin by changing the port num
| |
| 5 | |
| 6 <script> | |
| 7 description("Verify that two sibling cross-origin iframes both correctly scroll on MouseWheel events, as per https://crbug.com/675695."); | |
| 8 | |
| 9 // States: | |
| 10 // 0 => Scroll sent to iframe1 | |
| 11 // 1 => Fetching scroll offset from iframe1 | |
| 12 // 2 => Scroll sent to iframe2 | |
| 13 // 3 => Fetching scroll offset from iframe2 | |
| 14 var state = 0; | |
| 15 var iframe1 = document.getElementById("target-iframe1"); | |
| 16 var iframe2 = document.getElementById("target-iframe2"); | |
| 17 setPrintTestResultsLazily(); | |
| 18 self.jsTestIsAsync = true; | |
| 19 | |
| 20 function handleMessage(event) { | |
| 21 if (state == 0) { | |
| 22 iframe1.contentWindow.postMessage("", "*"); | |
| 23 state = 1; | |
| 24 } else if (state == 1) { | |
| 25 shouldBeEqualToNumber("event.data.scrollTop", 40); | |
| 26 state = 2; | |
| 27 iframe2.contentWindow.postMessage({scrollBy: -1, left: iframe2.offsetLeft, t op: iframe2.offsetTop}, "*"); | |
| 28 iframe2.contentWindow.postMessage("", "*"); | |
| 29 } else if (state == 2) { | |
| 30 iframe1.contentWindow.postMessage("", "*"); | |
| 31 state = 3; | |
| 32 } else if (state == 3) { | |
| 33 shouldBeEqualToNumber("event.data.scrollTop", 40); | |
| 34 finishJSTest(); | |
| 35 } | |
| 36 } | |
| 37 | |
| 38 window.addEventListener("message", handleMessage); | |
| 39 | |
| 40 iframe1.onload = (() => { | |
| 41 iframe1.contentWindow.postMessage({scrollBy: -1, left: iframe1.offsetLeft, top : iframe1.offsetTop}, "*"); | |
| 42 }); | |
| 43 | |
| 44 </script> | |
| OLD | NEW |