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

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: Addressed 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..e2a257e09554ec79cb55462941050cb274135c30 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,16 @@ 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 initializeA() {
+ valueA = {};
+ observationA = internals.observeGC(valueA);
+}
+
+initializeA();
gc();
shouldBeFalse('observationA.wasCollected');
// value ineligible for GC should not be flagged as collected
@@ -23,13 +27,17 @@ 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 valueB, observationB;
+function initializeB() {
+ valueB = {};
+ observationB = internals.observeGC(valueB);
+ valueB = null;
+}
+
+initializeB();
gc();
shouldBeTrue('observationB.wasCollected');
// value eligible for GC should be flagged as collected
@@ -38,13 +46,17 @@ 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 valueC, observationC;
+function initializeC() {
+ valueC = document.createElement('div');
+ observationC = internals.observeGC(valueC);
+ valueC = null;
+}
+
+initializeC();
gc();
shouldBeTrue('observationC.wasCollected');
// DOM node eligible for GC should be flagged as collected
@@ -59,15 +71,20 @@ 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/).
+var valueD;
+var observerD;
+function initializeD() {
+ valueD = {};
+ observerD = internals.observeGC(valueD);
+ valueD.observer = observerD;
+ observerD.observed = valueD;
+ valueD = observerD = null;
+}
+
+initializeD();
gc();
testPassed('did not crash');

Powered by Google App Engine
This is Rietveld 408576698