Index: third_party/WebKit/LayoutTests/fast/dom/MutationObserver/weak-callback-gc-crash.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/MutationObserver/weak-callback-gc-crash.html b/third_party/WebKit/LayoutTests/fast/dom/MutationObserver/weak-callback-gc-crash.html |
index 4cb6819f14bb9594483aaa5efd7575a9f78e152a..fb8d2b3d607feb982517014c9986a4d1d65ec744 100644 |
--- a/third_party/WebKit/LayoutTests/fast/dom/MutationObserver/weak-callback-gc-crash.html |
+++ b/third_party/WebKit/LayoutTests/fast/dom/MutationObserver/weak-callback-gc-crash.html |
@@ -5,11 +5,20 @@ |
if (window.testRunner) { |
testRunner.waitUntilDone(); |
testRunner.dumpAsText(); |
+} |
+var observer, div; |
+ |
+function initializeObserver() { |
+ observer = new MutationObserver( |
+ function() {console.log('Should not appear')}); |
+ div = document.createElement('div'); |
+ observer.observe(div, {attributes: true}); |
+ div.id = 'foo'; |
} |
-var observer = new MutationObserver(function() {console.log('Should not appear')}); |
-var div = document.createElement('div'); |
-observer.observe(div, {attributes: true}); |
-div.id = 'foo'; |
+ |
+// Do initialization work in an inner function to avoid references to objects |
+// remaining live on this function's stack frame (http://crbug.com/595672/). |
+initializeObserver(); |
div = null; |
observer = null; |
gc(); |