xpcom

Using nsIZipWriter or other to compress a string as a string?

I need to be able to take a javascript string, compress it using any fast and available means and get back a binary string/blob. Background: The extension I'm developing needs to send various large content to my server. It does this conveniently by dynamically creating a form, adding fields to the form and posting it. Some of these fi...

Where's all the XPCOM user documentation?

Google can't find much user documentation for XPCOM. Sure, it can find endless references to making new XPCOM components in C++, but that's utterly useless to anyone who needs to know how to use the existing components from JavaScript. This is a huge gap, occasionally touched on by trivial examples of creating an instance and calling a m...

How to register an nsIModule DLL on Windows

I've created a Windows library with an implementation of nsIModule (and nsIProtocolHandler) a while ago. I've only recently got round to debugging it some more, but FireFox doesn't run my library any more. I've tried to register my module again, with regxpcom and deleting xpti.dat and compreg.dat, but my contract-id doesn't get listed. I...

jetpack/xpcom async input stream: detect close

I write a small Jetpack extension that starts a server using Cc["@mozilla.org/network/server-socket;1"]. I read from a connected client asynchronously using: conn.istream.asyncWait(conn, 0, 0, null); The documentation says that the callback is invoked when data arrives AND when the stream is closed: https://developer.mozilla.org/en/XPCO...

How to listen to profile-after-change in XPCOM component for FF4

This blog post mentions that XPCOM components will no longer be able to observe 'app-startup' notifications and they will have to listen to 'profile-after-change' notifications now. My changes don't seem to work however; any idea what I did wrong? ...

Advice on implementing my own console as an XPCOM

I want to use my own console for my extension, where I would be printing out various debug info. I thought I would do that by doing window.open("chrome://myextension/content/console.xul".. and then printing into textboxes of that window. Do you already see something wrong here? =) Now I have a small problem, window.open returns immedi...

xpcom/jetpack observe all document loads

I write a Mozilla Jetpack based add-on that has to run whenever a document is loaded. For "toplevel documents" this mostly works using this code (OserverService = require('observer-service')): this.endDocumentLoadCallback = function (subject, data) { console.log('loaded: '+subject.location); try { server....

Using sockets (nsIServerSocket) in XPCOM component (Firefox Extension) (sockets + new window = seg faults)

PLEASE READ THE UPDATE #2 BELOW IF YOU ARE INTERESTED IN THIS PROBLEM ;) Say I put this code into the JS of my extension. var reader = { onInputStreamReady : function(input) { var sin = Cc["@mozilla.org/scriptableinputstream;1"] .createInstance(Ci.nsIScriptableInputStream); sin.init(input); ...

When creating a JS XPCOM Service can classID be random?

When I create a JS XPCOM service the guid that is used for the classID can just be a randomly generated string correct? following directions here? I ask because I'm forking another project and changed this to a another randomly generated value, and I believe I changed the classDescription, and contractID correctly as well, but I'm not h...

Firefox extension: XPCOM component with 3rd party DLLs

Hello everyone, I am trying to create a FF extension which implements XPCOM component. I built my component as a DLL following this nice guide: http://www.iosart.com/firefox/xpcom/ My component uses two external DLLs: lib1.dll and lib2.dll. Known issue here is that FF does not load external DLLs automatically. If I put these libs into W...

using eval.call() in firefox XPCOM component

Hi, I'm making an extension that on load of every page creates an instance of my xpcom component specifically for that page. I do that like this: var appcontent = document.getElementById("appcontent"); // browser if(appcontent) { appcontent.addEventListener("load", onPageLoad, true); } var onPageLoad = function(aEvent) { var do...

how to intercept firefox events in .net?

i'm using watin,to control a firefox browser,but there's no support for events like page load,& progress.. i need a way to expose this events through .net,i tried a bit with xpcom from geckofx but with no vain due to lack of documentation,, thanx in advance ...

Registering XPCOM in firefox. Unknown CID

Hi, I'm having difficulties registering an example XPCOM component into firefox from this example here: http://www.iosart.com/firefox/xpcom/ I'm trying this on Firefox 3.6. After successfully building and transferring the XPT and library into the components folder in firefox, and following what instructions are applicable, I'm unable to ...

Including XPCOM inFirefox extension

I have a very limited experience with Firefox extensions development (read XUL School, written a couple of very simple extensions). I now need some functionality that is not available through Firefox XPCOM objects, namely running an external process and reading its stdout. It seems that this can be done using Protozilla. So my problems ...

How to read from a serial port using xpcom from Firefox?

Hello, I want to use xpcom to connect Mozilla Firefox to a serial port. The final result should be an xpi addon that can be installed on various environments (cross-platform Windows/Linux with Firefox 3.*). Where should I start? I have found an example here: http://forums.mozillazine.org/viewtopic.php?f=19&t=1083965&start=0 , b...

Firefox Plugin Domain Restriction - Similar to IE's SiteLock

Hello everybody, I would like to know if there is any functionality in the Gecko SDK/NPAPI that would allow me to restrict a plugin-usage to restricted domains only. Exactly like SiteLock for IE does with ActiveX components. Any similar implementation in NPAPI, for example? ...

What's a good book/guide on developing COM applications on Visual Studio ?

I am a web developer with some C++ background. I need a relatively straightforward way to understand COM and its capabilities. Ultimately, I should be able to write an ActiveX or XPCOM component that I can interact with from javascript. Thanks. ...

How to sign script or webpage requiring UniversalXPConnect privilege

Hello. I have a website which uses some functionality implemented in the Firefox extension, which I developed. JavaScript script on one of my webpages requires UniversalXPConnect privilege for communicating with XPCOM component implemented in my Firefox extension. By default, when my script tries to enable this privilege for accessing ...

getElementById for XML Documents, Mozilla extensions

Is document.getElementById method supported on DOM parsed from XML strings using the DOMParser method in Mozilla ? I am making a mozilla extension that reads an xmlfile and uses DOM Parser to convert the xml into a DOM element, and tries getting elements by Id. The method getElementsByTagName works but not getElementById. It always retur...

What's the type of this object? And where is it documented?

I'm not finding what's the type of this "xpcomInterface", and there's no documentation of any class with this name. Any idea? This snippet is from Mozilla's website: var next = elements.item(i+1); var xpcomInterface = scroll.boxObject.QueryInterface( Components.interfaces.nsIScrollBoxObject); xpcomInterface.ensureElementIsVisible(eleme...