Commit 77a944c
worker: use fake MessageEvent for port.onmessage
Instead of passing the payload for Workers directly to `.onmessage`,
perform something more similar to what the browser API provides,
namely create an event object with a `.data` property.
This does not make `MessagePort` implement the `EventTarget` API, nor
does it implement the full `MessageEvent` API, but it would make
such extensions non-breaking changes if we desire them at
some point in the future.
(This would be a breaking change if Workers were not experimental.
Currently, this method is also undocumented and only exists with
the idea of enabling some degree of Web compatibility.)
PR-URL: #26082
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>1 parent f408d78 commit 77a944cCopy full SHA for 77a944c
File tree
Expand file treeCollapse file tree
6 files changed
+34
-13
lines changedOpen diff view settings
Filter options
- lib/internal/worker
- src
- test/parallel
Expand file treeCollapse file tree
6 files changed
+34
-13
lines changedOpen diff view settings
Collapse file
+4-4Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | | - |
65 | | - |
66 | | - |
| 64 | + |
| 65 | + |
| 66 | + |
67 | 67 | |
68 | | - |
| 68 | + |
69 | 69 | |
70 | 70 | |
71 | 71 | |
|
Collapse file
+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
146 | 146 | |
147 | 147 | |
148 | 148 | |
| 149 | + |
149 | 150 | |
150 | 151 | |
151 | 152 | |
| ||
291 | 292 | |
292 | 293 | |
293 | 294 | |
| 295 | + |
294 | 296 | |
295 | 297 | |
296 | 298 | |
| ||
359 | 361 | |
360 | 362 | |
361 | 363 | |
| 364 | + |
362 | 365 | |
363 | 366 | |
364 | 367 | |
|
Collapse file
+22-5Lines changed: 22 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
25 | 25 | |
26 | 26 | |
27 | 27 | |
| 28 | + |
28 | 29 | |
29 | 30 | |
30 | 31 | |
| ||
589 | 590 | |
590 | 591 | |
591 | 592 | |
592 | | - |
593 | | - |
594 | | - |
595 | 593 | |
596 | | - |
597 | | - |
| 594 | + |
| 595 | + |
| 596 | + |
| 597 | + |
| 598 | + |
| 599 | + |
| 600 | + |
| 601 | + |
| 602 | + |
| 603 | + |
| 604 | + |
| 605 | + |
598 | 606 | |
599 | 607 | |
600 | 608 | |
| ||
763 | 771 | |
764 | 772 | |
765 | 773 | |
| 774 | + |
| 775 | + |
766 | 776 | |
767 | 777 | |
768 | 778 | |
| ||
775 | 785 | |
776 | 786 | |
777 | 787 | |
| 788 | + |
| 789 | + |
| 790 | + |
| 791 | + |
| 792 | + |
| 793 | + |
| 794 | + |
778 | 795 | |
779 | 796 | |
780 | 797 | |
|
Collapse file
test/parallel/test-worker-message-port-transfer-self.js
Copy file name to clipboardExpand all lines: test/parallel/test-worker-message-port-transfer-self.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
25 | 25 | |
26 | 26 | |
27 | 27 | |
28 | | - |
| 28 | + |
29 | 29 | |
30 | 30 | |
31 | 31 | |
|
Collapse file
test/parallel/test-worker-message-port.js
Copy file name to clipboardExpand all lines: test/parallel/test-worker-message-port.js+3-2Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
21 | 21 | |
22 | 22 | |
23 | 23 | |
24 | | - |
| 24 | + |
| 25 | + |
25 | 26 | |
26 | 27 | |
27 | 28 | |
28 | 29 | |
29 | 30 | |
30 | 31 | |
31 | | - |
| 32 | + |
32 | 33 | |
33 | 34 | |
34 | 35 | |
|
Collapse file
test/parallel/test-worker-onmessage.js
Copy file name to clipboardExpand all lines: test/parallel/test-worker-onmessage.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
14 | 14 | |
15 | 15 | |
16 | 16 | |
17 | | - |
| 17 | + |
18 | 18 | |
19 | 19 | |
0 commit comments