@@ -741,4 +741,53 @@ describe('Tracekit - Chrome Tests', () => {
741741 value : 'memory access out of bounds' ,
742742 } ) ;
743743 } ) ;
744+
745+ it ( 'should correctly parse with data uris' , ( ) => {
746+ const DATA_URI_ERROR = {
747+ message : 'Error from data-uri module' ,
748+ name : 'Error' ,
749+ stack : `Error: Error from data-uri module
750+ at dynamicFn (data:application/javascript,export function dynamicFn() { throw new Error('Error from data-uri module');};:1:38)
751+ at loadDodgyModule (file:///Users/tim/Documents/Repositories/data-uri-tests/index.mjs:8:5)
752+ at async callSomeFunction (file:///Users/tim/Documents/Repositories/data-uri-tests/index.mjs:12:5)
753+ at async file:///Users/tim/Documents/Repositories/data-uri-tests/index.mjs:16:5` ,
754+ } ;
755+
756+ const ex = exceptionFromError ( parser , DATA_URI_ERROR ) ;
757+
758+ // This is really ugly but the wasm integration should clean up these stack frames
759+ expect ( ex ) . toStrictEqual ( {
760+ stacktrace : {
761+ frames : [
762+ {
763+ colno : 5 ,
764+ filename : 'file:///Users/tim/Documents/Repositories/data-uri-tests/index.mjs' ,
765+ function : '?' ,
766+ in_app : true ,
767+ lineno : 16 ,
768+ } ,
769+ {
770+ colno : 5 ,
771+ filename : 'file:///Users/tim/Documents/Repositories/data-uri-tests/index.mjs' ,
772+ function : 'async callSomeFunction' ,
773+ in_app : true ,
774+ lineno : 12 ,
775+ } ,
776+ {
777+ colno : 5 ,
778+ filename : 'file:///Users/tim/Documents/Repositories/data-uri-tests/index.mjs' ,
779+ function : 'loadDodgyModule' ,
780+ in_app : true ,
781+ lineno : 8 ,
782+ } ,
783+ {
784+ filename : '<data:application/javascript>' ,
785+ function : 'dynamicFn' ,
786+ } ,
787+ ] ,
788+ } ,
789+ type : 'Error' ,
790+ value : 'Error from data-uri module' ,
791+ } ) ;
792+ } ) ;
744793} ) ;
0 commit comments