chrome.extension.onMessage is undefined - api

I have a simple plugin that just does something like this:
chrome.extension.onMessage.addListener(function(msg, _, sendResponse) {
log("Got message from background page: " + msg);
});
unfortunately when my panel is loaded the following error is shown:
TypeError: Cannot call method 'addListener' of undefined
and according to my tests chrome.extension.onMessage is undefined
According to this page http://code.google.com/chrome/extensions/messaging.html I should be able to access this chrome API from my page so it has to be something small that I am missing here...

Please note methods chrome.extension.onRequest and chrome.extension.sendRequest, as originally suggested in this answer, are deprecated as of Chrome 33.
You should use
chrome.extension.onRequest
instead of
chrome.extension.onMessage
And in background page or any other extension scripts:
chrome.tabs.sendRequest
instead of
chrome.tabs.sendMessage
( the documentation is outdated... alert to google team ;) )

Just a side note: the Yandex browser (mostly oriented for Russians) which is also based on Chromium still (as of 11/10/2012, ver. 1.0) has the .*Request methods instead of .*Message. Many thanks to Ciprian Amariei for the tip, it saved me a lot of time!
PS: This should actually be a comment to Ciprian Amariei's answer but unfortunately I can't leave comments yet and I though this information could be very helpful to those who develop extensions for Yandex browser.

Make sure you're using the latest Google Chrome version. Older versions don't have the chrome.extension.onMessage API.

Related

cose-bilkent layout extension of cytoscpae.js

I have been using cytoscape.js library to develop an application, but the extension layout cose-bilkent is working fine in google chrome, but the same code gives an error in Internet Explorer.
I am getting SCRIPT5009: 'Set' is undefined error in th IE debugger. Please advise what I might be missing.
Image with error in cose-bilkent.js file
This is a very common mistake (not yours, its the ie that is broken). IE doesn't support either Map or Set (expect for their "basic support"). You can see that here.
import 'core-js/es6/map';
import 'core-js/es6/set';
If you want to use it, there may be some workarounds with requireJS or polyfill, but using edge or ANY other browser than good ol' IE would do the trick...

geb jquery.mouseover() not working

The geb documentation shows that it has built in jQuery support. Im interested in one particular method called mouseover. However when I try to use the mouseover function I get a warning saying, "Cannot resolve symbol 'mouseover'". This happens even when I'm using the code in their example. What am I missing?
This might not directly answer your question. But if you are trying to mimic mouse over action in Geb, you could also use
interact {
moveToElement(element)
}
http://www.gebish.org/manual/current/#interact-closures

Unable to get Gamepad events on Chromium Version 44.0.2383.0

I'm trying to get my gamepad events in chromium. Everything works perfectly fine on Chrome Version 44.0.2403.130 m with this code :
var gamepadList = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads : []);
But on the WebVR chromium version made by Brandon Jones, I can't get any feedback, the 'navigator.getGamepads()' function returns only an array of four undefined variables.
Is it not supported yet? Or do I need to do something specific?
Thanks for the help!
Seems to work for me using this test page:
http://www.html5rocks.com/en/tutorials/doodles/gamepad/gamepad-tester/tester.html
Keep in mind that, due to fingerprinting privacy concerns, you to press a "face" button on the controller before it is visible to the API.

Extjs 3.2 : Js error in built function "onDocumentReady"

I`m getting js error, after loading below function,
Ext.onReady(function(){
aFunc123([{header:'ss',Fn:'aFunc1(1)'}],"",undefined,{showCheck:true})
})
After coming out of "aFunc123" function,extjs immediatly calls "onDocumentReady" function, problem is, passed arguments are undefined,and also I dont know how it`s getting called.Please check out, for this problem I`m getting error like `"Unable to get property 'apply' of undefined or null reference"`.
Please suggest me what wrong I`m doing here.
I`m using ExtJS 3.2,IE10.
Thanks in advance.
Ext 3.4.1a was released recently to add IE10 support. You can download it from the Ext website. Otherwise, older versions don't have support for IE10.

Why do I have an error on some Flattr buttons?

I've integrated Flattr with my Dotclear blog, using the appropriate plugin, and it works fine.
Except that, from time to time, some older posts have errors and I don't understand why.
See:
http://ploum.net/post/224-gpager-03-scenes-from-a-memory-finally-free
http://ploum.net/post/86-le-repas-de-noel-en-famille
those posts have nothing special and, yet, cannot be Flattered.
Could it be an issue on Flattr side ? Do you see what can cause that problem ?
Thanks in advance,
Seems like you're both using the new 0.6 version of the Flattr JavaScript API and a quite old 0.2 version. Using two versions at the same page can probably result in some pretty strange things - I would suggest just using the newer version that is documented here: https://flattr.com/support/integrate/js
Regarding why the button show an error - here's a bit of a secret way to find out: Look at the HTML for the button iframe and look within the div-tag with a "button-wrapper"-class - there you should find an HTML-comment that states the reason for the button error.
In your case the HTML-comment in the button iframe says "ERRORS: User couldn't be found and no owner specified." - which isn't strange since the iframe's URL has "0" specified as the uid-parameter - it should be a username instead.
Your script is disrupted by doublequotes in "var flattr_tle=", you should encode them with '"'