Why do my breakpoints flee from their intended position
Asked Answered
F

4

6

I'm experiencing the behaviour of breakpoints moving to the end of the file in Firefox Developer Edition when trying to set them anywhere in the javascript.

enter image description here

Sometimes after restarting the PC or the next day it's working, but I'm unsure whether some code leads to this issue or whether this is a bug in Firefox Developer Edition.

Fearfully answered 3/2, 2015 at 11:53 Comment(0)
S
2

When you set a breakpoint on a line that contains no executable code, the debugger tries to be helpful and slide the breakpoint to the next closest line it can find with executable code on it. This is not as easy as it seems, because its possible to set breakpoints on scripts that have already been garbage collected, so the debugger can't always tell whether a line contains no executable code, or whether the corresponding script has just been garbage collected.

The problem is even more complicated when source maps are involved, because the debugger needs to figure out what lines in the original source correspond to the line in the generated source on which you set the breakpoint. The way we currently do this isn't always accurate, which can lead to problems like the one you're seeing.

That said, there are other things that could explain why your breakpoints aren't working the way they should. For instance, we also need to map breakpoint locations to bytecode offsets, which isn't always done accurately either.

We are actively refactoring the breakpoint code in the debugger at the moment in an attempt to resolve these issues, so I wouldn't be surprised if you hit upon a regression. The best thing to do would be to file a bug in bugzilla for the issue, ideally with steps to reproduce.

Hope that helps!

Schliemann answered 3/2, 2015 at 17:10 Comment(0)
S
0

Install firebug after that, it will ask you to upgrade to alpha version accept the upgrade, now you can put the breakpoint in the line you want.

Regards.

Souza answered 16/2, 2015 at 23:10 Comment(2)
Do Firebug and the Firefox Developer Edition affect each other? I.e. Will Firebug replace the built-in dev tools? Does this have other implications?Fearfully
Just installed Firebug. It seems like that it replaces/hides the integrated developer tools. However, I experience the same behavior regarding the breakpoints so I'm going to remove Firebug again.Fearfully
B
0

I just ran into this, and the problem was simply that I had a syntax error in the code in question.

As soon as I took out the offending "====", I was able to set breakpoints in that section of code.

Bud answered 10/9, 2015 at 1:4 Comment(0)
H
0

DON'T BREAK LINES

My solution was to delete the extra lines in a variable so everything will be on one line

Wrong Syntax:

 var inner_html =
'<a>
    <div class="list_autocomplete">
        <div class="image_autocomplete">
        <img src="'+ img_url + '">
        </div>
        <div class="label_autocomplete">' + item.label + '</div>
        <div class="description_autocomplete">' + item.description + '</div>
    </div>
</a>';

Correct Syntax:

var inner_html = '<a><div class="list_item_container"><div class="image"><img src="img/' + item.image + '"></div><div class="label">' + item.label + '</div><div class="description">' + item.description + '</div></div></a>';
Hachure answered 2/3, 2016 at 16:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.