File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
packages/experiment-browser/src/providers Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -119,14 +119,20 @@ export class DefaultUserProvider implements ExperimentUserProvider {
119
119
120
120
private getUrlParam ( ) : Record < string , string | string [ ] > {
121
121
if ( ! this . globalScope ) {
122
- return { } ;
122
+ return undefined ;
123
123
}
124
124
125
125
const params : Record < string , string [ ] > = { } ;
126
- for ( const [ name , value ] of new URL ( this . globalScope ?. location ?. href )
127
- . searchParams ) {
128
- params [ name ] = [ ...( params [ name ] ?? [ ] ) , ...value . split ( ',' ) ] ;
126
+
127
+ try {
128
+ const url = new URL ( this . globalScope . location . href ) ;
129
+ for ( const [ name , value ] of url . searchParams ) {
130
+ params [ name ] = [ ...( params [ name ] ?? [ ] ) , ...value . split ( ',' ) ] ;
131
+ }
132
+ } catch ( error ) {
133
+ return undefined ;
129
134
}
135
+
130
136
return Object . entries ( params ) . reduce < Record < string , string | string [ ] > > (
131
137
( acc , [ name , value ] ) => {
132
138
acc [ name ] = value . length == 1 ? value [ 0 ] : value ;
You can’t perform that action at this time.
0 commit comments