Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebug: During breakpoint, can't execute console statement

I'm seeing the following behavior in Firebug:

When the debugger is paused on a breakpoint, if I go to the console and attempt to execute a statement, the Enter key keeps just adding lines instead of executing.

I've tried hitting Shift+Enter and Ctrl+Enter also, to no avail.

like image 404
mtyson Avatar asked Jan 18 '15 05:01

mtyson


2 Answers

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.

like image 68
Gram Avatar answered Nov 15 '22 05:11

Gram


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.

like image 21
Pieter Meiresone Avatar answered Nov 15 '22 05:11

Pieter Meiresone