diff --git a/amendments.json b/amendments.json index 2348a5cc4..2ffd5fd13 100644 --- a/amendments.json +++ b/amendments.json @@ -1001,5 +1001,84 @@ "web-platform-tests/wpt#47663" ] } + ], + "webidl-rtcdatachannel": [ + { + "description": "Make RTCDataChannel transferable to DedicatedWorker", + "pr": 2988, + "type": "addition", + "status": "candidate", + "id": 48, + "tests": [ + "webrtc/transfer-datachannel.html" + ], + "testUpdates": [ + "web-platform-tests/wpt#47707" + ] + } + ], + "rtcdatachannel-istransferable-init-1": [ + { + "description": "Make RTCDataChannel transferable to DedicatedWorker", + "pr": 2988, + "type": "addition", + "status": "candidate", + "difftype": "append", + "id": 48, + "tests": [ + "webrtc/transfer-datachannel.html" + ], + "testUpdates": [ + "web-platform-tests/wpt#47707" + ] + } + ], + "rtcdatachannel-istransferable-init-2": [ + { + "description": "Make RTCDataChannel transferable to DedicatedWorker", + "pr": 2988, + "type": "addition", + "status": "candidate", + "difftype": "append", + "id": 48, + "tests": [ + "webrtc/transfer-datachannel.html" + ], + "testUpdates": [ + "web-platform-tests/wpt#47707" + ] + } + ], + "rtcdatachannel-send-istransferable": [ + { + "description": "Make RTCDataChannel transferable to DedicatedWorker", + "pr": 2988, + "type": "addition", + "status": "candidate", + "difftype": "append", + "id": 48, + "tests": [ + "webrtc/transfer-datachannel.html" + ], + "testUpdates": [ + "web-platform-tests/wpt#47707" + ] + } + ], + "transfering-a-data-channel": [ + { + "description": "Make RTCDataChannel transferable to DedicatedWorker", + "pr": 2988, + "type": "addition", + "status": "candidate", + "difftype": "append", + "id": 48, + "tests": [ + "webrtc/transfer-datachannel.html" + ], + "testUpdates": [ + "web-platform-tests/wpt#47707" + ] + } ] } diff --git a/base-rec.html b/base-rec.html index b06488e6a..26a5bb9b6 100644 --- a/base-rec.html +++ b/base-rec.html @@ -13891,7 +13891,7 @@
WebIDL[Exposed=Window] +WebIDL[Exposed=Window] interfaceRTCDataChannel
: EventTarget { readonly attribute USVStringlabel
; readonly attribute booleanordered
; diff --git a/webrtc.html b/webrtc.html index 5cbb671f6..24af0515d 100644 --- a/webrtc.html +++ b/webrtc.html @@ -14012,6 +14012,14 @@[[\Negotiated]], and [[\DataChannelId]]. +
Let channel have a [[\IsTransferable]] internal slot initialized to +true
.[=Queue a task=] to run the following step: +
+- Set channel.{{RTCDataChannel/[[IsTransferable]]}} to
+false
. +This task needs to run before any task enqueued by the [=receiving messages on a data channel=] algorithm for channel. + This ensures that no message is lost during the transfer of a {{RTCDataChannel}}.
++ Return channel. @@ -14226,7 +14234,7 @@
- Announcing a data channel as closed + Announcing a data channel as closed
When an {{RTCDataChannel}} object's [= underlying data transport =] @@ -14272,6 +14280,42 @@
+ Transfering data channel
+The {{RTCDataChannel}} [=transfer steps=], given value and dataHolder, are:
++
+- +
If value.{{RTCDataChannel/[[IsTransferable]]}} is
false
, throw a {{DataCloneError}} DOMException.- +
Set dataHolder.{{RTCDataChannel/[[ReadyState]]}} to value.{{RTCDataChannel/[[ReadyState]]}}.
- +
Set dataHolder.{{RTCDataChannel/[[DataChannelLabel]]}} to value.{{RTCDataChannel/[[DataChannelLabel]]}}.
- +
Set dataHolder.{{RTCDataChannel/[[Ordered]]}} to value.{{RTCDataChannel/[[Ordered]]}}.
- +
Set dataHolder.{{RTCDataChannel/[[MaxPacketLifeTime]]}} to value..{{RTCDataChannel/[[MaxPacketLifeTime]]}}
- +
Set dataHolder.{{RTCDataChannel/[[MaxRetransmits]]}} to value.{{RTCDataChannel/[[MaxRetransmits]]}}.
- +
Set dataHolder.{{RTCDataChannel/[[DataChannelProtocol]]}} to value.{{RTCDataChannel/[[DataChannelProtocol]]}}.
- +
Set dataHolder.{{RTCDataChannel/[[Negotiated]]}} to value.{{RTCDataChannel/[[Negotiated]]}}.
- +
Set dataHolder.{{RTCDataChannel/[[DataChannelId]]}} to value.{{RTCDataChannel/[[DataChannelId]]}}.
- +
Set dataHolder’s [= underlying data transport =] to value [=underlying data transport=].
- +
Set value.{{RTCDataChannel/[[IsTransferable]]}} to
false
.- +
Set value.{{RTCDataChannel/[[ReadyState]]}} to "closed".
The {{RTCDataChannel}} [=transfer-receiving steps=], given dataHolder and channel, are:
+Initialize channel.{{RTCDataChannel/[[ReadyState]]}} to dataHolder.{{RTCDataChannel/[[ReadyState]]}}.
Initialize channel.{{RTCDataChannel/[[DataChannelLabel]]}} to dataHolder.{{RTCDataChannel/[[DataChannelLabel]]}}.
Initialize channel.{{RTCDataChannel/[[Ordered]]}} to dataHolder.{{RTCDataChannel/[[Ordered]]}}.
Initialize channel.{{RTCDataChannel/[[MaxPacketLifeTime]]}} to dataHolder.{{RTCDataChannel/[[MaxPacketLifeTime]]}}.
Initialize channel.{{RTCDataChannel/[[MaxRetransmits]]}} to dataHolder.{{RTCDataChannel/[[MaxRetransmits]]}}.
Initialize channel.{{RTCDataChannel/[[DataChannelProtocol]]}} to dataHolder.{{RTCDataChannel/[[DataChannelProtocol]]}}.
Initialize channel.{{RTCDataChannel/[[Negotiated]]}} to dataHolder.{{RTCDataChannel/[[Negotiated]]}}.
Initialize channel.{{RTCDataChannel/[[DataChannelId]]}} to dataHolder.{{RTCDataChannel/[[DataChannelId]]}}.
Initialize channel’s [=underlying data transport=] to dataHolder’s [= underlying data transport =].
The above steps do not need to transfer {{RTCDataChannel/[[BufferedAmount]]}} as its value will always be equal to 0
.
+ The reason is an {{RTCDataChannel}} can be transferred only if its [=send() algorithm=] was not called prior the transfer.
If the [=underlying data transport=] is closed at the time of the [=transfer-receiving steps=], + the {{RTCDataChannel}} object will be closed by running the [=announcing a data channel as closed=] algorithm immediately after the [=transfer-receiving steps=].
+ +When an {{RTCDataChannel}} message has @@ -14402,7 +14446,7 @@
[Exposed=Window] +[Exposed=(Window,DedicatedWorker), Transferable] interface RTCDataChannel : EventTarget { readonly attribute USVString label; readonly attribute boolean ordered; @@ -14764,6 +14808,8 @@which data is to be sent. +
Set channel.{{RTCDataChannel/[[IsTransferable]]}} to false
.
If channel.{{RTCDataChannel/[[ReadyState]]}} is not