The above test is doing:
while(sentSize < 20 * 1024 * 1024) {
channel1.send(sendData);
sentSize += sendDataLength;
}
The test is then expecting that the channel is not firing an OperationError, which is allowed as per https://w3c.github.io/webrtc-pc/#datachannel-send step 6.
Safari is firing this error event, while Chrome and Firefox are not doing so.
If reducing the number of send calls to 16 * 1024 * 1024, the test is passing locally in Safari.
The goal of the test is ensuring that closing the channel will still make sure that the buffered messages are sent. The buffering is triggered by the congestion window size, which is hit in Safari largely before 16 * 1024 * 1024.
The 20 * 1024 * 1024 limit was added in 131d56a, and seems somehow arbitrary.
@guidou , @jan-ivar , do you have any thoughts on why Chrome and Firefox do not end-up in hitting the max buffer size which Safari is?