@@ -22,8 +22,14 @@ chrome.storage.sync.get(null, (data) => {
22
22
// Send message to content script in all tabs
23
23
const tabs = await chrome . tabs . query ( { } )
24
24
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
+ } )
27
33
}
28
34
}
29
35
} )
@@ -38,8 +44,14 @@ checkbox.addEventListener("change", async (event) => {
38
44
// Send message to content script in all tabs
39
45
const tabs = await chrome . tabs . query ( { } )
40
46
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
+ } )
43
55
}
44
56
}
45
57
} )
0 commit comments