Closed Bug 1384227 Opened 7 years ago Closed 6 years ago

setTimeout callback doesn't fire when run from the console input field

Categories

(DevTools :: Console, defect)

54 Branch
defect
Not set
normal

Tracking

(firefox57 wontfix)

RESOLVED WORKSFORME
Tracking Status
firefox57 --- wontfix

People

(Reporter: mfaust, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36

Steps to reproduce:

Load a page with developer tools open. Reloading the page several times eventually triggers the issue. The issue can be tested by running this code in the console:

window.setTimeout(function(){console.log('timed');}, 100);

which will echo out a number suitable for use by clearTimeout, but the function never gets called. It affects all scripts in the current webpage that use setTimeout such as jQuery.Deferred.

The debugger is not paused, and the app we are testing is very large so narrowing down what might be causing it would be very tedious so it may be quicker to narrow it down from the setTimeout source code to see what in the devtools may be causing it to not fire.

I did verify that the setTimeout method was not replaced and still is shown as [native code]. There are no error messages displayed in the console beyond a few script warnings (eg unreachable code after return statement) but those also appear when the issue does not manifest itself.  The issue in present in 53 and 54.


Actual results:

setTimeout never fires.


Expected results:

setTimeout should have fired after the specified interval has elapsed.
Also of interest, once the issue happens in a tab, a page reload will not resolve it. Only closing the tab entirely and opening the webpage in a new tab will make setTimeout work again--at least until dev tools is opened and the issue happens again.
Component: Untriaged → Developer Tools: Console
Hi, sorry for missing this report initially. I just tried to reproduce the problem and haven't been able to, so hoping we can get some more info to track it down:

* Is there a particular webpage or series of steps that lead to this problem?
* Could it be that the console.log() message inside the timeout is somehow filtered out in the UI? That is, if you run just `console.log("timed")` in the input field do you see the log?
* If you run the setTimeout in a script on the page instead of in the console do you see the log show up?
Flags: needinfo?(mfaust)
Summary: setTimeout fails to execute when devtools are opened. → setTimeout callback doesn't fire when run from the console input field
Resolving as worksforme since we haven't had another report of this and have been unable to reproduce. Feel free to reopen it if you see this happen again.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Flags: needinfo?(mfaust)
Resolution: --- → WORKSFORME
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.