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: Created March 2, 2015, 11:57 a.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
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,
kzar 2015/03/02 19:00:32 Dumb idea: wrap the sendMessage call here to add a
Sebastian Noack 2015/03/02 19:42:08 Currently, we don't need that information. So addi
+
+ getWindow: function()
+ {
+ return backgroundPage;
+ }
+ };
+})();

Powered by Google App Engine
This is Rietveld