debugger icon indicating copy to clipboard operation
debugger copied to clipboard

[Breakpoints] can't set breakpoint in prettified source

Open tromey opened this issue 9 years ago • 8 comments

I tried the test case in bug 1327713. After prettifying the source, when I try to set a breakpoint, the breakpoint briefly appears, and then disappears.

I don't see an stack trace in the console, but enabling pause-on-exception shows an exception coming from addBreakpoint saying: "query object's 'line' property is neither undefined nor an integer".

TEST PAGE

tromey avatar Feb 10 '17 20:02 tromey

STR 1:

  1. Open attached "testcase 1"
  2. Open debugger, prettify script containing word "click"
  3. Set breaking on "click" event, click on the page
  4. Keep clicking "Step in" button until line "console.log(123);" is executed

TEST PAGE TEST PAGE 2 (w/ only the hex lines)

AR: When debugger steps into a function, then, if the first token in that function is "function", debugger jumps to line 1. That line becomes highlighted with green; caret is displayed in that line

ER: When debugger steps into a function, some sensible line inside that function should be selected. In other words, debugger should select lines in the very same sequence as in STR_2 (see below).

STR_2:

  1. Open attached "testcase 1"
  2. Set breaking on "wheel" event, hover mouse over the page, rotate mouse wheel down once
  3. Keep clicking "Step in" button until line "console.log(123);" is executed

AR: Everything's OK

Here's the testcase 1:

<script src="data:text/javascript,
(function(){
  var A = {};
  window.A = A;
  A.F = function(){
    A.G();
  },
  A.G = function(){
    function _G(){};
    A.H();
  },
  A.H = function(){
    A.I()
  },
  A.I = function(){
    function _I(){};
    A.J();
  };
  A.J = function(){
    function _J(){};
    A.K();
  };
  A.K = function(){
    console.log(123);
  };
  
  addEventListener('click',A.F,false);
})()
//.js"></script>

<!-- a bit confusing -->

<script src="data:text/javascript,
(function () {
%0A  var A = {
%0A  };
%0A  window.A = A;
%0A  A.F = function () {
%0A    A.G();
%0A  },
%0A  A.G = function () {
%0A    function _G() {
%0A    };
%0A    A.H();
%0A  },
%0A  A.H = function () {
%0A    A.I()
%0A  },
%0A  A.I = function () {
%0A    function _I() {
%0A    };
%0A    A.J();
%0A  };
%0A  A.J = function () {
%0A    function _J() {
%0A    };
%0A    A.K();
%0A  };
%0A  A.K = function () {
%0A    console.log(123);
%0A  };
%0A  addEventListener('wheel', A.F, false);
%0A}) () //.js
%0A"></script>

jasonLaster avatar Feb 10 '17 21:02 jasonLaster

Just tried this again and it still seems to be an issue.

clarkbw avatar May 04 '17 22:05 clarkbw

/claim

NickMalt avatar Dec 14 '17 02:12 NickMalt

Thanks for claiming the issue! :wave:

!!! Please check your email and confirm the invitation

Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Dec 14 '17 02:12 claim

@NickMalt did some great research in #4902 and started a mochitest

I think we've narrowed the problem down to how we create the URLs


After some debugging I think that I caught this bug:

  1. Here we send correct parameters but got { line: null, column: null }. Which is why breakpoint flashing. https://github.com/devtools-html/debugger.html/blob/223d35a570d4762000c736e00e5a16b09c9ae8c6/src/utils/source-maps.js#L17-L20

  2. Here we handle this request in source-map worker. But _findSourceIndex return -1 as if this source did not exist. ļæ¼ image image

  3. The problem is in property sourceUrl mismatch. This one we send to worker: image This one we have in worker: image And we have this mismatch because of path normalization in worker image

  4. And if we add this patch to normalize function, everything works ok. image

Before/After

bp before bp after

@jasonLaster The question is, how to properly change normalize function? I’m probably miss something, because do not see the whole picture.

And how should I continue this? I mean how to contibute to mozila-central?

jasonLaster avatar Dec 20 '17 14:12 jasonLaster

Hey @NickMalt how's your schedule these days?

jasonLaster avatar Jan 25 '18 02:01 jasonLaster

@NickMalt if you're free these days claim it. Otherwise, this is now open for anyone to claim

jasonLaster avatar Feb 27 '18 21:02 jasonLaster

I'm moving the issue to the icebox. We will re-prioritize the issues in the icebox at the beginning of the next release in 6 weeks.

jasonLaster avatar Mar 06 '18 00:03 jasonLaster