> bz, is it possible for a Document object to be used with more than one global in its lifetime? Yes, with document.open, which is exactly what's going on here. A minimized testcase for this bug: <!DOCTYPE HTML> <iframe></iframe> <script> function doIt() { var doc = document.querySelector("iframe").contentDocument; doc.open(); doc.write('<script>import("data:text/javascript,")</' + 'script>'); doc.close(); } </script> <button type="button" onclick="doIt()"> Click this button, then wait a second and click it again. </button> Even with bug 1523843 fixed, this is an issue for the moment, as this testcase shows: <!DOCTYPE HTML> <script> var win; function doIt() { if (!win) { win = window.open(); } var doc = win.document; doc.open(); doc.write('<script>import("data:text/javascript,")</' + 'script>'); doc.close(); } </script> <button type="button" onclick="doIt()"> Click this button, then wait a second and click it again. </button> Bug 1489308 will fix the issue by removing the "single document with multiple globals" situation. But that's not landed yet, so we need a different fix for Firefox 66, right?
Bug 1529203 Comment 11 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
> bz, is it possible for a Document object to be used with more than one global in its lifetime? Yes, with document.open, which is exactly what's going on here. A minimized testcase for this bug: ``` <!DOCTYPE HTML> <iframe></iframe> <script> function doIt() { var doc = document.querySelector("iframe").contentDocument; doc.open(); doc.write('<script>import("data:text/javascript,")</' + 'script>'); doc.close(); } </script> <button type="button" onclick="doIt()"> Click this button, then wait a second and click it again. </button> ``` Even with bug 1523843 fixed, this is an issue for the moment, as this testcase shows: ``` <!DOCTYPE HTML> <script> var win; function doIt() { if (!win) { win = window.open(); } var doc = win.document; doc.open(); doc.write('<script>import("data:text/javascript,")</' + 'script>'); doc.close(); } </script> <button type="button" onclick="doIt()"> Click this button, then wait a second and click it again. </button> ``` Bug 1489308 will fix the issue by removing the "single document with multiple globals" situation. But that's not landed yet, so we need a different fix for Firefox 66, right?