LEFT | RIGHT |
1 "use strict"; | 1 "use strict"; |
2 | 2 |
3 (function() | 3 (function() |
4 { | 4 { |
5 if (typeof chrome == "undefined" || typeof chrome.extension == "undefined") | 5 if (typeof chrome == "undefined" || typeof chrome.extension == "undefined") |
6 window.chrome = browser; | 6 window.chrome = browser; |
7 const backgroundPage = chrome.extension.getBackgroundPage(); | 7 const backgroundPage = chrome.extension.getBackgroundPage(); |
8 window.ext = Object.create(backgroundPage.ext); | 8 window.ext = Object.create(backgroundPage.ext); |
9 | 9 |
10 window.ext.closePopup = () => | 10 window.ext.closePopup = () => |
11 { | 11 { |
12 window.close(); | 12 window.close(); |
13 }; | 13 }; |
14 | 14 |
15 // Calling getMessage with subsitutes on i18n from the background page causes | 15 // Calling i18n.getMessage from the background page causes Edge to throw an |
16 // Edge to throw an exception. | 16 // exception. |
17 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/127939
75/ | 17 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/127939
75/ |
18 window.ext.i18n = chrome.i18n; | 18 window.ext.i18n = chrome.i18n; |
19 | 19 |
20 // We have to override ext.backgroundPage, because in order | 20 // We have to override ext.backgroundPage, because in order |
21 // to send messages the local "chrome" namespace must be used. | 21 // to send messages the local "chrome" namespace must be used. |
22 window.ext.backgroundPage = { | 22 window.ext.backgroundPage = { |
23 sendMessage: chrome.runtime.sendMessage, | 23 sendMessage: chrome.runtime.sendMessage, |
24 | 24 |
25 getWindow() | 25 getWindow() |
26 { | 26 { |
27 return backgroundPage; | 27 return backgroundPage; |
28 } | 28 } |
29 }; | 29 }; |
30 }()); | 30 }()); |
LEFT | RIGHT |