1

This is the JavaScript code in the Chrome background.html.

var plugin = document.getElementById("reverbPlugin");
if (!plugin.startBackgroundThread()) {
        console.log("Failed to start background thread: " + plugin.getErrorMessage());
        return;
}

Here is the HTML part of it.

<embed type="application/x-reverbbrowserplugin" id="reverbPlugin"></embed>

The exception I'm getting on the JavaScript code is, TypeError - property_not_function.

My library (the BrowserPlugin.plugin file created after compiling the Firebreath project) is a non-fat binary for x86_64 arch on Mac OS X Lion.

Any ideas on why the function is not found by JavaScript? Am I missing something obvious? (Let me know any more information is needed).

Thanks!

PS. I had a similar problem for Firefox plugin using JS-Ctypes, but was solved. I tried the similar approach on this one and tried different function names. Didn't work.

Community
  • 1
  • 1
Rahul Jiresal
  • 1,006
  • 13
  • 24
  • It may be that "startBackgroundThread" is **void**. In your link to "similar problem for Firefox plugin" it is **void** not a function. So "**if (!**plugin.startBackgroundThread()..." is wrong. – moskito-x Jul 12 '12 at 16:55
  • startBackgroundThread is a function returning an integer. – Rahul Jiresal Jul 12 '12 at 17:03
  • return true or false or a number ? – moskito-x Jul 12 '12 at 17:05
  • Sorry. Its a boolean. Returns true/false. – Rahul Jiresal Jul 12 '12 at 17:09
  • 1
    you have it changed quickly. 7 hours before it was void in your library. My C + + library **function** is RFD_startBackgroundThread int (). But that is not right. You can see this in the mangled name. **__Z25RFD_startBackgroundThreadv** The last letter is a " v " stands for **void**. Regardless, what do you think that it is and what it really is. – moskito-x Jul 12 '12 at 17:37
  • Well, I'm getting a return value from the function, meaning that it is not void, as the declaration of the function says. I'm just wondering if it is a similar problem with Chrome - mangled function name. Apparently not. I tried the mangled name, the error is the same. – Rahul Jiresal Jul 12 '12 at 17:42
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/13807/discussion-between-rahul-jiresal-and-moskito-x) – Rahul Jiresal Jul 12 '12 at 17:48

2 Answers2

1

I realized that you need to call registerMethod for that method name in your JSAPI object. That worked for me.

Rahul Jiresal
  • 1,006
  • 13
  • 24
0

Unless this has changed recently, Chrome does not support 64 bit plugins. Try building it i386

Next, I recommend using an object tag instead of an embed tag.

If it still says no such method, you may have forgotten to call registerMethod in the constructor of your JSAPI object.

(updated to include items from the comments below)

taxilian
  • 14,229
  • 4
  • 34
  • 73
  • Changed the file to a [fat binary](http://en.wikipedia.org/wiki/Fat_binary) containing both i386 and x86_64. The same problem persists. `Object # has no method 'startBackgroundThread'`! – Rahul Jiresal Jul 12 '12 at 17:24
  • Don't use an embed use an object tag – taxilian Jul 12 '12 at 17:48
  • Now the error says `Uncaught TypeError: Property 'startBackgroundThread' of object is not a function`. I also printed out the object `plugin` to see if I'm getting the object, it now says ``. Earlier it was `[object HTMLEmbedElement]`. – Rahul Jiresal Jul 12 '12 at 17:53
  • @RahulJiresal. That's what i sayed . IT IS NOT A FUNCTION . Have you tried to call it with "plugin.startBackgroundThread();" **without if** ? – moskito-x Jul 12 '12 at 18:04
  • 2
    if you're getting "" then it definitely is loading the plugin. as @moskito-x suggests you may not have correctly exposed your function. What happens when you call it natively? Did you call registerMethod for that method name in your JSAPI object? – taxilian Jul 12 '12 at 19:13
  • @taxilian. +1 You can explain it better. Because my english is not so good. It may also the just compiled and the dll in the plugin folder are not the same. – moskito-x Jul 12 '12 at 19:33
  • @taxilian. I made a stupid mistake. I did not call registerMethod in the JSAPI object. Sigh. :-/ – Rahul Jiresal Jul 12 '12 at 20:39