If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

in pyXPCOM a failing QueryInterface for a client invalidates all names used in the non supported interface



Other Applications
6 years ago
4 years ago


(Reporter: Daniel Friederich, Unassigned)


1.9.2 Branch

Firefox Tracking Flags

(Not tracked)



(1 attachment)



6 years ago
Created attachment 590086 [details]
xpcom\client\__init__.py which only stores the names once QI succeeded.

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7

Steps to reproduce:

in pyXPCOM, with an native object implementing some interface (e.g. nsIArray).
nsIArray contains a length length attribute, reading it from python works fine.
When QueryInterface for another interface which is not supported by the object, but which does also provide a length attribute.
After this, reading the length attribute fails. Python attempts to use the non supported interface when accessing the field.
In my original case, interfaces did form a hierarchy.

scriptable, uuid(bc3173bd-aa46-46a0-9d25-d9867a9659b6)]
interface ISample1 : nsISupports
  readonly attribute long length;
scriptable, uuid(2AF664C0-3CBE-41da-B240-0D43F1ACE86E)]
interface ISample2 : ISample1 
  readonly attribute long somethingElse;
A native object only implements ISample1. Accessing ISample1.length works fine from python until a QI for ISample2 is attempted on the object. From then on pyxpcom QI's for ISample2 to access length, and that fails.

Actual results:

a accessible field suddenly becomes inaccessible after a QueryInterface.

Expected results:

QI should not invalidate accesses.

Comment 1

4 years ago
Sorry about missing this bug when I fixed things in https://hg.mozilla.org/pyxpcom/rev/3be9a7c623ce - we now have a test to hopefully avoid this in the future.\

I should have searched for existing bugs harder; didn't see it when I went for a fix :(
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.