Bug 1391823 - Logs added and multiple calls to finish() fixed draft
authorvinoth <cegvinoth@gmail.com>
Tue, 02 Jan 2018 14:03:30 +0100
changeset 716139 9df2751b2d1964cff8a77ed4ec7a1675b2b892d3
parent 709416 457b0fe91e0d49a5bc35014fb6f86729cd5bac9b
child 744965 ea33b02ca08326da89e59aea004e50f38953ccd7
push id94346
push userbmo:cegvinoth@gmail.com
push dateFri, 05 Jan 2018 08:12:54 +0000
bugs1391823
milestone59.0a1
Bug 1391823 - Logs added and multiple calls to finish() fixed MozReview-Commit-ID: Ailr5VCSWuC
dom/security/test/mixedcontentblocker/test_frameNavigation.html
--- a/dom/security/test/mixedcontentblocker/test_frameNavigation.html
+++ b/dom/security/test/mixedcontentblocker/test_frameNavigation.html
@@ -7,16 +7,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <head>
   <meta charset="utf-8">
   <title>Tests for Bug 840388</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 
   <script>
   var counter = 0;
+  var flag = 0;
   var origBlockActive = SpecialPowers.getBoolPref("security.mixed_content.block_active_content");
 
   SpecialPowers.setBoolPref("security.mixed_content.block_active_content", true);
   var blockActive = SpecialPowers.getBoolPref("security.mixed_content.block_active_content");
 
 
   var testsToRunInsecure = {
     insecurePage_navigate_child: false,
@@ -34,47 +35,53 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   var secureTestsStarted = false;
   function checkTestsCompleted() {
     for (var prop in testsToRunInsecure) {
       // some test hasn't run yet so we're not done
       if (!testsToRunInsecure[prop])
         return;
     }
+    log("all the insecure tests have been completed");
     // If we are here, all the insecure tests have run.
     // If we haven't changed the iframe to run the secure tests, change it now.
     if (!secureTestsStarted) {
       document.getElementById('testing_frame').src = "https://example.com/tests/dom/security/test/mixedcontentblocker/file_frameNavigation_secure.html";
       secureTestsStarted = true;
     }
     for (var prop in testsToRunSecure) {
       // some test hasn't run yet so we're not done
       if (!testsToRunSecure[prop])
         return;
     }
+    log("all the secure and insecure tests have been completed");
     //if the secure and insecure testsToRun are all completed, change the block mixed active content pref and run the tests again.
     if(counter < 1) {
        for (var prop in testsToRunSecure) {
          testsToRunSecure[prop] = false;
        }
        for (var prop in testsToRunInsecure) {
          testsToRunInsecure[prop] = false;
        }
       //call to change the preferences
       counter++;
+      flag++;
       SpecialPowers.setBoolPref("security.mixed_content.block_active_content", false);
       blockActive = SpecialPowers.getBoolPref("security.mixed_content.block_active_content");
       log("blockActive set to "+blockActive+".");
       secureTestsStarted = false;
       document.getElementById('framediv').innerHTML = '<iframe src="http://example.com/tests/dom/security/test/mixedcontentblocker/file_frameNavigation.html" id="testing_frame"></iframe>';
+
     }
     else {
-      //set the prefs back to what they were set to originally
-      SpecialPowers.setBoolPref("security.mixed_content.block_active_content", origBlockActive);
-      SimpleTest.finish();
+      if(flag == 1) {
+        //set the prefs back to what they were set to originally
+        SpecialPowers.setBoolPref("security.mixed_content.block_active_content", origBlockActive);
+        SimpleTest.finish();
+      }
     }
   }
 
   var firstTestDebugMessage = true;
 
   // listen for a messages from the mixed content test harness
   window.addEventListener("message", receiveMessage);
   function receiveMessage(event) {