OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="/js-test-resources/js-test.js"></script> | 2 <script src="/js-test-resources/js-test.js"></script> |
3 <div style="width:100%; height:700px;"></div> | 3 <div style="width:100%; height:700px;"></div> |
4 <iframe id="target-iframe" src="http://localhost:8080/intersection-observer/reso
urces/cross-origin-subframe.html" style="height: 100px; overflow-y: scroll"></if
rame> | 4 <iframe id="target-iframe" src="http://localhost:8080/intersection-observer/reso
urces/cross-origin-subframe.html" style="height: 100px; overflow-y: scroll"></if
rame> |
5 <div style="width:100%; height:700px;"></div> | 5 <div style="width:100%; height:700px;"></div> |
6 | 6 |
7 <script> | 7 <script> |
8 setPrintTestResultsLazily(); | 8 setPrintTestResultsLazily(); |
9 self.jsTestIsAsync = true; | 9 self.jsTestIsAsync = true; |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 function handleMessage(event) { | 49 function handleMessage(event) { |
50 if (event.data.hasOwnProperty('scrollTo')) { | 50 if (event.data.hasOwnProperty('scrollTo')) { |
51 document.scrollingElement.scrollTop = event.data.scrollTo; | 51 document.scrollingElement.scrollTop = event.data.scrollTo; |
52 requestAnimationFrame(function () { iframe.contentWindow.postMessage("", "*"
) }); | 52 requestAnimationFrame(function () { iframe.contentWindow.postMessage("", "*"
) }); |
53 } else if (event.data.hasOwnProperty('actual')) { | 53 } else if (event.data.hasOwnProperty('actual')) { |
54 checkData(event.data.actual, event.data.expected); | 54 checkData(event.data.actual, event.data.expected); |
55 } else if (event.data.hasOwnProperty('DONE')) { | 55 } else if (event.data.hasOwnProperty('DONE')) { |
56 finishJSTest(); | 56 // See LayoutTests/intersection-observer/README for explanation of this requ
estIdleCallback. |
| 57 requestIdleCallback(finishJSTest, {timeout: 100}); |
57 document.scrollingElement.scrollTop = 0; | 58 document.scrollingElement.scrollTop = 0; |
58 } else { | 59 } else { |
59 requestAnimationFrame(function () { iframe.contentWindow.postMessage("", "*"
) }); | 60 requestAnimationFrame(function () { iframe.contentWindow.postMessage("", "*"
) }); |
60 } | 61 } |
61 } | 62 } |
62 | 63 |
63 window.addEventListener("message", handleMessage); | 64 window.addEventListener("message", handleMessage); |
| 65 |
64 iframe.onload = function() { | 66 iframe.onload = function() { |
65 iframe.contentWindow.postMessage("", "*") | 67 // See LayoutTests/intersection-observer/README for explanation of double RAF. |
66 }; | 68 requestAnimationFrame(() => { |
| 69 requestAnimationFrame(() => { iframe.contentWindow.postMessage("", "*") }) |
| 70 }); |
| 71 } |
67 </script> | 72 </script> |
OLD | NEW |