Closed Bug 328804 Opened 18 years ago Closed 18 years ago

Create second instance of EventQueue sevice, no error

Categories

(Core :: XPCOM, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: jonsmirl, Unassigned)

References

Details

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));
Yes, it is a bug.  However, note that my patch for bug 326273 eliminates nsEventQueueService.
Depends on: nsIThreadManager
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
Closed: 18 years ago
Resolution: --- → INVALID
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.
> 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.