OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 | 8 |
9 description("This tests the constructor for the SecurityPolicyViolationEvent DOM
class."); | 9 description("This tests the constructor for the SecurityPolicyViolationEvent DOM
class."); |
10 | 10 |
11 var testObject = {nyannyan: 123}; | 11 var testObject = {nyannyan: 123}; |
12 var testDiv = document.createElement("div"); | 12 var testDiv = document.createElement("div"); |
13 | 13 |
14 // No initializer is passed. | 14 // No initializer is passed. |
15 shouldBeFalse("new SecurityPolicyViolationEvent('eventType').bubbles"); | 15 shouldBeFalse("new SecurityPolicyViolationEvent('eventType').bubbles"); |
16 shouldBeFalse("new SecurityPolicyViolationEvent('eventType').cancelable"); | 16 shouldBeFalse("new SecurityPolicyViolationEvent('eventType').cancelable"); |
17 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').documentURI")
; | 17 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').documentURI")
; |
18 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').referrer"); | 18 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').referrer"); |
19 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').blockedURI"); | 19 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').blockedURI"); |
20 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').violatedDirec
tive"); | 20 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').violatedDirec
tive"); |
21 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').effectiveDire
ctive"); | 21 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').effectiveDire
ctive"); |
22 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').originalPolic
y"); | 22 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').originalPolic
y"); |
23 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').sourceFile"); | 23 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').sourceFile"); |
| 24 shouldBeEqualToString("new SecurityPolicyViolationEvent('eventType').disposition
", "enforce"); |
24 shouldBe("new SecurityPolicyViolationEvent('eventType').lineNumber", "0"); | 25 shouldBe("new SecurityPolicyViolationEvent('eventType').lineNumber", "0"); |
25 shouldBe("new SecurityPolicyViolationEvent('eventType').columnNumber", "0"); | 26 shouldBe("new SecurityPolicyViolationEvent('eventType').columnNumber", "0"); |
26 shouldBe("new SecurityPolicyViolationEvent('eventType').statusCode", "0"); | 27 shouldBe("new SecurityPolicyViolationEvent('eventType').statusCode", "0"); |
27 | 28 |
28 // bubbles is passed. | 29 // bubbles is passed. |
29 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { bubbles: false })
.bubbles"); | 30 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { bubbles: false })
.bubbles"); |
30 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { bubbles: true }).b
ubbles"); | 31 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { bubbles: true }).b
ubbles"); |
31 | 32 |
32 // cancelable is passed. | 33 // cancelable is passed. |
33 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { cancelable: false
}).cancelable"); | 34 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { cancelable: false
}).cancelable"); |
34 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { cancelable: true }
).cancelable"); | 35 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { cancelable: true }
).cancelable"); |
35 | 36 |
36 // String members are passed. | 37 // String members are passed. |
37 ["documentURI", "referrer", "blockedURI", "violatedDirective", "effectiveDirecti
ve", "originalPolicy", "sourceFile"].forEach(function(member) { | 38 ["documentURI", "referrer", "blockedURI", "violatedDirective", "effectiveDirecti
ve", "originalPolicy", "sourceFile"].forEach(function(member) { |
38 shouldBeEqualToString("new SecurityPolicyViolationEvent('eventType', { " + m
ember + ": 'foo' })." + member, "foo"); | 39 shouldBeEqualToString("new SecurityPolicyViolationEvent('eventType', { " + m
ember + ": 'foo' })." + member, "foo"); |
39 }); | 40 }); |
40 | 41 |
| 42 // Enum members throw on unknown initializer values. |
| 43 shouldThrow("new SecurityPolicyViolationEvent('eventType', { disposition: 'foo'
}).disposition"); |
| 44 |
41 // Number members are passed. | 45 // Number members are passed. |
42 ["lineNumber", "columnNumber", "statusCode"].forEach(function(member) { | 46 ["lineNumber", "columnNumber", "statusCode"].forEach(function(member) { |
43 shouldBe("new SecurityPolicyViolationEvent('eventType', { " + member + ": 42
})." + member, "42"); | 47 shouldBe("new SecurityPolicyViolationEvent('eventType', { " + member + ": 42
})." + member, "42"); |
44 }); | 48 }); |
45 </script> | 49 </script> |
46 </body> | 50 </body> |
47 </html> | 51 </html> |
OLD | NEW |