npapi - javascript doesnt load the content of a plugin - firefox

I wrote a firefox plugin using C++ and used the <EMBED> to load it to html.
In javascript I got the embedded plugin by using document.getElementByID,
but when I tried to call a plugin function, the function was undefined. Moreover,
plugins constructors did not run while loading the page.
The same html file and plugin seems to work on some computers, while it doesnt work on others.
Does anyone have an idea what might by wrong?
How can I debug such an issue?

Can you reproduce it on your computer at first? If not, then try to figure out what systems, browsers, architecture, versions, they are using.
I recall, there are many GECKOSDK's, and each one has a specific version it works for. https://developer.mozilla.org/en/gecko_sdk For example, different SDK's for Firefox 1.5-2.0, FireFox 3.0, Firefox 3.5, and Firefox 3.5
For different browers, make sure you are exposing the right DLL Exports, browsers can vary: http://git.webvm.net/?p=npsimple is a good starting point. You can use firebreath.googlecode.com too as an alternative.

My suggestion would be to use an object tag instead of <embed>. In my experience, doesn't seem to work as reliably.
If I had more information on how your plugin is structured (are you using XPCOM or npruntime?), I might be able to help more.

Related

HtmlAgilityPack LoadFromBrowser method not found

I am using HtmlAgilityPack 1.6.2 within a .NET Core 2.0 Console application. HtmlWeb.Load function works fine but LoadFromBrowser function is not available. I got a compiler error. The testing code is copied from the tutorial page so it should be correct. Please advise how to use the API.
The LoadFromBrowser method requires the WinForm WebBrowser to work.
Since there is not WebBrowser in .NET Core 2.0, this method is not available.
This method could be available in the future by replacing the WebBrowser by an open source browser but there is currently no short-term plan for it.
EDIT: Answer comment
Is there still no solution for this?
I didn't try it, but some package support web browser for .NET Standard such as : https://www.nuget.org/packages/Selenium.WebDriver
So perhaps if you use this package to retrieve the HTML and use it with HAP, that will work.
I have the same prob, installed Selenium.WebDriver, but don't know how to use it with HAP to wait until JS is loaded.

Firefox plugin dll dependency on the filename

my current work tasking requires creating a firefox plugin. I've done this relatively easily on Linux but porting to windows has exposed a peculiar problem. To do the port, I refactored the basic windows example given in the mozilla source tree. I did this operation slowly and methodically, testing as I went. Aside from the occasional OS dependent glitch everything seemed to be going fine until I finally changed the output name of the plugin dll. So, instead of creating a dll called npbasic.dll, the filename was fubar.dll. This immediately caused the plugin to stop working: it did not get picked up in Firefox about:plugins. Changing the filename back to npbasic.dll allowed the firefox plugin tab to "see" the plugin again.
Is anyone aware of an aspect of dll linking/functionality which could be causing this observed dependency?, any help or pointers would be greatly appreciated.
Well, I've done some more research and it's clear that my approach of painstakingly refactoring the example plugin was flawed, the best strategy is to use something like firebreath, as described here : How to write a C++ FireFox 3 plugin (not extension) on Windows?

Plugin methods are missing in Firefox 3.6

We have a plugin that we use to enable printing and saving from our
app. We instantiate it using tag with all needed attributes,
and then call Save() or Print() method on the document.embeds[0]
object.
This used to work perfectly on Firefox 3.5 and earlier, but it no
longer works in Firefox 3.6. In 3.6, document.embeds[0].Save is null,
that is our custom methods are not defined on this object.
Any idea why this happens, and what has changed in Firefox 3.6 that
causes it? Any idea on how to debug it and find the cause? And most
important, any idea of a workaround that will allow us to access this
methods?
Thanks,
splintor
Got an answer in mozilla.dev.tech.plugins forum - Firefox 3.6 removes support for XPCOM. We will need to change our plugin according to one of the options suggested in the answer.

Firefox Gecko SDK : NPP_GetValue not getting called

I have tried out the NPRuntime sample provided with the Gecko SDK 1.9.1 with the help of this link.
It works perfectly fine with Firefox 3.6.
Following the above steps I created a new scripting plugin (npmyplugin.dll). I am currently placing npmyplugin.dll in a folder other than Firefox/plugins. I am registering the associated mime-type and plugin path in the registry. The plugin gets loaded properly. But now the browser is not calling NPP_GetValue.
I was suspecting that it must be because I am placing the plugin in a directory other than Firefox/plugins. Hence I did the same with npruntime.dll (the sample which comes with Gecko sdk). Suprisingly npruntime.dll scripting was working. Please guide me whether I missing anything important while creating the new plugin.
NPP_GetValue doesn't get called to get the NPObject until the first time you access it with javascript in many cases. When you do a getElementById, it will make the call.
Likely other calls to GetValue are being made, but you aren't seeing them because you aren't handling them. However, that's still not guaranteed.
Sorry for replying so late. I somehow solved the problem. I was embedding the plugin using tag
then i wrote a small javascript code
var MyWorkingPlugin = document.getElementById('MyPlugin');
It seems that after executing the above javascript NPP_GetValue was called. Currently I have no convincing reason why it happened but it worked and I am happy for the moment. If anyone can explain the above behaviour please let us know.

Turning a browser plugin into an XPI

I have a very old (1992) browser plugin for a mac that works in several different browsers. However, since Firefox restricted its plugins to XPI files in Firefox 3.6, the plugin no longer works.
I haven't been able to find a useful document describing what I need to do to my plugin to make it an XPI, or at least loadable by firefox, can anyone point me at such a document? or just explain to me what I need to do? I'm using Xcode.
Brain; the problem is most likely that in Firefox 3.6 they removed support for XPCOM interfaces on npapi plugins. you need to use npruntime instead.
http://colonelpanic.net/2010/01/firefox-3-6-has-removed-support-for-xpcom-plugins/
You could also consider using FireBreath to rewrite it with, as that abstracts a lot of the details.
So if this is an NPAPI plugin, you can just create a simple XPI (it's a ZIP file):
your-plugin.xpi/
install.rdf
plugins/
your-plugin.dylib
This follows from the https://developer.mozilla.org/en/Bundles page I linked earlier.
You can create the install.rdf by reading and following the install.rdf reference page on MDC or just generate a stub extension using something like
Extension Wizard (here's a "more official" version on addons.mozilla.org, but I haven't used that) and take the install.rdf from it.
You should probably limit the extension to Mac in your install.rdf (for that you'll have to read the install.rdf reference).
[original answer was:] What technology does the plugin use? XPI is a packaging mechanism; the answer to your question depends on whether the technology you use is still supported in Firefox 3.6.
I didn't think there were cross-browser plugin technologies, that worked in 1992 and are still in use now, so it's hard to guess what kind of plugin you're talking about.

Resources