Bug 873864 - Test failures when reloading test_bug669671.html. r=jlebar
authorMartijn Wargers <mwargers@mozilla.com>
Fri, 26 Jul 2013 00:57:25 +0200
changeset 140174 bcc709f93afb905dada3e188a42964e57c746cc5
parent 140173 7cdac016f94f2cdf37f9fe082d9226136adeebed
child 140175 e26410b337b59d41e88c952bceef0ac437d455b9
push id1945
push userryanvm@gmail.com
push dateSat, 27 Jul 2013 02:27:26 +0000
treeherderfx-team@4874fa438b1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar
bugs873864, 669671
milestone25.0a1
Bug 873864 - Test failures when reloading test_bug669671.html. r=jlebar
docshell/test/file_bug669671.sjs
docshell/test/test_bug669671.html
--- a/docshell/test/file_bug669671.sjs
+++ b/docshell/test/file_bug669671.sjs
@@ -1,13 +1,14 @@
 function handleRequest(request, response)
 {
   var count = parseInt(getState('count'));
-  if (!count)
+  if (!count || request.queryString == 'countreset')
     count = 0;
+
   setState('count', count + 1 + '');
 
   response.setHeader('Content-Type', 'text/html', false);
   response.setHeader('Cache-Control', 'max-age=0');
   response.write('<html><body onload="opener.onChildLoad()" ' +
                  'onunload="parseInt(\'0\')">' +
                  count + '</body></html>');
 }
--- a/docshell/test/test_bug669671.html
+++ b/docshell/test/test_bug669671.html
@@ -61,16 +61,22 @@ function checkPopupLoadCount()
   var origCount = _loadCount;
   if (popup.document.body.innerHTML >= _loadCount + '')
     _loadCount++;
   return origCount;
 }
 
 function test()
 {
+  // Step 0 - Make sure the count is reset to 0 in case of reload
+  popup.location = 'file_bug669671.sjs?countreset';
+  yield;
+  is(popup.document.body.innerHTML, '0',
+     'Load count should be reset to 0');
+
   // Step 1 - The popup's body counts how many times we've requested the
   // resource.  This is the first time we've requested it, so it should be '0'.
   checkPopupLoadCount();
 
   // Step 2 - We'll get another onChildLoad when this finishes.
   popup.location = 'file_bug669671.sjs';
   yield undefined;