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

Unified 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 side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698