File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ class CookiePopupsCollector extends ContentScriptCollector {
8787 * @param {import('devtools-protocol/types/protocol').Protocol.Runtime.ExecutionContextDescription } context
8888 */
8989 async onIsolatedWorldCreated ( session , context ) {
90- const bindingName = `${ BINDING_NAME_PREFIX } ${ context . uniqueId } ` ;
90+ const bindingName = `${ BINDING_NAME_PREFIX } ${ context . uniqueId . replace ( / \W / g , '_' ) } ` ;
9191 session . on ( 'Runtime.bindingCalled' , async ( { name, payload} ) => {
9292 if ( name === bindingName ) {
9393 try {
@@ -111,10 +111,13 @@ class CookiePopupsCollector extends ContentScriptCollector {
111111 }
112112 }
113113 try {
114- await session . send ( 'Runtime.evaluate' , {
114+ const evalResult = await session . send ( 'Runtime.evaluate' , {
115115 expression : getAutoconsentContentScript ( bindingName ) ,
116116 uniqueContextId : context . uniqueId ,
117117 } ) ;
118+ if ( evalResult . exceptionDetails ) {
119+ throw new Error ( `Content script injection failed: ${ evalResult . exceptionDetails . text } ` ) ;
120+ }
118121 } catch ( e ) {
119122 if ( ! this . isIgnoredCdpError ( e ) ) {
120123 this . log ( `Error injecting Autoconsent in ${ context . uniqueId } : ${ e } ` ) ;
You can’t perform that action at this time.
0 commit comments