chrome.tabs.sendMessage
works with messages as with JSON objects. (It serialise data before passing)
JSON specification not include functions i.e. all functions will be filtered before JSON serialisation.
The simple example:
var obj = {
a: '1',
b: 2,
c: undefined,
d: null,
e: new Date(),
f: function(){}
}
var str = JSON.stringify(obj);
UPDATE (workaround):
chrome.tabs.sendMessage(activeTabId, {
name:'executePageScript',
word:word,
isFirst:isFirst,
jq: 'actionName1',
jqParams: [1,2,3]
});
Other place:
runtimeRouter = {
actionName1: function(a,b,c){
console.log(arguments);
}
}
runtime.onMessage(function(message, sender){
if (message.jq && typeof runtimeRouter[message.jq] === 'function') {
runtimeRouter[message.jq].apply(/*some context or null*/null, message.jqParams || []);
}
});