| <!DOCTYPE html> |
| <body> |
| <script> |
| if (window.testRunner) { |
| testRunner.waitUntilDone(); |
| testRunner.dumpAsText(); |
| } |
| |
| let count = 0; |
| onmessage = (event) => { |
| ++count; |
| if (event.data !== "null") { |
| document.body.innerHTML = "FAIL, got " + event.data + " with count " + count; |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| window.clearTimeout(timer); |
| count = 3; |
| return; |
| } |
| if (count === 2) { |
| document.body.innerHTML = "PASS"; |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| window.clearTimeout(timer); |
| } |
| }; |
| |
| const timer = setTimeout(() => { |
| document.body.innerHTML = "TIMEOUT"; |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| }, 10000); |
| </script> |
| <iframe src="data:text/html,<body><script>console.log('data URL frame loaded'); const blob = new Blob(['<'+ 'script>console.log(\'blob iframe loaded\' + location.origin); onload = () => window.parent.postMessage(location.origin, \'*\'); console.log(\'blob iframe message posted\'); onmessage = () => window.parent.postMessage(location.origin, \'*\'); <' + '/script>'], {type: 'text/html'}); const blobURL = URL.createObjectURL(blob); const iframe = document.createElement('iframe'); iframe.src = blobURL; document.body.appendChild(iframe); onmessage = (event) => { iframe.contentWindow.postMessage('check', '*'); parent.postMessage(event.data, '*'); URL.revokeObjectURL(blobURL); onmessage = (event) => { parent.postMessage(event.data, '*'); }; }; console.log('blob iframe opened'); </script></body>"></iframe> |
| </body> |