Skip to content

Commit b72ebbf

Browse files
Add in exception handle debugging (#373)
* Add in exception handle debugging * Rename message for exception
1 parent 2a5b2bd commit b72ebbf

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/features.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export const featureNames = [
1414
'fingerprintingTemporaryStorage',
1515
'navigatorInterface',
1616
'clickToLoad',
17-
'elementHiding'
17+
'elementHiding',
18+
'exceptionHandler'
1819
]
1920

2021
// Certain features are injected into the page in Firefox

src/features/exception-handler.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { postDebugMessage } from '../utils.js'
2+
import ContentFeature from '../content-feature.js'
3+
4+
export default class ExceptionHandler extends ContentFeature {
5+
init () {
6+
// Report to the debugger panel if an uncaught exception occurs
7+
function handleUncaughtException (e) {
8+
postDebugMessage('jsException', {
9+
documentUrl: document.location.href,
10+
message: e.message,
11+
filename: e.filename,
12+
lineno: e.lineno,
13+
colno: e.colno,
14+
stack: e.error.stack
15+
})
16+
}
17+
globalThis.addEventListener('error', handleUncaughtException)
18+
}
19+
}

0 commit comments

Comments
 (0)