| 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 MessageEvent DOM class."); | 9 description("This tests the constructor for the MessageEvent DOM class."); |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // source is passed. | 69 // source is passed. |
| 70 // Window objects. | 70 // Window objects. |
| 71 shouldBe("new MessageEvent('eventType', { source: window }).source", "window"); | 71 shouldBe("new MessageEvent('eventType', { source: window }).source", "window"); |
| 72 shouldBe("new MessageEvent('eventType', { source: this }).source", "this"); | 72 shouldBe("new MessageEvent('eventType', { source: this }).source", "this"); |
| 73 | 73 |
| 74 // MessagePort objects. | 74 // MessagePort objects. |
| 75 var channel = new MessageChannel(); | 75 var channel = new MessageChannel(); |
| 76 shouldBe("new MessageEvent('eventType', { ports: [channel.port1], source: channe
l.port1 }).source", "channel.port1"); | 76 shouldBe("new MessageEvent('eventType', { ports: [channel.port1], source: channe
l.port1 }).source", "channel.port1"); |
| 77 | 77 |
| 78 // Unacceptable source objects (not a Window or a MessagePort). | 78 // Unacceptable source objects (not a Window or a MessagePort). |
| 79 shouldBe("new MessageEvent('eventType', { source: test_object }).source", "null"
); | 79 shouldThrow("new MessageEvent('eventType', { source: test_object }).source"); |
| 80 shouldBe("new MessageEvent('eventType', { source: document }).source", "null"); | 80 shouldThrow("new MessageEvent('eventType', { source: document }).source"); |
| 81 shouldBe("new MessageEvent('eventType', { source: document.body }).source", "nul
l"); | 81 shouldThrow("new MessageEvent('eventType', { source: document.body }).source"); |
| 82 shouldBe("new MessageEvent('eventType', { source: undefined }).source", "null"); | 82 shouldBe("new MessageEvent('eventType', { source: undefined }).source", "null"); |
| 83 shouldBe("new MessageEvent('eventType', { source: null }).source", "null"); | 83 shouldBe("new MessageEvent('eventType', { source: null }).source", "null"); |
| 84 shouldBe("new MessageEvent('eventType', { source: false }).source", "null"); | 84 shouldThrow("new MessageEvent('eventType', { source: false }).source"); |
| 85 shouldBe("new MessageEvent('eventType', { source: true }).source", "null"); | 85 shouldThrow("new MessageEvent('eventType', { source: true }).source"); |
| 86 shouldBe("new MessageEvent('eventType', { source: '' }).source", "null"); | 86 shouldThrow("new MessageEvent('eventType', { source: '' }).source"); |
| 87 shouldBe("new MessageEvent('eventType', { source: 'chocolate' }).source", "null"
); | 87 shouldThrow("new MessageEvent('eventType', { source: 'chocolate' }).source"); |
| 88 shouldBe("new MessageEvent('eventType', { source: 12345 }).source", "null"); | 88 shouldThrow("new MessageEvent('eventType', { source: 12345 }).source"); |
| 89 shouldBe("new MessageEvent('eventType', { source: 18446744073709551615 }).source
", "null"); | 89 shouldThrow("new MessageEvent('eventType', { source: 18446744073709551615 }).sou
rce"); |
| 90 shouldBe("new MessageEvent('eventType', { source: NaN }).source", "null"); | 90 shouldThrow("new MessageEvent('eventType', { source: NaN }).source"); |
| 91 // Note that valueOf() is not called, when the left hand side is evaluated. | 91 // Note that valueOf() is not called, when the left hand side is evaluated. |
| 92 shouldBeFalse("new MessageEvent('eventType', { source: {valueOf: function () { r
eturn window; } } }).source == window"); | 92 shouldThrow("new MessageEvent('eventType', { source: {valueOf: function () { ret
urn window; } } }).source == window"); |
| 93 shouldBe("new MessageEvent('eventType', { get source() { return 123; } }).source
", "null"); | 93 shouldBe("new MessageEvent('eventType', { get source() { return window; } }).sou
rce", "window"); |
| 94 shouldThrow("new MessageEvent('eventType', { get source() { return 123; } }).sou
rce"); |
| 94 shouldThrow("new MessageEvent('eventType', { get source() { throw 'MessageEvent
Error'; } })"); | 95 shouldThrow("new MessageEvent('eventType', { get source() { throw 'MessageEvent
Error'; } })"); |
| 95 | 96 |
| 96 // ports is passed. | 97 // ports is passed. |
| 97 // Valid message ports. | 98 // Valid message ports. |
| 98 var channel2 = new MessageChannel(); | 99 var channel2 = new MessageChannel(); |
| 99 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2,
channel2.port1] }).ports[0]", "channel.port1"); | 100 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2,
channel2.port1] }).ports[0]", "channel.port1"); |
| 100 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2,
channel2.port1] }).ports[1]", "channel.port2"); | 101 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2,
channel2.port1] }).ports[1]", "channel.port2"); |
| 101 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2,
channel2.port1] }).ports[2]", "channel2.port1"); | 102 shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2,
channel2.port1] }).ports[2]", "channel2.port1"); |
| 102 shouldBe("new MessageEvent('eventType', { ports: [] }).ports", "[]"); | 103 shouldBe("new MessageEvent('eventType', { ports: [] }).ports", "[]"); |
| 103 shouldBe("new MessageEvent('eventType', { ports: undefined }).ports", "[]"); | 104 shouldBe("new MessageEvent('eventType', { ports: undefined }).ports", "[]"); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 125 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data:
test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por
ts: [channel.port1, channel.port2, channel2.port1] }).data", "test_object"); | 126 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data:
test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por
ts: [channel.port1, channel.port2, channel2.port1] }).data", "test_object"); |
| 126 shouldBeEqualToString("new MessageEvent('eventType', { bubbles: true, cancelable
: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source
: window, ports: [channel.port1, channel.port2, channel2.port1] }).origin", "won
derful"); | 127 shouldBeEqualToString("new MessageEvent('eventType', { bubbles: true, cancelable
: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source
: window, ports: [channel.port1, channel.port2, channel2.port1] }).origin", "won
derful"); |
| 127 shouldBeEqualToString("new MessageEvent('eventType', { bubbles: true, cancelable
: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source
: window, ports: [channel.port1, channel.port2, channel2.port1] }).lastEventId",
"excellent"); | 128 shouldBeEqualToString("new MessageEvent('eventType', { bubbles: true, cancelable
: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source
: window, ports: [channel.port1, channel.port2, channel2.port1] }).lastEventId",
"excellent"); |
| 128 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data:
test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por
ts: [channel.port1, channel.port2, channel2.port1] }).source", "window"); | 129 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data:
test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por
ts: [channel.port1, channel.port2, channel2.port1] }).source", "window"); |
| 129 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data:
test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por
ts: [channel.port1, channel.port2, channel2.port1] }).ports[0]", "channel.port1"
); | 130 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data:
test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por
ts: [channel.port1, channel.port2, channel2.port1] }).ports[0]", "channel.port1"
); |
| 130 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data:
test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por
ts: [channel.port1, channel.port2, channel2.port1] }).ports[1]", "channel.port2"
); | 131 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data:
test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por
ts: [channel.port1, channel.port2, channel2.port1] }).ports[1]", "channel.port2"
); |
| 131 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data:
test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por
ts: [channel.port1, channel.port2, channel2.port1] }).ports[2]", "channel2.port1
"); | 132 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data:
test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, por
ts: [channel.port1, channel.port2, channel2.port1] }).ports[2]", "channel2.port1
"); |
| 132 </script> | 133 </script> |
| 133 </body> | 134 </body> |
| 134 </html> | 135 </html> |
| OLD | NEW |