Skip to content

Commit cdca569

Browse files
committed
test(ses): repro 2941 errorTrapping bugs
1 parent f8aa142 commit cdca569

17 files changed

+332
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Repro browser behavior
2+
3+
If relevant, first `yarn build` in the ancestral `ses` directory above.
4+
5+
---
6+
7+
## `errorTrapping: 'platform'`
8+
9+
In ses/src/test/error/issue-2941/test1/
10+
1. open error-trapping-platform.js in the browser using `file://` protocol
11+
2. see
12+
13+
Brave (likely all Chromium):
14+
15+
<img alt="errorTrapping: 'platform'" src="./error-trapping-platform.jpg" />
16+
17+
FireFox (TODO):
18+
```
19+
???
20+
```
21+
22+
---
23+
24+
## `errorTrapping: 'platform', errorTaming: 'safe'`
25+
26+
In ses/src/test/error/issue-2941/test1/
27+
1. open error-trapping-platform-safe.js in the browser using `file://` protocol
28+
2. see
29+
30+
Brave (likely all Chromium):
31+
32+
<img alt="errorTrapping: 'platform'" src="./error-trapping-platform-safe.jpg" />
33+
34+
FireFox (TODO):
35+
```
36+
???
37+
```
38+
39+
---
40+
41+
## `errorTrapping: 'none'`
42+
43+
In ses/src/test/error/issue-2941/test1/
44+
1. open error-trapping-none.js in the browser using `file://` protocol
45+
2. see
46+
47+
Brave (likely all Chromium):
48+
49+
<img alt="errorTrapping: 'none'" src="./error-trapping-none.jpg" />
50+
51+
FireFox (TODO):
52+
```
53+
???
54+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
<script src="../../../../dist/ses.cjs"></script>
9+
<script>
10+
lockdown({
11+
errorTaming: 'unsafe',
12+
stackFiltering: 'concise',
13+
errorTrapping: 'none',
14+
})
15+
16+
</script>
17+
</head>
18+
19+
<body>
20+
<script src="./test.notjs"></script>
21+
</body>
22+
23+
</html>
8.52 KB
Loading
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
<script src="../../../../dist/ses.cjs"></script>
9+
<script>
10+
lockdown({
11+
errorTaming: 'safe',
12+
stackFiltering: 'concise',
13+
errorTrapping: 'platform',
14+
})
15+
16+
</script>
17+
</head>
18+
19+
<body>
20+
<script src="./test.notjs"></script>
21+
</body>
22+
23+
</html>
20.5 KB
Loading
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
<script src="../../../../dist/ses.cjs"></script>
9+
<script>
10+
lockdown({
11+
errorTaming: 'unsafe',
12+
stackFiltering: 'concise',
13+
errorTrapping: 'platform',
14+
})
15+
16+
</script>
17+
</head>
18+
19+
<body>
20+
<script src="./test.notjs"></script>
21+
</body>
22+
23+
</html>
19.2 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
canIRunInvalidSyntax?()
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Repro multiline error
2+
3+
When a multiline message is thrown in Node.js, SES will print all lines of the message, except first, twice.
4+
5+
The problem goes away when `errorTrapping: "none"` is added to lockdown options
6+
7+
If relevant, first `yarn build` in the ancestral `ses` directory above.
8+
9+
---
10+
## `errorTrapping: 'platform'`
11+
12+
```
13+
$ node error-trapping-platform.demo.js
14+
SES_UNCAUGHT_EXCEPTION: (Error#1)
15+
Error#1: Does this place have an
16+
echo?
17+
18+
echo?
19+
20+
at packages/ses/test/error/issue-2941/test2/error-trapping-platform.demo.js:9:7
21+
```
22+
23+
---
24+
## `errorTrapping: 'platform', errorTaming: 'safe'`
25+
26+
```
27+
$ node error-trapping-platform-safe.demo.js
28+
SES_UNCAUGHT_EXCEPTION: (Error#1)
29+
Error#1: Does this place have an
30+
echo?
31+
32+
33+
at packages/ses/test/error/issue-2941/test2/error-trapping-platform-safe.demo.js:9:7
34+
```
35+
36+
---
37+
38+
## `errorTrapping: 'none'`
39+
40+
```
41+
$ node error-trapping-none.demo.js
42+
file:///Users/markmiller/src/ongithub/endojs/endo/packages/ses/test/error/issue-2941/test2/error-trapping-none.demo.js:9
43+
throw Error(`Does this place have an
44+
^
45+
46+
[Error: Does this place have an
47+
echo?
48+
49+
at packages/ses/test/error/issue-2941/test2/error-trapping-none.demo.js:9:7]
50+
51+
Node.js v22.16.0
52+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import '../../../../index.js';
2+
3+
lockdown({
4+
errorTaming: 'unsafe',
5+
stackFiltering: 'concise',
6+
errorTrapping: 'none',
7+
});
8+
9+
throw Error(`Does this place have an
10+
echo?
11+
`);

0 commit comments

Comments
 (0)