bug 1269812 - e10s-ify test_bug383369.html and test_unsecureRedirect.html r=Cykesiopka,mrbkap a=test-only
authorDavid Keeler <dkeeler@mozilla.com>
Tue, 03 May 2016 11:00:50 -0700
changeset 332846 ac470f026c69f90c82798f15dbf9d538fc99b68e
parent 332845 8f26c5435bb14e6da2f48a00738a38b290b78013
child 332847 d768e95103ff967c108496bc035b3be5fbef50b8
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCykesiopka, mrbkap, test-only
bugs1269812, 383369
milestone48.0a2
bug 1269812 - e10s-ify test_bug383369.html and test_unsecureRedirect.html r=Cykesiopka,mrbkap a=test-only MozReview-Commit-ID: E6z91sfEjan
security/manager/ssl/tests/mochitest/mixedcontent/mochitest.ini
security/manager/ssl/tests/mochitest/mixedcontent/test_bug383369.html
--- a/security/manager/ssl/tests/mochitest/mixedcontent/mochitest.ini
+++ b/security/manager/ssl/tests/mochitest/mixedcontent/mochitest.ini
@@ -22,17 +22,16 @@ support-files =
   nocontent.sjs
   redirecttoemptyimage.sjs
   somestyle.css
   unsecureIframe.html
   unsecurePictureDup.html
 
 [test_bug329869.html]
 [test_bug383369.html]
-skip-if = e10s
 [test_bug455367.html]
 [test_bug472986.html]
 [test_bug477118.html]
 [test_bug521461.html]
 [test_cssBefore1.html]
 [test_cssContent1.html]
 [test_cssContent2.html]
 [test_documentWrite1.html]
@@ -56,9 +55,8 @@ skip-if = e10s
 [test_unsecureIframe2.html]
 # [test_unsecureIframeMetaRedirect.html]
 # intermittently fails, less often, bug 487632
 [test_unsecureIframeRedirect.html]
 [test_unsecurePicture.html]
 [test_unsecurePictureDup.html]
 [test_unsecurePictureInIframe.html]
 [test_unsecureRedirect.html]
-skip-if = e10s
--- a/security/manager/ssl/tests/mochitest/mixedcontent/test_bug383369.html
+++ b/security/manager/ssl/tests/mochitest/mixedcontent/test_bug383369.html
@@ -2,96 +2,98 @@
 <html>
 <head>
   <title>Bug 383369 test</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="mixedContentTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
   <script class="testbody" type="text/javascript">
+  /* sendAsyncMessage isn't actually a global - this just mollifies eslint */
+  /* global sendAsyncMessage */
   /* import-globals-from mixedContentTest.js */
   "use strict";
 
   // We want to start this test from an insecure context
   loadAsInsecure = true;
   // We don't want to go through the navigation back/forward test
   bypassNavigationTest = true;
 
-  function runTest()
-  {
-    // Force download to be w/o user assistance for our testing mime type
-    const mimeSvc = SpecialPowers.Cc["@mozilla.org/mime;1"]
-      .getService(SpecialPowers.Ci.nsIMIMEService);
-    var handlerInfo = mimeSvc.getFromTypeAndExtension("application/x-auto-download", "auto");
-    handlerInfo.preferredAction = SpecialPowers.Ci.nsIHandlerInfo.saveToDisk;
-    handlerInfo.alwaysAskBeforeHandling = false;
-    handlerInfo.preferredApplicationHandler = null;
+  function runTest() {
+    var script = SpecialPowers.loadChromeScript(function() {
+      const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+      // Force download to be w/o user assistance for our testing mime type
+      const mimeSvc = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
+      var handlerInfo = mimeSvc.getFromTypeAndExtension("application/x-auto-download", "auto");
+      handlerInfo.preferredAction = Ci.nsIHandlerInfo.saveToDisk;
+      handlerInfo.alwaysAskBeforeHandling = false;
+      handlerInfo.preferredApplicationHandler = null;
 
-    const handlerSvc = SpecialPowers.Cc["@mozilla.org/uriloader/handler-service;1"]
-      .getService(SpecialPowers.Ci.nsIHandlerService);
-    handlerSvc.store(handlerInfo);
+      const handlerSvc = Cc["@mozilla.org/uriloader/handler-service;1"]
+                           .getService(Ci.nsIHandlerService);
+      handlerSvc.store(handlerInfo);
 
-    var dirProvider = SpecialPowers.Cc["@mozilla.org/file/directory_service;1"]
-      .getService(SpecialPowers.Ci.nsIProperties);
-    var profileDir = dirProvider.get("ProfDS", SpecialPowers.Ci.nsIFile);
-    profileDir.append("downloads");
+      var dirProvider = Cc["@mozilla.org/file/directory_service;1"]
+                          .getService(Ci.nsIProperties);
+      var profileDir = dirProvider.get("ProfDS", Ci.nsIFile);
+      profileDir.append("downloads");
 
-    var prefs = SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
-      .getService(SpecialPowers.Ci.nsIPrefService);
-    prefs = prefs.getBranch("browser.download.");
+      var prefs = Cc["@mozilla.org/preferences-service;1"]
+                    .getService(Ci.nsIPrefService);
+      prefs = prefs.getBranch("browser.download.");
 
-    prefs.setCharPref("dir", profileDir.path);
-    prefs.setBoolPref("useDownloadDir", true);
-    prefs.setIntPref("folderList", 2);
-    prefs.setBoolPref("manager.closeWhenDone", true);
-    prefs.setBoolPref("manager.showWhenStarting", false);
-
-    var theWindow = window;
+      prefs.setCharPref("dir", profileDir.path);
+      prefs.setBoolPref("useDownloadDir", true);
+      prefs.setIntPref("folderList", 2);
+      prefs.setBoolPref("manager.closeWhenDone", true);
+      prefs.setBoolPref("manager.showWhenStarting", false);
 
-    var Downloads = SpecialPowers.Cu.import("resource://gre/modules/Downloads.jsm").Downloads;
-    Downloads.getList(Downloads.PUBLIC).then(list => {
-      list = SpecialPowers.wrap(list);
-      list.addView({
-        onDownloadAdded: function (aDownload) {
-          list.removeView(this);
-          SpecialPowers.wrap(aDownload).whenSucceeded().then(() => {
-            list.removeFinished();
-            theWindow.location = "bug383369step2.html";
-          });
-        },
-      });
-      window.location = "download.auto";
-    }).then(null, SpecialPowers.Cu.reportError);
+      var Downloads = Cu.import("resource://gre/modules/Downloads.jsm").Downloads;
+      Downloads.getList(Downloads.PUBLIC).then(list => {
+        list.addView({
+          onDownloadAdded: function (aDownload) {
+            list.removeView(this);
+            aDownload.whenSucceeded().then(() => {
+              list.removeFinished();
+              sendAsyncMessage("navigate", "bug383369step2.html");
+            });
+          },
+        });
+        sendAsyncMessage("navigate", "download.auto");
+      }).then(null, SpecialPowers.Cu.reportError);
+    });
+    script.addMessageListener("navigate", function(url) {
+      window.location = url;
+    });
   }
 
-  function afterNavigationTest()
-  {
-  }
+  function afterNavigationTest() {}
 
-  testCleanUp = function cleanup()
-  {
-    const mimeSvc = SpecialPowers.Cc["@mozilla.org/mime;1"]
-      .getService(SpecialPowers.Ci.nsIMIMEService);
-    var handlerInfo = mimeSvc.getFromTypeAndExtension("application/x-auto-download", "auto");
+  testCleanUp = function cleanup() {
+    SpecialPowers.loadChromeScript(function() {
+      const { classes: Cc, interfaces: Ci } = Components;
+      const mimeSvc = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
+      var handlerInfo = mimeSvc.getFromTypeAndExtension("application/x-auto-download", "auto");
+
+      const handlerSvc = Cc["@mozilla.org/uriloader/handler-service;1"]
+                           .getService(Ci.nsIHandlerService);
+      handlerSvc.remove(handlerInfo);
 
-    const handlerSvc = SpecialPowers.Cc["@mozilla.org/uriloader/handler-service;1"]
-      .getService(SpecialPowers.Ci.nsIHandlerService);
-    handlerSvc.remove(handlerInfo);
-
-    var prefs = SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
-      .getService(SpecialPowers.Ci.nsIPrefService);
-    prefs = prefs.getBranch("browser.download.");
+      var prefs = Cc["@mozilla.org/preferences-service;1"]
+                    .getService(Ci.nsIPrefService);
+      prefs = prefs.getBranch("browser.download.");
 
-    var prefKeys = ["dir", "useDownloadDir", "folderList",
-                    "manager.closeWhenDone", "manager.showWhenStarting"];
-    for (let prefKey of prefKeys) {
-      if (prefs.prefHasUserValue(prefKey)) {
-        prefs.clearUserPref(prefKey);
+      var prefKeys = ["dir", "useDownloadDir", "folderList",
+                      "manager.closeWhenDone", "manager.showWhenStarting"];
+      for (let prefKey of prefKeys) {
+        if (prefs.prefHasUserValue(prefKey)) {
+          prefs.clearUserPref(prefKey);
+        }
       }
-    }
+    });
   };
 
   </script>
 </head>
 
 <body>
 </body>
 </html>