enumerate interfaces change needed for pyxpcom



6 years ago
5 months ago


(Reporter: twhitema, Assigned: twhitema)


Firefox Tracking Flags

(Not tracked)



(1 attachment)



6 years ago
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).

Comment 1

6 years ago
This changes a few things:
 1) uses "EnumerateInterfacesWhoseNamesStartWith()" with a 1-char prefix
 2) changes python API to replace "EnumerateInterfaces()" with two new methods:
    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 2

6 years ago
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+

Comment 3

5 months ago
Component is obsolete so resolving bugs as INCOMPLETE[B
Last Resolved: 5 months ago
Resolution: --- → INCOMPLETE


5 months ago
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.