Using a plugin generated with Firebreath in a Firefox Extension? - dll

Is it possible to use a .dll made with Firebreath in a Firefox extension?
Currently, I am trying to port an extension I made for Google Chrome that uses javascript to get the HTML of the document, and then calls a function from the .dll and passes the HTML of the document as a parameter. The .dll then saves the file and launches a program.
Is there a simple way to port this functionality over to Firefox? Or will I have to rewrite the code using XPCOM?

XPCOM is too complicated for simple things which is why Firefox 4 and above has js-ctypes (see https://developer.mozilla.org/en/js-ctypes for an overview and https://developer.mozilla.org/en/js-ctypes/Using_js-ctypes#Calling_Windows_routines for an example). This allows you to load the DLL and call an exported native function easily. If you really need to use this DLL as an NPAPI plugin things get more complicated because you need a window to load the plugin into and Firefox unlike Chrome doesn't have a dedicated background window for that. But I guess that you only turned your DLL into a plugin to be able to use it in Chrome.
On locating your DLL to use with ctypes.open() see my answer here: Reference a binary-component to js-ctypes

For simple functionality, I also recommend js-ctypes. It is easy to use and provides good isolation (since scripts on the page cannot access the imported library).
If you really need to access an NPAPI plugin from any page, the standard approach seems to be to create an extension and modify the DOM of each page to include the plugin:
Scriptable NPAPI plugin doesn't work with Firefox

yes you can use a firebreath dll as an firefox extension. you can use the same javascript with some modifications for Firefox and for HTML you have to use XUL. You have to load the script in a XUL that overlays default firfox's browser.xul
overlay chrome://browser/content/browser.xul chrome://Yourproject/content/Youroverlay.xul
Inside Youroverlay.xul, you can add the below line to embed Firebreath dll
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/"?>
<overlay id="myOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
<script type="application/javascript" src="chrome://Yourproject/content/background.js"/>
<vbox style="height:0;">
<html:embed type="application/x-myproject" id="myproject1" style="height:0;"/>
</vbox>
</overlay>

Related

Download HERE JS API for IDE code completion?

is there a way to download the here maps JS api 3.x to provide code completion in my IDE (like PHPStorm)?
I didn't find anything in the documentation.
Regards, Kristian
My knowledge of PHPStorm is limited, but are you able to use the javascript files by downloading them using the direct urls ?
Although you will run into issues when there are updates in the javascript file.

Add a custom javascript library in Netbeans 7.3.1

I have a custom javascript library that I want to use in Netbeans, I created an HTML5 Javascript project, I can add a jQuery, ExtJS in the properties of my project but there is no way of adding a custom Javascript lib.
Any help is much apreciated.
Just include the library manually to the html
(And copy your lib into the path ofc)
Edit (to low reputation):
http://forums.netbeans.org/topic20226.html even though it is for NB 6.8 it says that they are dropping the support for adding custom-libs due to the fact that it is so easy just to copy the lib manually. I would guess that this might still be valid reason for the NB-team.

Why mozilla plugins and xulrunner being used by WebKitGTK?

I've got a simple application using WebKitGTK 1.6.0 that simply displays a webpage in a window.
When I browse a page using it that contains an Ogg/Theora video and HTML5 video element it appears this simple application is using some mozilla plugins and even xulrunner. Can somebody tell me why this is?
Here is a list of files open by the program using lsof.
I built WebKitGTK 1.6.0 and most of it's dependencies from source including gstreamer-0.10 and the gstreamer plugins. No where do I recall configuring WebKitGTK to using any mozilla plugins or xulrunner.
What might be causing the mozilla plugins, libtotem and xulrunner to be loaded? I provided the link to the files the application is using in hopes that it might provide a clue.
Lol, found the reason. I have FireFox, totem and totem-mozplugin installed on my system. Once I removed totem and totem-mozplugin, WebKitGTK used the appropriate Gstreamer plugins to render the video and audio.

Detect if own Opera extension installed and disabled using JavaScript

I can detect if my Opera extension installed by setting the new window object property (window.isExtensionInstalled for example) in injected script and checking it in web-page javaScript.
But this is not solution in case the extension is disabled.
How can I detect disabled extension?
Are there features like resources web-access in same manner as for Chrome extensions?
May be some other useful features?
Thanks in advance.
No, there is no such feature.
By definition, each extension lives in its own sandbox and is not aware of other extension.
The only chance is to look out of the window (object) and search for footprints (modifications of the window or child objects) of other extensions.
If these are forced to stay at home (deactivated), the can't leave footprints..
Sry for being so figurative ;)

How to create firefox3 sidebar?

Hi I want to create sidebar in Firefox 3 but have no clue how to do this.
I find tutorial on MDC (https://developer.mozilla.org/en/Creating_a_Firefox_sidebar) but after installation extension do not work with "not compatible with Firefox 3.0.3" error.
Does anybody have any tip or link to some resource about how to make sidebar?
Well, a Firefox extension, be it a sidebar, toolbar or whatever other type of extension is basically a mix of XUL and Javascript, all packaged nice and tidy into an installer package called an XPI.
For an excelent XUL tutorial see http://xulplanet.mozdev.org/tutorials/xultu/.
For information about building extensions and the package format see https://developer.mozilla.org/en/Building_an_Extension.
For a sidebar you basically have to override the browser's sidebar area by using an overlay. For good overlay information check out MDC and the excerpt at http://www.oreillynet.com/pub/a/mozilla/excerpt/FirefoxHacks_chap01/.
All you need except the links above is knowledge of XML, some Javascript and a creative mind.
To fix the problem you faced above, you have to specify the correct version of Firefox in the install.rdf file. For Firefox 3 set maxVersion to:
<em:maxVersion>3.*</em:maxVersion>