clipboard-on-detached-iframe.https.html (1038B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Clipboard API on detached iframe</title> 4 <link rel='help' href='https://w3c.github.io/clipboard-apis/#async-clipboard-api'> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 8 <iframe id="iframe"></iframe> 9 <script> 10 'use strict'; 11 12 promise_test(async () => { 13 const iframe = document.getElementById('iframe'); 14 const iframeNavigator = iframe.contentWindow.navigator; 15 assert_not_equals(navigator.clipboard, null, 16 "parent frame's clipboard should exist with iframe attached"); 17 assert_not_equals(iframeNavigator.clipboard, null, 18 "attached child iframe's clipboard should exist"); 19 20 iframe.parentNode.removeChild(iframe); 21 assert_not_equals(navigator.clipboard, null, 22 "parent frame's clipboard should exist with iframe detached"); 23 assert_not_equals(iframeNavigator.clipboard, null, 24 "detached child iframe's clipboard should still exist"); 25 }, 'Verify navigator.clipboard behavior in detached frames'); 26 </script>