Port a firefox extension to a BHO (Browser Helper Objects, aka IE extensions)
Asked Answered
L

3

6

I have a Firefox extension that I would like to port to IE, I don't want to code it again.

Is there something that can help me? It could come in very different ways:

  • An IE BHO that can render a firefox extension, with IE fonctions mapped to the ones the FF extension calls.
  • A generator that takes a FF extension and generates a BHO (in C,C#,etc. whatever it wants).

EDIT: There may be no such thing. I'll keep the question open...

EDIT: question is irrelevant as of today

Leith answered 24/11, 2010 at 12:49 Comment(1)
Wiki how to write BHO for IE petesearch.com/wiki. Good luck.Antimasque
N
1

There is no easy way out. The models are very different. Abstract your core code to the extent that you can, and write the glue once for each browser.

Nedi answered 29/11, 2010 at 23:21 Comment(0)
R
1

The biggest problem we have with one codebase and our own mapping between IE and FF functions is where the interfaces differ slightly or are otherwise buggy so you cannot use a consitent approach across browsers.

You will either have a heavier helper library to make the 2 interfaces consitent for your usage, or be re writing some of the workarounds.

As we had an IE BHO first we have things like the following to map the IE stuff to FF, but depending on what you use you may find you need mappings both ways from the most detailed to the least. Here are some quick ideas for you

// Normally if you where just doing IE or FF you would use one technique for getting a different interface
// as we are mixing the code, we have macros which allows you to use a combination of code
// eg.  for IE  CComQIPtr<IHTMLDocument2> doc( disp );
// eg.  for FF  nsCOMPtr<IHTMLDocument2> doc( do_QueryInterface(disp) );
// combined in code will be CComQIPtr<IHTMLDocument2> doc( do_QueryInterface(disp) );
// FF strips off the QI,  IE strips out the do_QueryInterface.
#ifdef MOZILLA
#define CComPtr                     nsCOMPtr
#define CComQIPtr                   nsCOMPtr

#define IWebBrowser2                nsIDOMWindow
#define IHTMLWindow2                nsIBrowserDOMWindow
#define IHTMLDocument2              nsIDOMHTMLDocument

#define get_Document            GetDocument
#define get_type                    GetType
#else
// Pointer handling for nsCOMPtr vs CComPtr/CComQIPtr
#define getter_AddRefs(x)       (&(x).p)        
#define do_QueryInterface(x)        (x)
#endif

Good Luck!

Riane answered 28/12, 2010 at 0:43 Comment(1)
Thanks for the post =) I think I will have to do this. Mmmh I look forward to the debug phase....Leith
L
0

depending on the plugin injecting js(and bind ie to the methodes you use in ff) is a lot more portable

there are sites/software that can use single code that compiles both to ie and ff

Leatherworker answered 10/12, 2010 at 11:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.