Skip to content

<script> tags are not executed in Firefox 75 #1264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tleb opened this issue May 6, 2020 · 2 comments
Closed

<script> tags are not executed in Firefox 75 #1264

tleb opened this issue May 6, 2020 · 2 comments

Comments

@tleb
Copy link

tleb commented May 6, 2020

Wanting to try out djdt-flamegraph, I fall onto a bug.

The issue is that <script> tags loaded for panels are not executed (but included in the DOM). The function responsible for this is $$.executeScripts. I modified it getting inspiration from StackOverflow, the following implementation works in my case:

executeScripts: function(root) {
    root.querySelectorAll('script').forEach(function(e) {
        var clone = document.createElement('script');
        try {
            clone.appendChild(document.createTextNode(e.innerHTML));
        } catch (e) {
            clone.text = e.innerHTML;
        }
        root.appendChild(clone);
    });
},

I wanted other opinions before sending a pull request. I did not see another linked issue, is this recent? Does it concern other browsers? Will this solution be cross-browser?

@matthiask
Copy link
Member

matthiask commented Jun 14, 2020

I'm not sure why this worked before and doesn't anymore.

However, the upcoming version of django-debug-toolbar contains #1282; panels are now supposed to deliver JSON, not HTML blobs. So, you should probably submit a PR to djdt-flamegraph not to django-debug-toolbar, except if it turns out that the upcoming panel API is insufficient.

Addendum: I wanted to link the panel API https://django-debug-toolbar.readthedocs.io/en/latest/panels.html#debug_toolbar.panels.Panel.scripts , I hope it helps.

@jdufresne
Copy link
Contributor

The "Time" panel is a working example that execute scripts on load.

Closing as the executeScripts function has changed significantly since this was reported and this looks like it may be an issue in flamegraph. Please reopen if you can provide details that demonstrate otherwise. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants