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 shouldBeTrue("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 shouldBeEqualToString("new SecurityPolicyViolationEvent('eventType').disposition
", "enforce"); |
25 shouldBe("new SecurityPolicyViolationEvent('eventType').lineNumber", "0"); | 25 shouldBe("new SecurityPolicyViolationEvent('eventType').lineNumber", "0"); |
26 shouldBe("new SecurityPolicyViolationEvent('eventType').columnNumber", "0"); | 26 shouldBe("new SecurityPolicyViolationEvent('eventType').columnNumber", "0"); |
27 shouldBe("new SecurityPolicyViolationEvent('eventType').statusCode", "0"); | 27 shouldBe("new SecurityPolicyViolationEvent('eventType').statusCode", "0"); |
28 | 28 |
29 // bubbles is passed. | 29 // bubbles is always true. |
30 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { bubbles: false })
.bubbles"); | 30 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { bubbles: false }).
bubbles"); |
31 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { bubbles: true }).b
ubbles"); | 31 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { bubbles: true }).b
ubbles"); |
32 | 32 |
33 // cancelable is passed. | 33 // cancelable is always false. |
34 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { cancelable: false
}).cancelable"); | 34 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { cancelable: false
}).cancelable"); |
35 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { cancelable: true }
).cancelable"); | 35 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { cancelable: true
}).cancelable"); |
36 | 36 |
37 // String members are passed. | 37 // String members are passed. |
38 ["documentURI", "referrer", "blockedURI", "violatedDirective", "effectiveDirecti
ve", "originalPolicy", "sourceFile"].forEach(function(member) { | 38 ["documentURI", "referrer", "blockedURI", "violatedDirective", "effectiveDirecti
ve", "originalPolicy", "sourceFile"].forEach(function(member) { |
39 shouldBeEqualToString("new SecurityPolicyViolationEvent('eventType', { " + m
ember + ": 'foo' })." + member, "foo"); | 39 shouldBeEqualToString("new SecurityPolicyViolationEvent('eventType', { " + m
ember + ": 'foo' })." + member, "foo"); |
40 }); | 40 }); |
41 | 41 |
42 // Enum members throw on unknown initializer values. | 42 // Enum members throw on unknown initializer values. |
43 shouldThrow("new SecurityPolicyViolationEvent('eventType', { disposition: 'foo'
}).disposition"); | 43 shouldThrow("new SecurityPolicyViolationEvent('eventType', { disposition: 'foo'
}).disposition"); |
44 | 44 |
45 // Number members are passed. | 45 // Number members are passed. |
46 ["lineNumber", "columnNumber", "statusCode"].forEach(function(member) { | 46 ["lineNumber", "columnNumber", "statusCode"].forEach(function(member) { |
47 shouldBe("new SecurityPolicyViolationEvent('eventType', { " + member + ": 42
})." + member, "42"); | 47 shouldBe("new SecurityPolicyViolationEvent('eventType', { " + member + ": 42
})." + member, "42"); |
48 }); | 48 }); |
49 </script> | 49 </script> |
50 </body> | 50 </body> |
51 </html> | 51 </html> |
OLD | NEW |