Changeset 222045 in webkit
- Timestamp:
- Sep 14, 2017 12:45:31 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r222040 r222045 1 2017-09-14 Youenn Fablet <youenn@apple.com> 2 3 RTCDataChannel connectivity issues in Safari 11 4 https://bugs.webkit.org/show_bug.cgi?id=173052 5 <rdar://problem/32712143> 6 7 Reviewed by Alex Christensen. 8 9 * webrtc/datachannel/binary-expected.txt: 10 * webrtc/datachannel/binary.html: 11 1 12 2017-09-14 Antti Koivisto <antti@apple.com> 2 13 -
trunk/LayoutTests/webrtc/datachannel/binary-expected.txt
r218774 r222045 1 1 2 2 PASS Basic binary data channel exchange from offerer to receiver 3 PASS test array buffer 1 4 PASS test array buffer 2 5 PASS test array buffer 3 6 PASS test array buffer 4 7 PASS test array buffer view 1 8 PASS test array buffer view 2 9 PASS test array buffer view 3 10 PASS test array buffer view 4 3 11 -
trunk/LayoutTests/webrtc/datachannel/binary.html
r218774 r222045 27 27 } 28 28 29 function createArrayBufferView(length) 30 { 31 return createArrayBuffer(2 * length).subarray(length, 2 * length); 32 } 33 29 34 function checkArrayBuffer(array, length) 30 35 { … … 40 45 } 41 46 47 function checkArrayBufferView(array, length) 48 { 49 if (array.byteLength !== length) 50 return false; 51 52 var a = new Uint8Array(array); 53 for (var cptr = 0; cptr < length; cptr++) { 54 if (a[cptr] !== cptr + length + 1) 55 return false; 56 } 57 return true; 58 } 59 60 function testArrayBuffer(array, length) 61 { 62 test(() => { 63 assert_true(checkArrayBuffer(array, length)); 64 }, "test array buffer " + length); 65 } 66 67 function testArrayBufferView(array, length) 68 { 69 test(() => { 70 assert_true(checkArrayBufferView(array, length)); 71 }, "test array buffer view " + length); 72 } 73 42 74 function receiveMessages(event) { 43 75 try { 44 76 if (++counter === 1) 45 assert_true(checkArrayBuffer(event.data, 1));77 testArrayBuffer(event.data, 1); 46 78 else if (counter === 2) 47 assert_true(checkArrayBuffer(event.data, 2));79 testArrayBuffer(event.data, 2); 48 80 else if (counter === 3) 49 assert_true(checkArrayBuffer(event.data, 3)); 50 else if (counter === 4) { 51 assert_true(checkArrayBuffer(event.data, 4)); 81 testArrayBuffer(event.data, 3); 82 else if (counter === 4) 83 testArrayBuffer(event.data, 4); 84 else if (counter === 5) 85 testArrayBufferView(event.data, 1); 86 else if (counter === 6) 87 testArrayBufferView(event.data, 2); 88 else if (counter === 7) 89 testArrayBufferView(event.data, 3); 90 else if (counter === 8) { 91 testArrayBufferView(event.data, 4); 52 92 closeDataChannels(); 53 93 finishTest(); … … 65 105 channel.send(createArrayBuffer(3)); 66 106 channel.send(createArrayBuffer(4)); 107 channel.send(createArrayBufferView(1)); 108 channel.send(createArrayBufferView(2)); 109 channel.send(createArrayBufferView(3)); 110 channel.send(createArrayBufferView(4)); 67 111 } 68 112 -
trunk/Source/WebCore/ChangeLog
r222040 r222045 1 2017-09-14 Youenn Fablet <youenn@apple.com> 2 3 RTCDataChannel connectivity issues in Safari 11 4 https://bugs.webkit.org/show_bug.cgi?id=173052 5 <rdar://problem/32712143> 6 7 Reviewed by Alex Christensen. 8 9 Covered by updated test. 10 11 Before the patch, when sending an ArrayBufferView, RTCDataChannel was sending the whole ArrayBuffer backing the ArrayBufferView. 12 With this patch, RTCDataChannel will now send only the bytes the ArrayBufferView is exposing. 13 14 * Modules/mediastream/RTCDataChannel.cpp: 15 (WebCore::RTCDataChannel::send): Correctly handling sending of ArrayBufferView. 16 (WebCore::RTCDataChannel::sendRawData): Helper routine for raw data sending. 17 * Modules/mediastream/RTCDataChannel.h: 18 1 19 2017-09-14 Antti Koivisto <antti@apple.com> 2 20 -
trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp
r219856 r222045 106 106 ExceptionOr<void> RTCDataChannel::send(const String& data) 107 107 { 108 // FIXME: We should only throw in Connected state.109 108 if (m_readyState != RTCDataChannelState::Open) 110 109 return Exception { InvalidStateError }; … … 118 117 } 119 118 120 ExceptionOr<void> RTCDataChannel::send(ArrayBuffer& data) 121 { 122 // FIXME: We should only throw in Connected state. 119 ExceptionOr<void> RTCDataChannel::sendRawData(const char* data, size_t length) 120 { 123 121 if (m_readyState != RTCDataChannelState::Open) 124 122 return Exception { InvalidStateError }; 125 123 126 size_t dataLength = data.byteLength(); 127 if (!dataLength) 124 if (!length) 128 125 return { }; 129 126 130 const char* dataPointer = static_cast<const char*>(data.data()); 131 132 if (!m_handler->sendRawData(dataPointer, dataLength)) { 127 if (!m_handler->sendRawData(data, length)) { 133 128 // FIXME: Decide what the right exception here is. 134 129 return Exception { SyntaxError }; … … 138 133 } 139 134 135 136 ExceptionOr<void> RTCDataChannel::send(ArrayBuffer& data) 137 { 138 return sendRawData(static_cast<const char*>(data.data()), data.byteLength()); 139 } 140 140 141 ExceptionOr<void> RTCDataChannel::send(ArrayBufferView& data) 141 142 { 142 // FIXME: We should only throw in Connected state. 143 return send(*data.unsharedBuffer()); 143 return sendRawData(static_cast<const char*>(data.baseAddress()), data.byteLength()); 144 144 } 145 145 -
trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.h
r214627 r222045 89 89 void derefEventTarget() final { deref(); } 90 90 91 ExceptionOr<void> sendRawData(const char* data, size_t length); 92 91 93 // ActiveDOMObject API 92 94 void stop() final;
Note: See TracChangeset
for help on using the changeset viewer.