Merge pull request #6180 from jhen0409/patch-4

Fix chrome.runtime.sendMessage
This commit is contained in:
Cheng Zhao 2016-06-23 04:58:30 +00:00 committed by GitHub
commit 19d8a366b3

View file

@ -119,7 +119,13 @@ exports.injectTo = function (extensionId, isBackgroundPage, context) {
if (args.length === 1) {
message = args[0]
} else if (args.length === 2) {
[targetExtensionId, message] = args
// A case of not provide extension-id: (message, responseCallback)
if (typeof args[1] === 'function') {
console.error('responseCallback is not supported')
message = args[0]
} else {
[targetExtensionId, message] = args
}
} else {
console.error('options and responseCallback are not supported')
}