| OLD | NEW | 
|---|
| 1 "use strict"; | 1 "use strict"; | 
| 2 | 2 | 
| 3 chrome.runtime.onMessage.addListener((message, sender, sendResponse) => | 3 // Firefox 55 erroneously sends messages from the content script to the | 
|  | 4 // devtools panel: | 
|  | 5 // https://bugzilla.mozilla.org/show_bug.cgi?id=1383310 | 
|  | 6 // As a workaround, listen for messages only if this isn't the devtools panel. | 
|  | 7 if (!("devtools" in chrome)) | 
| 4 { | 8 { | 
| 5   return ext.onMessage._dispatch(message, {}, sendResponse).indexOf(true) != -1; | 9   // Listen for messages from the background page. | 
| 6 }); | 10   chrome.runtime.onMessage.addListener((message, sender, sendResponse) => | 
|  | 11   { | 
|  | 12     return ext.onMessage._dispatch(message, {}, sendResponse).includes(true); | 
|  | 13   }); | 
|  | 14 } | 
| 7 | 15 | 
| 8 (function() | 16 (function() | 
| 9 { | 17 { | 
| 10   let port = null; | 18   let port = null; | 
| 11 | 19 | 
| 12   ext.onExtensionUnloaded = { | 20   ext.onExtensionUnloaded = { | 
| 13     addListener(listener) | 21     addListener(listener) | 
| 14     { | 22     { | 
| 15       if (!port) | 23       if (!port) | 
| 16         port = chrome.runtime.connect(); | 24         port = chrome.runtime.connect(); | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 27 | 35 | 
| 28         if (!port.onDisconnect.hasListeners()) | 36         if (!port.onDisconnect.hasListeners()) | 
| 29         { | 37         { | 
| 30           port.disconnect(); | 38           port.disconnect(); | 
| 31           port = null; | 39           port = null; | 
| 32         } | 40         } | 
| 33       } | 41       } | 
| 34     } | 42     } | 
| 35   }; | 43   }; | 
| 36 }()); | 44 }()); | 
| OLD | NEW | 
|---|