Closed Bug 296561 Opened 19 years ago Closed 19 years ago

Make it possible to access nsIXULRuntime during xpcom-startup event

Categories

(Toolkit Graveyard :: XULRunner, enhancement, P2)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.8beta4

People

(Reporter: darin.moz, Assigned: benjamin)

References

Details

(Whiteboard: has patch with reviews)

Attachments

(1 file, 2 obsolete files)

Make it possible to access nsIXULRuntime during xpcom-startup event Right now, one cannot access nsIXULRuntime or nsIXULAppInfo during the xpcom-startup event, which fires before NS_InitXPCOM2 returns. Since these interfaces expose information about the runtime, we probably want to ensure that they are available sooner rather than later. I realize that people could defer to the app-startup event, but a lot of documentation out there mentions xpcom-startup. We could probably solve this bug easily by leveraging the static component loader.
Assignee: nobody → benjamin
Attached patch NS_InitXPCOM3, rev. 1 (obsolete) — Splinter Review
This patch works on windows with dynamic and static builds of ffox/tbird and with dynamic/static/libxul builds of xulrunner. It also fixes the embedding clients built on Windows. It does not fix seamonkey static build, and I will attach a separate patch for the camino static build.
Attachment #186347 - Flags: first-review?(shaver)
Comment on attachment 186347 [details] [diff] [review] NS_InitXPCOM3, rev. 1 Dougt, I've burndened darin with a lot of reviews recently, can you take on superreviewing this?
Attachment #186347 - Flags: second-review?(dougt)
Please specify whether static components specified via this interface are loaded before or after dynamic components. I recall observing that static components are currently registered after dynamic components making it difficult to override a static component. I think it should be the other way around.
I would be happy to switch the native and static component loader (nsComponentManagerUtils.cpp#3193 and #3197), but I'm leery about frozen-documenting that before we come up with a better XPCOM override mechanism in general.
Hrm... I think we should specify the order since it would be a natural question of anyone calling NS_InitXPCOM3. We could also specify that it is not specified. Either way, we need to say something about it.
I'm happy enough to document that the static components come first, as long as we don't specify the relative ordering of native/JS/python/whatever components.
That sounds fine to me.
Attached patch NS_InitXPCOM3, rev. 2 (obsolete) — Splinter Review
This changes the autoreg order to static -> dynamic -> others, but only documents static -> everything else as I plan to change the "everything else" situation a little bit in the 1.9 timeframe (nsIComponentLoader -> nsIModuleLoader, but not filed yet). It also makes sure that the static components are registered in the order they appear in the NS_InitXPCOM3 list. This means that static camino and other embedders can reliably override core gecko components.
Attachment #186347 - Attachment is obsolete: true
Attachment #186396 - Flags: second-review?(dougt)
Attachment #186396 - Flags: first-review?(shaver)
Comment on attachment 186396 [details] [diff] [review] NS_InitXPCOM3, rev. 2 Alot cooler then the _BUILD_STATIC_BIN #define we were using! A few general q's: Why are you removing the ablity to disable the static build? Why are you moving the nsGetModuleProc into nsXPCOM.h. It is already defined in nsModule.h:53. Can you avoid NS_InitXPCOM3 by adding a function that can set the nsStaticModuleInfo data before init is called? Could you fix up the spelling error(s) "initialisation" in nsXPCOM.h, plz.
> Why are you removing the ablity to disable the static build? Because the static loader is now part of the frozen XPCOM API, and I haven't found any consumers who really need to disable it (minimo uses it, and that's the only real consumer I'm worried about WRT codesize). > Why are you moving the nsGetModuleProc into nsXPCOM.h. It is already defined > in nsModule.h:53. nsModule.h is not a frozen header, at least as far as I can tell, and I need the function prototype declaration for the structure. > Can you avoid NS_InitXPCOM3 by adding a function that can set the > nsStaticModuleInfo data before init is called? I could, but I don't think it's a good idea. I don't want multiple callers to start overriding static component lists or other badness. > Could you fix up the spelling error(s) "initialisation" in nsXPCOM.h, plz. Damn yankees ;-)
Comment on attachment 186396 [details] [diff] [review] NS_InitXPCOM3, rev. 2 + * Initialises XPCOM with static components. You must call this method + * before proceeding to use xpcom. I have the choice between NS_InitXPCOM2 and 3, right? maybe the comment should make that a bit more clear...
biesi: suggest wording?
Attachment #186347 - Flags: second-review?(dougt)
Attachment #186347 - Flags: first-review?(shaver)
"One of the NS_InitXPCOM methods must be called before proceeding to use XPCOM."
Comment on attachment 186396 [details] [diff] [review] NS_InitXPCOM3, rev. 2 I'll try to get to this review this week; it's a big'un.
Comment on attachment 186396 [details] [diff] [review] NS_InitXPCOM3, rev. 2 r=shaver. It'd be nice if there was a macro outside of nsIGenericFactory.h that let people get the right calling convention on their NSGetModule impl, but it's no big deal.
Attachment #186396 - Flags: first-review?(shaver) → first-review+
dougt, ping? An important Firefox extension author wants this badly.
Flags: blocking1.8b4?
Attachment #186396 - Flags: second-review?(dougt) → second-review+
Comment on attachment 186396 [details] [diff] [review] NS_InitXPCOM3, rev. 2 >Index: xpcom/build/nsXPCOM.h >+typedef nsresult (PR_CALLBACK *nsGetModuleProc)(nsIComponentManager *aCompMgr, >+ nsIFile* location, >+ nsIModule** return_cobj); Should this use NS_CALLBACK instead? I'm not sure. We don't seem to be very consistent in our use of cdecl vs stdcall.
Attachment #186396 - Flags: second-review+ → second-review?(dougt)
NSGetModule is very unfortunately *not* stdcall on windows, it is cdecl.
Comment on attachment 186396 [details] [diff] [review] NS_InitXPCOM3, rev. 2 I'm going to re-mark dougt's review based on the fact that we can't use NS_CALLBACK because it would change our frozen-by-real-life cdecl NSGetModule signature, and requesting approval. This is unlikely to break the toolkit apps or camino, which have been tested.
Attachment #186396 - Flags: second-review?(dougt)
Attachment #186396 - Flags: second-review+
Attachment #186396 - Flags: approval1.8b4?
Flags: blocking1.8b4? → blocking1.8b4+
Priority: -- → P2
Target Milestone: --- → mozilla1.8beta4
Whiteboard: has patch with reviews
Attachment #186396 - Flags: approval1.8b4? → approval1.8b4+
This is the final patch committed, there were some additional changes needed in embedding/browser/gtk and some makefile-fu to get those working properly.
Attachment #186396 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Looks like this slowed btek Tp by about 10ms.
Blocks: 310105
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: