bug 1269812 - e10s-ify test_bug383369.html and test_unsecureRedirect.html r=Cykesiopka r=mrbkap
MozReview-Commit-ID: E6z91sfEjan
--- 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>