OLD | NEW |
1 importScripts('../../serviceworker/resources/worker-testharness.js'); | 1 importScripts('../../serviceworker/resources/worker-testharness.js'); |
2 | 2 |
3 function createPushMessageData(data) | 3 function createPushMessageData(data) |
4 { | 4 { |
5 // The PushMessageData object does not expose a constructor, but we can get
an object | 5 // The PushMessageData object does not expose a constructor, but we can get
an object |
6 // initialized with our data by constructing a PushEvent. | 6 // initialized with our data by constructing a PushEvent. |
7 return new PushEvent('PushEvent', { data: data }).data; | 7 return new PushEvent('PushEvent', { data: data }).data; |
8 } | 8 } |
9 | 9 |
10 test(function() { | 10 test(function() { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 assert_throws(null, () => new PushMessageData(new ArrayBuffer(8))); | 101 assert_throws(null, () => new PushMessageData(new ArrayBuffer(8))); |
102 | 102 |
103 }, 'PushMessageData should not be constructable.'); | 103 }, 'PushMessageData should not be constructable.'); |
104 | 104 |
105 test(function() { | 105 test(function() { |
106 var s = "e\u0328"; // 'e' + COMBINING OGONEK | 106 var s = "e\u0328"; // 'e' + COMBINING OGONEK |
107 var data = createPushMessageData(s); | 107 var data = createPushMessageData(s); |
108 assert_equals(data.text(), s, 'String should not be NFC-normalized.'); | 108 assert_equals(data.text(), s, 'String should not be NFC-normalized.'); |
109 | 109 |
110 }, 'PushEventInit data is not normalized'); | 110 }, 'PushEventInit data is not normalized'); |
| 111 |
| 112 if (self.SharedArrayBuffer) { |
| 113 test(function() { |
| 114 assert_throws(null, () => { |
| 115 createPushMessageData(new Uint8Array(new SharedArrayBuffer(16))); |
| 116 }); |
| 117 }, 'PushMessageData throws when passed SharedArrayBuffer view.'); |
| 118 } |
OLD | NEW |