Commit b68e924
authored
fix(consent): hold a port open so the consent ask reaches the worker (#109)
chrome.runtime.sendMessage from an offscreen document does not dependably
START a terminated MV3 service worker. The send resolves nowhere, nothing
is thrown, and the caller's await hangs forever.
That is the remaining failure. A task-consent request arrived on the
approver inbox, verified, passed both dedup gates, and was acked to the
mediator -- deleting its queued copy -- and then nothing: no prompt, no
error, no decision. #108 proved it was not throwing; the same message sent
by hand from the offscreen console, with the worker already awake, raised
the window correctly. Inspect views showed "service worker (Inactive)".
chrome.runtime.connect does start the worker, and an open port keeps it
alive for the connection's lifetime. That also covers the second half:
requestTaskConsent awaits a human decision that can run minutes past the
~30s idle teardown, with the resolver held in the worker's memory --
so even a delivered ask could be discarded mid-decision.
Both offscreen consent sites open the port before asking and disconnect in
finally, so an answered, denied or failed prompt never leaves the worker
pinned awake. The background accepts the port and does nothing else;
accepting it is the entire purpose. The name lives in bridge-protocol.ts
with the message types it belongs beside.
Signed-off-by: Glenn Gore <glenn.g@affinidi.com>1 parent 63668cf commit b68e924
3 files changed
Lines changed: 67 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
457 | 458 | | |
458 | 459 | | |
459 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
460 | 484 | | |
461 | 485 | | |
462 | 486 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
270 | 278 | | |
271 | 279 | | |
272 | 280 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| |||
690 | 691 | | |
691 | 692 | | |
692 | 693 | | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
693 | 710 | | |
694 | 711 | | |
695 | 712 | | |
| |||
733 | 750 | | |
734 | 751 | | |
735 | 752 | | |
| 753 | + | |
736 | 754 | | |
737 | 755 | | |
738 | 756 | | |
| |||
1895 | 1913 | | |
1896 | 1914 | | |
1897 | 1915 | | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
1898 | 1932 | | |
1899 | 1933 | | |
1900 | 1934 | | |
| |||
1934 | 1968 | | |
1935 | 1969 | | |
1936 | 1970 | | |
| 1971 | + | |
1937 | 1972 | | |
1938 | 1973 | | |
1939 | 1974 | | |
| |||
0 commit comments