File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
dev-packages/browser-integration-tests/suites/integrations/globalHandlers/dataUrls Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ const workerCode = `
2
+ self.addEventListener('message', (event) => {
3
+ if (event.data.type === 'error') {
4
+ throw new Error('Error thrown in worker');
5
+ }
6
+ });
7
+ ` ;
8
+
9
+ const worker = new Worker ( `data:text/javascript;base64,${ btoa ( workerCode ) } ` ) ;
10
+
11
+ worker . postMessage ( { type : 'error' } ) ;
Original file line number Diff line number Diff line change
1
+ import { expect } from '@playwright/test' ;
2
+ import { sentryTest } from '../../../../utils/fixtures' ;
3
+ import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4
+
5
+ sentryTest ( 'detects and handles data urls on first stack frame' , async ( { getLocalTestUrl, page } ) => {
6
+ const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
7
+
8
+ const errorEventPromise = waitForErrorRequest ( page , e => {
9
+ return ! ! e . exception ?. values ;
10
+ } ) ;
11
+
12
+ await page . goto ( url ) ;
13
+
14
+ const errorEvent = envelopeRequestParser ( await errorEventPromise ) ;
15
+
16
+ expect ( errorEvent ?. exception ?. values ?. [ 0 ] ) . toEqual ( {
17
+ mechanism : {
18
+ handled : false ,
19
+ synthetic : true ,
20
+ type : 'auto.browser.global_handlers.onerror' ,
21
+ } ,
22
+ stacktrace : {
23
+ frames : [
24
+ {
25
+ colno : 13 ,
26
+ filename : '<data:text/javascript,base64>' ,
27
+ function : '?' ,
28
+ in_app : true ,
29
+ lineno : 4 ,
30
+ } ,
31
+ ] ,
32
+ } ,
33
+ type : 'Error' ,
34
+ value : 'Uncaught Error: Error thrown in worker' ,
35
+ } ) ;
36
+ } ) ;
You can’t perform that action at this time.
0 commit comments