(message, callback)
| 4 | * Safe message sending with error handling |
| 5 | */ |
| 6 | export function safeSendMessage(message, callback) { |
| 7 | try { |
| 8 | if (chrome.runtime && chrome.runtime.sendMessage) { |
| 9 | chrome.runtime.sendMessage(message, function(response) { |
| 10 | if (chrome.runtime.lastError) { |
| 11 | console.log('Chrome runtime error:', chrome.runtime.lastError.message); |
| 12 | return; |
| 13 | } |
| 14 | if (callback && typeof callback === 'function') { |
| 15 | callback(response); |
| 16 | } |
| 17 | }); |
| 18 | } else { |
| 19 | console.log('Chrome runtime API not available'); |
| 20 | } |
| 21 | } catch (error) { |
| 22 | console.log('Error sending message:', error); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Initialize page-to-content communication for Selenium API |
no outgoing calls
no test coverage detected