Firebug: During breakpoint, can't execute console statement

99封情书 提交于 2019-12-04 03:08:36

Environment

I sometimes get this issue on firebug (console), FireFox (dev console), and FireFox developer edition (dev console).

Issue

Using the "web console" I would type something like alert("test") and hit the enter key but it would not run.

Instead of running it would enter a new line as if I hit "Shift Enter". Oddly when I hit "Shift Enter" just to see what happens, there is no more new line but the code does not run.

Attempt to find a solution

I restarted my computer, and it went away only to return again later. I don't have a solution but more of a work around (that works some of the time). The biggest issue is I don't know what causes this to happen. After may hours I can only guess what I think the issue is.

I suspect that why this happens is the developer console gets disconnected with the web page that it is trying to debugged.

If the Dev tools are disconnected, then it can not run the code (my alert) because it does not know what page/tab to run it on.

Work Around

Fully closing all Firefox windows/tabs (and its dev/firebug windows/tabs). This may-or-may-not re-associate the console with the web page allowing the code to run again.

Disclaimer

It works for me most of the time, I would be vary happy if someone (who knows more about this) could explain why this happens and a better solution. But until then for anyone else with this issue like me I hope this helps.

I have experienced the same issue, where I would enter (a long) javascript statement in the console and pressing enter would just add new lines instead of running the statements.

In my case this was caused by brackets and parentheses that were not balanced. Once they were balanced, hitting the enter key would execute the statements.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!