From 426bf8391a8acbfe85ecefb1b337b8efd90c1aa4 Mon Sep 17 00:00:00 2001 From: Agi Sferro Date: Thu, 29 Aug 2019 16:04:14 +0000 Subject: [PATCH] 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 --- .../test/csp/file_upgrade_insecure.html | 40 ++++++++++--------- .../test/csp/file_upgrade_insecure_meta.html | 30 ++++++++------ dom/security/test/csp/mochitest.ini | 10 ++--- .../test/csp/test_upgrade_insecure.html | 19 ++++++--- dom/security/test/general/mochitest.ini | 7 +--- .../test_assert_about_page_no_csp.html | 12 +++++- .../file_main_bug803225.html | 29 ++++++++------ .../test/mixedcontentblocker/mochitest.ini | 5 +-- .../mixedcontentblocker/test_bug803225.html | 10 ++++- 9 files changed, 95 insertions(+), 67 deletions(-) diff --git a/dom/security/test/csp/file_upgrade_insecure.html b/dom/security/test/csp/file_upgrade_insecure.html index e3243c1bbe9c..5fcd8f80949c 100644 --- a/dom/security/test/csp/file_upgrade_insecure.html +++ b/dom/security/test/csp/file_upgrade_insecure.html @@ -49,24 +49,28 @@ diff --git a/dom/security/test/csp/file_upgrade_insecure_meta.html b/dom/security/test/csp/file_upgrade_insecure_meta.html index 15f565a6b8a7..96896dd51239 100644 --- a/dom/security/test/csp/file_upgrade_insecure_meta.html +++ b/dom/security/test/csp/file_upgrade_insecure_meta.html @@ -50,19 +50,23 @@ diff --git a/dom/security/test/csp/mochitest.ini b/dom/security/test/csp/mochitest.ini index ec259fb1d56d..20f005190927 100644 --- a/dom/security/test/csp/mochitest.ini +++ b/dom/security/test/csp/mochitest.ini @@ -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 const&, float const&, unsigned long, nsTString const&, nsresult&, nsCOMPtr&, bool*, int&, nsIPrincipal*, nsIReferrerInfo*, bool, nsIContentSecurityPolicy*) diff --git a/dom/security/test/csp/test_upgrade_insecure.html b/dom/security/test/csp/test_upgrade_insecure.html index 10eab740947c..c8b02837ed67 100644 --- a/dom/security/test/csp/test_upgrade_insecure.html +++ b/dom/security/test/csp/test_upgrade_insecure.html @@ -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; diff --git a/dom/security/test/general/mochitest.ini b/dom/security/test/general/mochitest.ini index 97b0847f939b..a6bfa3ed1dc0 100644 --- a/dom/security/test/general/mochitest.ini +++ b/dom/security/test/general/mochitest.ini @@ -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 diff --git a/dom/security/test/general/test_assert_about_page_no_csp.html b/dom/security/test/general/test_assert_about_page_no_csp.html index 6f37eb6761b5..94f2d8551f62 100644 --- a/dom/security/test/general/test_assert_about_page_no_csp.html +++ b/dom/security/test/general/test_assert_about_page_no_csp.html @@ -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,just a dumy data: URI"; SpecialPowers.setBoolPref("csp.overrule_about_uris_without_csp_whitelist", false); diff --git a/dom/security/test/mixedcontentblocker/file_main_bug803225.html b/dom/security/test/mixedcontentblocker/file_main_bug803225.html index bad41f5a759d..9e96e986998e 100644 --- a/dom/security/test/mixedcontentblocker/file_main_bug803225.html +++ b/dom/security/test/mixedcontentblocker/file_main_bug803225.html @@ -22,6 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=803225 --> diff --git a/dom/security/test/mixedcontentblocker/mochitest.ini b/dom/security/test/mixedcontentblocker/mochitest.ini index f24d36b85656..f387e8651d15 100644 --- a/dom/security/test/mixedcontentblocker/mochitest.ini +++ b/dom/security/test/mixedcontentblocker/mochitest.ini @@ -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] diff --git a/dom/security/test/mixedcontentblocker/test_bug803225.html b/dom/security/test/mixedcontentblocker/test_bug803225.html index c3a8a6a4714a..de5b326ce1f5 100644 --- a/dom/security/test/mixedcontentblocker/test_bug803225.html +++ b/dom/security/test/mixedcontentblocker/test_bug803225.html @@ -11,6 +11,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=803225