xpcom

Writing a Firefox XPCOM plug-in with a native window interface? (like ActiveX control)

I have an ActiveX control that works fine in Internet Explorer and the ActiveX Control Test Container program. The actual behavior of the control is split in two parts, where one part is the ATL gunk that interfaces with the OLE host, and the other part is the real meat, which just receives callbacks for window attach, sizing, drawing an...

Dependency Injection in XPCOM

Hi, One of my XPCOM components make use of other XPCOM components. As I was testing it, I found it cumbersome cos of the dependencies. Then I thought of using Dependency Injection to pass in the other components in my constructor. I wasn't successful. Is it possible to pass in references of other components into your constructor? var ...

Creating an image from a nsIBinaryInputStream

I create a binary input stream using some js trickery which contains compressed image data like jpeg or gif. I want to decode and display this data either using imgITools::decodeImageData or some other way but couldn't find a way yet. Where should I start? ...

How to listen to 'SendMail' event in Thunderbird?

I need to intercept all mail sent by Thunderbird and block sending if there is a predefined string in the mail body. It should be a part of our already existing XPCOM dll addon. Do you have any ideas how to implement it? ...

Browser Cache API for non IE browsers

IE has WinInet API, such as GetUrlCacheEntryInfo, to read and manipulate IE browser cache. Is there a similar API for non IE browsers such as Firefox or Chrome? If so where can I get more info? Thanks Update: According to following (http://stackoverflow.com/questions/61453/accessing-firefox-cache-from-an-xpcom-component) the WinInet...

Event-based XPCOM with java

Hello, I'm writing a toolbar for Firefox using Javascript connected to a Java XPCOM component. I want it to send a receive URLs from an external application that the java end is connected to. I can send the URL just fine, and I can load an incoming URL if I know one is there, but it's missing something crucial. There is no way for the u...

How can I implement a content converter in Firefox for all page elements?

I'm attempting to port over an Internet Explorer plugin to Firefox, but I'm not sure where to look for what I need. Basically I need to be able to filter all content that is received by the browser with a certain Content-Type header. I tried implementing a stream converter, and this works, but only for the top-level document in the page...

nsIFile: How to get Vista AppData/LocalLow folder path?

I am able to get path to User 'AppData/Local' folder as follows, appdatafile = Components.classes["@mozilla.org/file/directory_service;1"]. getService(Components.interfaces.nsIProperties). get("LocalAppData", Components.interfaces.nsIFile).path; Can anyone help me to get the 'AppData/LocalLow'...

Writing a Firefox Extension that uses XPCOM components?

I'm trying to write a Firefox extension that writes Firefox's history into the Windows system history, which ought to be useful for folks at work who use IE and Firefox to get work done. Adding pages to IE history appears simple enough (IUrlHistoryStg::AddUrl ought to do it). However, my experience with Firefox extensions is limited to ...

How can I read the source URL of a file downloaded with FireFox from an external application?

I have an C++ app I built which is registered as the default handler for a file with a specific extension. So when I download one of these files with Firefox from a website, it downloads it to a temp directory and then shell executes my app while passing the full path to the downloaded file on the command line. What is the best way to ...

Calling Firefox XPCOM from external app?

Context: we need to read Firefox cookies in our app; until Firefox 3.5, this was possible by reading cookies.txt / cookies.sqlite. In Firefox 3.5, it exclusively locks the cookie file so outside apps can't read it (see https://bugzilla.mozilla.org/show_bug.cgi?id=476167), and even if we make a local copy, FF doesn't always flush the cook...

how to create an nsIFile object using URIs

I'm making extension for firefox, and I want to my extension open a file like "file:///home/blahblah/foo.txt" and then put content of this file in text area. Its easy with files "http://", but i cant do this with "file://" ...

google doesn't want to be innerred (XPCOM)

Hi, I'm trying to make an firefox extension. Why when I want to use document.body.innerHTML = data; in new opened tab, it doesn't work. Here is my code: function change() { //Open google in new Tab and select it tab=gBrowser.addTab("http://www.google.com"); gBrowser.selectedTab=tab; //Create nslFile object var path="/home/foo/notify...

Loaded data truncated when using nsIFileInputStream & nsIConverterInputStream

I'm working on a project (BrowserIO - go to browserio dot googlecode dot com if you want to check out the code and work on it. Help welcome!) in which I'm using Firefox's nsIFileInputStream in tandem with nsIConverterInputStream, per their example (https://developer.mozilla.org/en/Code%5Fsnippets/File%5FI%2F%2FO#Simple), but only a port...

How to attach mouse event listeners to embedded nsIWebBrowser in C++

I've embedded an nsIWebBrowser in my application. Because I'm just generating HTML for it on the fly, I'm using OpenStream, AppendToStream, and CloseStream to add content. What I need is to add event listeners for mouse movement over the web browser as well as mouse clicks. I've read documentation and tried lots of different things, but ...

NS_ERROR_XPC_GS_RETURNED_FAILURE error code

I'm developing extension for Firefox which calls XPCOM component writen in C++ and I get this error: [Exception... "Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]" nsresult: "0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)" location: "JS frame :: chrome://testtest/content/mytest.js ...

Service Control Security Issues in XPCOM

I'm am developing a Firefox extension which interfaces with an underlying Windows service (which I have already made). During the development so far I encountered one bug in the installer program (which installs the FF extension AND the service). This was due to the security model on Vista requiring elevated privileges to be able to ins...

Javascript alert not defined . . .

I am creating a javascript xpcom component Its source is as follows- Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); function callback() { } callback.prototype = { classDescription: "My Hello World Javascript XPCOM Component", classID: Components.ID("{3459D788-D284-4ef0-8AFF-96CBAF51BD35}"), contractID...

Firefox crashes when XPCOM function called from thread

I want to create a thread from XPCOM Component ... Here is a code for that nsresult rv = NS_OK; nsCOMPtr<Callback> obj = do_CreateInstance("@jscallback.p2psearch.com/f2f;1", &rv); NS_ENSURE_SUCCESS(rv, rv); char* str="Hello from C++"; obj->Status(str); _beginthread( (void(*)(void* ))&(P2P::test), 0,obj); return...

How to convert char* to PRUnichar *

I need to pass char* to XPCOM function but that function accepts PRUnichar *. How to convert from char* to PRUnichar * ? ...