Closed Bug 1532240 Opened 5 years ago Closed 5 years ago

Debugger focuses wrong line when looking for event handler

Categories

(DevTools :: Debugger, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1394998

People

(Reporter: Gijs, Unassigned)

References

Details

Attachments

(1 file)

STR:

  1. yesterday's (March 3, 2019) nightly, mac
  2. open gmail and log in.
  3. open inspector
  4. click {event} bubble on <body> . Expand the 'click' event and note the source code of the handler.
  5. click the "go to this in the debugger" button
  6. stare in confusion at the minified JS, and click "pretty print" button in the bottom left hand corner
  7. lose your place, so go back to inspector, repeat step 3/4 (I'm assuming this is already on file elsewhere).

ER:

You get to the source code of the handler;

AR:

you end up at:

b.addEventListener(c.toString(), e, f);

which is the addEventListener call.

The actual handler lives a little lower down, in the pUa minified function that looks like this:

 pUa = function () {
    var b = rUa,
    c = JTa ? function (d) {
      return b.call(c.src, c.listener, d)
    }
     : function (d) {
      d = b.call(c.src, c.listener, d);
      if (!d) return d
    };
    return c
  },
See Also: → 1532244

The issue here is that the console doesn't actually tell the debugger what column to jump to, just what line, and the start of that line happens to be b.addEventListener(c.toString(), e, f); while b.call(c.src, c.listener, d) is later on the line.

Relevant code: https://hg.mozilla.org/mozilla-central/file/c89f024c023f/devtools/server/actors/inspector/event-collector.js#l901

We have several bugs along these lines, but I'm not duping them because they may actually be separate instances of related problems.

Has STR: --- → yes
Priority: -- → P3
Attached image image.png

Simplified test case: https://debugger-pretty-print-events-1532240.glitch.me/

STR:

  • Pretty print compressed.js in Debugger (click through via console log)
  • In Inspector find the click event on the body element
  • Navigate to Debugger via event handler location

Alternative STR:

  • Inspect body element to find the click event from compressed.js
  • Pretty print compressed.js

AR: Wrong line (setup declaration) is focused (compressed.js:formatted:7)
ER: myEventHandler declaration is focused


Logan, does it seem reasonable to treat the both STRs as the same bug. That the column information is missing, probably affects both cases.

Flags: needinfo?(lsmyth)

Closing in favor of bug 1394998 as it has some technical discussion and focuses on the location issue.

Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(lsmyth)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: