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

Unified Diff: chrome/ext/popup.js

Issue 5703008528629760: Issue 2071 - Fixed issues when sending messages from the popup to the background page (Closed)
Patch Set: Addressed comment Created March 2, 2015, 7:42 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/ext/background.js ('k') | safari/ext/background.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/ext/popup.js
===================================================================
--- a/chrome/ext/popup.js
+++ b/chrome/ext/popup.js
@@ -1,6 +1,21 @@
-window.ext = Object.create(chrome.extension.getBackgroundPage().ext);
+(function()
+{
+ var backgroundPage = chrome.extension.getBackgroundPage();
+ window.ext = Object.create(backgroundPage.ext);
-ext.closePopup = function()
-{
- window.close();
-};
+ ext.closePopup = function()
+ {
+ window.close();
+ };
+
+ // We have to override ext.backgroundPage, because in order
+ // to send messages the local "chrome" namespace must be used.
+ ext.backgroundPage = {
+ sendMessage: chrome.runtime.sendMessage,
+
+ getWindow: function()
+ {
+ return backgroundPage;
+ }
+ };
+})();
« no previous file with comments | « chrome/ext/background.js ('k') | safari/ext/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld