Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/nesting-cross-origin-subframe.html

Issue 2873083002: Propagate viewport intersection across OOPIFs at the correct time (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <style>
3 iframe {
4 position:absolute;
5 top: 0px;
6 left: 0px;
7 width: 160px;
8 height: 100px;
9 overflow-y: scroll;
10 }
11 </style>
12 <iframe src="http://127.0.0.1:8080/intersection-observer/resources/nested-cross- origin-subframe.html"></iframe>
13
14 <script>
15 var iframe = document.querySelector("iframe");
16 var port;
17 var iframe_loaded = false;
18 var start_message_queued = false;
19 // This frame forwards messages bidirectionally between its parent frame and
20 // its child frame. The initiating message comes from the parent, but it
21 // needs to be held if the child frame is not yet finished loading. The
22 // booleans above account for the different possible orderings of events.
23 function handleMessage(event) {
24 if (event.source == iframe.contentWindow) {
25 port.postMessage(event.data, "*");
26 } else if (iframe_loaded){
27 port = event.source;
28 iframe.contentWindow.postMessage(event.data, "*");
29 } else {
30 port = event.source;
31 start_message_queued = true;
32 }
33 }
34 window.addEventListener("message", handleMessage);
35 iframe.onload = function () {
36 iframe_loaded = true;
37 if (start_message_queued) {
38 iframe.contentWindow.postMessage("", "*");
39 start_message_queued = false;
40 }
41 }
42 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698