| Index: third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/nesting-cross-origin-subframe.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/nesting-cross-origin-subframe.html b/third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/nesting-cross-origin-subframe.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..cf40dd3a9dc4a95b3f988c2754d7f16ae5a034f1
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/nesting-cross-origin-subframe.html
|
| @@ -0,0 +1,42 @@
|
| +<!DOCTYPE html>
|
| +<style>
|
| +iframe {
|
| + position:absolute;
|
| + top: 0px;
|
| + left: 0px;
|
| + width: 160px;
|
| + height: 100px;
|
| + overflow-y: scroll;
|
| +}
|
| +</style>
|
| +<iframe src="http://127.0.0.1:8080/intersection-observer/resources/nested-cross-origin-subframe.html"></iframe>
|
| +
|
| +<script>
|
| +var iframe = document.querySelector("iframe");
|
| +var port;
|
| +var iframe_loaded = false;
|
| +var start_message_queued = false;
|
| +// This frame forwards messages bidirectionally between its parent frame and
|
| +// its child frame. The initiating message comes from the parent, but it
|
| +// needs to be held if the child frame is not yet finished loading. The
|
| +// booleans above account for the different possible orderings of events.
|
| +function handleMessage(event) {
|
| + if (event.source == iframe.contentWindow) {
|
| + port.postMessage(event.data, "*");
|
| + } else if (iframe_loaded){
|
| + port = event.source;
|
| + iframe.contentWindow.postMessage(event.data, "*");
|
| + } else {
|
| + port = event.source;
|
| + start_message_queued = true;
|
| + }
|
| +}
|
| +window.addEventListener("message", handleMessage);
|
| +iframe.onload = function () {
|
| + iframe_loaded = true;
|
| + if (start_message_queued) {
|
| + iframe.contentWindow.postMessage("", "*");
|
| + start_message_queued = false;
|
| + }
|
| +}
|
| +</script>
|
|
|