Bug 671976: Add SpecialPowers.gc() calls so bug 671976 assertions show up in correct tests, and correctly annotate assertions.
authorL. David Baron <dbaron@dbaron.org>
Thu, 28 Feb 2013 23:46:54 -0800
changeset 123455 c4bed36b752aa4feae5f13236ae4a55426554f58
parent 123454 777d41b883a92b04b5318fa6141f71b68e7d6f6b
child 123456 109ab43e98b5f5167807cb7f13d972d91d298251
push id23850
push userdbaron@mozilla.com
push dateFri, 01 Mar 2013 07:47:04 +0000
treeherdermozilla-inbound@c4bed36b752a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs671976
milestone22.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 671976: Add SpecialPowers.gc() calls so bug 671976 assertions show up in correct tests, and correctly annotate assertions.
layout/base/tests/chrome/printpreview_bug396024_helper.xul
layout/base/tests/chrome/printpreview_bug482976_helper.xul
layout/base/tests/chrome/printpreview_helper.xul
layout/base/tests/chrome/test_printpreview.xul
layout/base/tests/chrome/test_printpreview_bug396024.xul
layout/base/tests/chrome/test_printpreview_bug482976.xul
layout/base/tests/chrome/test_transformed_scrolling_repaints.html
layout/base/tests/chrome/test_transformed_scrolling_repaints_3.html
layout/forms/test/test_bug536567_perwindowpb.html
layout/forms/test/test_bug665540.html
layout/generic/test/test_bug469613.xul
layout/generic/test/test_bug469774.xul
layout/generic/test/test_bug508115.xul
layout/generic/test/test_bug514732-2.xul
layout/generic/test/test_bug632379.xul
layout/generic/test/test_selection_preventDefault.html
layout/generic/test/test_selection_underline.html
--- a/layout/base/tests/chrome/printpreview_bug396024_helper.xul
+++ b/layout/base/tests/chrome/printpreview_bug396024_helper.xul
@@ -9,17 +9,17 @@ https://bugzilla.mozilla.org/show_bug.cg
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 <iframe id="i" src="about:blank" type="content"></iframe>
 <iframe src="about:blank" type="content"></iframe>
 <script type="application/javascript">
 <![CDATA[
 var is = window.opener.wrappedJSObject.is;
 var ok = window.opener.wrappedJSObject.ok;
 var todo = window.opener.wrappedJSObject.todo;
-var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
+var parentFinish = window.opener.wrappedJSObject.parentFinish;
 var gWbp;
 function printpreview() {
   gWbp = window.frames[1].QueryInterface(Components.interfaces.nsIInterfaceRequestor)
              .getInterface(Components.interfaces.nsIWebBrowserPrint);
   var listener = {
     onLocationChange: function(webProgress, request, location, flags) { },
     onProgressChange: function(webProgress, request, curSelfProgress, 
                                maxSelfProgress, curTotalProgress,
@@ -44,17 +44,17 @@ function printpreview() {
 }
 
 function exitprintpreview() {
   window.frames[1].QueryInterface(Components.interfaces.nsIInterfaceRequestor)
    .getInterface(Components.interfaces.nsIWebBrowserPrint).exitPrintPreview(); 
 }
 
 function finish() {
-  SimpleTest.finish();
+  parentFinish();
   window.close();
 }
 
 function run()
 {
 /** Test for Bug 396024 **/
   var printService = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
                                .getService(Components.interfaces.nsIPrintSettingsService);
--- a/layout/base/tests/chrome/printpreview_bug482976_helper.xul
+++ b/layout/base/tests/chrome/printpreview_bug482976_helper.xul
@@ -9,17 +9,17 @@ https://bugzilla.mozilla.org/show_bug.cg
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 <iframe src="about:blank" type="content"></iframe>
 <iframe src="about:blank" type="content"></iframe>
 <script type="application/javascript">
 <![CDATA[
 var is = window.opener.wrappedJSObject.is;
 var ok = window.opener.wrappedJSObject.ok;
 var todo = window.opener.wrappedJSObject.todo;
-var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
+var parentFinish = window.opener.wrappedJSObject.parentFinish;
 var gWbp;
 function printpreview() {
   gWbp = window.frames[1].QueryInterface(Components.interfaces.nsIInterfaceRequestor)
              .getInterface(Components.interfaces.nsIWebBrowserPrint);
   var listener = {
     onLocationChange: function(webProgress, request, location, flags) { },
     onProgressChange: function(webProgress, request, curSelfProgress, 
                                maxSelfProgress, curTotalProgress,
@@ -44,17 +44,17 @@ function printpreview() {
 }
 
 function exitprintpreview() {
   window.frames[1].QueryInterface(Components.interfaces.nsIInterfaceRequestor)
    .getInterface(Components.interfaces.nsIWebBrowserPrint).exitPrintPreview(); 
 }
 
 function finish() {
-  SimpleTest.finish();
+  parentFinish();
   window.close();
 }
 
 function run1()
 {
 /** Test for Bug 482976 **/
   var printService = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
                                .getService(Components.interfaces.nsIPrintSettingsService);
--- a/layout/base/tests/chrome/printpreview_helper.xul
+++ b/layout/base/tests/chrome/printpreview_helper.xul
@@ -7,17 +7,17 @@
 <iframe height="200" width="600" type="content"></iframe>
 <iframe height="200" width="600" type="content"></iframe>
 <script type="application/javascript">
 <![CDATA[
 var is = window.opener.wrappedJSObject.is;
 var isnot = window.opener.wrappedJSObject.isnot;
 var ok = window.opener.wrappedJSObject.ok;
 var todo = window.opener.wrappedJSObject.todo;
-var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
+var parentFinish = window.opener.wrappedJSObject.parentFinish;
 var gWbp;
 var ctx1;
 var ctx2;
 var counter = 0;
 
 var file = Components.classes["@mozilla.org/file/directory_service;1"]
              .getService(Components.interfaces.nsIProperties)
              .get("TmpD", Components.interfaces.nsILocalFile);
@@ -61,17 +61,17 @@ function printpreview() {
 }
 
 function exitprintpreview() {
   window.frames[1].QueryInterface(Components.interfaces.nsIInterfaceRequestor)
    .getInterface(Components.interfaces.nsIWebBrowserPrint).exitPrintPreview(); 
 }
 
 function finish() {
-  SimpleTest.finish();
+  parentFinish();
   window.close();
 }
 
 function runTests()
 {
   var printService = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
                                .getService(Components.interfaces.nsIPrintSettingsService);
 
--- a/layout/base/tests/chrome/test_printpreview.xul
+++ b/layout/base/tests/chrome/test_printpreview.xul
@@ -6,14 +6,31 @@
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 <body xmlns="http://www.w3.org/1999/xhtml">
 </body>
   <!-- test code goes here -->
 <script type="application/javascript">
 <![CDATA[
 if (navigator.platform.startsWith("Linux")) {
-  SimpleTest.expectAssertions(0, 1);
+  SimpleTest.expectAssertions(1); // bug 671976
+} else if (navigator.platform.startsWith("Win")) {
+  // reliable 2 on Win7, but not on XP
+  SimpleTest.expectAssertions(0, 1); // bug 671976
+}
+
+function parentFinish() {
+  // This is called while the helper window is still open.  Call
+  // doFinish after it closes.
+  setTimeout(doFinish, 0);
+}
+function doFinish() {
+  // Garbage collecting the windows created in this test can cause
+  // assertions, so GC now to blame those assertions to this test.
+  // ("Destroying a currently-showing document", bug 671976)
+  SpecialPowers.gc();
+
+  SimpleTest.finish();
 }
 SimpleTest.waitForExplicitFinish();
 window.open("printpreview_helper.xul", "printpreview", "chrome,width=100,height=100");
 ]]></script>
 </window>
--- a/layout/base/tests/chrome/test_printpreview_bug396024.xul
+++ b/layout/base/tests/chrome/test_printpreview_bug396024.xul
@@ -12,14 +12,31 @@ https://bugzilla.mozilla.org/show_bug.cg
 <body xmlns="http://www.w3.org/1999/xhtml">
 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=396024"
    target="_blank">Mozilla Bug 396024</a>
 </body>
   <!-- test code goes here -->
 <script type="application/javascript">
 <![CDATA[
 if (navigator.platform.startsWith("Linux")) {
-  SimpleTest.expectAssertions(0, 1);
+  SimpleTest.expectAssertions(2); // bug 671976
+} else if (navigator.platform.startsWith("Win")) {
+  // reliable 2 on Win7, but not on XP
+  SimpleTest.expectAssertions(0, 2); // bug 671976
+}
+
+function parentFinish() {
+  // This is called while the helper window is still open.  Call
+  // doFinish after it closes.
+  setTimeout(doFinish, 0);
+}
+function doFinish() {
+  // Garbage collecting the windows created in this test can cause
+  // assertions, so GC now to blame those assertions to this test.
+  // ("Destroying a currently-showing document", bug 671976)
+  SpecialPowers.gc();
+
+  SimpleTest.finish();
 }
 SimpleTest.waitForExplicitFinish();
 window.open("printpreview_bug396024_helper.xul", "bug396024", "chrome,width=100,height=100");
 ]]></script>
 </window>
--- a/layout/base/tests/chrome/test_printpreview_bug482976.xul
+++ b/layout/base/tests/chrome/test_printpreview_bug482976.xul
@@ -11,13 +11,32 @@ https://bugzilla.mozilla.org/show_bug.cg
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 <body xmlns="http://www.w3.org/1999/xhtml">
 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=482976"
    target="_blank">Mozilla Bug 482976</a>
 </body>
   <!-- test code goes here -->
 <script type="application/javascript">
 <![CDATA[
-SimpleTest.expectAssertions(0, 1);
+if (navigator.platform.startsWith("Linux")) {
+  SimpleTest.expectAssertions(1); // bug 671976
+} else if (navigator.platform.startsWith("Win")) {
+  // reliable 2 on Win7, but not on XP
+  SimpleTest.expectAssertions(0, 1); // bug 671976
+}
+
 SimpleTest.waitForExplicitFinish();
+function parentFinish() {
+  // This is called while the helper window is still open.  Call
+  // doFinish after it closes.
+  setTimeout(doFinish, 0);
+}
+function doFinish() {
+  // Garbage collecting the windows created in this test can cause
+  // assertions, so GC now to blame those assertions to this test.
+  // ("Destroying a currently-showing document", bug 671976)
+  SpecialPowers.gc();
+
+  SimpleTest.finish();
+}
 window.open("printpreview_bug482976_helper.xul", "bug482976", "chrome,width=100,height=100");
 ]]></script>
 </window>
--- a/layout/base/tests/chrome/test_transformed_scrolling_repaints.html
+++ b/layout/base/tests/chrome/test_transformed_scrolling_repaints.html
@@ -10,21 +10,16 @@
 <body onload="setTimeout(startTest,0)">
 <div id="t" style="-moz-transform: scale(1.2, 1.2); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden">
   <div style="height:40px;">Hello</div>
   <div id="e" style="height:30px; background:lime">Kitty</div>
   <div style="height:300px; background:yellow">Kitty</div>
 </div>
 <pre id="test">
 <script type="application/javascript">
-if (navigator.platform.startsWith("Linux")) {
-  SimpleTest.expectAssertions(0, 2);
-} else if (navigator.platform.startsWith("Win")) {
-  SimpleTest.expectAssertions(0, 1);
-}
 SimpleTest.waitForExplicitFinish();
 
 var t = document.getElementById("t");
 var e = document.getElementById("e");
 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
                getInterface(Components.interfaces.nsIDOMWindowUtils);
 const isLinux = navigator.platform.indexOf("Linux") >= 0;
 const is64 = navigator.platform.indexOf("x86_64") >= 0;
--- a/layout/base/tests/chrome/test_transformed_scrolling_repaints_3.html
+++ b/layout/base/tests/chrome/test_transformed_scrolling_repaints_3.html
@@ -5,22 +5,16 @@
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <!-- Need a timeout here to allow paint unsuppression before we start the test -->
 <body>
 <pre id="test">
 <script type="application/javascript">
-if (navigator.platform.startsWith("Win")) {
-  SimpleTest.expectAssertions(0, 1);
-} else if (navigator.platform.startsWith("Linux")) {
-  SimpleTest.expectAssertions(0, 3);
-}
-
 SimpleTest.waitForExplicitFinish();
 
 var root = getRootDirectory(window.location.href);
 window.open(root + "transformed_scrolling_repaints_3_window.html", "transformed_scrolling_repaints_3",
             "chrome,width=300,height=400");
 </script>
 </pre>
 </body>
--- a/layout/forms/test/test_bug536567_perwindowpb.html
+++ b/layout/forms/test/test_bug536567_perwindowpb.html
@@ -10,20 +10,16 @@ https://bugzilla.mozilla.org/show_bug.cg
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=536567">Mozilla Bug 536567</a>
 <p id="display"></p>
 <pre id="test">
 <script type="application/javascript">
 
-if (!navigator.platform.startsWith("Mac")) {
-  SimpleTest.expectAssertions(0, 4);
-}
-
 /** Test for Bug 536567 **/
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 const Cm = Components.manager;
 
 Cu.import("resource://gre/modules/Services.jsm");
--- a/layout/forms/test/test_bug665540.html
+++ b/layout/forms/test/test_bug665540.html
@@ -13,20 +13,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=665540">Mozilla Bug 665540</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (!navigator.platform.startsWith("Mac")) {
-  SimpleTest.expectAssertions(0, 3);
-}
-
 /** Test for Bug 665540 **/
 
 SimpleTest.waitForExplicitFinish();
 
 var win;
 var select;
 var optiona;
 var eventType = "mouseover";
--- a/layout/generic/test/test_bug469613.xul
+++ b/layout/generic/test/test_bug469613.xul
@@ -19,20 +19,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 </body>
 
 <vbox style="height: 100px; overflow: auto;" id="scrollbox">
   <hbox style="height: 200px;"/>
 </vbox>
 
 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[
 
-if (navigator.platform.startsWith("Win")) {
-  SimpleTest.expectAssertions(0, 3);
-}
-
 /** Test for Bug 469613 **/
 
 function doTest() {
   let scrollbox = document.getElementById("scrollbox");
   scrollbox.scrollTop = 0;
 
   // Make sure that the "scroll focus" is inside the scrollbox by moving the
   // mouse in the scrollbox.
--- a/layout/generic/test/test_bug469774.xul
+++ b/layout/generic/test/test_bug469774.xul
@@ -22,18 +22,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 </body>
 
 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[
 
-SimpleTest.expectAssertions(0, 3);
-
 /** Test for Bug 469774 **/
 
 // Test whether menu popups are blocked from being painted in their parent window.
 
 // Like snapshotWindow, but with DRAWWINDOW_DRAW_CARET
 function snapShot() {
   var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
   canvas.setAttribute("width", 200);
--- a/layout/generic/test/test_bug508115.xul
+++ b/layout/generic/test/test_bug508115.xul
@@ -15,20 +15,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 <body  xmlns="http://www.w3.org/1999/xhtml">
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=508115">Mozilla Bug 508115</a>
 
   <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 </body>
 <script class="testbody" type="application/javascript"><![CDATA[
-if (navigator.platform.startsWith("Win")) {
-  SimpleTest.expectAssertions(0, 3);
-}
-
 function doTest() {
   document.getElementById("panel").style.display = '';
   document.getElementById("deck").selectedIndex = 1;
   document.getElementById("anchor").open = true;
   document.getElementById("container").style.width = "0";
   document.getElementById("anchor2").open = true;
 }
 var count = 0;
--- a/layout/generic/test/test_bug514732-2.xul
+++ b/layout/generic/test/test_bug514732-2.xul
@@ -25,20 +25,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 </pre>
 </body>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
-if (!navigator.platform.startsWith("Mac")) {
-  SimpleTest.expectAssertions(0, 3);
-}
-
 /** Test for Bug 514732 **/
 
 SimpleTest.waitForExplicitFinish();
 window.open("file_bug514732_window.xul", "bug514732",
             "chrome,width=600,height=600,scrollbars");
 
 ]]>
 </script>
--- a/layout/generic/test/test_bug632379.xul
+++ b/layout/generic/test/test_bug632379.xul
@@ -161,22 +161,16 @@ https://bugzilla.mozilla.org/show_bug.cg
   <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 </body>
 
 
 <script class="testbody" type="application/javascript"><![CDATA[
 
-if (navigator.platform.startsWith("Win")) {
-  SimpleTest.expectAssertions(0, 3);
-} else if (navigator.platform.startsWith("Linux")) {
-  SimpleTest.expectAssertions(0, 2);
-}
-
 /** Test for Bug 632379 **/
 // Tests whether scrolling a menu affects the position at which popups appear
 var pos = new Array(2);
 var count=0;
 
 function snapshot(elem)
 {
     pos[count] = elem.getBoundingClientRect().top;
--- a/layout/generic/test/test_selection_preventDefault.html
+++ b/layout/generic/test/test_selection_preventDefault.html
@@ -27,20 +27,16 @@
 <body>
 <input id="input" type="text" value="iiiiiiiii iiiiiiiii iiiiiiiii">
 <div id="fixedDiv1" class="testingDiv">
 dddddd dddddd dddddd
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.startsWith("Win")) {
-  SimpleTest.expectAssertions(0, 3);
-}
-
 var fixedDiv1 = document.getElementById("fixedDiv1");
 var input = document.getElementById("input");
 
 function test()
 {
   function getSelectionForEditor(aEditorElement)
   {
     const nsIDOMNSEditableElement =
--- a/layout/generic/test/test_selection_underline.html
+++ b/layout/generic/test/test_selection_underline.html
@@ -3,22 +3,16 @@
 <head>
   <title>Test for selection underline</title>
   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
 <script type="text/javascript">
 
-if (navigator.platform.startsWith("Win")) {
-  SimpleTest.expectAssertions(0, 3);
-} else if (navigator.platform.startsWith("Linux")) {
-  SimpleTest.expectAssertions(0, 1);
-}
-
 // Canvas related code stolen from layout/base/tests/bidi_numeral_test.js which
 // stole from http://developer.mozilla.org/en/docs/Code_snippets:Canvas
 
 var RemoteCanvas = function(aIFrame, aTest) {
   this.iframe = aIFrame;
   this.test = aTest;
   this.snapshot = null;
 };