Bug 986077: Enable most CSP tests on B2G, B2G desktop, and e10s r=sstamm

This commit is contained in:
Garrett Robinson 2014-05-15 08:20:40 -07:00
parent 79195f8785
commit 7070d540e3
6 changed files with 33 additions and 58 deletions

View File

@ -1,5 +1,4 @@
[DEFAULT]
skip-if = e10s
support-files =
file_CSP.css
file_CSP.sjs
@ -127,57 +126,40 @@ support-files =
file_multi_policy_injection_bypass_2.html^headers^
[test_CSP.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'android' #TIMED_OUT # b2g-debug(observer not working) b2g-desktop(observer not working)
[test_CSP_bug663567.html]
[test_CSP_bug802872.html]
[test_CSP_bug885433.html]
[test_CSP_bug888172.html]
[test_CSP_bug916446.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(observer not working) b2g-desktop(observer not working)
[test_CSP_evalscript.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(observer not working) b2g-desktop(observer not working)
[test_CSP_evalscript_getCRMFRequest.html]
skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 824652 # b2g(no window.crypto support in multiprocess) b2g-debug(observer not working) b2g-desktop(observer not working)
skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # no (deprecated) window.crypto support in multiprocess (bug 824652)
[test_CSP_frameancestors.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'android' # b2g-debug(observer not working) b2g-desktop(observer not working)
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'android' # Times out, not sure why (bug 1008445)
[test_CSP_inlinescript.html]
skip-if = toolkit == 'android'
[test_CSP_inlinestyle.html]
[test_bothCSPheaders.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug))
[test_bug836922_npolicies.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(observer not working) b2g-desktop(observer not working)
[test_bug886164.html]
skip-if = (toolkit == 'gonk' && debug) #debug-only failure
[test_csp_redirects.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'android' #TIMED_OUT
[test_CSP_bug910139.html]
[test_CSP_bug909029.html]
skip-if = (toolkit == 'gonk' && debug) #debug-only failure
[test_policyuri_regression_from_multipolicy.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(debug-only failure) b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
[test_nonce_source.html]
skip-if = (toolkit == 'gonk' && debug) #debug-only failure
[test_CSP_bug941404.html]
skip-if = (toolkit == 'gonk' && debug) #debug-only failure
[test_hash_source.html]
skip-if = toolkit=='gonk' # b2g(can't use nsICryptoHash in CSPUtils.jsm (child process)) b2g-debug(can't use nsICryptoHash in CSPUtils.jsm (child process))
skip-if = e10s || buildapp == 'b2g' # can't compute hashes in child process (bug 958702)
[test_dual_headers_warning.html]
[test_self_none_as_hostname_confusion.html]
[test_bug949549.html]
[test_csp_regexp_parsing.html]
[test_report_uri_missing_in_report_only_header.html]
[test_csp_report.html]
skip-if = buildapp == 'b2g' # b2g(observerservice issue) b2g-debug(observerservice issue) b2g-desktop(observerservice issue)
skip-if = e10s || buildapp == 'b2g' # http-on-opening-request observer not supported in child process (bug 1009632)
[test_policyuri_async_fetch.html]
[test_301_redirect.html]
skip-if = buildapp == 'b2g'
[test_302_redirect.html]
skip-if = buildapp == 'b2g'
[test_303_redirect.html]
skip-if = buildapp == 'b2g'
[test_307_redirect.html]
skip-if = buildapp == 'b2g'
[test_subframe_run_js_if_allowed.html]
[test_multi_policy_injection_bypass.html]
skip-if = buildapp == 'b2g'

View File

@ -23,7 +23,7 @@ Test that CSP violation reports are not sent when a 301 redirect is encountered
// This is used to watch the redirect of the report POST get blocked
function examiner() {
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
SpecialPowers.addObserver(this, "http-on-modify-request", false);
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
}
examiner.prototype = {
@ -32,12 +32,11 @@ examiner.prototype = {
if(!SpecialPowers.can_QI(subject))
return;
if (topic === "http-on-modify-request") {
if (topic === "specialpowers-http-notify-request") {
// this is used to fail the test - if we see the POST to the target of the redirect
// we know this is a fail
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
if (asciiSpec == "http://example.com/some/fake/path")
var uri = data;
if (uri == "http://example.com/some/fake/path")
window.done(false);
}
@ -52,7 +51,7 @@ examiner.prototype = {
// or mochitests might get borked.
remove: function() {
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
SpecialPowers.removeObserver(this, "http-on-modify-request");
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
}
}

View File

@ -23,7 +23,7 @@ Test that CSP violation reports are not sent when a 302 redirect is encountered
// This is used to watch the redirect of the report POST get blocked
function examiner() {
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
SpecialPowers.addObserver(this, "http-on-modify-request", false);
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
}
examiner.prototype = {
@ -32,12 +32,11 @@ examiner.prototype = {
if(!SpecialPowers.can_QI(subject))
return;
if (topic === "http-on-modify-request") {
if (topic === "specialpowers-http-notify-request") {
// this is used to fail the test - if we see the POST to the target of the redirect
// we know this is a fail
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
if (asciiSpec == "http://example.com/some/fake/path")
var uri = data;
if (uri == "http://example.com/some/fake/path")
window.done(false);
}
@ -52,7 +51,7 @@ examiner.prototype = {
// or mochitests might get borked.
remove: function() {
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
SpecialPowers.removeObserver(this, "http-on-modify-request");
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
}
}

View File

@ -23,7 +23,7 @@ Test that CSP violation reports are not sent when a 303 redirect is encountered
// This is used to watch the redirect of the report POST get blocked
function examiner() {
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
SpecialPowers.addObserver(this, "http-on-modify-request", false);
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
}
examiner.prototype = {
@ -32,12 +32,11 @@ examiner.prototype = {
if(!SpecialPowers.can_QI(subject))
return;
if (topic === "http-on-modify-request") {
if (topic === "specialpowers-http-notify-request") {
// this is used to fail the test - if we see the POST to the target of the redirect
// we know this is a fail
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
if (asciiSpec == "http://example.com/some/fake/path")
var uri = data;
if (uri == "http://example.com/some/fake/path")
window.done(false);
}
@ -52,7 +51,7 @@ examiner.prototype = {
// or mochitests might get borked.
remove: function() {
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
SpecialPowers.removeObserver(this, "http-on-modify-request");
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
}
}

View File

@ -23,7 +23,7 @@ Test that CSP violation reports are not sent when a 307 redirect is encountered
// This is used to watch the redirect of the report POST get blocked
function examiner() {
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
SpecialPowers.addObserver(this, "http-on-modify-request", false);
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
}
examiner.prototype = {
@ -32,12 +32,11 @@ examiner.prototype = {
if(!SpecialPowers.can_QI(subject))
return;
if (topic === "http-on-modify-request") {
if (topic === "specialpowers-http-notify-request") {
// this is used to fail the test - if we see the POST to the target of the redirect
// we know this is a fail
var asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"), "URI.asciiSpec");
if (asciiSpec == "http://example.com/some/fake/path")
var uri = data;
if (uri == "http://example.com/some/fake/path")
window.done(false);
}
@ -52,7 +51,7 @@ examiner.prototype = {
// or mochitests might get borked.
remove: function() {
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
SpecialPowers.removeObserver(this, "http-on-modify-request");
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
}
}

View File

@ -40,26 +40,18 @@ window.tests = {
// get sent out to the wire.
function examiner() {
SpecialPowers.addObserver(this, "csp-on-violate-policy", false);
SpecialPowers.addObserver(this, "http-on-modify-request", false);
SpecialPowers.addObserver(this, "specialpowers-http-notify-request", false);
}
examiner.prototype = {
observe: function(subject, topic, data) {
// subject should be an nsIHttpChannel (for http-on-modify-request)
// and nsIURI for csp-on-violate-policy, and the Request should be
//either allowed or blocked.
if(!SpecialPowers.can_QI(subject))
return;
var testpat = new RegExp("testid=([a-z0-9_]+)");
//_good things better be allowed!
//_bad things better be stopped!
if (topic === "http-on-modify-request") {
if (topic === "specialpowers-http-notify-request") {
//these things were allowed by CSP
var asciiSpec = SpecialPowers.getPrivilegedProps(
SpecialPowers.do_QueryInterface(subject, "nsIHttpChannel"),
"URI.asciiSpec");
var asciiSpec = data;
if (!testpat.test(asciiSpec)) return;
var testid = testpat.exec(asciiSpec)[1];
window.testResult(testid,
@ -69,6 +61,11 @@ examiner.prototype = {
}
if(topic === "csp-on-violate-policy") {
// subject should be an nsIURI for csp-on-violate-policy
if (!SpecialPowers.can_QI(subject)) {
return;
}
//these were blocked... record that they were blocked
var asciiSpec = SpecialPowers.getPrivilegedProps(
SpecialPowers.do_QueryInterface(subject, "nsIURI"),
@ -85,7 +82,7 @@ examiner.prototype = {
// or mochitests might get borked.
remove: function() {
SpecialPowers.removeObserver(this, "csp-on-violate-policy");
SpecialPowers.removeObserver(this, "http-on-modify-request");
SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
}
}