Index: chrome/common.js |
=================================================================== |
--- a/chrome/common.js |
+++ b/chrome/common.js |
@@ -56,7 +56,7 @@ |
var MessageEventTarget = function() |
{ |
- WrappedEventTarget.call(this, chrome.runtime.onMessage); |
+ WrappedEventTarget.call(this, chrome.runtime.onMessage || chrome.extension.onRequest); |
}; |
MessageEventTarget.prototype = { |
__proto__: WrappedEventTarget.prototype, |
@@ -68,18 +68,13 @@ |
} |
}; |
+ |
/* API */ |
ext = { |
backgroundPage: { |
- sendMessage: function(message, responseCallback) |
- { |
- chrome.runtime.sendMessage(message, responseCallback); |
- }, |
- getWindow: function() |
- { |
- return chrome.extension.getBackgroundPage(); |
- } |
+ sendMessage: chrome.runtime.sendMessage || chrome.extension.sendRequest, |
Wladimir Palant
2013/11/17 06:19:45
This will error out with "Cannot get property send
|
+ getWindow: chrome.extension.getBackgroundPage |
}, |
getURL: chrome.extension.getURL, |
onMessage: new MessageEventTarget(), |