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

Side by Side Diff: ext/popup.js

Issue 29570614: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Oct. 9, 2017, 3:12 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") 5 const backgroundPage = browser.extension.getBackgroundPage();
Manish Jethani 2017/10/09 15:49:41 This is redundant since it's already done in ext/c
6 window.chrome = browser;
7 const backgroundPage = chrome.extension.getBackgroundPage();
8 window.ext = Object.create(backgroundPage.ext); 6 window.ext = Object.create(backgroundPage.ext);
9 7
10 // We have to override ext.backgroundPage, because in order 8 // We have to override ext.backgroundPage, because in order
11 // to send messages the local "chrome" namespace must be used. 9 // to send messages the local "browser" namespace must be used.
12 window.ext.backgroundPage = { 10 window.ext.backgroundPage = {
13 sendMessage: chrome.runtime.sendMessage, 11 sendMessage: browser.runtime.sendMessage,
14 12
15 getWindow() 13 getWindow()
16 { 14 {
17 return backgroundPage; 15 return backgroundPage;
18 } 16 }
19 }; 17 };
20 }()); 18 }());
OLDNEW

Powered by Google App Engine
This is Rietveld