Bug 1358135 part 1 - Fix some browser tests to trigger a shrinking GC instead of a normal GC. r=jonco
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 03 Jun 2017 17:29:17 +0200
changeset 410320 908a9b9835446178c801ea908c8207d58bf8dce4
parent 410300 90df8b3f52d60d79b2730153f97300039019b694
child 410321 f8b1a6312c02403f84f3882230d30ab013a8eb80
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1358135
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1358135 part 1 - Fix some browser tests to trigger a shrinking GC instead of a normal GC. r=jonco
accessible/tests/browser/head.js
netwerk/test/unit/test_alt-data_overwrite.js
testing/specialpowers/content/specialpowersAPI.js
--- a/accessible/tests/browser/head.js
+++ b/accessible/tests/browser/head.js
@@ -128,14 +128,14 @@ function waitForEvent(eventType, expecte
   });
 }
 
 /**
  * Force garbage collection.
  */
 function forceGC() {
   SpecialPowers.gc();
-  SpecialPowers.forceGC();
+  SpecialPowers.forceShrinkingGC();
   SpecialPowers.forceCC();
   SpecialPowers.gc();
-  SpecialPowers.forceGC();
+  SpecialPowers.forceShrinkingGC();
   SpecialPowers.forceCC();
 }
--- a/netwerk/test/unit/test_alt-data_overwrite.js
+++ b/netwerk/test/unit/test_alt-data_overwrite.js
@@ -85,46 +85,46 @@ function readServerContent(request, buff
 
     do_execute_soon(flushAndOpenAltChannel);
   });
 }
 
 function flushAndOpenAltChannel()
 {
   // We need to do a GC pass to ensure the cache entry has been freed.
-  gc();
+  Cu.forceShrinkingGC();
   Services.cache2.QueryInterface(Ci.nsICacheTesting).flush(cacheFlushObserver);
 }
 
 // needs to be rooted
 let cacheFlushObserver = { observe: function() {
   if (!cacheFlushObserver) {
     do_print("ignoring cacheFlushObserver\n");
     return;
   }
   cacheFlushObserver = null;
-  gc();
+  Cu.forceShrinkingGC();
   make_and_open_channel(URL, altContentType, readAltContent);
 }};
 
 function readAltContent(request, buffer, closure, fromCache)
 {
-  gc();
+  Cu.forceShrinkingGC();
   let cc = request.QueryInterface(Ci.nsICacheInfoChannel);
 
   do_check_eq(fromCache || servedNotModified, true);
   do_check_eq(cc.alternativeDataType, altContentType);
   do_check_eq(buffer, altContent);
 
   make_and_open_channel(URL, "dummy/null", readServerContent2);
 }
 
 function readServerContent2(request, buffer, closure, fromCache)
 {
-  gc();
+  Cu.forceShrinkingGC();
   let cc = request.QueryInterface(Ci.nsICacheInfoChannel);
 
   do_check_eq(fromCache || servedNotModified, true);
   do_check_eq(buffer, responseContent);
   do_check_eq(cc.alternativeDataType, "");
 
   do_execute_soon(() => {
     let os = cc.openAlternativeOutputStream(altContentType);
@@ -133,67 +133,67 @@ function readServerContent2(request, buf
 
     do_execute_soon(flushAndOpenAltChannel2);
   });
 }
 
 function flushAndOpenAltChannel2()
 {
   // We need to do a GC pass to ensure the cache entry has been freed.
-  gc();
+  Cu.forceShrinkingGC();
   Services.cache2.QueryInterface(Ci.nsICacheTesting).flush(cacheFlushObserver2);
 }
 
 // needs to be rooted
 let cacheFlushObserver2 = { observe: function() {
   if (!cacheFlushObserver2) {
     do_print("ignoring cacheFlushObserver2\n");
     return;
   }
   cacheFlushObserver2 = null;
-  gc();
+  Cu.forceShrinkingGC();
   make_and_open_channel(URL, altContentType, readAltContent2);
 }};
 
 function readAltContent2(request, buffer, closure, fromCache)
 {
-  gc();
+  Cu.forceShrinkingGC();
   let cc = request.QueryInterface(Ci.nsICacheInfoChannel);
 
   do_check_eq(servedNotModified || fromCache, true);
   do_check_eq(cc.alternativeDataType, altContentType);
   do_check_eq(buffer, altContent);
 
   do_execute_soon(() => {
-    gc();
+    Cu.forceShrinkingGC();
     do_print("writing other content\n");
     let os = cc.openAlternativeOutputStream(altContentType2);
     os.write(altContent2, altContent2.length);
     os.close();
 
     do_execute_soon(flushAndOpenAltChannel3);
   });
 }
 
 function flushAndOpenAltChannel3()
 {
   // We need to do a GC pass to ensure the cache entry has been freed.
-  gc();
+  Cu.forceShrinkingGC();
   Services.cache2.QueryInterface(Ci.nsICacheTesting).flush(cacheFlushObserver3);
 }
 
 // needs to be rooted
 let cacheFlushObserver3 = { observe: function() {
   if (!cacheFlushObserver3) {
     do_print("ignoring cacheFlushObserver3\n");
     return;
   }
 
   cacheFlushObserver3 = null;
-  gc();
+  Cu.forceShrinkingGC();
   make_and_open_channel(URL, altContentType2, readAltContent3);
 }};
 
 
 function readAltContent3(request, buffer, closure, fromCache)
 {
   let cc = request.QueryInterface(Ci.nsICacheInfoChannel);
 
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -1482,16 +1482,20 @@ SpecialPowersAPI.prototype = {
   gc() {
     this.DOMWindowUtils.garbageCollect();
   },
 
   forceGC() {
     Cu.forceGC();
   },
 
+  forceShrinkingGC() {
+    Cu.forceShrinkingGC();
+  },
+
   forceCC() {
     Cu.forceCC();
   },
 
   finishCC() {
     Cu.finishCC();
   },