Bug
1843499 - Part 2: Rethrow with exception stack in for-of loop. r=iain
The exception stack trace is discarded when using the opcodes `JSOp::Exception`
and `JSOp::Throw`. This is visible when throwing values which aren't instances
of `ErrorObject`.
This happens for example in test262, because `Test262Error` isn't an `Error`
subclass.
Example using test262 assertions:
```
for (let value of [0]) {
assert.throws(TypeError, () => {}); // This is line 2.
assert.sameValue(value, 0); // This is line 4.
}
```
Before this patch:
```
/tmp/a.js:4:10 uncaught exception: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all
Stack:
@/tmp/a.js:4:10
```
With this patch:
```
/tmp/test262-assert.js:104:9 uncaught exception: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all
Stack:
assert.throws@/tmp/test262-assert.js:104:9
@/tmp/a.js:2:10
```
Differential Revision: https://phabricator.services.mozilla.com/
D183563