Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox - Disable 'debugger' keywords

How do I tell Firefox not to stop if it sees a debugger keyword?

I need to avoid a continuous debugger loop in case the website uses debugging protection generating debugger statements on the fly using timers.

Here is an example. In case you open the debugging console the script will throw tons of debugger statements, which will block you from normal debugging work.

An example website is http://www.avito.ru - the biggest classified site in Russia. Open it and then open the debugger console and it will be immediately stop at the debugger keyword in generated script.

(function(x/**/) {
    (function(f){
        (function a(){
            try {
                function b(i) {
                    if(
                        (''+(i/i)).length !== 1 ||
                        i % 20 === 0
                    ) {
                        (function(){}).constructor('debugger')();
                    } else {
                        debugger;
                    }

                    b(++i);
                }

                b(0);
            } catch(e) {
                f.setTimeout(a, x)
            }
        })()
    })(document.body.appendChild(document.createElement('frame')).contentWindow);
});
like image 462
user201202 Avatar asked Sep 29 '16 09:09

user201202


People also ask

How do I disable developer tools in Firefox?

Just search for devtools. *. enabled there and set all of the appearing options to false .

How do I turn off breakpoint?

In the Query Editor window, right-click the breakpoint, and then click Delete Breakpoint. In the Breakpoints window, right-click the breakpoint, and then click Delete on the shortcut menu. In the Breakpoints window, select the breakpoint, and then press DELETE.


2 Answers

In the current version of Firefox at writing this answer (ver 63.0.3), in the Developer Tools, the Debugger section, there's an icon with the tooltip "Skip all pausing" or "Deactivate breakpoints". When enabled it seems to disable stopping at any debugger instruction.

Skip all pausing FireFox 63.0.3 Deactivae Breakpoints on FireFox 71.0b9

like image 155
Sam Sirry Avatar answered Sep 20 '22 18:09

Sam Sirry


Obviously the page tries to avoid people from debugging their JavaScript code with that construct.

Debugging in Firebug

Firebug allows to set disabled breakpoints on the debugger statements. Because the page generates a variable call stack depth, you'll need to set those disabled breakpoints for all of them to be able to debug the JavaScript properly. Unfortunately, Firebug seems to be buggy when it comes to set those breakpoints.

Furthermore, Firebug doesn't have an option to ignore all debugger statements.

So, if you don't need to debug JavaScript but only HTML, CSS, network requests, etc., you can simply disable the Script panel to avoid these annoying debugger halts. To do so, right-click the Script tab and click on Enable within the opening menu.

Disable Firebug's *Script* panel

Note: Because Firebug development is discontinued, it's useless to file an enhancement request for it.

Debugging in Firefox DevTools

Unfortunately, the Firefox DevTools currently don't allow to avoid halting on debugger statements. So you have to wait until bug 1300934 (which mentions the same website as an example), bug 925269 and/or issue 828 are fixed.

Furthermore there is no way to disable the Debugger panel completely, which is filed as bug 1247198.

like image 34
Sebastian Zartner Avatar answered Sep 19 '22 18:09

Sebastian Zartner