Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/tests/filterNotifier.js

Issue 5650509725696000: Issue 261 - FilterNotifier doesn`t support listeners removing themselves when triggered (Closed)
Patch Set: Created April 4, 2014, 12:46 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/tests/filterNotifier.js
===================================================================
--- a/chrome/content/tests/filterNotifier.js
+++ b/chrome/content/tests/filterNotifier.js
@@ -52,9 +52,23 @@
compareListeners("removeListener(listener3)", [listener2, listener1]);
FilterNotifier.removeListener(listener1);
compareListeners("removeListener(listener1)", [listener2]);
FilterNotifier.removeListener(listener2);
compareListeners("removeListener(listener2)", []);
});
+
+ test("Removing listeners while being called", function()
+ {
+ let listener1 = function(){
Thomas Greiner 2014/04/07 08:30:49 Nit: Move bracket to new line
+ listeners[0].apply(this, arguments);
+ FilterNotifier.removeListener(listener1);
+ };
+ let listener2 = listeners[1];
+ FilterNotifier.addListener(listener1);
+ FilterNotifier.addListener(listener2);
+
+ compareListeners("Initial call", [listener1, listener2]);
+ compareListeners("Subsequent calls", [listener2]);
+ })
Thomas Greiner 2014/04/07 08:30:49 Nit: Missing semicolon
})();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld