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; |
+ } |
+ }; |
+})(); |