Hi there,
I am using GeckoFX Multi 1.9.1.0 v.1 GeckoMulti and implementing the HttpActivityDistributor and HttpActivityObserver by using the following code:
public void InitObserver()
{
nsIHttpActivityDistributor activityDistributor = Xpcom.GetService<nsIHttpActivityDistributor>("@mozilla.org/network/http-activity-distributor;1");
activityDistributor = Xpcom.QueryInterface<nsIHttpActivityDistributor>(activityDistributor);
GeckoHttpActivityObserver httpActivityObserver = new GeckoHttpActivityObserver();
activityDistributor.addObserver(httpActivityObserver);
}
This is the httpAcitvityDistributor and httpActivityObserver interface:
[Guid("7C512CB8-582A-4625-B5B6-8639755271B5"), ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface nsIHttpActivityDistributor : nsIHttpActivityObserver
{
void addObserver(nsIHttpActivityObserver aObserver);
void removeObserver(nsIHttpActivityObserver aObserver);
}
[Guid("412880C8-6C36-48d8-BF8F-84F91F892503"), ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface nsIHttpActivityObserver
{
void observeActivity(nsISupports aHttpChannel,
UInt32 aActivityType,
UInt32 aActivitySubtype,
UInt64 aTimestamp,
UInt64 aExtraSizeData,
nsACString aExtraStringData);
bool get_isActive();
}
And this is the httpActivityObserver implementation
public class GeckoHttpActivityObserver : nsIHttpActivityObserver
{
public GeckoHttpActivityObserver() { }
public void observeActivity(Skybound.Gecko.nsISupports aHttpChannel, UInt32 aActivityType, UInt32 aActivitySubtype, UInt64 aTimestamp, UInt64 aExtraSizeData, nsACString aExtraStringData)
{
ulong bytesSent;
ulong bytesReceived;
if (aActivityType == nsIHttpActivityObserverConstants.ACTIVITY_TYPE_SOCKET_TRANSPORT && aActivitySubtype == nsISocketTransportConstants.STATUS_SENDING_TO)
bytesSent = aExtraSizeData;
if (aActivityType == nsIHttpActivityObserverConstants.ACTIVITY_TYPE_HTTP_TRANSACTION && aActivitySubtype == nsIHttpActivityObserverConstants.ACTIVITY_SUBTYPE_RESPONSE_COMPLETE)
bytesReceived = aExtraSizeData;
}
public bool get_isActive()
{
bool value = false;
return value;
}
}
Now on, I am getting a stack overflow exception when try to execute the activityDistributor.addObserver(httpActivityObserver) described at InitObserver() method.
Did I miss something?
Thank you so much in advance for your help and support
Regards