Open Bug 1685990 Opened 4 years ago Updated 9 months ago

Stack trace of code in new Function() in network tab does not reveal source when clicked

Categories

(DevTools :: Netmonitor, defect, P3)

Firefox 85
defect

Tracking

(Not tracked)

People

(Reporter: random_n0body, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:85.0) Gecko/20100101 Firefox/85.0

Steps to reproduce:

  1. Open developeper tools (press f12)
  2. Go to https://www.paulbrunngard.com/se/skovards-produkter/impregneringsspray-och-refresh/footwear-repel
  3. go to network tab
  4. filter after: recommend
  5. find request to api.depict.ai
  6. click on it
  7. click "stack trace" on the tab bar of the panel poping up to the right in the dev console
  8. click on a line containing "Function"

Actual results:

Firefox opened the location of the script with " line 1 %3E Function" appended to it and then displayed an error message that the specified line could not be found, prompting for a line.

Expected results:

It should have opened the source code making the request

When you have fixed this there will be another bug waiting for you ;)

When it is possible to click the stack trace and it opens the script, click on the "format source code" button and try adding a breakpoint to the code. You will notice that it is not possible. It is however possible to add breakpoints before using the beautify button.

Oh yeah and before I forget, after you have fixed the second bug there will be another bug waiting for you ;)

And that is that the code which is being executed when stepping through new Function() code is not aligned with the code being shown in the debugger.

I.e. you can add breakpoints on empty lines and you can't add breakpoints where you otherwise would be able to (for example on if statements).

Also when you step through it it will highlight that it executes one function, but if you go one step deeper it will become apparent that it was executing a function some lines lower.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Netmonitor
Product: Firefox → DevTools

sounds like bug 1629822 needs to be solved first.
Currently we don't support displaying dynamically-generated scripts like eval and new Function in debugger.

Depends on: 1629822

Currently we don't support displaying dynamically-generated scripts like eval and new Function in debugger.

Could you please provide proof or examples for that statement?

It works fine when working with unminified new Function statements and clicking on the function location displayed when console.log'ing.

There is even a page on the feature on MDN: https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Debug_eval_sources

Also bug 1629822 is a "Tracking bug for issues related to dynamically evaluated scripts.", and I don't see how a tracking bug is ever going to be resolved.

oh, sorry. I misremembered the current situation.

No longer depends on: 1629822
See Also: → 1629822

No problem.

I figured out that clicking the stack traces of console.trace() always works, while the stack traces in the network tab and the one of thrown errors do not work.

Is devtools development dead or is this just a feature not so many people need?

There is another bug in devtools generally which annoys me, where breakpoints trigger even though they have been removed, but I don't know if I should even bother reporting. In chrome none of these issues exist -.-

Thanks for reporting!
I can reproduce the bug in the description.

Hello random_nObody,
Please would you be able to open the other issues in separate bugs.

Thanks

Severity: -- → S3
Flags: needinfo?(random_n0body)
Priority: -- → P3
Status: UNCONFIRMED → NEW
Ever confirmed: true

(In reply to Hubert Boma Manilla (:bomsy) from comment #8)

Thanks for reporting!
I can reproduce the bug in the description.

Hello random_nObody,
Please would you be able to open the other issues in separate bugs.

Thanks

Thank you bomsy for reproducing it!

I have opened https://bugzilla.mozilla.org/show_bug.cgi?id=1687165, https://bugzilla.mozilla.org/show_bug.cgi?id=1687166 and https://bugzilla.mozilla.org/show_bug.cgi?id=1687175 for the other issues.

I'd be delighted if you could take a look at #1687165 and #1687165 as they are both related with this issue (both are issues with debugging new Function code).

Please tell me if I can do anything more to help resolve the issues, I am suffering from them every day.

Flags: needinfo?(random_n0body)

I noticed that the reproduction link is now dead, new reproduction steps is:

  1. Open debug console, execute: new Function("fetch('')")()
  2. Got go to network tab, find request, try to click on the source location.
You need to log in before you can comment on or make changes to this bug.