Open
Bug 661043
Opened 14 years ago
Updated 2 years ago
Testing frame work should handle event listener in itself
Categories
(Testing :: Mochitest, defect)
Testing
Mochitest
Tracking
(Not tracked)
NEW
People
(Reporter: hiro, Unassigned)
Details
Attachments
(1 file)
3.44 KB,
patch
|
Details | Diff | Splinter Review |
For example, many tests have codes like this:
window.addEventListener("needThisEvent", function(event) {
window.removeEventListener("needThisEvent", arguments.callee, false);
...
}, false);
But this listener is not removed when the test is timed out.
So we currently have to do something like this:
var listener = function(event) {
..
}
registerCleanupFunction(function() {
window.removeEventListener("needThisEvent", listener, false);
});
window.addEventListener("needThisEvent", listener, false);
But this code is a little bit inconvenient to write, many test codes does actually not use registerCleanupFunction for removal of event listener.
So I'd propose more convenient way and testing frame work does remove event listener even if the test is timed out.
Reporter | ||
Comment 1•14 years ago
|
||
Add registerEventListener and unregisterEventListener.
Updated•14 years ago
|
Group: core-security
Comment 2•14 years ago
|
||
Bug 454717 is related.
IIRC removeEventListener can't throw, so I don't think you need the try/catch.
A unregisterListener(listeningObject) method would allow sharing some code.
Assignee | ||
Updated•7 years ago
|
Component: BrowserTest → Mochitest
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•