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

NEW
Unassigned

Status

()

Firefox
Developer Tools: Debugger
P3
normal
3 years ago
3 years ago

People

(Reporter: Jonathan Allard, Unassigned)

Tracking

(Blocks: 1 bug)

33 Branch
x86
Mac OS X
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
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
(Reporter)

Updated

3 years ago
Component: Untriaged → Developer Tools: Debugger
(Reporter)

Comment 1

3 years ago
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: 905700
Ever confirmed: true
Priority: -- → P3
(Reporter)

Updated

3 years ago
Blocks: 1074182

Updated

3 years ago
Summary: Breakpoint hits on code that doesn't run (eg. if(false)) → Breakpoint triggers on code that doesn't run (eg. if(false))

Comment 3

3 years ago
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.
You need to log in before you can comment on or make changes to this bug.