Skip to content

Commit 8538a55

Browse files
committed
Make ServiceWorker/ExtendableMessageEvent's ports non-nullable
Update the ServiceWorker/ExtendableMessageEvent IDL conforming to the latest HTML changes: - Make ports attribute non-nullable - Change the type of the origin attribute from DOMString to USVString - Assign default values to the corresponding Init dictionaries Fixes #989
1 parent 7d7bcac commit 8538a55

File tree

4 files changed

+130
-122
lines changed

4 files changed

+130
-122
lines changed

docs/index.bs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
467467
interface ServiceWorker : EventTarget {
468468
readonly attribute USVString scriptURL;
469469
readonly attribute ServiceWorkerState state;
470-
void postMessage(any message, optional sequence<object> transfer);
470+
void postMessage(any message, optional sequence<object> transfer = []);
471471

472472
// event
473473
attribute EventHandler onstatechange;
@@ -888,19 +888,19 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
888888
[Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)]
889889
interface ServiceWorkerMessageEvent : Event {
890890
readonly attribute any data;
891-
readonly attribute DOMString origin;
891+
readonly attribute USVString origin;
892892
readonly attribute DOMString lastEventId;
893893
[SameObject] readonly attribute (ServiceWorker or MessagePort)? source;
894-
readonly attribute FrozenArray<MessagePort>? ports;
894+
readonly attribute FrozenArray<MessagePort> ports;
895895
};
896896
</pre>
897897
<pre class="idl" id="serviceworkermessage-event-init-dictionary">
898898
dictionary ServiceWorkerMessageEventInit : EventInit {
899-
any data;
900-
DOMString origin;
901-
DOMString lastEventId;
902-
(ServiceWorker or MessagePort)? source;
903-
sequence&lt;MessagePort&gt;? ports;
899+
any data = null;
900+
USVString origin = "";
901+
DOMString lastEventId = "";
902+
(ServiceWorker or MessagePort)? source = null;
903+
sequence&lt;MessagePort&gt; ports = [];
904904
};
905905
</pre>
906906

@@ -933,7 +933,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
933933
<section>
934934
<h4 id="serviceworkermessage-event-ports">{{ServiceWorkerMessageEvent/ports|event.ports}}</h4>
935935

936-
<p>The <dfn attribute id="serviceworkermessage-event-ports-attribute">ports</dfn> attribute <em class="rfc2119" title="MUST">must</em> return the value it was initialized to. When the object is created, this attribute <em class="rfc2119" title="MUST">must</em> be initialized to null. It represents the {{MessagePort}} array being sent, if any.</p>
936+
<p>The <dfn attribute id="serviceworkermessage-event-ports-attribute">ports</dfn> attribute <em class="rfc2119" title="MUST">must</em> return the value it was initialized to. When the object is created, this attribute <em class="rfc2119" title="MUST">must</em> be initialized to the empty array. It represents the {{MessagePort}} array being sent.</p>
937937
</section>
938938
</section>
939939

@@ -1156,7 +1156,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
11561156
readonly attribute USVString url;
11571157
readonly attribute FrameType frameType;
11581158
readonly attribute DOMString id;
1159-
void postMessage(any message, optional sequence&lt;object&gt; transfer);
1159+
void postMessage(any message, optional sequence&lt;object&gt; transfer = []);
11601160
};
11611161

11621162
[Exposed=ServiceWorker]
@@ -2018,19 +2018,19 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
20182018
[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker]
20192019
interface ExtendableMessageEvent : ExtendableEvent {
20202020
readonly attribute any data;
2021-
readonly attribute DOMString origin;
2021+
readonly attribute USVString origin;
20222022
readonly attribute DOMString lastEventId;
20232023
[SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source;
2024-
readonly attribute FrozenArray&lt;MessagePort&gt;? ports;
2024+
readonly attribute FrozenArray&lt;MessagePort&gt; ports;
20252025
};
20262026
</pre>
20272027
<pre class="idl" id="extendablemessage-event-init-dictionary">
20282028
dictionary ExtendableMessageEventInit : ExtendableEventInit {
2029-
any data;
2030-
DOMString origin;
2031-
DOMString lastEventId;
2032-
(Client or ServiceWorker or MessagePort)? source;
2033-
sequence&lt;MessagePort&gt;? ports;
2029+
any data = null;
2030+
USVString origin = "";
2031+
DOMString lastEventId = "";
2032+
(Client or ServiceWorker or MessagePort)? source = null;
2033+
sequence&lt;MessagePort&gt; ports = [];
20342034
};
20352035
</pre>
20362036

@@ -2063,7 +2063,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
20632063
<section>
20642064
<h4 id="extendablemessage-event-ports">{{ExtendableMessageEvent/ports|event.ports}}</h4>
20652065

2066-
<p>The <dfn attribute id="extendablemessage-event-ports-attribute">ports</dfn> attribute <em class="rfc2119" title="MUST">must</em> return the value it was initialized to. When the object is created, this attribute <em class="rfc2119" title="MUST">must</em> be initialized to null. It represents the {{MessagePort}} array being sent, if any.</p>
2066+
<p>The <dfn attribute id="extendablemessage-event-ports-attribute">ports</dfn> attribute <em class="rfc2119" title="MUST">must</em> return the value it was initialized to. When the object is created, this attribute <em class="rfc2119" title="MUST">must</em> be initialized to the empty array. It represents the {{MessagePort}} array being sent.</p>
20672067
</section>
20682068
</section>
20692069

0 commit comments

Comments
 (0)