Create second instance of EventQueue sevice, no error

RESOLVED INVALID

Status

()

Core
XPCOM
RESOLVED INVALID
12 years ago
12 years ago

People

(Reporter: Jon Smirl, Unassigned)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

12 years ago
I accidentally created a second instance of the EventQueue sevice and received no error (rv == 0). Shouldn't this cause an error? It resulted in a messed up event pump and it was hard to debug. The symptom was that proxy objects failed to work.

Wrong:
   rv = compMan->CreateInstanceByContractID(NS_EVENTQUEUESERVICE_CONTRACTID,
                                           nsnull,
                                           NS_GET_IID(nsIEventQueueService),
                                           getter_AddRefs(eqs));    
I meant to do this:
    rv = servMan->GetServiceByContractID(NS_EVENTQUEUESERVICE_CONTRACTID,
                                             NS_GET_IID(nsIEventQueueService),
                                             getter_AddRefs(eqs));

Comment 1

12 years ago
Yes, it is a bug.  However, note that my patch for bug 326273 eliminates nsEventQueueService.
Depends on: 326273

Comment 2

12 years ago
Well, it shouldn't be considered a bug in the EQS: this code is buggy since you should be using getservice, not createinstance. EQS doesn't keep a static "gInstance" or anything like that.
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → INVALID
(Reporter)

Comment 3

12 years ago
There is clearly a bug here, I passed in some invalid parameters to an API and the API misbehaved instead of returning an error. This should be resolved as WONTFIX instead of INVALID.

I mistakenly translated this from some existing Javascript. Can an arbitrary web page trigger this? If you trigger it the browser stops working.

Comment 4

12 years ago
> I mistakenly translated this from some existing Javascript. Can an arbitrary
> web page trigger this? If you trigger it the browser stops working.

No, the API you are using requires permissions that a website does not have.
You need to log in before you can comment on or make changes to this bug.