Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid arguments to sendMessage #31

Open
dantheman3333 opened this issue Jun 28, 2017 · 0 comments
Open

Invalid arguments to sendMessage #31

dantheman3333 opened this issue Jun 28, 2017 · 0 comments

Comments

@dantheman3333
Copy link

dantheman3333 commented Jun 28, 2017

I'm trying to send a message with

import chrome.runtime.Runtime
Runtime.sendMessage(message = "hi")

This is how it looks in js:

$c_Lchrome_runtime_Runtime$.prototype.sendMessage__sjs_js_UndefOr__sjs_js_Any__sjs_js_UndefOr__sjs_js_UndefOr__V = (function(extensionId, message, options, responseCallback) {
  $g.chrome.runtime.sendMessage(extensionId, message, options, responseCallback)
});
  var x$10 = (void 0);
  $m_Lchrome_runtime_Runtime$();
  var x$11 = (void 0);
  $m_Lchrome_runtime_Runtime$();
  var x$12 = (void 0);
  $m_Lchrome_runtime_Runtime$().sendMessage__sjs_js_UndefOr__sjs_js_Any__sjs_js_UndefOr__sjs_js_UndefOr__V(x$10, "hi", x$11, x$12)

Which seemingly matches chrome.runtime.sendMessage(undefined, "hi", undefined, undefined") but I am getting this error:

Error in event handler for runtime.onMessage: Error: Invalid arguments to sendMessage.
    at $c_Lchrome_runtime_Runtime$.sendMessage__sjs_js_UndefOr__sjs_js_Any__sjs_js_UndefOr__sjs_js_UndefOr__V 

Edit: Running in a content script this does not work:

chrome.runtime.Runtime.sendMessage(extensionId = Runtime.id, message = "hi")

But this does:

chrome.runtime.bindings.Runtime.sendMessage(extensionId = Runtime.id, message = "hi")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant