Unresponsive script warning appears much too late
Categories
(DevTools :: Debugger, defect, P2)
Tracking
(firefox104 fixed)
Tracking | Status | |
---|---|---|
firefox104 | --- | fixed |
People
(Reporter: ygoe, Assigned: ochameau)
References
Details
Attachments
(3 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0
Steps to reproduce:
I currently have a broken JavaScript to debug that hangs and causes an endless loop somewhere. I waited for Firefox to show me the "unresponsive script" warning, but nothing happened. It keps circling, the F12 debugger tab remained empty. So I clicked the "stop load" button. Once, then many times. Pressed the Escape key. It kept circling. Then after a minute or so, the warning appeared. I clicked Stop and after another while, it actually stopped.
My "dom.max_script_run_time" setting is at its default value of 10. Is that seconds or minutes? According to web sources, it should be seconds. So it doesn't work. It takes much longer. And stopping also doesn't work immediately, it again takes some time.
Expected results:
I'd think that the warning appears more or less exactly after the specified time span. A few seconds more should be okay, but not a multiple of it. And when I say "stop", what's the use in deferring that? Is there some major vote going on inside the browser and the script has a blocking vote?
I can't provide the broken script here (it's really huge and has dependencies). If you don't have a non-terminating script, I may try to provide one.
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'DevTools::Debugger' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•3 years ago
|
||
Alex reproduced the issue, the popup appears way too late, even with a simple infinite loop.
The issue probably lies before DevTools are involved, but we should provide a reduced test case and some pointers about where this popup is triggered.
Comment 3•3 years ago
|
||
Will find existing bug reports about this popup.
Assignee | ||
Comment 4•3 years ago
|
||
Yes dom.max_script_run_time
is in seconds and note that you might have to at least click once in the tab in order to ensure the dialog to be shown.
But there is a couple of things being imperfect/broken around this "slow script warning" feature:
- The "debug script" button is only shown in Developer Edition. In any other Firefox build (release/nigthly) you would only see "Stop". So you could only break in the loop in Dev edition.
- The "debug script" button only works if DevTools were already opened before opening the page that loops.
- There is an exception that seems to almost always make the debugger fail to break.
Comment 5•3 years ago
|
||
I filed Bug 1692491 a while ago, but at that time I was waiting for https://mozilla-hub.atlassian.net/browse/FFXP-106 (not sure if that's openly visible, but it was a project to improve the UI/UX of the slow script feature).
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 6•3 years ago
|
||
Assignee | ||
Comment 7•3 years ago
|
||
We weren't waiting for interrupt to have fully paused the thread
before trying to resume when the state was "attached".
Assignee | ||
Comment 8•3 years ago
|
||
The test doesn't really cover this fix as mochitest head files will force loading gDevTools...
To properly cover that we would have to have this test in another file and folder without any head.
This will make it hard to reuse Debugger test helpers. Let's assume we cover the modified feature
while not covering the very precise regression I fix here.
Updated•3 years ago
|
Comment 10•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/39fe8edd4b83
https://hg.mozilla.org/mozilla-central/rev/a472404e52f7
https://hg.mozilla.org/mozilla-central/rev/a545a227cec1
Description
•