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

Unified Diff: third_party/WebKit/LayoutTests/fast/harness/internals-observe-gc.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/harness/internals-observe-gc.html
diff --git a/third_party/WebKit/LayoutTests/fast/harness/internals-observe-gc.html b/third_party/WebKit/LayoutTests/fast/harness/internals-observe-gc.html
index 4fb4c4eb373ad04bb2be8b3427e0458037141958..5521c6c52a20eb103b1166ac53cf64762cd04c3e 100644
--- a/third_party/WebKit/LayoutTests/fast/harness/internals-observe-gc.html
+++ b/third_party/WebKit/LayoutTests/fast/harness/internals-observe-gc.html
@@ -9,12 +9,15 @@ shouldBe('typeof window.internals.observeGC', '"function"',
// "Generic Kid's Movie III": ... where nobody dies.
-var valueA = {};
-// Do not pass the object directly 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.
-observationA = internals.observeGC((() => {return valueA;})());
+// Do initialization work in an inner function to avoid references to
+// objects remaining live on this function's stack frame.
+// (http://crbug.com/595672/).
+var valueA, observationA;
+(function () {
+ valueA = {};
+ observationA = internals.observeGC(valueA);
+})();
+
gc();
shouldBeFalse('observationA.wasCollected');
// value ineligible for GC should not be flagged as collected
@@ -23,13 +26,15 @@ observationA = null;
// "Romeo and GCuliet": Romeo JavaScript finds G.uliet C.apulet and dies.
-var valueB = {};
-// Do not pass the object directly 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.
-observationB = internals.observeGC((() => {return valueB;})());
-valueB = null;
+// Do initialization work in an inner function to avoid references to
+// objects remaining live on this function's stack frame.
+// (http://crbug.com/595672/).
+var observationB;
+(function() {
+ var valueB = {};
+ observationB = internals.observeGC(valueB);
+})();
+
gc();
shouldBeTrue('observationB.wasCollected');
// value eligible for GC should be flagged as collected
@@ -38,13 +43,15 @@ observationB = null;
// "One DOM Tree Hill": A family struggles with the loss of
// innocence. And a DOM node.
-var valueC = document.createElement('div');
-// Do not pass the object directly 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.
-observationC = internals.observeGC((() => {return valueC;})());
-valueC = null;
+// Do initialization work in an inner function to avoid references to
+// objects remaining live on this function's stack frame.
+// (http://crbug.com/595672/).
+var observationC;
+(function() {
+ var valueC = document.createElement('div');
+ observationC = internals.observeGC(valueC);
+})();
+
gc();
shouldBeTrue('observationC.wasCollected');
// DOM node eligible for GC should be flagged as collected
@@ -59,15 +66,16 @@ shouldThrow('internals.observeGC(null)',
// Try to create objects and observers that will die at once
-var valueD = {};
-// Do not pass the object directly 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 observerD = internals.observeGC((() => {return valueD;})());
-valueD.observer = observerD;
-observerD.observed = valueD;
-valueD = observerD = null;
+// 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 valueD = {};
+ var observerD = internals.observeGC(valueD);
+ valueD.observer = observerD;
+ observerD.observed = valueD;
+})();
+
gc();
testPassed('did not crash');

Powered by Google App Engine
This is Rietveld 408576698