c1f5618e6ba34d4cd8f79a08b85e3acec82afc9d
[WebKit-https.git] / LayoutTests / editing / async-clipboard / clipboard-wrapper-stays-alive.html
1 <!DOCTYPE html> <!-- webkit-test-runner [ experimental:asyncClipboardAPIEnabled=true ] -->
2 <html>
3     <head>
4         <script src="../../resources/js-test.js"></script>
5     </head>
6     <script>
7         jsTestIsAsync = true;
8
9         addEventListener("load", async function() {
10             description("Verifies that the wrapper for Navigator's Clipboard remains consistent across GC passes. This test must be run using WebKitTestRunner.");
11
12             subframe = document.querySelector("iframe");
13             subframeNavigator = subframe.contentWindow.navigator;
14             subframeNavigator.clipboard.foo = "bar";
15             subframe.remove();
16             subframe = null;
17
18             if (window.GCController)
19                 GCController.collect();
20
21             await new Promise(resolve => setTimeout(resolve, 50));
22             shouldBeEqualToString("subframeNavigator.clipboard.foo", "bar");
23             finishJSTest();
24         });
25     </script>
26     <body>
27         <iframe srcdoc="Hello world"></iframe>
28     </body>
29 </html>