diff options
Diffstat (limited to 'testing/web-platform/tests/content-security-policy')
-rw-r--r-- | testing/web-platform/tests/content-security-policy/securitypolicyviolation/constructor-required-fields.html | 213 |
1 files changed, 103 insertions, 110 deletions
diff --git a/testing/web-platform/tests/content-security-policy/securitypolicyviolation/constructor-required-fields.html b/testing/web-platform/tests/content-security-policy/securitypolicyviolation/constructor-required-fields.html index 1a090d8e2c..1f30e38b0c 100644 --- a/testing/web-platform/tests/content-security-policy/securitypolicyviolation/constructor-required-fields.html +++ b/testing/web-platform/tests/content-security-policy/securitypolicyviolation/constructor-required-fields.html @@ -25,118 +25,111 @@ }), undefined); }, "SecurityPolicyViolationEvent constructor works with an init dict"); - // missing required members + // missing optional members test(function() { - assert_throws_js(TypeError, - function() { new SecurityPolicyViolationEvent("securitypolicyviolation", { - // documentURI: "http://example.com", - referrer: "http://example.com", - blockedURI: "http://example.com", - violatedDirective: "default-src", - effectiveDirective: "default-src", - originalPolicy: "default-src 'none'", - sourceFile: "example.js", - sample: "<script>alert('1');</scr" + "ipt>", - disposition: "enforce", - statusCode: 200, - lineNumber: 1, - columnNumber: 1, - })}); - }, "SecurityPolicyViolationEvent constructor requires documentURI"); + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + // documentURI: "http://example.com", + referrer: "http://example.com", + blockedURI: "http://example.com", + violatedDirective: "default-src", + effectiveDirective: "default-src", + originalPolicy: "default-src 'none'", + sourceFile: "example.js", + sample: "<script>alert('1');</scr" + "ipt>", + disposition: "enforce", + statusCode: 200, + lineNumber: 1, + columnNumber: 1, + }).documentURI, ""); + }, "SecurityPolicyViolationEvent constructor does not require documentURI"); test(function() { - assert_throws_js(TypeError, - function() { new SecurityPolicyViolationEvent("securitypolicyviolation", { - documentURI: "http://example.com", - referrer: "http://example.com", - blockedURI: "http://example.com", - // violatedDirective: "default-src", - effectiveDirective: "default-src", - originalPolicy: "default-src 'none'", - sourceFile: "example.js", - sample: "<script>alert('1');</scr" + "ipt>", - disposition: "enforce", - statusCode: 200, - lineNumber: 1, - columnNumber: 1, - })}); - }, "SecurityPolicyViolationEvent constructor requires violatedDirective"); + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + documentURI: "http://example.com", + referrer: "http://example.com", + blockedURI: "http://example.com", + // violatedDirective: "default-src", + effectiveDirective: "default-src", + originalPolicy: "default-src 'none'", + sourceFile: "example.js", + sample: "<script>alert('1');</scr" + "ipt>", + disposition: "enforce", + statusCode: 200, + lineNumber: 1, + columnNumber: 1, + }).violatedDirective, ""); + }, "SecurityPolicyViolationEvent constructor does not require violatedDirective"); test(function() { - assert_throws_js(TypeError, - function() { new SecurityPolicyViolationEvent("securitypolicyviolation", { - documentURI: "http://example.com", - referrer: "http://example.com", - blockedURI: "http://example.com", - violatedDirective: "default-src", - // effectiveDirective: "default-src", - originalPolicy: "default-src 'none'", - sourceFile: "example.js", - sample: "<script>alert('1');</scr" + "ipt>", - disposition: "enforce", - statusCode: 200, - lineNumber: 1, - columnNumber: 1, - })}); - }, "SecurityPolicyViolationEvent constructor requires effectiveDirective"); + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + documentURI: "http://example.com", + referrer: "http://example.com", + blockedURI: "http://example.com", + violatedDirective: "default-src", + // effectiveDirective: "default-src", + originalPolicy: "default-src 'none'", + sourceFile: "example.js", + sample: "<script>alert('1');</scr" + "ipt>", + disposition: "enforce", + statusCode: 200, + lineNumber: 1, + columnNumber: 1, + }).effectiveDirective, ""); + }, "SecurityPolicyViolationEvent constructor does not require effectiveDirective"); test(function() { - assert_throws_js(TypeError, - function() { new SecurityPolicyViolationEvent("securitypolicyviolation", { - documentURI: "http://example.com", - referrer: "http://example.com", - blockedURI: "http://example.com", - violatedDirective: "default-src", - effectiveDirective: "default-src", - // originalPolicy: "default-src 'none'", - sourceFile: "example.js", - sample: "<script>alert('1');</scr" + "ipt>", - disposition: "enforce", - statusCode: 200, - lineNumber: 1, - columnNumber: 1, - })}); - }, "SecurityPolicyViolationEvent constructor requires originalPolicy"); + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + documentURI: "http://example.com", + referrer: "http://example.com", + blockedURI: "http://example.com", + violatedDirective: "default-src", + effectiveDirective: "default-src", + // originalPolicy: "default-src 'none'", + sourceFile: "example.js", + sample: "<script>alert('1');</scr" + "ipt>", + disposition: "enforce", + statusCode: 200, + lineNumber: 1, + columnNumber: 1, + }).originalPolicy, ""); + }, "SecurityPolicyViolationEvent constructor does not require originalPolicy"); test(function() { - assert_throws_js(TypeError, - function() { new SecurityPolicyViolationEvent("securitypolicyviolation", { - documentURI: "http://example.com", - referrer: "http://example.com", - blockedURI: "http://example.com", - violatedDirective: "default-src", - effectiveDirective: "default-src", - originalPolicy: "default-src 'none'", - sourceFile: "example.js", - sample: "<script>alert('1');</scr" + "ipt>", - // disposition: "enforce", - statusCode: 200, - lineNumber: 1, - columnNumber: 1, - })}); - }, "SecurityPolicyViolationEvent constructor requires disposition"); + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + documentURI: "http://example.com", + referrer: "http://example.com", + blockedURI: "http://example.com", + violatedDirective: "default-src", + effectiveDirective: "default-src", + originalPolicy: "default-src 'none'", + sourceFile: "example.js", + sample: "<script>alert('1');</scr" + "ipt>", + // disposition: "enforce", + statusCode: 200, + lineNumber: 1, + columnNumber: 1, + }).disposition, "enforce"); + }, "SecurityPolicyViolationEvent constructor does not require disposition"); test(function() { - assert_throws_js(TypeError, - function() { new SecurityPolicyViolationEvent("securitypolicyviolation", { - documentURI: "http://example.com", - referrer: "http://example.com", - blockedURI: "http://example.com", - violatedDirective: "default-src", - effectiveDirective: "default-src", - originalPolicy: "default-src 'none'", - sourceFile: "example.js", - sample: "<script>alert('1');</scr" + "ipt>", - disposition: "enforce", - // statusCode: 200, - lineNumber: 1, - columnNumber: 1, - })}); - }, "SecurityPolicyViolationEvent constructor requires statusCode"); + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + documentURI: "http://example.com", + referrer: "http://example.com", + blockedURI: "http://example.com", + violatedDirective: "default-src", + effectiveDirective: "default-src", + originalPolicy: "default-src 'none'", + sourceFile: "example.js", + sample: "<script>alert('1');</scr" + "ipt>", + disposition: "enforce", + // statusCode: 200, + lineNumber: 1, + columnNumber: 1, + }).statusCode, 0); + }, "SecurityPolicyViolationEvent constructor does not require statusCode"); - // missing optional members test(function() { - assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { documentURI: "http://example.com", // referrer: "http://example.com", blockedURI: "http://example.com", @@ -149,11 +142,11 @@ statusCode: 200, lineNumber: 1, columnNumber: 1, - }), undefined); + }).referrer, ""); }, "SecurityPolicyViolationEvent constructor does not require referrer"); test(function() { - assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { documentURI: "http://example.com", referrer: "http://example.com", // blockedURI: "http://example.com", @@ -166,11 +159,11 @@ statusCode: 200, lineNumber: 1, columnNumber: 1, - }), undefined); + }).blockedURI, ""); }, "SecurityPolicyViolationEvent constructor does not require blockedURI"); test(function() { - assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { documentURI: "http://example.com", referrer: "http://example.com", blockedURI: "http://example.com", @@ -183,11 +176,11 @@ statusCode: 200, lineNumber: 1, columnNumber: 1, - }), undefined); + }).sourceFile, ""); }, "SecurityPolicyViolationEvent constructor does not require sourceFile"); test(function() { - assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { documentURI: "http://example.com", referrer: "http://example.com", blockedURI: "http://example.com", @@ -200,11 +193,11 @@ statusCode: 200, lineNumber: 1, columnNumber: 1, - }), undefined); + }).sample, ""); }, "SecurityPolicyViolationEvent constructor does not require sample"); test(function() { - assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { documentURI: "http://example.com", referrer: "http://example.com", blockedURI: "http://example.com", @@ -217,11 +210,11 @@ statusCode: 200, // lineNumber: 1, columnNumber: 1, - }), undefined); + }).lineNumber, 0); }, "SecurityPolicyViolationEvent constructor does not require lineNumber"); test(function() { - assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { + assert_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", { documentURI: "http://example.com", referrer: "http://example.com", blockedURI: "http://example.com", @@ -234,6 +227,6 @@ statusCode: 200, lineNumber: 1, // columnNumber: 1, - }), undefined); + }).columnNumber, 0); }, "SecurityPolicyViolationEvent constructor does not require columnNumber"); </script> |