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

Unified Diff: tests/html/mutationobserver_test.dart

Issue 102373007: Fix mutation observer test bug dartbug.com/15497 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | « tests/html/html.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/mutationobserver_test.dart
diff --git a/tests/html/mutationobserver_test.dart b/tests/html/mutationobserver_test.dart
index 0af69c50bb8f882a9c856eb3891ccccb3fea8204..a77a26b250b3f5ef669a005017b7b4a2da7c4bb4 100644
--- a/tests/html/mutationobserver_test.dart
+++ b/tests/html/mutationobserver_test.dart
@@ -7,6 +7,16 @@ import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_individual_config.dart';
import 'dart:html';
+// MutationObservers sometimes do not fire if the node being observed is GCed
+// so we keep around references to all nodes we have created mutation
+// observers for. As a side note, this behavior only manifests in content_shell
+// and not chrome and the behavior goes away in content_shell if the flag
+// -js-flags="--gc_global" is passed to content_shell. Note: the gc behavior
+// only has been detected when running dart2js but could equally reasonably
+// impact the dartvm as well unless it is specified that mutation events must
+// be delivered even if the object the events are for has already been GCed.
+var keepAlive = [];
+
/**
* Test suite for Mutation Observers. This is just a small set of sanity
* checks, not a complete test suite.
@@ -61,6 +71,7 @@ main() {
test('direct-parallel options-named', () {
expect(() {
var container = new DivElement();
+ keepAlive.add(container);
var div1 = new DivElement();
var div2 = new DivElement();
var mutationObserver = new MutationObserver(
@@ -75,6 +86,7 @@ main() {
test('direct-nested options-named', () {
expect(() {
var container = new DivElement();
+ keepAlive.add(container);
var div1 = new DivElement();
var div2 = new DivElement();
var mutationObserver =
@@ -89,6 +101,7 @@ main() {
test('subtree options-named', () {
expect(() {
var container = new DivElement();
+ keepAlive.add(container);
var div1 = new DivElement();
var div2 = new DivElement();
var mutationObserver = new MutationObserver(
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698