mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-09 04:25:38 +00:00
Bug 583923 - 'IndexedDB: Don't fire events if there are no listeners for it'. r=sicking.
This commit is contained in:
parent
20fdbdcaa8
commit
e5a07dae46
@ -313,6 +313,17 @@ AsyncConnectionHelper::OnSuccess(nsIDOMEventTarget* aTarget)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check to make sure we have a listener here before actually firing.
|
||||
nsCOMPtr<nsPIDOMEventTarget> target(do_QueryInterface(aTarget));
|
||||
if (target) {
|
||||
nsIEventListenerManager* manager = target->GetListenerManager(PR_FALSE);
|
||||
if (!manager ||
|
||||
!manager->HasListenersFor(NS_LITERAL_STRING(SUCCESS_EVT_STR))) {
|
||||
// No listeners here, skip creating and dispatching the event.
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(variant->SetWritable(PR_FALSE))) {
|
||||
NS_ERROR("Failed to make variant readonly!");
|
||||
return nsIIDBDatabaseException::UNKNOWN_ERR;
|
||||
|
Loading…
x
Reference in New Issue
Block a user