Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: tests/html/native_gc_test.dart

Issue 10689120: Add test for garbage collected window event listeners issue. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
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: tests/html/native_gc_test.dart
diff --git a/tests/html/native_gc_test.dart b/tests/html/native_gc_test.dart
index 1882c6e2e00f9de246ca696f61bce7b01f0bd4a0..c8c9c934effd3dd946010755297f6d7ee2362c0f 100644
--- a/tests/html/native_gc_test.dart
+++ b/tests/html/native_gc_test.dart
@@ -30,4 +30,24 @@ main() {
final event = new Event('test');
div.on['test'].dispatch(event);
});
+
+ test('WindowEventListener', () {
+ Element testDiv = new DivElement();
+ testDiv.id = '#TestDiv';
+ document.body.nodes.add(testDiv);
+ window.on.message.add((e) => testDiv.click());
+
+ for (int i = 0; i < 100; ++i) {
+ triggerMajorGC();
+ }
+
+ testDiv.on.click.add(expectAsync1((e) {}));
+ window.postMessage('test', '*');
+ });
+}
+
+void triggerMajorGC() {
+ List list = new List(1000000);
Anton Muhin 2012/07/06 16:17:01 somewhat fragile, but, I don't know better approac
+ Element div = new DivElement();
+ div.on.click.add((e) => print(list[0]));
Anton Muhin 2012/07/06 16:17:01 why?
podivilov 2012/07/10 08:33:52 why not? :)
Anton Muhin 2012/07/10 08:41:38 It's not obvious why code which promises to trigge
podivilov 2012/07/10 11:03:47 Is it possible that void foo() { List list = new L
Anton Muhin 2012/07/10 11:36:16 That's a good point, but in this case you'd better
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698