Closed Bug 1788610 Opened 3 years ago Closed 7 months ago

breakpoint stop at wrong line

Categories

(DevTools :: Debugger, defect, P3)

Firefox 104
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1687166

People

(Reporter: h5on1, Unassigned)

Details

Attachments

(1 file)

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

Steps to reproduce:

I build a webpage, and use new Function to convert string to callable function.
I place some debugger code inside the string.
I open developer tools and refresh the page.
Firefox developer tools stop the code execution and show the source panel so I can debug.

below is the sample html file that can reproduce the issue

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body>

<script>
	/** 
	 * debugger is located at line 2
	 * expect breakpoint stop at line 2
	 * but firefox developer tool stop at line 4
	 */
	let f = new Function(`console.log(1);\ndebugger;\nconsole.log(3);\nconsole.log(4);\n`);
	f.apply(this, []);
</script>

</body>

</html>

Actual results:

firefox developer tools breakpoint stop at wrong line, 2 line after the real code

Expected results:

firefox developer tools should stop at the line where debugger is at

The Bugbug bot thinks this bug should belong to the 'DevTools::Debugger' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Debugger
Product: Firefox → DevTools

We have an offset of 2 lines compared to the debugger's line, which might come from the fact that we consider new Function as

function anonymous() {

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

This looks like a duplicate of bug 1687166.

Comment 0 STR works fine now.

data:text/html,<script>/*** debugger is located at line 2* expect breakpoint stop at line 2* but firefox developer tool stop at line 4*/let f = new Function(console.log(1);\ndebugger;\nconsole.log(3);\nconsole.log(4);\n);f.apply(this, []);</script>

Status: NEW → RESOLVED
Closed: 7 months ago
Duplicate of bug: 1687166
Flags: needinfo?(hmanilla)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: