Closed Bug 1051632 Opened 10 years ago Closed 5 years ago

Breakpoint triggers on code that doesn't run (eg. if(false))

Categories

(DevTools :: Debugger, defect, P3)

33 Branch
x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jonathan, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:33.0) Gecko/20100101 Firefox/33.0 (Beta/Release)
Build ID: 20140808004001

Steps to reproduce:

1. Open in a new tab http://codepen.io/joallard/debug/wqKsE
2. Set breakpoint on line on wqKsE:21
3. Reload



Actual results:

Breakpoint hits (intermittent)


Expected results:

Breakpoint should not hit
Component: Untriaged → Developer Tools: Debugger
I can usually reproduce it 50% of the time.
Line 21 doesn't seem to contain script most of the time for me, sometimes it's right into the body tag of a different page. Line 25 contains the "if (false)" branch. I doubt that we are seeing the correct source in the editor and using Debugger.Source should make it behave consistently, so setting a dependency on bug 905700.
Status: UNCONFIRMED → NEW
Depends on: dbg-source
Ever confirmed: true
Priority: -- → P3
Summary: Breakpoint hits on code that doesn't run (eg. if(false)) → Breakpoint triggers on code that doesn't run (eg. if(false))
I looked into this.

The code in question looks like:

    (function() {
  if (false) {
    document.querySelector("#foo").innerHTML = 1;
  }

}).call(this);

The bug related to bug 1003554 and bug 1013219.  Applying those patches helps a bit.
Now when I try to set a breakpoint on the body of the "if", the breakpoint slides
down to the "call" line.

The function body here is optimized away early; see bug 1096736.
But also see https://bugzilla.mozilla.org/show_bug.cgi?id=1013219#c17 -
what is happening is that the entire function appears to be artificial, so
we can't set a breakpoint on it; so it slides to a funny spot.
Product: Firefox → DevTools

I'm pretty sure that this has been addressed, so going to close. Feel free to reopen with a specific reproduction case if there's still something you're aware of.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.