Changeset 244196 in webkit


Ignore:
Timestamp:
Apr 11, 2019 2:51:10 PM (5 years ago)
Author:
youenn@apple.com
Message:

Support RTCDataChannel blob binaryType
https://bugs.webkit.org/show_bug.cgi?id=196821

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

  • web-platform-tests/webrtc/RTCDataChannel-send-expected.txt:

Source/WebCore:

Add support for receiving blobs.
Default value is still left to 'arraybuffer' which is not spec compliant.
Covered by rebased test.

  • Modules/mediastream/RTCDataChannel.cpp:

(WebCore::RTCDataChannel::setBinaryType):
(WebCore::RTCDataChannel::didReceiveRawData):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r244182 r244196  
     12019-04-11  Youenn Fablet  <youenn@apple.com>
     2
     3        Support RTCDataChannel blob binaryType
     4        https://bugs.webkit.org/show_bug.cgi?id=196821
     5
     6        Reviewed by Eric Carlson.
     7
     8        * web-platform-tests/webrtc/RTCDataChannel-send-expected.txt:
     9
    1102019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannel-send-expected.txt

    r230524 r244196  
    77PASS Data channel should be able to send ArrayBuffer message and receive as ArrayBuffer
    88FAIL Data channel should be able to send Blob message and receive as ArrayBuffer promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
    9 FAIL Data channel should be able to send ArrayBuffer message and receive as Blob promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
     9PASS Data channel should be able to send ArrayBuffer message and receive as Blob
    1010FAIL Data channel binaryType should receive message as Blob by default assert_equals: Expect initial binaryType value to be blob expected "blob" but got "arraybuffer"
    1111FAIL Sending multiple messages with different types should succeed and be received assert_unreached: Unexpected promise rejection: NotSupportedError: The operation is not supported. Reached unreachable code
  • trunk/Source/WebCore/ChangeLog

    r244195 r244196  
     12019-04-11  Youenn Fablet  <youenn@apple.com>
     2
     3        Support RTCDataChannel blob binaryType
     4        https://bugs.webkit.org/show_bug.cgi?id=196821
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add support for receiving blobs.
     9        Default value is still left to 'arraybuffer' which is not spec compliant.
     10        Covered by rebased test.
     11
     12        * Modules/mediastream/RTCDataChannel.cpp:
     13        (WebCore::RTCDataChannel::setBinaryType):
     14        (WebCore::RTCDataChannel::didReceiveRawData):
     15
    1162019-04-11  Devin Rousso  <drousso@apple.com>
    217
  • trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp

    r243887 r244196  
    3535#include "RTCDataChannelHandler.h"
    3636#include "ScriptExecutionContext.h"
     37#include "SharedBuffer.h"
    3738#include <JavaScriptCore/ArrayBuffer.h>
    3839#include <JavaScriptCore/ArrayBufferView.h>
     
    9899ExceptionOr<void> RTCDataChannel::setBinaryType(const AtomicString& binaryType)
    99100{
    100     if (binaryType == blobKeyword())
    101         return Exception { NotSupportedError };
     101    if (binaryType == blobKeyword()) {
     102        m_binaryType = BinaryType::Blob;
     103        return { };
     104    }
    102105    if (binaryType == arraybufferKeyword()) {
    103106        m_binaryType = BinaryType::ArrayBuffer;
     
    198201        return;
    199202
    200     if (m_binaryType == BinaryType::Blob) {
    201         // FIXME: Implement.
    202         return;
    203     }
    204 
    205     if (m_binaryType == BinaryType::ArrayBuffer) {
     203    switch (m_binaryType) {
     204    case BinaryType::Blob:
     205        scheduleDispatchEvent(MessageEvent::create(Blob::create(SharedBuffer::create(data, dataLength), emptyString()), { }));
     206        return;
     207    case BinaryType::ArrayBuffer:
    206208        scheduleDispatchEvent(MessageEvent::create(ArrayBuffer::create(data, dataLength)));
    207209        return;
Note: See TracChangeset for help on using the changeset viewer.