0

I am busy converting by existing firebreath plugin here to use gpgme instead of making calls via the OS and the gpg binary.

I have managed to get the code to compile in windows using VS 2010 on a x32 system but after loading the plugin into chrome I can not access the npapi code at all. Even simple version calls fails.

When loading the plugin I get no visible errors but when using sawbuck log viewer for chrome I get the erorr messages below.

.\renderer\webplugin_delegate_proxy.cc  347 PluginMsg_Init returned false
..\plugins\npapi\webplugin_impl.cc  271 Couldn't initialize plug-in

I have tried to use my code with both firebreath 1.4 and 1.6 and neither versions work. After some simple debugging it seems that using any code provided by gpgme (whether its called or not) causes the plugin to break.

I came to this conclusion by doing the following.

  1. Created a new project with firebreath (versions 1.4 and 1.6)
  2. Add the gpgme.h headers to gmailGPGAPI.cpp and changed nothing else aside from adding the required reference paths to the project.
  3. Build the project to create the dll (this generates the dll fine).
  4. Replace the existing ddl in my project with the dll in step 2 and test it with the following piece of code

plugin = document.createElement('object'); plugin.id = 'plugin';
plugin.type = 'application/x-gmailtest';
document.body.appendChild(plugin);
console.log("my plugin returned: "+ plugin.valid);
console.log("my plugin returned: " + plugin.version);

  1. This returns valid = true and the version returns what ever i set it to.
  2. I then modified gmailGPGAPI.cpp to now return the gpg version by calling gpgme_check_version(NULL) in the version method. I used that method because its probably the simplest returning function that I could test with.
  3. Build the plugin and copy dll to chrome extension as in step 3-4. The plugin builds fine again as expected.
  4. Load the plugin and try to execute the code in step 4 at which point it now just returns undefined for any property or method i try to access on the plugin. No errors are printed to the console or anywhere else in chrome except for the error logged to sawbuck.

I have got no idea where to look or what to try since I cant seem to get an actionable error to work against. I have also reduced by test code to the point where its just a new project with a one line change to make it easier to find the problem.

I should note the code in the repo builds fine in linux/OSX and loads into chrome correctly so I know at some level my code does work.

RC1140
  • 8,423
  • 14
  • 48
  • 71
  • Never never *never* set the mimetype on the object tag until after you inject it into the DOM. – taxilian Jun 13 '12 at 21:42
  • RC1140, I am not sure if you are aware of this or not, but my plugin webpg-npapi (https://github.com/kylehuff/webpg-npapi/) is designed to be a drop-in browser interface to GnuPG -- some of your code is based off of my other plugin - gpgauth-npapi - but that has a more narrow scope for a specific task. I would suggest using webpg-npapi in your extension(s) to provide a uniform interface to GnuPG. The plugin is GPL and runs on Windows, Linux and OSX. The source for my own extension webpg-chrome found on github.com can be used as a reference for accessing the methods provided by webpg-npapi. – kylehuff Jul 07 '12 at 15:25
  • Hi Kyle I will have a look at it again , but could not get your plugin to build easily on windows. Now that I have figured that out I will see if I can use your plugin as a drop in alternative. I have used your code in the past as a reference but the issue atm is getting chrome to load the plugin not the code in the plugin. – RC1140 Jul 09 '12 at 20:08

1 Answers1

0

Two possible paths:

  1. You may have a DLL dependency that isn't available which keeps the plugin from loading; if you run regsvr32 on it in the state where it doesn't work on chrome, does it work?
  2. Your plugin may be loading and then crashing. Start chrome with --plugin-startup-dialog and then when it pops up a dialog warning you that a plugin is about to be loaded attach to that process and see if the process crashes. At this point you can also set breakpoints to try to figure out how far it gets.

Double check your metadata in PluginConfig.cmake as well; sometimes unusual characters in some fields can cause issues like this.

taxilian
  • 14,229
  • 4
  • 34
  • 73