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: third_party/WebKit/LayoutTests/fast/dom/NodeIterator/NodeIterator-dont-overcollect.html

Issue 1999013002: Modify some gc related layout tests to work with Ignition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed more comments. Created 4 years, 7 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
Index: third_party/WebKit/LayoutTests/fast/dom/NodeIterator/NodeIterator-dont-overcollect.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/NodeIterator/NodeIterator-dont-overcollect.html b/third_party/WebKit/LayoutTests/fast/dom/NodeIterator/NodeIterator-dont-overcollect.html
index 7b5d83fc727ccdb3a207ec910907da2711614c69..744903abd451142fb6dde56c36d12b16f445083c 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/NodeIterator/NodeIterator-dont-overcollect.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/NodeIterator/NodeIterator-dont-overcollect.html
@@ -4,21 +4,24 @@
<script src="../../../resources/js-test.js"></script>
<script>
var callbackWasTriggered = false;
+ var nodeIterator, callbackObservation, nodeFilterObservation,
+ nodeIteratorObservation;
- var callback = function(node) {
+ // Do initialization work in an inner function to avoid references to
+ // objects remaining live on this function's stack frame.
+ // (http://crbug.com/595672/).
+ (function() {
+ var callback = function(node) {
callbackWasTriggered = true;
return NodeFilter.FILTER_ACCEPT;
- };
- var nodeIterator = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, callback, false);
+ };
- // Do not pass the object as a parameter to observeGC function. This may
- // remain live on this function's stack preventing GC from collecting
- // it. Accessing the object inside an inner function will prevent any
- // unneeded references on this function's stack.
- var callbackObservation = internals.observeGC((() => {return callback;})());
- callback = null;
- var nodeFilterObservation = internals.observeGC((() => {return nodeIterator.filter;})());
- var nodeIteratorObservation = internals.observeGC((() => {return nodeIterator;})());
+ nodeIterator = document.createNodeIterator(document,
+ NodeFilter.SHOW_ELEMENT, callback, false);
+ callbackObservation = internals.observeGC(callback);
+ nodeFilterObservation = internals.observeGC(nodeIterator.filter);
+ nodeIteratorObservation = internals.observeGC(nodeIterator);
+ })()
gc();
shouldBeFalse('nodeFilterObservation.wasCollected');

Powered by Google App Engine
This is Rietveld 408576698