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

Unified Diff: chrome/common.js

Issue 4549521954570240: Added backwards compatibility for Chrome's old messaging API (Closed)
Patch Set: Created Nov. 15, 2013, 6: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/background.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(),
« no previous file with comments | « chrome/background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld