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: Created June 7, 2017, 12:41 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") ||
6 (typeof chrome.extension == "undefined"))
Sebastian Noack 2017/06/07 14:42:14 Why is explicit checking for chrome.extension nece
Oleksandr 2017/06/14 03:41:01 There is a 'chrome' object defined in Edge, which
Sebastian Noack 2017/06/14 05:13:38 That's why we only check for `typeof chrome.extens
7 chrome = browser;
Sebastian Noack 2017/06/07 14:42:14 Is this variable meant to be global? If so, we sho
Oleksandr 2017/06/14 03:41:01 Done.
5 const backgroundPage = chrome.extension.getBackgroundPage(); 8 const backgroundPage = chrome.extension.getBackgroundPage();
6 window.ext = Object.create(backgroundPage.ext); 9 window.ext = Object.create(backgroundPage.ext);
7 10
8 window.ext.closePopup = () => 11 window.ext.closePopup = () =>
9 { 12 {
10 window.close(); 13 window.close();
11 }; 14 };
12 15
13 // We have to override ext.backgroundPage, because in order 16 // We have to override ext.backgroundPage, because in order
14 // to send messages the local "chrome" namespace must be used. 17 // to send messages the local "chrome" namespace must be used.
15 window.ext.backgroundPage = { 18 window.ext.backgroundPage = {
16 sendMessage: chrome.runtime.sendMessage, 19 sendMessage: chrome.runtime.sendMessage,
17 20
18 getWindow() 21 getWindow()
19 { 22 {
20 return backgroundPage; 23 return backgroundPage;
21 } 24 }
22 }; 25 };
23 }()); 26 }());
OLDNEW

Powered by Google App Engine
This is Rietveld