Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: ext/popup.js

Issue 29458601: Issue 5315 - Add support for Microsoft Edge (Closed)
Patch Set: Workaround CSS.excape, i18n issue and use typeof for 'undefined' detection Created July 17, 2017, 12:51 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 "use strict"; 1 "use strict";
2 2
3 (function() 3 (function()
4 { 4 {
5 if (typeof chrome == "undefined" || typeof chrome.extension == "undefined")
6 window.chrome = browser;
5 const backgroundPage = chrome.extension.getBackgroundPage(); 7 const backgroundPage = chrome.extension.getBackgroundPage();
6 window.ext = Object.create(backgroundPage.ext); 8 window.ext = Object.create(backgroundPage.ext);
7 9
8 window.ext.closePopup = () => 10 window.ext.closePopup = () =>
9 { 11 {
10 window.close(); 12 window.close();
11 }; 13 };
12 14
15 // Edge needs the i18n to be local, otherwise it can't process substitutions
kzar 2017/07/17 14:08:19 How about this? "Calling i18n from the background
Oleksandr 2017/07/17 23:52:09 Rephrased to be more precise. Calling i18n alone d
kzar 2017/07/18 09:30:49 "Calling i18n.getMessage from the background page
kzar 2017/07/18 10:36:23 It seems like your latest improvement to this comm
16 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/127939 75/
17 window.ext.i18n = chrome.i18n;
18
13 // We have to override ext.backgroundPage, because in order 19 // We have to override ext.backgroundPage, because in order
14 // to send messages the local "chrome" namespace must be used. 20 // to send messages the local "chrome" namespace must be used.
15 window.ext.backgroundPage = { 21 window.ext.backgroundPage = {
16 sendMessage: chrome.runtime.sendMessage, 22 sendMessage: chrome.runtime.sendMessage,
17 23
18 getWindow() 24 getWindow()
19 { 25 {
20 return backgroundPage; 26 return backgroundPage;
21 } 27 }
22 }; 28 };
23 }()); 29 }());
OLDNEW

Powered by Google App Engine
This is Rietveld