Closed Bug 1728798 Opened 3 years ago Closed 3 years ago

Print original error stack in the shell instead of the pending exception stack

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

RESOLVED FIXED
93 Branch
Tracking Status
firefox93 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file)

finally blocks call setPendingExceptionAndCaptureStack(), which overwrites the pending exception stack. This leads to showing the wrong stack in the shell.

This is a regression from bug 1547131.


The stack trace points to the finally block instead of the call.

Test case 1:

function throwError() {
  throw new Error();
}

try {
  throwError();
} finally {
}

Expected:

/tmp/d.js:2:9 Error: 
Stack:
  throwError@/tmp/d.js:2:9
  @/tmp/d.js:6:3

Actual:

/tmp/d.js:2:9 Error: 
Stack:
  @/tmp/d.js:7:11

Super confusing in for-of loops when the stack line number points to non-throwing operation.

Test case 2:

function throwError() {
  throw new Error();
}

for (var v of [0]) {
  throwError();

  v = 1;
}

Expected:

/tmp/d.js:2:9 Error: 
Stack:
  throwError@/tmp/d.js:2:9
  @/tmp/d.js:6:3

Actual:

/tmp/d.js:2:9 Error: 
Stack:
  @/tmp/d.js:8:3
Pushed by andre.bargull@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/f6b35ebab6d6
Print original error stack in the shell instead of the pending exception stack. r=jandem
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: