@@ -22,8 +22,14 @@ chrome.storage.sync.get(null, (data) => {
2222 // Send message to content script in all tabs
2323 const tabs = await chrome . tabs . query ( { } )
2424 for ( const tab of tabs ) {
25- console . debug ( "OpenBlur Sending message to tab id %d, url %s" , tab . id , tab . url )
26- void chrome . tabs . sendMessage ( tab . id ! , { literals} )
25+ console . debug ( "OpenBlur Sending literals message to tab id %d, title '%s' url %s" , tab . id , tab . title , tab . url )
26+ chrome . tabs . sendMessage ( tab . id ! , { literals} )
27+ . catch ( ( error ) => {
28+ // We ignore tabs without a proper URL, like chrome://extensions/
29+ if ( tab . url ) {
30+ console . info ( "OpenBlur Could not send message to tab with title '%s' and url %s. Was OpenBlur just installed?" , tab . title , tab . url , error )
31+ }
32+ } )
2733 }
2834 }
2935 } )
@@ -38,8 +44,14 @@ checkbox.addEventListener("change", async (event) => {
3844 // Send message to content script in all tabs
3945 const tabs = await chrome . tabs . query ( { } )
4046 for ( const tab of tabs ) {
41- console . debug ( "OpenBlur Sending message to tab id %d, url %s" , tab . id , tab . url )
42- void chrome . tabs . sendMessage ( tab . id ! , { mode : mode } )
47+ console . debug ( "OpenBlur Sending mode message to tab id %d, title '%s' url %s" , tab . id , tab . title , tab . url )
48+ chrome . tabs . sendMessage ( tab . id ! , { mode : mode } )
49+ . catch ( ( error ) => {
50+ // We ignore tabs without a proper URL, like chrome://extensions/
51+ if ( tab . url ) {
52+ console . info ( "OpenBlur Could not send message to tab with title '%s' and url %s. Was OpenBlur just installed?" , tab . title , tab . url , error )
53+ }
54+ } )
4355 }
4456 }
4557} )
0 commit comments