2

Has something changed in Firefox 6 so I can no longer add my nsIProtocolHandler (and nsIChannel) implementation from an add-on just by registering it under a contract like @mozilla.org/network/protocol;1?name=myscheme? I've checked all the interfaces I use if any changed (judging by a new UUID), but I don't get a call to my getFactoryProc I list in NSModule, like I did before. Do I need to add a category (like http-startup or something?) or is something else wrong? (the code that worked in firefox 3.6 is still here I haven't committed the new code yet...)

Update: I've logged this as a bug.

Stijn Sanders
  • 35,982
  • 11
  • 45
  • 67
  • 1
    FF6? I thought 4 was only released this year. Have they got the Chrome disease? – David Heffernan Aug 29 '11 at 22:22
  • I wouldn't really call it a disease, but yes, @David, that was [announced back in February](http://www.electronista.com/articles/11/02/28/mozilla.will.update.firefox.more.frequently/). – Rob Kennedy Aug 29 '11 at 22:33
  • If anyone is still interested, I've released the version that's ready for FF7 yesterday http://sourceforge.net/mailarchive/forum.php?thread_name=CAHYFsWU6e2tKz%2BrJzac5VTtSH%3DZWLq3aRTqzvAFPDxSfTOGUEA%40mail.gmail.com&forum_name=xxm-releases (I've given up in FF6, but am happy next FF versions should get straight-forward to adapt to) Thanks again for all the help I got here – Stijn Sanders Sep 12 '11 at 22:13

1 Answers1

4

Update: Okay, I figured this out. See https://bugzilla.mozilla.org/show_bug.cgi?id=656331. Basically you need to export the right kVersion value in your module or the library will be unloaded immediately after it is loaded (i.e. the behavior you are observing). This behavior is new as of Firefox 5.

If you haven't updated to Firefox 4 yet then you need to change the way that you register your XPCOM component. See https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0. The sections on JS components or binary components are relevant depending on whether your component is implemented in JS or C++.

Matthew Gertner
  • 4,487
  • 2
  • 32
  • 54
  • I have read this page and and a number like it. I've added `category profile-after-change` in my chrome.manifest, but still no change. – Stijn Sanders Aug 30 '11 at 21:41
  • Unfortunately the document I linked to seems to have some broken links at the moment. It sounds to me like your component is not being registered properly. I don't think this has anything to do with adding it to the profile-after-change category. Just to confirm, you are calling `XPCOMUtils.generateNSGetFactory()` to create an `NSGetFactory()` function? You shouldn't be exporting an `NSGetModule()` function as of Gecko 2 (i.e. Firefox 4). – Matthew Gertner Aug 31 '11 at 10:07
  • I'm not using javascript! So I don't have XPCOMUtils. I am exporting an NSModule structure, filled with the required data, especially `mCIDs[0].constructorProc`which I expect to get called when I navigate to a `xxm://` url, and which worked before. – Stijn Sanders Aug 31 '11 at 20:34
  • So does you module registration look like http://mxr.mozilla.org/mozilla-central/source/xpcom/sample/nsSampleModule.cpp ? They completely changed this between Firefox 3.6 and 4.0. – Matthew Gertner Sep 01 '11 at 08:38
  • From Delphi I don't have access to the defined C macro's, but my compiled binary exports the `NSModule` structure with one mCIDs and mContracts entry just like this sample. It worked fine with FF5, it doesn't with FF6, so my guess would be either it's a bug or I'm missing a category? – Stijn Sanders Sep 01 '11 at 15:17
  • Okay, now I follow you. I was thrown off because you mentioned that you repo hasn't been updated since FF 3.6. It's strange that getFactoryProc isn't being called. You might try setting NSPR_LOG_MODULES to all:5 and NSPR_LOG_FILE to some filename in your environment. When you run Firefox, that will create a big log file and you can search for your DLL name. You might get a clue as to what's going wrong. – Matthew Gertner Sep 01 '11 at 16:44
  • Interesting, but nothing much there. There's `Loaded library full-path-to-my-dll (load lib)` and right after `Unloaded library full-path-to-my-dll` – Stijn Sanders Sep 02 '11 at 20:42
  • I started trying to run firefox.exe in a debugger, I thought I got the source (with kVersion=9), but mozilla-central is frozen at FF4, where is the FF6/FF7 source? it it 'releases/mozilla-beta'? (it has kVersion=7 ??!! http://mxr.mozilla.org/mozilla-beta/source/xpcom/components/Module.h ) – Stijn Sanders Sep 05 '11 at 17:11
  • Yep, should be the same as the platform version (e.g. https://hg.mozilla.org/releases/mozilla-aurora/rev/0fad9fa9fa3f) – Matthew Gertner Sep 05 '11 at 17:35
  • I've done the work to install mozilla-build and the windows prerequisites, clone mozilla-beta and build a debug-build. Turns out the source is all ready for 'aurora 7.0', and setting kVersion=7 and install.rdf min/max versions to 7.0.*, it all works! So I give up on FF6, and accept your answer since it pointed me in the good direction and I greatly appreciated your help and input. Thanks – Stijn Sanders Sep 06 '11 at 16:56