Skip to content

Commit c4661d0

Browse files
mkruisselbrinkmfalken
authored andcommitted
Use ExtendableMessageEvent for messageerror in service workers. (#1485)
It seems inconsistent to use ExtendableMessageEvent for message events but not for messageerror events. This fixes that inconsistency.
1 parent ffdd6c0 commit c4661d0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/index.bs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,11 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
456456
1. Let |destination| be the {{ServiceWorkerGlobalScope}} object associated with |serviceWorker|.
457457
1. Let |deserializeRecord| be <a abstract-op>StructuredDeserializeWithTransfer</a>(|serializeWithTransferResult|, |destination|'s [=global object/Realm=]).
458458

459-
If this throws an exception, catch it, [=fire an event=] named {{messageerror!!event}} at |destination|, using {{MessageEvent}}, with the {{MessageEvent/origin}} attribute initialized to |origin| and the {{MessageEvent/source}} attribute initialized to |source|, and then abort these steps.
460-
1. Let |messageClone| be |deserializeRecord|.\[[Deserialized]].
461-
1. Let |newPorts| be a new [=frozen array type|frozen array=] consisting of all {{MessagePort}} objects in |deserializeRecord|.\[[TransferredValues]], if any, maintaining their relative order.
462-
1. Let |e| be the result of [=creating an event=] named {{message!!event}}, using {{ExtendableMessageEvent}}, with the {{ExtendableMessageEvent/origin}} attribute initialized to |origin|, the {{ExtendableMessageEvent/source}} attribute initialized to |source|, the {{ExtendableMessageEvent/data}} attribute initialized to |messageClone|, and the {{ExtendableMessageEvent/ports}} attribute initialized to |newPorts|.
459+
If this throws an exception, let |e| be the result of [=creating an event=] named {{messageerror!!event}}, using {{ExtendableMessageEvent}}, with the {{ExtendableMessageEvent/origin}} attribute initialized to |origin| and the {{ExtendableMessageEvent/source}} attribute initialized to |source|.
460+
1. Else:
461+
1. Let |messageClone| be |deserializeRecord|.\[[Deserialized]].
462+
1. Let |newPorts| be a new [=frozen array type|frozen array=] consisting of all {{MessagePort}} objects in |deserializeRecord|.\[[TransferredValues]], if any, maintaining their relative order.
463+
1. Let |e| be the result of [=creating an event=] named {{message!!event}}, using {{ExtendableMessageEvent}}, with the {{ExtendableMessageEvent/origin}} attribute initialized to |origin|, the {{ExtendableMessageEvent/source}} attribute initialized to |source|, the {{ExtendableMessageEvent/data}} attribute initialized to |messageClone|, and the {{ExtendableMessageEvent/ports}} attribute initialized to |newPorts|.
463464
1. [=Dispatch=] |e| at |destination|.
464465
1. Invoke [=Update Service Worker Extended Events Set=] with |serviceWorker| and |e|.
465466
</section>

0 commit comments

Comments
 (0)