4 <script src=
"../../../resources/js-test.js"></script>
9 description("This tests the constructor for the SecurityPolicyViolationEvent DOM class.");
11 var testObject
= {nyannyan
: 123};
12 var testDiv
= document
.createElement("div");
14 // No initializer is passed.
15 shouldBeFalse("new SecurityPolicyViolationEvent('eventType').bubbles");
16 shouldBeFalse("new SecurityPolicyViolationEvent('eventType').cancelable");
17 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').documentURI");
18 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').referrer");
19 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').blockedURI");
20 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').violatedDirective");
21 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').effectiveDirective");
22 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').originalPolicy");
23 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').sourceFile");
24 shouldBe("new SecurityPolicyViolationEvent('eventType').lineNumber", "0");
25 shouldBe("new SecurityPolicyViolationEvent('eventType').columnNumber", "0");
26 shouldBe("new SecurityPolicyViolationEvent('eventType').statusCode", "0");
29 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { bubbles: false }).bubbles");
30 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { bubbles: true }).bubbles");
32 // cancelable is passed.
33 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { cancelable: false }).cancelable");
34 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { cancelable: true }).cancelable");
36 // String members are passed.
37 ["documentURI", "referrer", "blockedURI", "violatedDirective", "effectiveDirective", "originalPolicy", "sourceFile"].forEach(function(member
) {
38 shouldBeEqualToString("new SecurityPolicyViolationEvent('eventType', { " + member
+ ": 'foo' })." + member
, "foo");
41 // Number members are passed.
42 ["lineNumber", "columnNumber", "statusCode"].forEach(function(member
) {
43 shouldBe("new SecurityPolicyViolationEvent('eventType', { " + member
+ ": 42 })." + member
, "42");