Bug 1561964 - Re-enable all tests in dom/security/test on Android. r=ckerschb

Differential Revision: https://phabricator.services.mozilla.com/D37488

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Agi Sferro 2019-08-29 16:04:14 +00:00
Родитель c7e39034b6
Коммит 426bf8391a
9 изменённых файлов: 95 добавлений и 67 удалений

Просмотреть файл

@ -49,24 +49,28 @@
<!-- websockets: upgrade ws:// to wss://-->
<script type="application/javascript">
var mySocket = new WebSocket("ws://example.com/tests/dom/security/test/csp/file_upgrade_insecure");
mySocket.onopen = function(e) {
if (mySocket.url.includes("wss://")) {
window.parent.postMessage({result: "websocket-ok"}, "*");
}
else {
window.parent.postMessage({result: "websocket-error"}, "*");
}
mySocket.close();
};
mySocket.onerror = function(e) {
// debug information for Bug 1316305
dump(" xxx mySocket.onerror: (mySocket): " + mySocket + "\n");
dump(" xxx mySocket.onerror: (mySocket.url): " + mySocket.url + "\n");
dump(" xxx mySocket.onerror: (e): " + e + "\n");
dump(" xxx mySocket.onerror: (e.message): " + e.message + "\n");
window.parent.postMessage({result: "websocket-unexpected-error"}, "*");
};
// WebSocket tests are not supported on Android yet. Bug 1566168
const {AppConstants} = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
if (AppConstants.platform !== "android") {
var mySocket = new WebSocket("ws://example.com/tests/dom/security/test/csp/file_upgrade_insecure");
mySocket.onopen = function(e) {
if (mySocket.url.includes("wss://")) {
window.parent.postMessage({result: "websocket-ok"}, "*");
}
else {
window.parent.postMessage({result: "websocket-error"}, "*");
}
mySocket.close();
};
mySocket.onerror = function(e) {
// debug information for Bug 1316305
dump(" xxx mySocket.onerror: (mySocket): " + mySocket + "\n");
dump(" xxx mySocket.onerror: (mySocket.url): " + mySocket.url + "\n");
dump(" xxx mySocket.onerror: (e): " + e + "\n");
dump(" xxx mySocket.onerror: (e.message): " + e.message + "\n");
window.parent.postMessage({result: "websocket-unexpected-error"}, "*");
};
}
</script>
<!-- form action: (upgrade POST from http:// to https://) -->

Просмотреть файл

@ -50,19 +50,23 @@
<!-- websockets: upgrade ws:// to wss://-->
<script type="application/javascript">
var mySocket = new WebSocket("ws://example.com/tests/dom/security/test/csp/file_upgrade_insecure");
mySocket.onopen = function(e) {
if (mySocket.url.includes("wss://")) {
window.parent.postMessage({result: "websocket-ok"}, "*");
}
else {
window.parent.postMessage({result: "websocket-error"}, "*");
}
mySocket.close();
};
mySocket.onerror = function(e) {
window.parent.postMessage({result: "websocket-unexpected-error"}, "*");
};
// WebSocket tests are not supported on Android Yet. Bug 1566168.
const {AppConstants} = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
if (AppConstants.platform !== "android") {
var mySocket = new WebSocket("ws://example.com/tests/dom/security/test/csp/file_upgrade_insecure");
mySocket.onopen = function(e) {
if (mySocket.url.includes("wss://")) {
window.parent.postMessage({result: "websocket-ok"}, "*");
}
else {
window.parent.postMessage({result: "websocket-error"}, "*");
}
mySocket.close();
};
mySocket.onerror = function(e) {
window.parent.postMessage({result: "websocket-unexpected-error"}, "*");
};
}
</script>
<!-- form action: (upgrade POST from http:// to https://) -->

Просмотреть файл

@ -252,7 +252,7 @@ prefs =
[test_frameancestors.html]
skip-if = fission
[test_frameancestors_userpass.html]
skip-if = fission || toolkit == 'android' # Times out, not sure why (bug 1008445)
skip-if = fission
[test_inlinescript.html]
[test_inlinestyle.html]
[test_invalid_source_expression.html]
@ -291,11 +291,9 @@ skip-if = verify
[test_win_open_blocked.html]
[test_upgrade_insecure.html]
# no ssl support as well as websocket tests do not work (see test_websocket.html)
skip-if = fission || (toolkit == 'android') || (os != 'linux' && !debug) # Bug 1183300
skip-if = fission || (os != 'linux' && !debug) # Bug 1183300
[test_upgrade_insecure_reporting.html]
skip-if = toolkit == 'android'
[test_upgrade_insecure_cors.html]
skip-if = toolkit == 'android'
[test_upgrade_insecure_loopback.html]
[test_report_for_import.html]
[test_blocked_uri_in_reports.html]
@ -333,7 +331,7 @@ skip-if = fission
[test_iframe_srcdoc.html]
[test_image_nonce.html]
[test_websocket_self.html]
skip-if = toolkit == 'android'
skip-if = toolkit == 'android' # no websocket support Bug 982828
[test_ignore_xfo.html]
[test_data_csp_inheritance.html]
[test_data_csp_merge.html]
@ -387,7 +385,7 @@ support-files =
file_script_template.html
file_script_template.js
[test_reloadInFreshProcess.html]
# no ssl support on android and no large-allocation on win32
# no large-allocation on win32, no e10s-multi support on Android Bug 1530770
skip-if =
(toolkit == 'android') || (os == 'win' && bits == 32) ||
fission # Crashes: @ mozilla::dom::ContentParent::CommonCreateWindow(mozilla::dom::PBrowserParent*, bool, unsigned int const&, bool const&, bool const&, bool const&, nsIURI*, nsTString<char> const&, float const&, unsigned long, nsTString<char16_t> const&, nsresult&, nsCOMPtr<nsIRemoteTab>&, bool*, int&, nsIPrincipal*, nsIReferrerInfo*, bool, nsIContentSecurityPolicy*)

Просмотреть файл

@ -28,6 +28,8 @@
* received by the server (*.sjs) were actually *https* requests.
*/
const {AppConstants} = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
const UPGRADE_POLICY =
"upgrade-insecure-requests;" + // upgrade all http requests to https
"block-all-mixed-content;" + // upgrade should be enforced before block-all.
@ -50,7 +52,7 @@ var tests = [
deliveryMethod: "header",
results: [
"iframe-ok", "script-ok", "img-ok", "img-redir-ok", "font-ok", "xhr-ok", "style-ok",
"media-ok", "object-ok", "form-ok", "websocket-ok", "nested-img-ok"
"media-ok", "object-ok", "form-ok", "nested-img-ok"
]
},
{ // (2) test that all requests within an >> http << page get updated
@ -60,7 +62,7 @@ var tests = [
deliveryMethod: "header",
results: [
"iframe-ok", "script-ok", "img-ok", "img-redir-ok", "font-ok", "xhr-ok", "style-ok",
"media-ok", "object-ok", "form-ok", "websocket-ok", "nested-img-ok"
"media-ok", "object-ok", "form-ok", "nested-img-ok"
]
},
{ // (3) test that all requests within an >> http << page get updated, but do
@ -71,7 +73,7 @@ var tests = [
deliveryMethod: "header",
results: [
"iframe-ok", "script-ok", "img-ok", "img-redir-ok", "font-ok", "xhr-ok", "style-ok",
"media-ok", "object-ok", "form-ok", "websocket-ok", "nested-img-ok"
"media-ok", "object-ok", "form-ok", "nested-img-ok"
]
},
{ // (4) test that no requests get updated if >> upgrade-insecure-requests << is not used
@ -82,7 +84,7 @@ var tests = [
results: [
"iframe-error", "script-error", "img-error", "img-redir-error", "font-error",
"xhr-error", "style-error", "media-error", "object-error", "form-error",
"websocket-error", "nested-img-error"
"nested-img-error"
]
},
{ // (5) test that all requests within an >> https << page using meta CSP get updated
@ -94,11 +96,18 @@ var tests = [
deliveryMethod: "meta",
results: [
"iframe-ok", "script-ok", "img-ok", "img-redir-ok", "font-ok", "xhr-ok", "style-ok",
"media-ok", "object-ok", "form-ok", "websocket-ok", "nested-img-ok"
"media-ok", "object-ok", "form-ok", "nested-img-ok"
]
},
];
// TODO: WebSocket tests are not supported on Android Yet. Bug 1566168.
if (AppConstants.platform !== "android") {
for (let test of tests) {
test.results.push(test.results[0] == "iframe-ok" ? "websocket-ok" : "websocket-error");
}
}
var counter = 0;
var curTest;

Просмотреть файл

@ -35,13 +35,10 @@ skip-if = fission || verify
[test_nosniff_navigation.html]
[test_block_script_wrong_mime.html]
[test_block_toplevel_data_navigation.html]
skip-if = toolkit == 'android' # intermittent failure
[test_block_toplevel_data_img_navigation.html]
skip-if = toolkit == 'android' # intermittent failure
[test_allow_opening_data_pdf.html]
skip-if = toolkit == 'android'
skip-if = toolkit == 'android' # no pdf reader on Android
[test_allow_opening_data_json.html]
skip-if = toolkit == 'android'
[test_block_subresource_redir_to_data.html]
[test_same_site_cookies_subrequest.html]
[test_same_site_cookies_toplevel_nav.html]
@ -57,7 +54,7 @@ skip-if = fission # Fails intermittently under Fission
[test_same_site_cookies_about.html]
skip-if = fission # Fails intermittently under Fission
[test_assert_about_page_no_csp.html]
skip-if = !debug || toolkit == 'android'
skip-if = !debug
[test_same_site_cookies_laxByDefault.html]
skip-if = fission
support-files = closeWindow.sjs

Просмотреть файл

@ -12,6 +12,8 @@
SimpleTest.waitForExplicitFinish();
SimpleTest.expectAssertions(0, 1);
const {AppConstants} = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
// Test Setup:
// The test overrules the whitelist of about: pages that are allowed to load without a CSP
// and makes sure to hit the assertion within AssertAboutPageHasCSP().
@ -19,7 +21,11 @@
// test loads a second dummy data: URI to reset the old cache and finally resets the pref
// used for testing purposes.
let origWhiteList = SpecialPowers.getCharPref("csp.about_uris_without_csp");
let origWhiteList = "";
// Android doesn't have this pref
if (AppConstants.platform !== "android") {
origWhiteList = SpecialPowers.getCharPref("csp.about_uris_without_csp");
}
SpecialPowers.setCharPref("csp.about_uris_without_csp", "");
SpecialPowers.setBoolPref("csp.overrule_about_uris_without_csp_whitelist", true);
@ -29,7 +35,9 @@
myFrame.src = "about:blank";
// booom :-)
SpecialPowers.setCharPref("csp.about_uris_without_csp", origWhiteList);
if (origWhiteList !== "") {
SpecialPowers.setCharPref("csp.about_uris_without_csp", origWhiteList);
}
myFrame.src = "data:text/html,<body>just a dumy data: URI</body>";
SpecialPowers.setBoolPref("csp.overrule_about_uris_without_csp_whitelist", false);

Просмотреть файл

@ -22,6 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=803225
-->
<script>
const {AppConstants} = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
//For tests that require setTimeout, set the timeout interval
var TIMEOUT_INTERVAL = 100;
@ -148,22 +149,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=803225
mailtoProtocolStatus();
// Test 7: wss protocol
var wss;
wss = new WebSocket("wss://example.com/tests/dom/security/test/mixedcontentblocker/file_main_bug803225_websocket");
// WebSocket tests are not supported on Android Yet. Bug 1566168.
if (AppConstants.platform !== "android") {
var wss;
wss = new WebSocket("wss://example.com/tests/dom/security/test/mixedcontentblocker/file_main_bug803225_websocket");
var status_wss = "started";
wss.onopen = function(e) {
status_wss = "opened";
wss.close();
}
wss.onclose = function(e) {
if(status_wss == "opened") {
parent.postMessage({"test": "wss", "msg": "resource with wss protocol loaded"}, "http://mochi.test:8888");
} else {
parent.postMessage({"test": "wss", "msg": "resource with wss protocol did not load"}, "http://mochi.test:8888");
var status_wss = "started";
wss.onopen = function(e) {
status_wss = "opened";
wss.close();
}
wss.onclose = function(e) {
if(status_wss == "opened") {
parent.postMessage({"test": "wss", "msg": "resource with wss protocol loaded"}, "http://mochi.test:8888");
} else {
parent.postMessage({"test": "wss", "msg": "resource with wss protocol did not load"}, "http://mochi.test:8888");
}
}
}
</script>
</body>
</html>

Просмотреть файл

@ -25,8 +25,7 @@ skip-if =
(toolkit == 'android') || webrender || (verify && !debug && (os == 'linux')) || # Android: TIMED_OUT; bug 1402554
fission # Crashes: @ mozilla::dom::BrowsingContextGroup::EnsureSubscribed(mozilla::dom::ContentParent*)
[test_bug803225.html]
skip-if =
toolkit == 'android' || (os=='linux' && bits==32) || headless #Android: TIMED_OUT; Linux32:bug 1324870; Headless:bug 1405870
skip-if = (os=='linux' && bits==32) || headless # Linux32:bug 1324870; Headless:bug 1405870
[test_frameNavigation.html]
skip-if = fission || toolkit == 'android' || webrender || (debug && (os == 'linux' || os == 'win')) || (os == 'win' && !debug) # Android: TIMED_OUT; webrender: bug 1424752 # Bug 1391823; Bug 1353608
skip-if = fission || webrender || (debug && (os == 'linux' || os == 'win')) || (os == 'win' && !debug) # webrender: bug 1424752 # Bug 1391823; Bug 1353608
[test_redirect.html]

Просмотреть файл

@ -11,6 +11,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=803225
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script>
const {AppConstants} = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
var counter = 0;
var settings = [ [true, true], [true, false], [false, true], [false, false] ];
@ -40,10 +42,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=803225
unsafe_about: false,
data_protocol: false,
javascript: false,
mailto: false,
wss: false,
};
if (AppConstants.platform !== "android") {
// WebSocket tests are not supported on Android Yet. Bug 1566168.
testsToRun.wss = false;
testsToRun.mailto = false;
}
function log(msg) {
document.getElementById("log").textContent += "\n" + msg;
}