Closed
Bug 583923
Opened 14 years ago
Closed 14 years ago
IndexedDB: Don't fire events if there are no listeners for it
Categories
(Core :: Storage: IndexedDB, defect)
Core
Storage: IndexedDB
Tracking
()
RESOLVED
FIXED
People
(Reporter: bent.mozilla, Assigned: bent.mozilla)
Details
Attachments
(1 file)
1.08 KB,
patch
|
sicking
:
review+
|
Details | Diff | Splinter Review |
We're wasting time firing events if no listener is attached. See patch.
Attachment #462270 -
Flags: review?(jonas)
Attachment #462270 -
Flags: review?(jonas) → review+
Comment 1•14 years ago
|
||
Comment on attachment 462270 [details] [diff] [review] Patch >diff --git a/dom/indexedDB/AsyncConnectionHelper.cpp b/dom/indexedDB/AsyncConnectionHelper.cpp >--- a/dom/indexedDB/AsyncConnectionHelper.cpp >+++ b/dom/indexedDB/AsyncConnectionHelper.cpp >@@ -308,16 +308,27 @@ AsyncConnectionHelper::OnSuccess(nsIDOME > return nsIIDBDatabaseException::UNKNOWN_ERR; > } > > PRUint16 result = GetSuccessResult(variant); > if (result != OK) { > 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))) { This should be if (!manager || !manager->HasListenersFor(NS_LITERAL_STRING(SUCCESS_EVT_STR)) { ... } Because if you don't have any listeners, you may not have the manager at all.
Assignee | ||
Comment 2•14 years ago
|
||
Ah! Very nice. I'll change to that, thanks.
Assignee | ||
Comment 3•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/08084a1de4a1
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Component: DOM → DOM: IndexedDB
Version: Trunk → unspecified
You need to log in
before you can comment on or make changes to this bug.
Description
•