Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/push_messaging/resources/pushmessagedata-worker.js

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: update comment, add TODO Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698