Closed Bug 879951 Opened 12 years ago Closed 6 years ago

enumerate interfaces change needed for pyxpcom

Categories

(Other Applications Graveyard :: PyXPCOM, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: twhitema, Assigned: twhitema)

Details

Attachments

(1 file)

The "nsIInterfaceInfoManager.EnumerateInterfacesWhoseNamesStartWith()" method requires a prefix string of at least one character, otherwise it does not match any interfaces. Will need to call EnumerateInterfacesWhoseNamesStartWith() for each variation of alphabet character (i.e. A-Za-z).
This changes a few things: 1) uses "EnumerateInterfacesWhoseNamesStartWith()" with a 1-char prefix 2) changes python API to replace "EnumerateInterfaces()" with two new methods: "GetScriptableInterfaces()" "GetFunctionInterfaces()" both of which return a dictionary (name > iid), instead of a full nsIInterfaceInfo 3) drops the Py_(BEGIN|END)_ALLOW_THREADS around calls to EnumerateInterfacesWhoseNamesStartWith() - as I don't think it's really necessary and it will just end up slowing things down
Attachment #758766 - Flags: review?(marky)
Comment on attachment 758766 [details] [diff] [review] Update pyxpcom's interface manager calls (from review of attachment 758766 [details] [diff] [review]) >diff --git a/xpcom/components.py b/xpcom/components.py >+ name_to_iid_dict = interfaceInfoManager.GetScriptableInterfaces() Hmm, I thought we cheated somewhere and used a non-[scriptable] interface from python. I guess we'll have to see if anything breaks :D >diff --git a/xpcom/src/PyIInterfaceInfoManager.cpp b/xpcom/src/PyIInterfaceInfoManager.cpp >+ // Add all returned interfaces to the python dict. >+ for ( ; interfaces_enum->IsDone() == static_cast<nsresult>(NS_ENUMERATOR_FALSE); interfaces_enum->Next()) { This line's kinda long. (I'd probably just use a do/while loop instead...) >+ nsCOMPtr<nsIInterfaceInfo> iinfo(do_QueryInterface(entry)); >+ if (fn_scripables_only && (NS_FAILED(iinfo->IsFunction(&isFunction)) || !isFunction)) { Should probably just split this into multiple lines for clarity ----- Given discussions with tbsaunde on IRC: I'd see if we can just static_cast the nsIInterfaceInfoManager to XPTInterfaceInfoManager and use GetScriptableInterfaces... It's pretty horrible as things go, but it's not like it will make much of a difference in terms of mismatched gecko versions...
Attachment #758766 - Flags: review?(marky) → review+
Component is obsolete so resolving bugs as INCOMPLETE[B
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INCOMPLETE
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: