Closed Bug 437640 Opened 17 years ago Closed 17 years ago

ability to remove <keyset>s

Categories

(Core :: XUL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: enndeakin, Assigned: enndeakin)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 4 obsolete files)

Attached patch support this (obsolete) — Splinter Review
1. allow keysets to be removed and have their listener removed 2. support a disabled attribute to disable keysets Couldn't think of a better way to retrieve the listener again so I store it as a property of the keyset.
Attachment #324059 - Flags: superreview?(neil)
Attachment #324059 - Flags: review?(neil)
Comment on attachment 324059 [details] [diff] [review] support this For some reason I'm not seeing the event listeners get removed corretly - the keydown listener is OK but the other two aren't.
(In reply to comment #1) > (From update of attachment 324059 [details] [diff] [review]) > For some reason I'm not seeing the event listeners get removed corretly - the > keydown listener is OK but the other two aren't. I don't see this problem. How are you checking this?
(In reply to comment #2) > (In reply to comment #1) > > (From update of attachment 324059 [details] [diff] [review] [details]) > > For some reason I'm not seeing the event listeners get removed corretly - the > > keydown listener is OK but the other two aren't. > I don't see this problem. How are you checking this? 1. Open DOMi and use it to inspect the browser 2. Pick a keyset and remove it from the DOM 3. Switch back to the browser and press a key in that keyset Actual results: assertion "element must be in document"
I also breakpointed in nsEventListenerManager::RemoveEventListener mListeners.RemoveElementAt(i); and it was only hit once.
Hmmm. It seems that the same keyset is being added multiple times, thus there are extra listeners.
Minor change to just not add a listener if one already exists. The bug of adding it multiple times is probably something in the document/overlay loading code and should be a different bug.
Attachment #324059 - Attachment is obsolete: true
Attachment #324289 - Flags: superreview?(neil)
Attachment #324289 - Flags: review?(neil)
Attachment #324059 - Flags: superreview?(neil)
Attachment #324059 - Flags: review?(neil)
Comment on attachment 324289 [details] [diff] [review] don't add a listener if one already exists >+// >+// DetachGlobalKeyHandler >+// >+// Removes a key handler added by DeatchGlobalKeyHandler. >+// Oops ;-)
Attachment #324289 - Flags: superreview?(neil)
Attachment #324289 - Flags: superreview+
Attachment #324289 - Flags: review?(neil)
Attachment #324289 - Flags: review+
(In reply to comment #4) > I also breakpointed in nsEventListenerManager::RemoveEventListener > mListeners.RemoveElementAt(i); and it was only hit once. Smaug pointed out that because the listener implements nsIDOMKeyListener it only gets added/removed once.
Attached patch to be checked in (obsolete) — Splinter Review
minor issues with test: - disable accesskey test, as it seems eventutils.js doesn't handle it - make sure to close the test window when finished
Attachment #324289 - Attachment is obsolete: true
Attachment #325257 - Attachment is obsolete: true
Attachment #325537 - Flags: superreview?(neil)
Attachment #325537 - Flags: review?(neil)
Attachment #325537 - Flags: superreview?(neil)
Attachment #325537 - Flags: superreview+
Attachment #325537 - Flags: review?(neil)
Attachment #325537 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Reopening -- this was backed out, because it caused some tinderboxen to go orange due to leaks during mochitests. Sample tinderbox log, with the offending leaks marked "ERROR FAIL": http://tinderbox.mozilla.org/showlog.cgi?log=Mozilla2/1213882948.1213885920.16571.gz&fulltext=1 The backout was changeset 26033045ba14.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #325537 - Attachment is obsolete: true
Attachment #328966 - Flags: superreview?(neil)
Attachment #328966 - Flags: review?(neil)
Comment on attachment 328966 [details] [diff] [review] fix the leak by readding the NS_RELEASE I had removed >- // Release. Do this so that only the event receiver holds onto the key handler. >+ // the reference added in NS_NewXBLWindowKeyHandler will be taken by the property >+ if (contentNode) >+ return contentNode->SetProperty(nsGkAtoms::listener, handler, >+ nsPropertyTable::SupportsDtorFunc, PR_TRUE); > NS_RELEASE(handler); >+ return NS_OK; >+} You should fix up the comments to make it clearer who owns what depending on whether or not you have a content node.
Attachment #328966 - Flags: superreview?(neil)
Attachment #328966 - Flags: superreview+
Attachment #328966 - Flags: review?(neil)
Attachment #328966 - Flags: review+
Blocks: 441794
Keywords: checkin-needed
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
Status: REOPENED → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → FIXED
Keywords: checkin-needed
Flags: in-testsuite+
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: